Patent ID: 7561749

Claim:
An image encoding apparatus, which receives image data and encodes the image data, comprising: first encoding means for lossy encoding input image data for each predetermined pixel block in accordance with a first parameter to generate lossy encoded data; second encoding means for lossless encoding the input image data for each predetermined pixel block to generate lossless encoded data; a first memory, which stores one of the encoded data from said first encoding means and said second encoding means; a second memory which stores the encoded data generated by said second encoding means; monitoring means for determining whether an encoded data amount stored in said first memory has exceeded a predetermined target data amount; attribute determination means for detecting an attribute of each predetermined pixel block in the input image data and determining whether detected attribute information satisfies a predetermined condition; first selection means for, when said attribute determination means determines that the detected attribute information satisfies the predetermined condition, selecting the lossless encoded data from said second encoding means in order to store the lossless encoded data in said first memory; second selection means for, when said attribute determination means determines that the detected attribute information does not satisfy the predetermined condition, selecting encoded data of a shorter code length among the encoded data from said first encoding means and said second encoding means in order to store the selected encoded data in said first memory; re-encoding means for decoding the lossless encoded data in said second memory, re-encoding the decoded data in accordance with a second parameter to generate lossy encoded data, and storing, in said first memory, encoded data of a shorter code length among the lossy encoded data obtained after re-encoding and the lossless encoded data before re-encoding; determination condition change means for, when said monitoring means determines that the encoded data amount has exceeded the predetermined target data amount, changing a determination condition of said attribute determination means; and parameter update means for, when said monitoring means determines that the encoded data amount has exceeded the predetermined target data amount, (a) discarding the encoded data in said first memory, (b) updating the first parameter set for said first encoding means to a parameter having a high compression ratio, and causing said first encoding means to continue encoding of the input image data, and (c) setting, as the second parameter, a same parameter as the updated first parameter for said re-encoding means, and causing said re-encoding means to re-encode lossless encoded data obtained before the encoded data amount exceeds the predetermined target data amount.