diff --git a/src/pixie/fileformats/jpeg.nim b/src/pixie/fileformats/jpeg.nim index ea3d4d5..d734de2 100644 --- a/src/pixie/fileformats/jpeg.nim +++ b/src/pixie/fileformats/jpeg.nim @@ -446,8 +446,6 @@ proc decodeSOS(state: var DecoderState) = state.successiveApproxLow = aa and 15 state.successiveApproxHigh = aa shr 4 - state.reset() - if state.progressive: if state.spectralStart > 63 or state.spectralEnd > 63: failInvalid() @@ -467,6 +465,8 @@ proc decodeSOS(state: var DecoderState) = if len != 0: failInvalid() + state.reset() + proc fillBitBuffer(state: var DecoderState) = ## When we are low on bits, we need to call this to populate some more. while state.bitsBuffered < 24: