Now the DC and AC pieces combine into one call that decodes a full 64-coefficient block. Today you assemble them, producing your first complete block of coefficients.
Decode a full block - one DC coefficient then AC coefficients until end-of-block - into a 64-entry array in zig-zag order.
This is where the chapter’s pieces click together. A block is one DC coefficient followed by the AC loop running until end-of-block, producing a 64-entry array. Entry 0 is the DC; entries 1 through 63 are the AC coefficients laid out in the order the run-length loop placed them. For the pinned example the DC decodes to 3 and a single AC pair puts 3 at index 1, with the EOB zeroing the rest, so the block is [3, 3, 0, 0, ...].
Two things to keep straight. First, the block stays in zig-zag order - these 64 values are still the diagonal sequence, not a spatial grid; the un-zig-zag and dequantize happen in the next chapter, deliberately kept separate. Second, decodeBlock threads the DC predictor through, so calling it repeatedly for the blocks of a component naturally carries the running DC. That repeated call, interleaved across components, is how a whole MCU decodes - which is the next lesson.
// decodeBlock: start a zeroed [64]int in zig-zag order.// block[0] = decodeDC(...)// decodeAC(&block, ...) // fills indices 1..63 until EOB// returns the block still in zig-zag order (dequantize/un-zig-zag come later).func decodeBlock(r *BitReader, dc, ac *HuffTable, pred *int) [64]int { }