Browse Source

Populate QT Tables

Nearly there... Getting some odd errors in individual images. Otherwise accuraccy is 100% same as Golang port.
pull/525/head
James Jackson-South 8 years ago
parent
commit
bc50fc76cb
  1. 6
      src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsFrameComponent.cs
  2. 4
      src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs

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

@ -126,8 +126,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components
}
else
{
// TODO: Check division accuracy here. May need to divide by float
this.SubSamplingDivisors = this.SamplingFactors.DivideBy(new Size(this.Frame.MaxHorizontalFactor, this.Frame.MaxVerticalFactor));
PdfJsFrameComponent c0 = this.Frame.Components[0];
this.SubSamplingDivisors = c0.SamplingFactors.DivideBy(this.SamplingFactors);
}
this.SpectralBlocks = this.memoryManager.Allocate2D<Block8x8>(this.SizeInBlocks.Width, this.SizeInBlocks.Height, true);
@ -137,7 +137,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components
public int GetBlockBufferOffset(int row, int col)
{
// return 64 * (((this.WidthInBlocks + 1) * row) + col);
return 64 * ((this.SpectralBlocks.Width * row) + col);
return 64 * ((this.WidthInBlocks * row) + col);
}
}
}

4
src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs

@ -653,7 +653,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort
this.InputStream.Read(this.temp, 0, 64);
remaining -= 64;
Block8x8F table = this.QuantizationTables[quantizationTableSpec & 15];
ref Block8x8F table = ref this.QuantizationTables[quantizationTableSpec & 15];
for (int j = 0; j < 64; j++)
{
table[j] = this.temp[j];
@ -673,7 +673,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort
this.InputStream.Read(this.temp, 0, 128);
remaining -= 128;
Block8x8F table = this.QuantizationTables[quantizationTableSpec & 15];
ref Block8x8F table = ref this.QuantizationTables[quantizationTableSpec & 15];
for (int j = 0; j < 64; j++)
{
table[j] = (this.temp[2 * j] << 8) | this.temp[(2 * j) + 1];

Loading…
Cancel
Save