Patent ID: 8116378

Claim:
A variable length decoding method for decoding complete binary tree codes, which is implemented to an entropy coding module and applying to the coeffToken decoding in the H.264 and the motion vector and to the DCT coefficient decoding in the MPEG-4, comprising the steps of: obtaining leading zero number, namely LZ num, from a current bitstream; looking up a first table having a plurality of fields of baseIndex and TabIndex by using the LZ Num as an index to obtain the baseIndex and TabIndex corresponding thereto; procuring the TabIndex to calculate a value T=└log 2 (TabIndex)┘; reading T bits from the current bitstream to obtain a first result M; determining whether or not the first result M is smaller than (TabIndex-(1<<T)); when determining that the first result M is not smaller than (TabIndex-(1<<T)), obtaining an Index equal to (1<<T)−M−1; and adding the Index to the baseIndex for obtaining an addition result; and looking up a second table having a plurality of fields of syntax elements by using the addition result as an index to obtain a final result of the syntax elements.