PURPOSE: To make total bit length of code data of one picture constant by comparing an allocated code quantity with a code quantity in a same processing block and performing prescribed output operation in response to an excess or a deficiency for the allocated code quantity.
CONSTITUTION: A code quantity calculation circuit 4 calculates an actual code quantity in each processing block to output to a prediction code quantity calculation circuit 5 and a comparator 7. The circuit 5 predicts the code quantity of m-th row processing block based on the code quantity of each processing block of (m-1)th row by the circuit 4 and calculates a predicted code quantity and outputs it to an allocated code quantity calculation circuit 6. The circuit 6 allocates the total value of N pieces of processing block code quantities arranged in m-rows in proportion to the predicted code quantity. The comparator 7 compares a code quantity Qmn allocated to the processing block Bmn by the circuit 6 with a code quantity Cmn calculated by the circuit 4. In the case of Qmn<Cmnm an output of the code data from the variable length coding circuit 3 is invalidated in the Qmn. On the other hand in the case of Qmn≥Cmn, all output code data of the circuit 3 are outputted.