Patent ID: 7903891

Claim:
An image encoding apparatus comprising: a motion detection part that divides a coding target image into macroblocks of a predetermined size, divides each said macroblock into blocks of a predetermined shape and size specified based on a macroblock type, and performs a motion compensated prediction in each unit of said block to output a motion vector; a motion compensation part that generates a predicted image from a reference image on the basis of the motion vector outputted from the motion detection part; a subtraction part that calculates a difference between the predicted image generated by the motion compensation part, and the coding target image to output a predictive residual image; a transform part that performs transform coding of the predictive residual image outputted from the subtraction part, in each unit of a predetermined transform block to output transform coefficients; a quantization part that quantizes the transform coefficients outputted from the transform part, based on a quantization parameter, to output quantized transform coefficients; and an encoding part that performs compression coding of coding-related information containing the motion vector outputted from the motion detection part, the macroblock type, the quantization parameter, and the quantized transform coefficients outputted from the quantization part, to output coded data, wherein the encoding part comprises a coded symbol memory for memorizing the coding-related information; a coding procedure provider that provides one or more types of coding procedures; and a coded data outputting part that selects one of the coding procedures provided by the coding procedure provider, based on a predetermined coding procedure selection criterion, using the coding-related information stored in the coded symbol memory, and performs the compression coding of the coding-related information on the basis of the selected coding procedure to output the coded data, and wherein the encoding part has a function of, for each of the transform blocks in a said macroblock, performing compression coding of coded block pattern information containing a nonzero coefficient existence flag indicating whether there exists a nonzero quantized transform coefficient, and on the occasion of encoding the coded block pattern information in the coding target macroblock, where a size of the quantization parameter in the coding target macroblock is greater than a preset threshold, the coding procedure provider provides a coding procedure of setting a shorter code length for the coded block pattern information indicating a smaller number of blocks containing a nonzero quantized transform coefficient.