[Ffmpeg-devel] [PATCH] remove ac3 tables from parser.c

Michael Niedermayer michaelni
Sat Mar 10 11:47:29 CET 2007


Hi

On Fri, Mar 09, 2007 at 11:18:42PM -0500, Justin Ruggles wrote:
[...]
> > this looks wrong, it doesnt generate the same table
> > the followig MIGHT be correct (didnt really check)
> > 
> > for(i=0; i<38; i++) {
> >     int br = ff_ac3_bitratetab[i >> 1];
> >     ff_ac3_frame_sizes[i][0] = (  2*br      );
> >     ff_ac3_frame_sizes[i][1] = (320*br / 147) + (i & 1);
> >     ff_ac3_frame_sizes[i][2] = (  3*br      );
> > }
> > 
> > [...]
> 
> You're right.  I did forget about the fact that the odd numbers only
> differ for 44.1kHz, and that was all I tested with.
> 
> ff_ac3_frame_sizes[i][j] = (br * 96 / ff_ac3_freqs[j]) + ((i & 1) &&
>                                                           (j == 1));
> 
> The above also does the trick, but I like your version better.  New
> patch attached.

theres another possible issue which ive missed ...
ac3_common() is after your patch executed by the AVParser initalization
which MUST be thread safe as new AVStreams can be added anytime 
(in mpeg-ps/ts for example) and that also might cause a new AVParser to be
inited, now the current code looks safe but ac3_common() should get a
comment that it has to be thread safe because its called by the AVParser 
init code
otherwise someone smart might by misstake add code like:

static int done=0
if(!done){
    done=1;
    for(...)
        foobartab[i]= abcd;
}

except that patch looks ok

[...]

-- 
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: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070310/e5528be8/attachment.pgp>



More information about the ffmpeg-devel mailing list