Patent ID: 8867614

Claim:
An image coding method comprising: a transforming and quantizing step of orthogonally transforming and quantizing a plurality of blocks within a target region of an input image as a unit to obtain coefficients; an aligning step of aligning coefficients among the blocks in accordance with frequency to make a coefficient string, the coefficients in a same coefficient string having a same frequency component; a variable-length coding step of variable-length coding the coefficient strings by using different types of variable length coding schemes, the variable-length coding step including switching among the different types of the variable-length coding schemes for each coefficient string; and a predicting step of predicting a predicted image of the block by using a reference image that has already been decoded, wherein the transforming and the quantizing step includes orthogonally transforming and quantizing a prediction error between the predicted image and the block of the input image to obtain the coefficients; the variable-length coding step includes: a first variable-length coding step of variable-length coding the coefficient strings by the coefficient; and a second variable-length coding step of coding the coefficient strings by variable-length partial data, the variable-length partial data including a variable number of coefficients; and the variable-length coding step switches between performing the first variable-length coding step and performing the second variable-length coding step for each coefficient string based on at least one of a quantization width representing a width of the quantization and a prediction direction representing a direction of prediction by the predicting process.