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

Muhammad Faiz mfcc64 at gmail.com
Sat Jul 8 05:06:05 EEST 2017


On Sat, Jul 8, 2017 at 6:45 AM, 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
>
> -rw-r----- 1 michael michael 57671 Jul  8 00:48 file3.nut
> -rw-r----- 1 michael michael 62162 Jul  8 00:48 file3p.nut
>
> framecrc difference of video with -vcodec copy -copyinkf -f framecrc
>
> --- a   2017-07-08 01:41:49.717555033 +0200
> +++ b   2017-07-08 01:42:09.877555273 +0200
> @@ -5,28 +5,28 @@
>  #dimensions 0: 80x60
>  #sar 0: 1/1
>  0,          0,          0,     2048,     1860, 0xaa19412e, F=0x0
> -0,       2048,       2048,     2048,     1261, 0xd0bd2d34, F=0x0
> -0,       4096,       4096,     2048,     1261, 0x30083a11, F=0x0
> -0,       6144,       6144,     2048,     1347, 0xfd5b5c17, F=0x0
> -0,       8192,       8192,     2048,      933, 0x3e95a0aa, F=0x0
> -0,      10240,      10240,     2048,     1299, 0x5fd141e1, F=0x0
> -0,      12288,      12288,     2048,     1311, 0xcb90563e, F=0x0
> -0,      14336,      14336,     2048,     1288, 0x55553cee, F=0x0
> -0,      16384,      16384,     2048,     1295, 0x68d34476, F=0x0
> -0,      18432,      18432,     2048,     1397, 0xf0646699, F=0x0
> -0,      20480,      20480,     2048,     1353, 0xbd0557f9, F=0x0
> -0,      22528,      22528,     2048,     1358, 0x90095601, F=0x0
> -0,      24576,      24576,     2048,     2004, 0x8de57d88, F=0x0
> -0,      26624,      26624,     2048,     1477, 0x6c099b28, F=0x0
> -0,      28672,      28672,     2048,     1515, 0x2fd78855, F=0x0
> +0,       2048,       2048,     2048,     1827, 0x1a47f795, F=0x0
> +0,       4096,       4096,     2048,     1379, 0x50435dbb, F=0x0
> +0,       6144,       6144,     2048,     1912, 0x9b2529a8, F=0x0
> +0,       8192,       8192,     2048,     1052, 0x6fe1ce3b, F=0x0
> +0,      10240,      10240,     2048,     1862, 0x10e30eae, F=0x0
> +0,      12288,      12288,     2048,     1432, 0x93858555, F=0x0
> +0,      14336,      14336,     2048,     1850, 0xaf3b039d, F=0x0
> +0,      16384,      16384,     2048,     1408, 0x049e668a, F=0x0
> +0,      18432,      18432,     2048,     1956, 0x751c36c6, F=0x0
> +0,      20480,      20480,     2048,     1465, 0xb6e58045, F=0x0
> +0,      22528,      22528,     2048,     1916, 0x22dc1fe7, F=0x0
> +0,      24576,      24576,     2048,     2038, 0x56548c7c, F=0x0
> +0,      26624,      26624,     2048,     1490, 0x7e42a072, F=0x0
> +0,      28672,      28672,     2048,     1521, 0x6e128b71, F=0x0
>  0,      30720,      30720,     2048,     1523, 0xa5819af8, F=0x0
>  0,      32768,      32768,     2048,     1528, 0x9898a156, F=0x0
> -0,      34816,      34816,     2048,     1601, 0x9873cdf4, F=0x0
> +0,      34816,      34816,     2048,     1613, 0x5e97d399, F=0x0
>  0,      36864,      36864,     2048,     1597, 0xf02ad0e6, F=0x0
> -0,      38912,      38912,     2048,     1620, 0x4da2da72, F=0x0
> -0,      40960,      40960,     2048,     1668, 0xb794dc64, F=0x0
> +0,      38912,      38912,     2048,     1625, 0x9bdddcbb, F=0x0
> +0,      40960,      40960,     2048,     1673, 0x0a11de8f, F=0x0
>  0,      43008,      43008,     2048,     1678, 0xd81de01a, F=0x0
>  0,      45056,      45056,     2048,     1647, 0x5ca1d51c, F=0x0
> -0,      47104,      47104,     2048,     1643, 0x8010d916, F=0x0
> -0,      49152,      49152,     2048,     2118, 0x985ea130, F=0x0
> +0,      47104,      47104,     2048,     1655, 0xca23ddf2, F=0x0
> +0,      49152,      49152,     2048,     2158, 0x4619aaac, F=0x0
>  0,      49153,      49153,     2048,        4, 0x00b300b2, F=0x0

I cannot reproduce this. I test it and both are not different.

Thank's


More information about the ffmpeg-devel mailing list