[FFmpeg-devel] [PATCH v2] avfilter/pthread: rewrite implementation

Muhammad Faiz mfcc64 at gmail.com
Tue Jul 11 07:18:42 EEST 2017


On Tue, Jul 11, 2017 at 4:40 AM, Michael Niedermayer
<michael at niedermayer.cc> wrote:
> On Mon, Jul 10, 2017 at 10:53:42AM +0200, wm4 wrote:
>> On Sat, 8 Jul 2017 01:45:06 +0200
>> Michael Niedermayer <michael at niedermayer.cc> wrote:
>>
>> > On Fri, Jul 07, 2017 at 09:04:37PM +0700, Muhammad Faiz wrote:
>> > > Avoid pthread_cond_broadcast that wakes up all workers. Make each of them
>> > > uses distict mutex/cond. Also let main thread help running jobs.
>> > >
>> > > Benchmark using afir with threads=5 and 4096 taps fir:
>> > > channels=1:
>> > > old:
>> > >     1849650 decicycles in afir_execute,       2 runs,      0 skips
>> > >     1525719 decicycles in afir_execute,    1024 runs,      0 skips
>> > >     1546032 decicycles in afir_execute,   16356 runs,     28 skips
>> > > new:
>> > >     1495525 decicycles in afir_execute,       2 runs,      0 skips
>> > >      968897 decicycles in afir_execute,    1024 runs,      0 skips
>> > >      941286 decicycles in afir_execute,   16384 runs,      0 skips
>> > >
>> > > channels=2:
>> > > old:
>> > >     3135485 decicycles in afir_execute,       2 runs,      0 skips
>> > >     1967158 decicycles in afir_execute,    1024 runs,      0 skips
>> > >     1802430 decicycles in afir_execute,   16364 runs,     20 skips
>> > > new:
>> > >     1864750 decicycles in afir_execute,       2 runs,      0 skips
>> > >     1437792 decicycles in afir_execute,    1024 runs,      0 skips
>> > >     1183963 decicycles in afir_execute,   16382 runs,      2 skips
>> > >
>> > > channels=4:
>> > > old:
>> > >     4879925 decicycles in afir_execute,       2 runs,      0 skips
>> > >     3557950 decicycles in afir_execute,    1022 runs,      2 skips
>> > >     3206843 decicycles in afir_execute,   16379 runs,      5 skips
>> > > new:
>> > >     2962320 decicycles in afir_execute,       2 runs,      0 skips
>> > >     2450430 decicycles in afir_execute,    1024 runs,      0 skips
>> > >     2446219 decicycles in afir_execute,   16383 runs,      1 skips
>> > >
>> > > channels=8:
>> > > old:
>> > >     6032455 decicycles in afir_execute,       2 runs,      0 skips
>> > >     4838614 decicycles in afir_execute,    1023 runs,      1 skips
>> > >     4720760 decicycles in afir_execute,   16369 runs,     15 skips
>> > > new:
>> > >     5228150 decicycles in afir_execute,       2 runs,      0 skips
>> > >     4592129 decicycles in afir_execute,    1023 runs,      1 skips
>> > >     4469067 decicycles in afir_execute,   16383 runs,      1 skips
>> >
>> > this causes a strange change:
>> >
>> > ./ffmpeg -i ~/videos/matrixbench_mpeg2.mpg  -vcodec libxavs  -vf scale=80x60 -t 1 file3.nut
>> >
>> > results in different files before and after this patch. Neither plays
>> > i suspect this is not a bug in the patch but something odd elsewhere
>> > but i dont know
>>
>
>> OK so you're saying there's no bug.
>
> no, i didnt say that
>
>
>> Something changed,
>
> yes
>
>
>> and you're too
>> lazy to investigate,
>
> no, i didnt say that either, nor is that true
>
>
>> but I guess he has all time in the world.
>>
>> So why should he care?
>
> You seem to try to imply that i asked Muhammad to look into this
> or take care of or fix the issue.
>
> please read my reply again its just 3 lines, i have not asked
> Muhammad to do anything. Nor was it intended to imply that.
> It is just a report of some odd findings which were triggered by
> the patch but which quite possibly are unrelated to the patch excpt
> by coincidence.

Probably this patch generates race condition. The silence of tsan is
artificial, the similar patch in avcodec cannot make tsan warning
silence. Currently I'm reworking on this.
My plan is to merge implementation of slice threading in avutil.

Thank's.


More information about the ffmpeg-devel mailing list