[FFmpeg-devel] [PATCH] AAC Decoder - Round 2.

Michael Niedermayer michaelni
Mon Jun 23 02:46:10 CEST 2008


On Sat, Jun 21, 2008 at 06:30:55PM +0100, Robert Swain wrote:
> 2008/6/20 Michael Niedermayer <michaelni at gmx.at>:
> > On Thu, Jun 19, 2008 at 04:22:57PM +0100, Robert Swain wrote:
> >> +    for (i = 0; i < 128; i++) {
> >> +        sine_short_128[i] *= 8.;
> >> +        kbd_short_128[i] *= 8.;
> >> +    }
> >
> > not thread safe, you cannot store wrong values in static tables and then
> > correct them.
> 
> OK. I'm not really familiar with thread safety as I haven't written
> any threaded code myself to date or read about writing threaded code,
> but I think I understand.
> 
> To clarify, the issue is that the values of the tables are reassigned
> with different values meaning that at different times after
> initialisation, the table values change. Separate threads using these
> tables then have the potential to use incorrect values. So, such
> alterations must be done either before assignment to the table within
> the initialisation functions or when using the tables in the code. Is
> that correct?

Iam not completely sure what you describe but one possible thread saftey
issue is that
Thread1 init sine_table, multiply sine_table by 8, decode frame1
Thread2                                           init sine_table

Thread2 here sets sine_table to "invalid" values while the table is
used by another thread leading to wrong output from thread1


> 
> As this alteration is specific to the use of eight short windows (I
> think) I'm inclined to not hack it into the init functions but rather
> multiply by 8.0 at some other appropriate point in the code. Would you
> agree?

yes

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

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus
-------------- 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/20080623/b81bd6c5/attachment.pgp>



More information about the ffmpeg-devel mailing list