Browse Source

It works!!!!

pull/525/head
James Jackson-South 9 years ago
parent
commit
073c44255d
  1. 16
      src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsFrameComponent.cs

16
src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsFrameComponent.cs

@ -26,6 +26,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components
this.Id = id; this.Id = id;
this.HorizontalSamplingFactor = horizontalFactor; this.HorizontalSamplingFactor = horizontalFactor;
this.VerticalSamplingFactor = verticalFactor; this.VerticalSamplingFactor = verticalFactor;
this.SamplingFactors = new Size(this.HorizontalSamplingFactor, this.VerticalSamplingFactor);
this.QuantizationTableIndex = quantizationTableIndex; this.QuantizationTableIndex = quantizationTableIndex;
this.Index = index; this.Index = index;
} }
@ -63,10 +64,10 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components
public int Index { get; } public int Index { get; }
/// <inheritdoc /> /// <inheritdoc />
public Size SizeInBlocks => new Size(this.WidthInBlocks, this.HeightInBlocks); public Size SizeInBlocks { get; private set; }
/// <inheritdoc /> /// <inheritdoc />
public Size SamplingFactors => new Size(this.HorizontalSamplingFactor, this.VerticalSamplingFactor); public Size SamplingFactors { get; set; }
/// <summary> /// <summary>
/// Gets the number of blocks per line /// Gets the number of blocks per line
@ -88,10 +89,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components
/// </summary> /// </summary>
public int ACHuffmanTableId { get; set; } public int ACHuffmanTableId { get; set; }
internal int BlocksPerLineForMcu { get; private set; }
internal int BlocksPerColumnForMcu { get; private set; }
public PdfJsFrame Frame { get; } public PdfJsFrame Frame { get; }
/// <inheritdoc/> /// <inheritdoc/>
@ -109,8 +106,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components
this.HeightInBlocks = (int)MathF.Ceiling( this.HeightInBlocks = (int)MathF.Ceiling(
MathF.Ceiling(this.Frame.Scanlines / 8F) * this.VerticalSamplingFactor / this.Frame.MaxVerticalFactor); MathF.Ceiling(this.Frame.Scanlines / 8F) * this.VerticalSamplingFactor / this.Frame.MaxVerticalFactor);
this.BlocksPerLineForMcu = this.Frame.McusPerLine * this.HorizontalSamplingFactor; int blocksPerLineForMcu = this.Frame.McusPerLine * this.HorizontalSamplingFactor;
this.BlocksPerColumnForMcu = this.Frame.McusPerColumn * this.VerticalSamplingFactor; int blocksPerColumnForMcu = this.Frame.McusPerColumn * this.VerticalSamplingFactor;
this.SizeInBlocks = new Size(blocksPerLineForMcu, blocksPerColumnForMcu);
// For 4-component images (either CMYK or YCbCrK), we only support two // For 4-component images (either CMYK or YCbCrK), we only support two
// hv vectors: [0x11 0x11 0x11 0x11] and [0x22 0x11 0x11 0x22]. // hv vectors: [0x11 0x11 0x11 0x11] and [0x22 0x11 0x11 0x22].
@ -131,7 +129,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components
this.SubSamplingDivisors = c0.SamplingFactors.DivideBy(this.SamplingFactors); this.SubSamplingDivisors = c0.SamplingFactors.DivideBy(this.SamplingFactors);
} }
this.SpectralBlocks = this.memoryManager.Allocate2D<Block8x8>(this.BlocksPerColumnForMcu, this.BlocksPerLineForMcu + 1, true); this.SpectralBlocks = this.memoryManager.Allocate2D<Block8x8>(blocksPerColumnForMcu, blocksPerLineForMcu + 1, true);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]

Loading…
Cancel
Save