The method includes the following units: a coefficient number detecting
unit (109) for detecting the number of coefficients which has a value
other than 0 for each block according to the generated coefficient, a
coefficient number storing unit (110) for storing the number of
coefficients detected, a coefficient number coding unit (111) for
selecting a table for variable length coding based on the numbers of
coefficients in the coded blocks located on the periphery of a current
block to be coded with reference to the selected table for variable
length coding so as to perform variable length coding for the number of
coefficients.