Browse Source

Fixed access modifier & docs

pull/1853/head
Dmitry Pentin 5 years ago
parent
commit
e8b59c6bb4
  1. 1
      src/ImageSharp/Formats/Jpeg/Components/Decoder/IRawJpegData.cs
  2. 52
      src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponentPostProcessor.cs

1
src/ImageSharp/Formats/Jpeg/Components/Decoder/IRawJpegData.cs

@ -5,7 +5,6 @@ using System;
namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
{ {
/// <inheritdoc />
/// <summary> /// <summary>
/// Represents decompressed, unprocessed jpeg data with spectral space <see cref="IJpegComponent" />-s. /// Represents decompressed, unprocessed jpeg data with spectral space <see cref="IJpegComponent" />-s.
/// </summary> /// </summary>

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

@ -21,6 +21,21 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
/// </summary> /// </summary>
private readonly JpegFrame frame; private readonly JpegFrame frame;
/// <summary>
/// Gets the maximal number of block rows being processed in one step.
/// </summary>
private readonly int blockRowsPerStep;
/// <summary>
/// Gets the <see cref="IJpegComponent"/> component containing decoding meta information.
/// </summary>
private readonly IJpegComponent component;
/// <summary>
/// Gets the <see cref="IRawJpegData"/> instance containing decoding meta information.
/// </summary>
private readonly IRawJpegData rawJpeg;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="JpegComponentPostProcessor"/> class. /// Initializes a new instance of the <see cref="JpegComponentPostProcessor"/> class.
/// </summary> /// </summary>
@ -28,39 +43,22 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
{ {
this.frame = frame; this.frame = frame;
this.Component = component; this.component = component;
this.RawJpeg = rawJpeg; this.rawJpeg = rawJpeg;
this.blockAreaSize = this.Component.SubSamplingDivisors * 8; this.blockAreaSize = this.component.SubSamplingDivisors * 8;
this.ColorBuffer = memoryAllocator.Allocate2DOveraligned<float>( this.ColorBuffer = memoryAllocator.Allocate2DOveraligned<float>(
postProcessorBufferSize.Width, postProcessorBufferSize.Width,
postProcessorBufferSize.Height, postProcessorBufferSize.Height,
this.blockAreaSize.Height); this.blockAreaSize.Height);
this.BlockRowsPerStep = postProcessorBufferSize.Height / 8 / this.Component.SubSamplingDivisors.Height; this.blockRowsPerStep = postProcessorBufferSize.Height / 8 / this.component.SubSamplingDivisors.Height;
} }
public IRawJpegData RawJpeg { get; }
/// <summary>
/// Gets the <see cref="Component"/>
/// </summary>
public IJpegComponent Component { get; }
/// <summary> /// <summary>
/// Gets the temporary working buffer of color values. /// Gets the temporary working buffer of color values.
/// </summary> /// </summary>
public Buffer2D<float> ColorBuffer { get; } public Buffer2D<float> ColorBuffer { get; }
/// <summary>
/// Gets <see cref="IJpegComponent.SizeInBlocks"/>
/// </summary>
public Size SizeInBlocks => this.Component.SizeInBlocks;
/// <summary>
/// Gets the maximal number of block rows being processed in one step.
/// </summary>
public int BlockRowsPerStep { get; }
/// <inheritdoc /> /// <inheritdoc />
public void Dispose() => this.ColorBuffer.Dispose(); public void Dispose() => this.ColorBuffer.Dispose();
@ -69,20 +67,20 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
/// </summary> /// </summary>
public void CopyBlocksToColorBuffer(int spectralStep) public void CopyBlocksToColorBuffer(int spectralStep)
{ {
Buffer2D<Block8x8> spectralBuffer = this.Component.SpectralBlocks; Buffer2D<Block8x8> spectralBuffer = this.component.SpectralBlocks;
float maximumValue = this.frame.MaxColorChannelValue; float maximumValue = this.frame.MaxColorChannelValue;
int destAreaStride = this.ColorBuffer.Width; int destAreaStride = this.ColorBuffer.Width;
int yBlockStart = spectralStep * this.BlockRowsPerStep; int yBlockStart = spectralStep * this.blockRowsPerStep;
Size subSamplingDivisors = this.Component.SubSamplingDivisors; Size subSamplingDivisors = this.component.SubSamplingDivisors;
Block8x8F dequantTable = this.RawJpeg.QuantizationTables[this.Component.QuantizationTableIndex]; Block8x8F dequantTable = this.rawJpeg.QuantizationTables[this.component.QuantizationTableIndex];
Block8x8F workspaceBlock = default; Block8x8F workspaceBlock = default;
for (int y = 0; y < this.BlockRowsPerStep; y++) for (int y = 0; y < this.blockRowsPerStep; y++)
{ {
int yBuffer = y * this.blockAreaSize.Height; int yBuffer = y * this.blockAreaSize.Height;
@ -118,7 +116,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
public void ClearSpectralBuffers() public void ClearSpectralBuffers()
{ {
Buffer2D<Block8x8> spectralBlocks = this.Component.SpectralBlocks; Buffer2D<Block8x8> spectralBlocks = this.component.SpectralBlocks;
for (int i = 0; i < spectralBlocks.Height; i++) for (int i = 0; i < spectralBlocks.Height; i++)
{ {
spectralBlocks.GetRowSpan(i).Clear(); spectralBlocks.GetRowSpan(i).Clear();

Loading…
Cancel
Save