|
|
|
@ -6,6 +6,9 @@ using SixLabors.ImageSharp.Memory; |
|
|
|
|
|
|
|
namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder |
|
|
|
{ |
|
|
|
/// <summary>
|
|
|
|
/// Base class for processing component spectral data and converting it to raw color data.
|
|
|
|
/// </summary>
|
|
|
|
internal abstract class ComponentProcessor : IDisposable |
|
|
|
{ |
|
|
|
public ComponentProcessor(MemoryAllocator memoryAllocator, JpegFrame frame, Size postProcessorBufferSize, IJpegComponent component, int blockSize) |
|
|
|
@ -28,8 +31,18 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder |
|
|
|
|
|
|
|
protected Size BlockAreaSize { get; } |
|
|
|
|
|
|
|
public abstract void CopyBlocksToColorBuffer(int spectralStep); |
|
|
|
/// <summary>
|
|
|
|
/// Converts spectral data to color data accessible via <see cref="GetColorBufferRowSpan(int)"/>.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="row">Spectral row index to convert.</param>
|
|
|
|
public abstract void CopyBlocksToColorBuffer(int row); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Clears spectral buffers.
|
|
|
|
/// </summary>
|
|
|
|
/// <remarks>
|
|
|
|
/// Should only be called during baseline interleaved decoding.
|
|
|
|
/// </remarks>
|
|
|
|
public void ClearSpectralBuffers() |
|
|
|
{ |
|
|
|
Buffer2D<Block8x8> spectralBlocks = this.Component.SpectralBlocks; |
|
|
|
@ -39,6 +52,11 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets converted color buffer row.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="row">Row index.</param>
|
|
|
|
/// <returns>Color buffer row.</returns>
|
|
|
|
public Span<float> GetColorBufferRowSpan(int row) => |
|
|
|
this.ColorBuffer.DangerousGetRowSpan(row); |
|
|
|
|
|
|
|
|