[Ffmpeg-devel] [PATCH] updated LGPL AC-3 decoder

Michael Niedermayer michaelni
Sat Feb 10 17:49:08 CET 2007


Hi

On Sat, Feb 10, 2007 at 05:29:13PM +0100, Aurelien Jacobs wrote:
> On Sat, 10 Feb 2007 16:30:41 +0100
> Michael Niedermayer <michaelni at gmx.at> wrote:
> 
> > On Sat, Feb 10, 2007 at 01:02:20AM -0500, Justin Ruggles wrote:
> > [...]
> > > #include "avcodec.h"
> > > #include "ac3.h"
> > > #include "ac3tab.h"
> > > 
> > > static inline int calc_lowcomp1(int a, int b0, int b1)
> > > {
> > >     if ((b0 + 256) == b1) {
> > >         a = 384 ;
> > >     } else if (b0 > b1) {
> > >         a = a - 64;
> > >         if (a < 0) a=0;
> > >     }
> > >     return a;
> > > }
> > 
> > calc_lowcomp1(int a, int b0, int b1, int C){
> >     if ((b0 + 256) == b1) {
> >         a= C;
> >     } else if (b0 > b1) {
> >         a= FFMAX(a - 64, 0);
> >     }
> >     return a;
> 
> I had already spoted lots of potential FFMIN/FFMAX usage before seeing
> Michael's reply. So here are a few more that I spoted:
> 
[...]
> >         v=hth[bin >> s->halfratecod][s->fscod];
> >         if (v1 > v) v=v1;
> >         mask[bin] = v;
> 
> mask[bin] = FFMAX(hth[bin >> s->halfratecod][s->fscod], v1);
> 
> > [...]
> >         v=mask[j];
> >         v -= snroffset ;
> >         v -= s->floor ;
> >         if (v < 0) v = 0;
> >         v &= 0x1fe0 ;
> >         v += s->floor ;
> 
> v = (FFMAX(mask[j] - snroffset - s->floor, 0) & 0x1fe0) + s->floor;

i didnt mention these 2 because they look obfuscated, they put too
much on a single line IMHO, but then again if justin prefers them ive
no objections at all ...

[...]
-- 
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: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070210/4ad5cf57/attachment.pgp>



More information about the ffmpeg-devel mailing list