Patent ID: 8731056

Claim:
An image encoding apparatus for encoding image data indicative of an image, the apparatus comprising: a shuffling portion which collects and shuffles a plurality of macroblocks constituting the image data from respective positions within the image; an encoding portion which performs space-frequency transform and entropy encoding on the plurality of macroblocks collected and shuffled by the shuffling portion, as a base unit; and a rate control portion which controls the encoding portion to adjust, with the plurality of macroblocks as the base unit, a rate of the plurality of macroblocks after the encoding, wherein the rate control portion judges, for each macroblock of the plurality of macroblocks, whether a predictive quantity, to be predicted from a predictor macroblock of each macroblock, is known or not, and controls the encoding portion by performing rate correction, based on a number of macroblocks each judged as having a predictive quantity which is not known from among macroblocks which have already been encoded in the image data as a whole including the plurality of macroblocks, wherein an encoded macroblock whose predictive quantity, to be predicted from an associated predictor macroblock, is not known is defined as an open macroblock, and the rate control portion calculates an allocated rate of the plurality of macroblocks by multiplying the allocated rate of the image data by a value obtained by dividing a number of macroblocks in the plurality of macroblocks by a number of macroblocks in the image data, calculates a correction to the allocated rate of the plurality of macroblocks by multiplying a difference between a number of the open macroblocks in the image data as a whole before and after the plurality of macroblocks are encoded by the encoding portion by a difference between a maximum rate of a predictive code of the open macroblock and an average rate of the predictive code, calculates a corrected, allocated rate by adding the correction to the allocated rate of the plurality of macroblocks, and controls the encoding portion so that the rate after the encoding of the plurality of macroblocks is equal to or less than the corrected, allocated rate.