// makeImg allocates and initializes the destination image. func (d *decoder) makeImg(mxx, myy int) { … } // Specified in section B.2.3. func (d *decoder) processSOS(n int) error { … } // refine decodes a successive approximation refinement block, as specified in // section G.1.2. func (d *decoder) refine(b *block, h *huffman, zigStart, zigEnd, delta int32) error { … } // refineNonZeroes refines non-zero entries of b in zig-zag order. If nz >= 0, // the first nz zero entries are skipped over. func (d *decoder) refineNonZeroes(b *block, zig, zigEnd, nz, delta int32) (int32, error) { … } func (d *decoder) reconstructProgressiveImage() error { … } // reconstructBlock dequantizes, performs the inverse DCT and stores the block // to the image. func (d *decoder) reconstructBlock(b *block, bx, by, compIndex int) error { … } // findRST advances past the next RST restart marker that matches expectedRST. // Other than I/O errors, it is also an error if we encounter an {0xFF, M} // two-byte marker sequence where M is not 0x00, 0xFF or the expectedRST. // // This is similar to libjpeg's jdmarker.c's next_marker function. // https://github.com/libjpeg-turbo/libjpeg-turbo/blob/2dfe6c0fe9e18671105e94f7cbf044d4a1d157e6/jdmarker.c#L892-L935 // // Precondition: d.tmp[:2] holds the next two bytes of JPEG-encoded input // (input in the d.readFull sense). func (d *decoder) findRST(expectedRST uint8) error { … }