[FFmpeg-devel] Dirac Golomb decoder [PATCH]
Michael Niedermayer
michaelni
Tue Aug 14 21:52:33 CEST 2007
Hi
On Tue, Aug 14, 2007 at 02:21:33PM +0200, Marco Gerards wrote:
> Hi,
>
> For Dirac, some values are coded using interleaved exp. golomb. I
> think this part of my work can already be included in FFmpeg.
>
> In my SoC repository, you can find a program that I used to generate
> ff_interleaved_dirac_golomb_vlc_len and
> ff_interleaved_dirac_golomb_vlc_code.
>
> Please let me know if there is something wrong with this code.
[...]
> Index: golomb.c
> ===================================================================
> --- golomb.c (revision 10115)
> +++ golomb.c (working copy)
> @@ -1,6 +1,7 @@
> /*
> * exp golomb vlc stuff
> * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
> + * Copyright (c) 2007 Marco Gerards <marco at gnu.org>
> *
as reimar already said, we are affraid of ending up with hundreads of
copyright lines ...
if you want your name in the file, i think maybe something like
/**
* this function finds the foobar.
* @author (copyright) Marco Gerards <marco at gnu.org>
above functions you wrote, would be a compromise
> * This file is part of FFmpeg.
> *
> @@ -23,7 +24,7 @@
> * @file golomb.c
> * @brief
> * exp golomb vlc stuff
> - * @author Michael Niedermayer <michaelni at gmx.at>
> + * @author Michael Niedermayer <michaelni at gmx.at> and Marco Gerards <marco at gnu.org>
> */
>
> #include "common.h"
> @@ -153,3 +154,39 @@
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> };
> +
> +const uint8_t ff_interleaved_dirac_golomb_vlc_len[256]={
> +9,9,7,7,9,9,7,7,5,5,5,5,5,5,5,5,
> +9,9,7,7,9,9,7,7,5,5,5,5,5,5,5,5,
> +3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
> +3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
> +9,9,7,7,9,9,7,7,5,5,5,5,5,5,5,5,
> +9,9,7,7,9,9,7,7,5,5,5,5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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,};
this looks suspiciously similar to ff_interleaved_ue_golomb_vlc_code
remove_msb(a+1) = b
could you check if svq3_get_ue_golomb() does the same as
dirac_get_ue_golomb()?
if no please check if its maybe just that svq3 code currently doenst support
more than 32bit codewords
if they do the same, a benchmark (with actual video data) of both would be
interresting
[...]
> + buf = GET_CACHE(re, gb);
> +
> + buf >>= 32 - 8;
buf= SHOW_UBITS(re, gb, 8);
> + LAST_SKIP_BITS(re, gb, FFMIN(ff_interleaved_dirac_golomb_vlc_len[buf], 8));
> +
> + ret <<= (ff_interleaved_dirac_golomb_vlc_len[buf] - 1) >> 1;
> + ret |= ff_interleaved_dirac_golomb_vlc_code[buf];
> + if (ff_interleaved_dirac_golomb_vlc_len[buf] != 9)
> + break;
this can be done more efficiently (see svq3_get_ue_golomb())
also small values should be much more common than large ones so the
loop would most of the time do just 1 iteration ...
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates
-------------- 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/20070814/c3c7d18c/attachment.pgp>
More information about the ffmpeg-devel
mailing list