From 07d16c7c8790b6e0f69f1cc8f1c84d75930b56c5 Mon Sep 17 00:00:00 2001 From: Ryan Oldenburg Date: Wed, 25 May 2022 19:20:45 -0500 Subject: [PATCH] f --- src/pixie/fileformats/jpeg.nim | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/pixie/fileformats/jpeg.nim b/src/pixie/fileformats/jpeg.nim index 05cbee1..ae41de4 100644 --- a/src/pixie/fileformats/jpeg.nim +++ b/src/pixie/fileformats/jpeg.nim @@ -69,12 +69,14 @@ type len, pos: int bitsBuffered: int bitBuffer: uint32 + imageHeight, imageWidth: int quantizationTables: array[4, array[64, uint8]] huffmanTables: array[2, array[4, Huffman]] # 0 = DC, 1 = AC components: seq[Component] maxYScale, maxXScale: int mcuWidth, mcuHeight, numMcuWide, numMcuHigh: int + scanComponents: int spectralStart, spectralEnd: int successiveApproxLow, successiveApproxHigh: int @@ -857,8 +859,8 @@ proc decodeBlocks(state: var DecoderState) = # Single component pass. let comp = state.componentOrder[0] - w = (state.components[comp].width + 7) shr 3 - h = (state.components[comp].height + 7) shr 3 + w = (state.components[comp].width + 7) div 8 + h = (state.components[comp].height + 7) div 8 for column in 0 ..< h: for row in 0 ..< w: state.decodeBlock(comp, row, column) @@ -880,8 +882,8 @@ proc quantizationAndIDCTPass(state: var DecoderState) = ## Does quantization and IDCT. for comp in 0 ..< state.components.len: let - w = (state.components[comp].width + 7) shr 3 - h = (state.components[comp].height + 7) shr 3 + w = (state.components[comp].width + 7) div 8 + h = (state.components[comp].height + 7) div 8 qTableId = state.components[comp].quantizationTableId if qTableId.int notin 0 ..< state.quantizationTables.len: failInvalid()