[Ffmpeg-devel] Reading bit-reversed VLC codes

Måns Rullgård mans
Sun Mar 18 20:27:43 CET 2007


Michael Niedermayer <michaelni at gmx.at> writes:

> Hi
>
> On Sun, Mar 18, 2007 at 07:13:30PM +0000, M?ns Rullg?rd wrote:
>> I need to read VLC codes that are stored in reverse order in the
>> bitstream, i.e. a 4-bit code value of 5 is returned by get_bits as
>> 0xa.  Is there some way to do this using the lavc VLC reader?
>
> for get bits the code in asv1.c
> static inline int asv2_get_bits(GetBitContext *gb, int n){
>     return ff_reverse[ get_bits(gb, n) << (8-n) ];
> }

Non-VLC elements are stored the right way around, so I don't need to
do anything special with those.

> might do what you want, for get_vlc() just change the table
> before init_vlc()

I tried reversing the bits of each code before init_vlc(), but that
only gives me an "incorrect codes" message and an error return.  I
guess I did something wrong, but I'm at a loss figuring out what.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list