[FFmpeg-devel] [PATCH] Function to parse Dirac sequence header

Michael Niedermayer michaelni
Fri Nov 7 23:35:59 CET 2008


On Thu, Nov 06, 2008 at 02:42:13PM +0200, Kostya wrote:
> On Thu, Nov 06, 2008 at 11:15:47AM +0100, Diego Biurrun wrote:
> > On Wed, Nov 05, 2008 at 11:22:01PM -0500, David Conrad wrote:
> > >
> > > This will be useful for both the dirac parser and ogg demuxer (and  
> > > future native dirac decoder of course.)
> > > Adapted from the soc repository.
> > >
> > > --- /dev/null
> > > +++ b/libavcodec/dirac.c
> > > @@ -0,0 +1,259 @@
> > > +    /* framerate */
> > > +    if (get_bits1(gb)) {
> > > +        source->frame_rate_index = svq3_get_ue_golomb(gb);
> > 
> > This function is used in svq3.c, rv30.c, rv40.c and now dirac.c.
> > Clearly, the svq3_ prefix is misleading and it should be renamed.
> > 
> > Does anybody have a suggestion for a better name?
> 
> Oh, I used one in RV* code.
> 
> I find those names misleading.
> In reality it's called Elias Gamma code - read any good book on
> data compression or excellent report by Peter Fenwick
> (http://www.cs.auckland.ac.nz/~peter-f/FTPfiles/TechRep137.ps)
> 
> It's idea is to prefix each bit with another bit that signals
> that this is the last bit of codeword, i.e.
> (those examples are for illustrative purposes only, the real
>  coding differs a bit - no leading zeroes coding, zero is not
>  coded too).
> 
>  0 -> 0 0
> 01 -> 1 0 0 1
> 10 -> 1 1 0 0
> 11 -> 1 1 0 1
> 
> When signal and payload bits are separated into two groups like
>  0 ->  0 0
> 01 -> 10 01
> 10 -> 10 10
> 11 -> 10 11
> we get Gamma' (wider-known version of Elias code).

While i appreciate your effort to credit some of the authors in the
function names.
Why do you provide examples that as you say are not elias gamma codes anyway?
And the examples you provide are not what svq3_* uses either ...


> 
> In original paper Golomb (which is funny to read), he describes
> more sophisticated codes where prefix length may differ from
> payload length (that's just a rule for recognizing them).
> 

> Why those committees call every variable-length code for integers
> Golomb codes is a great mystery.

probably because they have some common sense ...
One should ALWAYS use descriptive names, NEVER names technically unrelated
to the actual thing one names. Unless the names are universally used and
understood. like fourier in FFT
as examples heap and radix sort are descriptive names, for bad ones refer
to wikipedia (string searching algos for example)

In that respect exp golomb codes are golomb codes with exponential behaviour
Interleaved exp golomb codes are the same but with prefix and postfix bits
interleaved.
First is what h264 uses, later is what svq3 uses. both are elias gamma codes
which is why using just the name elias gamma is ambigous here.

Also in case of the question of why its in RV and SVQ3, they are both
strongly based on h264 drafts, and previous drafts used interleaved
exp golomb codes IIRC.

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081107/8c0696fa/attachment.pgp>



More information about the ffmpeg-devel mailing list