Patent ID: 7248191

Claim:
A variable-length coding method for generating variable-length coding data from a coefficient series, the coefficient series including Run, Level and Last, Run indicating the number of zero coefficients before a non-zero coefficient, Level indicating a value of a non-zero coefficient, Last indicating whether or not the non-zero coefficient is the last coefficient in a DCT coefficient obtained by performing discrete cosine transform to digital data, the method comprising: a first coefficient series generation step of generating a first coefficient series in which Level is replaced with NewLevel obtained, based on an equation of NewLevel=sign(Level)×(|Level|−LMAX) where sign(Level) is a code of Level and |Level| is an absolute value of Level, using LMAX which is a maximum value of Level corresponding to Last and Run in a given coefficient series in a VLC table showing the correlation between a coefficient series to be variable-length coded and variable-length coding data obtained by variable-length coding the coefficient series, a second coefficient series generation step of generating a second coefficient series in which Run in a given coefficient series is replaced with NewRun obtained, based on an equation of NewRun=Run−(RMA+1), using RMAX which is a maximum value of Run corresponding to Last and Level in the given coefficient series in the VLC table; a VLC mode judgment step of judging, according to a given coefficient series, which one of a mode for coding the given coefficient series by variable-length coding, a mode for coding the first coefficient series by variable-length coding, a mode for coding the second coefficient series by variable-length coding and a mode for coding the given coefficient series by fixed-length coding should be used; a coefficient series output step of outputting, based on a judgment result of the VLC mode judgment step, one of the given coefficient series, the first coefficient series and the second coefficient series; a variable-length coding step of generating, based on the VLC table, variable-length coding data from the coefficient series output in the coefficient series outputting step; a fixed-length coding step of generating fixed-length coding data obtained by fixed-length coding the coefficient series output in the coefficient series outputting step; and a coding data outputting step of outputting, based on the judgment result of the VLC judgment step, one of the variable-length coding data and the fixed-length coding data.