Decoding variable length codes having regular bit pattern prefixes enables
faster decoding of variable length codes, especially in systems that provide bit
or bit mask search capabilities. An embodiment of the present invention determines
a code prefix type, and calculates a length of the code prefix. A first data structure
may be provided to associate the maximal number of bits in a variable length code
with the length of the code prefix, and to locate further decoding data in accordance
with the prefix length and type. A bit stream may be read according to the maximal
length obtained. An additional data structure may be provided to retrieve a decoded
value and the actual length of a variable length code being decoded. This data
structure may be indexed with the value of the bit combination read from the bit
stream. In case the actual length of the variable length code is less than the
maximal length, the excess bits may be returned to the bit stream.