Re: Problem understanding your's implementation VLC.

"Marco Al" <[email protected]>
Newsgroups gmane.comp.video.xvid.user
Message-ID <[email protected]>
Amit Bhushan wrote:

>             I would like to know how you have implemented the vlc table. The
> table is present in vlc_tables.h file but in mbcoding.c how are bringing it
> in memory. Could you please give me a brief idea how you have done it i will
> be gratefull to you.

If you are talking about the old code ... all the different the tables in
vlc_codes.h are a factorization of the run-level combinations codeable without
escape codes for inter/intra and last, grouped for having simular number of
levels per run into the coeff_tab tables and parsed by the preprocessor into
unified tables.

A larger LUT is then populated with valid codes for each last/level/run
combination by checking for each level if when maxlevel for a given run is
subtracted level is smaller than that maxlevel, and run for that level is
smaller than maxrun for that level (convoluted sentence I know). If so the
corresponding code is stored in the LUT, if not max run for the original level
is subtracted and a simular sequence follows for the second escape code. If
neither succeeds the last/level/run combo is escape coded.

The new code is a naive reimplementation of that, initializing the LUT with the
non-escape code VLCs from an unstructured list of codes with their corresponding
last/run/level combinations copy pasted from the standard (it was reimplented
for the dual purpose of getting rid of the cryptic coeff_tabs and dct3dtabs in
the header, and to generate code which could use smaller LUTs). At the time of
the implementation I didnt realize what max_run/level actually signified though
... so my implementation while correct is hopelessly convoluted.

It is also not helped by the fact that in a single function I populate LUTs for
intra for levels 0 - 64, but -32 - 32 for inter instead (and with defines even a
big lut of 2*2*4096*64 entries which has explicit codes for each possible
combinations just like the old code). I made the intra/inter choice for the
small lut because of the fact that the maximum level with a escape1/2 code
(these are relatively hard to compute, so we want to store them in the LUT) for
intra is 48, but only 24 for inter ... this allowed me to use the LUT for both
positive and negative levels, which allows codecoeffinter to be a little faster.
Since mbcoding takes a lot of time, and most MBs are inter it seemed justified
to split codecoeff up.

DCT3D is simply a reverse lookup of all possible 12 bit codes giving a reference
to the corresponding event and the length of the code, since some codes are
shorter than 12 bits all possible combinations of the LSBs not belonging to the
code have to be traversed storing a reference to the event for each resulting 12
bit word.

Oh man, even in words its hopelessly convoluted :) Ill clean up the code a bit
though.

Marco
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.