This invention reliably encodes an image while continuously inputting the
image with a relatively simple configuration. For this purpose, in this
invention, input image data is encoded by an encoder (102) and stored in
first and second memories. An encoding sequence controller (108) monitors
the code amount. Upon determining that the code amount has reached a set
value, the encoding sequence controller discards the data in the first
memory and instructs the encoder (102) to increase the quantization step
and continue encoding. Preceding encoded data is stored in the second
memory. The encoded data is re-encoded by a re-encoder (109) using the
same quantization step as that of the encoder (102) after the parameter
is changed. The re-encoded data is stored in the first and second
memories. The quantization steps set in the encoder (102) and re-encoder
(109) at this time have such values that re-encoding by the re-encoder
(109) is ended before time when the code amount reaches the set value
again.