Browse Source

Renamed vectorized rgb -> ycbcr converter for 444 subsampling

pull/1632/head
Dmitry Pentin 5 years ago
parent
commit
01f44a839e
  1. 2
      src/ImageSharp/Formats/Jpeg/Components/Encoder/RgbToYCbCrConverterVectorized.cs
  2. 2
      src/ImageSharp/Formats/Jpeg/Components/Encoder/YCbCrForwardConverter444{TPixel}.cs
  3. 2
      tests/ImageSharp.Benchmarks/Format/Jpeg/Components/Encoder/YCbCrForwardConverterBenchmark.cs
  4. 4
      tests/ImageSharp.Tests/Formats/Jpg/RgbToYCbCrConverterTests.cs

2
src/ImageSharp/Formats/Jpeg/Components/Encoder/RgbToYCbCrConverterVectorized.cs

@ -63,7 +63,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Encoder
/// <param name="yBlock">8x8 destination matrix of Luminance(Y) converted data</param> /// <param name="yBlock">8x8 destination matrix of Luminance(Y) converted data</param>
/// <param name="cbBlock">8x8 destination matrix of Chrominance(Cb) converted data</param> /// <param name="cbBlock">8x8 destination matrix of Chrominance(Cb) converted data</param>
/// <param name="crBlock">8x8 destination matrix of Chrominance(Cr) converted data</param> /// <param name="crBlock">8x8 destination matrix of Chrominance(Cr) converted data</param>
public static void Convert(ReadOnlySpan<Rgb24> rgbSpan, ref Block8x8F yBlock, ref Block8x8F cbBlock, ref Block8x8F crBlock) public static void Convert444(ReadOnlySpan<Rgb24> rgbSpan, ref Block8x8F yBlock, ref Block8x8F cbBlock, ref Block8x8F crBlock)
{ {
Debug.Assert(IsSupported, "AVX2 is required to run this converter"); Debug.Assert(IsSupported, "AVX2 is required to run this converter");

2
src/ImageSharp/Formats/Jpeg/Components/Encoder/YCbCrForwardConverter444{TPixel}.cs

@ -124,7 +124,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Encoder
if (RgbToYCbCrConverterVectorized.IsSupported) if (RgbToYCbCrConverterVectorized.IsSupported)
{ {
RgbToYCbCrConverterVectorized.Convert(this.rgbSpan, ref yBlock, ref cbBlock, ref crBlock); RgbToYCbCrConverterVectorized.Convert444(this.rgbSpan, ref yBlock, ref cbBlock, ref crBlock);
} }
else else
{ {

2
tests/ImageSharp.Benchmarks/Format/Jpeg/Components/Encoder/YCbCrForwardConverterBenchmark.cs

@ -49,7 +49,7 @@ namespace SixLabors.ImageSharp.Benchmarks.Format.Jpeg.Components.Encoder
if (RgbToYCbCrConverterVectorized.IsSupported) if (RgbToYCbCrConverterVectorized.IsSupported)
{ {
RgbToYCbCrConverterVectorized.Convert(this.data.AsSpan(), ref y, ref cb, ref cr); RgbToYCbCrConverterVectorized.Convert444(this.data.AsSpan(), ref y, ref cb, ref cr);
} }
} }
} }

4
tests/ImageSharp.Tests/Formats/Jpg/RgbToYCbCrConverterTests.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors. // Copyright (c) Six Labors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System; using System;
@ -52,7 +52,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
Block8x8F cb = default; Block8x8F cb = default;
Block8x8F cr = default; Block8x8F cr = default;
RgbToYCbCrConverterVectorized.Convert(data.AsSpan(), ref y, ref cb, ref cr); RgbToYCbCrConverterVectorized.Convert444(data.AsSpan(), ref y, ref cb, ref cr);
Verify(data, ref y, ref cb, ref cr, new ApproximateColorSpaceComparer(0.0001F)); Verify(data, ref y, ref cb, ref cr, new ApproximateColorSpaceComparer(0.0001F));
} }

Loading…
Cancel
Save