[FFmpeg-devel] Dirac Golomb decoder [PATCH]

Michael Niedermayer michaelni
Wed Aug 15 00:40:12 CEST 2007


Hi

On Tue, Aug 14, 2007 at 11:54:04PM +0200, Marco Gerards wrote:
[...]
> > 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
> 
> This code is quite hard to change.  If I make it more generic, I am
> afraid I will slow it down and make the benchmark useless.
> 
> Can you propose a way to fix this without slowing it down too much?  I
> can benchmark it in that case.

hmm, i think just putting your code into the else of svq3_get_ue_golomb()
should do, the current code for the else{} path doesnt look very efficient
anyway


[...]
> >> +        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 ...
> 
> Do you mean I should make a special condition for the case the loop
> should not be entered and just return the value?  

yes


> And in case more
> than 8 bits should be read use the code I have now?

yes
which makes the code identical to the svq3 code with the suggested change
above


> 
> Or is there something with the code above?  In that case I do not get
> it.  This works very different from svq3 so I will not be able to do
> the same.

indeed it seems i need some sleep ...
one obvious optimization though is:

if (ff_interleaved_dirac_golomb_vlc_len[buf] != 9){
    ret <<= (ff_interleaved_dirac_golomb_vlc_len[buf] - 1) >> 1;
    ret |= ff_interleaved_dirac_golomb_vlc_code[buf];
    break;
}
ret= (ret<<4) | ff_interleaved_dirac_golomb_vlc_code[buf];



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

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- 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/20070815/c2a27b0d/attachment.pgp>



More information about the ffmpeg-devel mailing list