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

Michael Niedermayer michaelni
Sat Mar 10 19:19:12 CET 2007


Hi

On Sat, Mar 10, 2007 at 09:26:37AM -0500, Justin Ruggles wrote:
> Michael Niedermayer wrote:
> > 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
> 
> Okay.  Would this work?

yes

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

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- 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/6eacc409/attachment.pgp>



More information about the ffmpeg-devel mailing list