Browse Source

Compilation fixes

pull/2120/head
Dmitry Pentin 4 years ago
parent
commit
ebdf4dd91f
  1. 2
      src/ImageSharp/Formats/Jpeg/Components/Encoder/HuffmanScanEncoder.cs
  2. 6
      src/ImageSharp/Formats/Jpeg/Components/Encoder/JpegComponent.cs
  3. 2
      src/ImageSharp/Formats/Jpeg/Components/Encoder/SpectralConverter{TPixel}.cs
  4. 24
      src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs

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

@ -777,7 +777,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Encoder
/// <summary>
/// Flushes spectral data bytes after encoding all channel blocks
/// in a single jpeg macroblock using <see cref="WriteBlock"/>.
/// in a single jpeg macroblock using <see cref="WriteBlock(JpegComponent, ref Block8x8, ref HuffmanLut, ref HuffmanLut)"/>.
/// </summary>
/// <remarks>
/// This must be called only if <see cref="IsStreamFlushNeeded"/> is true

6
src/ImageSharp/Formats/Jpeg/Components/Encoder/JpegComponent.cs

@ -39,19 +39,14 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Encoder
/// </summary>
public int VerticalSamplingFactor { get; }
/// <inheritdoc />
public Buffer2D<Block8x8> SpectralBlocks { get; private set; }
/// <inheritdoc />
public Size SubSamplingDivisors { get; private set; }
/// <inheritdoc />
public int QuantizationTableIndex { get; }
/// <inheritdoc />
public Size SizeInBlocks { get; private set; }
/// <inheritdoc />
public Size SamplingFactors { get; set; }
/// <summary>
@ -84,6 +79,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Encoder
/// <summary>
/// Initializes component for future buffers initialization.
/// </summary>
/// <param name="frame">asdfasdf.</param>
/// <param name="maxSubFactorH">Maximal horizontal subsampling factor among all the components.</param>
/// <param name="maxSubFactorV">Maximal vertical subsampling factor among all the components.</param>
public void Init(JpegFrame frame, int maxSubFactorH, int maxSubFactorV)

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

@ -9,7 +9,6 @@ using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Encoder
{
/// <inheritdoc/>
internal class SpectralConverter<TPixel> : SpectralConverter
where TPixel : unmanaged, IPixel<TPixel>
@ -77,7 +76,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Encoder
// 2. Byte r/g/b planes to normalized float r/g/b planes
// 3. Convert from r/g/b planes to target pixel type with JpegColorConverter
// 4. Convert color buffer to spectral blocks with component post processors
int maxY = Math.Min(this.pixelBuffer.Height, this.pixelRowCounter + this.pixelRowsPerStep);
int width = this.pixelBuffer.Width;

24
src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs

@ -131,28 +131,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
// Write the scan header.
this.WriteStartOfScan(componentCount, componentIds);
//var quantTables = new Block8x8F[] { luminanceQuantTable, chrominanceQuantTable };
//new HuffmanScanEncoder(3, stream).Encode(image, quantTables, Configuration.Default, cancellationToken);
// Write the scan compressed data.
switch (this.colorType)
{
case JpegColorType.YCbCrRatio444:
new HuffmanScanEncoder(3, stream).Encode444(image, ref luminanceQuantTable, ref chrominanceQuantTable, cancellationToken);
break;
case JpegColorType.YCbCrRatio420:
new HuffmanScanEncoder(6, stream).Encode420(image, ref luminanceQuantTable, ref chrominanceQuantTable, cancellationToken);
break;
case JpegColorType.Luminance:
new HuffmanScanEncoder(1, stream).EncodeGrayscale(image, ref luminanceQuantTable, cancellationToken);
break;
case JpegColorType.Rgb:
new HuffmanScanEncoder(3, stream).EncodeRgb(image, ref luminanceQuantTable, cancellationToken);
break;
default:
// all other non-supported color types are checked at the start of this method
break;
}
var quantTables = new Block8x8F[] { luminanceQuantTable, chrominanceQuantTable };
new HuffmanScanEncoder(3, stream).Encode(image, quantTables, Configuration.Default, cancellationToken);
// Write the End Of Image marker.
this.WriteEndOfImageMarker();

Loading…
Cancel
Save