Browse Source

Replaced hardcoded values with actual calculated ones in postprocessor

pull/1694/head
Dmitry Pentin 5 years ago
parent
commit
5ba8763ade
  1. 2
      src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponentPostProcessor.cs
  2. 13
      src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegImagePostProcessor.cs
  3. 5
      tests/ImageSharp.Tests.ProfilingSandbox/Program.cs

2
src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponentPostProcessor.cs

@ -37,7 +37,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
imagePostProcessor.PostProcessorBufferSize.Height,
this.blockAreaSize.Height);
this.BlockRowsPerStep = JpegImagePostProcessor.BlockRowsPerStep / this.Component.SubSamplingDivisors.Height;
this.BlockRowsPerStep = imagePostProcessor.BlockRowsPerStep / this.Component.SubSamplingDivisors.Height;
}
/// <summary>

13
src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegImagePostProcessor.cs

@ -29,12 +29,12 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
/// <summary>
/// The number of block rows to be processed in one Step.
/// </summary>
public const int BlockRowsPerStep = 4;
public int BlockRowsPerStep;
/// <summary>
/// The number of image pixel rows to be processed in one step.
/// </summary>
public const int PixelRowsPerStep = 4 * 8;
public int PixelRowsPerStep;
/// <summary>
/// Temporal buffer to store a row of colors.
@ -56,8 +56,13 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
this.configuration = configuration;
this.RawJpeg = rawJpeg;
IJpegComponent c0 = rawJpeg.Components[0];
this.NumberOfPostProcessorSteps = c0.SizeInBlocks.Height / BlockRowsPerStep;
this.PostProcessorBufferSize = new Size(c0.SizeInBlocks.Width * 8, PixelRowsPerStep);
this.BlockRowsPerStep = c0.SamplingFactors.Height;
this.PixelRowsPerStep = this.BlockRowsPerStep * 8;
this.NumberOfPostProcessorSteps = c0.SizeInBlocks.Height / this.BlockRowsPerStep;
this.PostProcessorBufferSize = new Size(c0.SizeInBlocks.Width * 8, this.PixelRowsPerStep);
MemoryAllocator memoryAllocator = configuration.MemoryAllocator;

5
tests/ImageSharp.Tests.ProfilingSandbox/Program.cs

@ -58,7 +58,6 @@ namespace SixLabors.ImageSharp.Tests.ProfilingSandbox
//Test_DebugRun("Channel_digital_image_CMYK_color");
//Console.WriteLine();
//Test_DebugRun("test_baseline_4k_444", false);
//Console.WriteLine();
//Test_DebugRun("test_progressive_4k_444", false);
@ -69,6 +68,10 @@ namespace SixLabors.ImageSharp.Tests.ProfilingSandbox
// Binary size of this must be ~2096kb
//Test_DebugRun("422", true);
//Test_DebugRun("baseline_4k_420", false);
//Test_DebugRun("baseline_s444_q100", false);
//Test_DebugRun("progressive_s444_q100", false);
Test_DebugRun("baseline_4k_420", true);
Test_DebugRun("baseline_s444_q100", true);
Test_DebugRun("progressive_s444_q100", true);

Loading…
Cancel
Save