|
|
@ -786,7 +786,9 @@ namespace ImageSharp.Formats.Jpeg.PdfJsPort |
|
|
int blocksPerLine = component.BlocksPerLine; |
|
|
int blocksPerLine = component.BlocksPerLine; |
|
|
int blocksPerColumn = component.BlocksPerColumn; |
|
|
int blocksPerColumn = component.BlocksPerColumn; |
|
|
using (var computationBuffer = Buffer<short>.CreateClean(64)) |
|
|
using (var computationBuffer = Buffer<short>.CreateClean(64)) |
|
|
using (var multiplicationBuffer = Buffer<short>.CreateClean(64)) |
|
|
|
|
|
|
|
|
// IDCTFast Only
|
|
|
|
|
|
// using (var multiplicationBuffer = Buffer<short>.CreateClean(64))
|
|
|
{ |
|
|
{ |
|
|
Span<short> quantizationTable = |
|
|
Span<short> quantizationTable = |
|
|
this.quantizationTables.Tables.GetRowSpan(frameComponent.QuantizationIdentifier); |
|
|
this.quantizationTables.Tables.GetRowSpan(frameComponent.QuantizationIdentifier); |
|
|
@ -797,22 +799,30 @@ namespace ImageSharp.Formats.Jpeg.PdfJsPort |
|
|
// scalefactor[0] = 1
|
|
|
// scalefactor[0] = 1
|
|
|
// scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7
|
|
|
// scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7
|
|
|
// For integer operation, the multiplier table is to be scaled by 12.
|
|
|
// For integer operation, the multiplier table is to be scaled by 12.
|
|
|
Span<short> multiplierSpan = multiplicationBuffer; |
|
|
|
|
|
for (int i = 0; i < 64; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
multiplierSpan[i] = (short)PdfJsIDCT.Descale(quantizationTable[i] * PdfJsIDCT.Aanscales[i], 12); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// IDCTFast Only
|
|
|
|
|
|
// Span<short> multiplierSpan = multiplicationBuffer;
|
|
|
|
|
|
// for (int i = 0; i < 64; i++)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// multiplierSpan[i] = (short)PdfJsIDCT.Descale(quantizationTable[i] * PdfJsIDCT.Aanscales[i], 12);
|
|
|
|
|
|
// }
|
|
|
for (int blockRow = 0; blockRow < blocksPerColumn; blockRow++) |
|
|
for (int blockRow = 0; blockRow < blocksPerColumn; blockRow++) |
|
|
{ |
|
|
{ |
|
|
for (int blockCol = 0; blockCol < blocksPerLine; blockCol++) |
|
|
for (int blockCol = 0; blockCol < blocksPerLine; blockCol++) |
|
|
{ |
|
|
{ |
|
|
int offset = GetBlockBufferOffset(ref component, blockRow, blockCol); |
|
|
int offset = GetBlockBufferOffset(ref component, blockRow, blockCol); |
|
|
PdfJsIDCT.QuantizeAndInverseFast( |
|
|
|
|
|
|
|
|
// IDCTFast Only
|
|
|
|
|
|
// PdfJsIDCT.QuantizeAndInverseFast(
|
|
|
|
|
|
// ref frameComponent,
|
|
|
|
|
|
// offset,
|
|
|
|
|
|
// ref computationBufferSpan,
|
|
|
|
|
|
// ref multiplierSpan);
|
|
|
|
|
|
PdfJsIDCT.QuantizeAndInverse( |
|
|
ref frameComponent, |
|
|
ref frameComponent, |
|
|
offset, |
|
|
offset, |
|
|
ref computationBufferSpan, |
|
|
ref computationBufferSpan, |
|
|
ref multiplierSpan); |
|
|
ref quantizationTable); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|