[FFmpeg-devel] gcc: Remove auto-vectorization limitation.

Jiawei jiawei at iscas.ac.cn
Wed May 21 13:17:19 EEST 2025


在 2025/5/21 14:52, Nicolas George 写道:
> Jiawei (HE12025-05-21):
>> 					  particularly improving
>> performance on x86_64 (AVX), ARM64 (SVE) and RISC-V(RVV) architectures.
> Benchmark needed.
>
> Regards,


Hi Nicolas,


Since I am a gcc developer, I'm not so familiar with the FFmpeg test 
flow, here is my test process,
if there exists anything uncorrect, please point me out:


1. Download the video bbb_sunflower_2160p_30fps_normal.mp4.zip 
<https://download.blender.org/demo/movies/BBB/bbb_sunflower_2160p_30fps_normal.mp4.zip> 
from https://download.blender.org/demo/movies/BBB/,

```

ffmpeg -i bbb_sunflower_2160p_30fps_normal.mp4 -t 60 -vf 
"scale=1920:1080" -c:v libx265 -c:a libmp3lame 1080p_hevc_mp3.mp4
```

get the 1080p video as Benchmark test video


2. Build two version of FFmpeg, one with the modify,  another without 
the patch modif, using the gcc 13.3 release version,

verified with Intel(R) Core(TM) Ultra 9 285HX


Using patch:

```
./ffmpeg -benchmark -i ~/mp/1080p_hevc_mp3.mp4 -f null -
ffmpeg version N-119636-g96518c8d8d Copyright (c) 2000-2025 the FFmpeg 
developers
   built with gcc 13 (Ubuntu 13.3.0-6ubuntu2~24.04)
   configuration: --prefix=/home/pz9115/ffpo --disable-ffplay --arch=x64 
--extra-cflags=-O3 --enable-static --target-os=linux
   libavutil      60.  2.100 / 60.  2.100
   libavcodec     62.  3.101 / 62.  3.101
   libavformat    62.  0.102 / 62.  0.102
   libavdevice    62.  0.100 / 62.  0.100
   libavfilter    11.  0.100 / 11.  0.100
   libswscale      9.  0.100 /  9.  0.100
   libswresample   6.  0.100 /  6.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 
'/home/pz9115/mp/1080p_hevc_mp3.mp4':
   Metadata:
     major_brand     : isom
     minor_version   : 512
     compatible_brands: isomiso2mp41
     title           : Big Buck Bunny, Sunflower version
     artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
     composer        : Sacha Goedegebure
     encoder         : Lavf60.16.100
     comment         : Creative Commons Attribution 3.0 - 
http://bbb3d.renderfarming.net
     genre           : Animation
   Duration: 00:01:00.00, start: 0.000000, bitrate: 1564 kb/s
   Stream #0:0[0x1](und): Video: hevc (Main) (hev1 / 0x31766568), 
yuv420p(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 1429 kb/s, 30 
fps, 30 tbr, 15360 tbn (default)
     Metadata:
       handler_name    : GPAC ISO Video Handler
       vendor_id       : [0][0][0][0]
       encoder         : Lavc60.31.102 libx265
   Stream #0:1[0x2](und): Audio: mp3 (mp3float) (mp4a / 0x6134706D), 
48000 Hz, stereo, fltp, 128 kb/s (default)
     Metadata:
       handler_name    : GPAC ISO Audio Handler
       vendor_id       : [0][0][0][0]
Stream mapping:
   Stream #0:0 -> #0:0 (hevc (native) -> wrapped_avframe (native))
   Stream #0:1 -> #0:1 (mp3 (mp3float) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, null, to 'pipe:':
   Metadata:
     major_brand     : isom
     minor_version   : 512
     compatible_brands: isomiso2mp41
     title           : Big Buck Bunny, Sunflower version
     artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
     composer        : Sacha Goedegebure
     genre           : Animation
     comment         : Creative Commons Attribution 3.0 - 
http://bbb3d.renderfarming.net
     encoder         : Lavf62.0.102
   Stream #0:0(und): Video: wrapped_avframe, yuv420p(tv, progressive), 
1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 30 fps, 30 tbn (default)
     Metadata:
       encoder         : Lavc62.3.101 wrapped_avframe
       handler_name    : GPAC ISO Video Handler
       vendor_id       : [0][0][0][0]
   Stream #0:1(und): Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s 
(default)
     Metadata:
       encoder         : Lavc62.3.101 pcm_s16le
       handler_name    : GPAC ISO Audio Handler
       vendor_id       : [0][0][0][0]
[out#0/null @ 0x565233669eb0] video:731KiB audio:11250KiB subtitle:0KiB 
other streams:0KiB global headers:0KiB muxing overhead: unknown
frame= 1800 fps=635 q=-0.0 Lsize=N/A time=00:01:00.00 bitrate=N/A 
speed=21.2x elapsed=0:00:02.83
bench: utime=11.324s stime=0.290s rtime=2.834s
bench: maxrss=186556KiB
```

Without patch(here I add the fno-tree-vectorize directly):

./ffmpeg -benchmark -i ~/mp/1080p_hevc_mp3.mp4 -f null -
ffmpeg version N-119636-g96518c8d8d Copyright (c) 2000-2025 the FFmpeg 
developers
   built with gcc 13 (Ubuntu 13.3.0-6ubuntu2~24.04)
   configuration: --prefix=/home/pz9115/ffpo --disable-ffplay --arch=x64 
--extra-cflags='-O3 -fno-tree-vectorize' --enable-static --target-os=linux
   libavutil      60.  2.100 / 60.  2.100
   libavcodec     62.  3.101 / 62.  3.101
   libavformat    62.  0.102 / 62.  0.102
   libavdevice    62.  0.100 / 62.  0.100
   libavfilter    11.  0.100 / 11.  0.100
   libswscale      9.  0.100 /  9.  0.100
   libswresample   6.  0.100 /  6.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 
'/home/pz9115/mp/1080p_hevc_mp3.mp4':
   Metadata:
     major_brand     : isom
     minor_version   : 512
     compatible_brands: isomiso2mp41
     title           : Big Buck Bunny, Sunflower version
     artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
     composer        : Sacha Goedegebure
     encoder         : Lavf60.16.100
     comment         : Creative Commons Attribution 3.0 - 
http://bbb3d.renderfarming.net
     genre           : Animation
   Duration: 00:01:00.00, start: 0.000000, bitrate: 1564 kb/s
   Stream #0:0[0x1](und): Video: hevc (Main) (hev1 / 0x31766568), 
yuv420p(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 1429 kb/s, 30 
fps, 30 tbr, 15360 tbn (default)
     Metadata:
       handler_name    : GPAC ISO Video Handler
       vendor_id       : [0][0][0][0]
       encoder         : Lavc60.31.102 libx265
   Stream #0:1[0x2](und): Audio: mp3 (mp3float) (mp4a / 0x6134706D), 
48000 Hz, stereo, fltp, 128 kb/s (default)
     Metadata:
       handler_name    : GPAC ISO Audio Handler
       vendor_id       : [0][0][0][0]
Stream mapping:
   Stream #0:0 -> #0:0 (hevc (native) -> wrapped_avframe (native))
   Stream #0:1 -> #0:1 (mp3 (mp3float) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, null, to 'pipe:':
   Metadata:
     major_brand     : isom
     minor_version   : 512
     compatible_brands: isomiso2mp41
     title           : Big Buck Bunny, Sunflower version
     artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
     composer        : Sacha Goedegebure
     genre           : Animation
     comment         : Creative Commons Attribution 3.0 - 
http://bbb3d.renderfarming.net
     encoder         : Lavf62.0.102
   Stream #0:0(und): Video: wrapped_avframe, yuv420p(tv, progressive), 
1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 30 fps, 30 tbn (default)
     Metadata:
       encoder         : Lavc62.3.101 wrapped_avframe
       handler_name    : GPAC ISO Video Handler
       vendor_id       : [0][0][0][0]
   Stream #0:1(und): Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s 
(default)
     Metadata:
       encoder         : Lavc62.3.101 pcm_s16le
       handler_name    : GPAC ISO Audio Handler
       vendor_id       : [0][0][0][0]
[out#0/null @ 0x55eb196b7eb0] video:731KiB audio:11250KiB subtitle:0KiB 
other streams:0KiB global headers:0KiB muxing overhead: unknown
frame= 1800 fps=509 q=-0.0 Lsize=N/A time=00:01:00.00 bitrate=N/A 
speed=  17x elapsed=0:00:03.53
bench: utime=21.544s stime=0.349s rtime=3.536s
bench: maxrss=181580KiB

And I also tested on a RISC-V develop board MUSE Pi Pro, Here following 
is the configure and result:

Using patch:

root at spacemit-k1-x-MUSE-Pi-Pro-board:~# ./ffpv/bin/ffmpeg -benchmark -i 
1080p_hevc_mp3.mp4 -f null -
ffmpeg version n6.1.2 Copyright (c) 2000-2024 the FFmpeg developers
   built with gcc 16.0.0 (g3fc902e738b) 20250519 (experimental)
   configuration: --prefix=/home/pz9115/ffpv --disable-ffplay 
--arch=riscv --extra-cflags='-march=rv64gcv_zba_zbb_zbs -O3 -ffast-math' 
--cross-prefix=/home/pz9115/rvv/bin/riscv64-unknown-linux-gnu- 
--cc=/home/pz9115/rvv/bin/riscv64-unknown-linux-gnu-gcc 
--cxx=/home/pz9115/rvv/bin/riscv64-unknown-linux-gnu-g++ --enable-static 
--enable-cross-compile --target-os=linux --disable-rvv
   libavutil      58. 29.100 / 58. 29.100
   libavcodec     60. 31.102 / 60. 31.102
   libavformat    60. 16.100 / 60. 16.100
   libavdevice    60.  3.100 / 60.  3.100
   libavfilter     9. 12.100 /  9. 12.100
   libswscale      7.  5.100 /  7.  5.100
   libswresample   4. 12.100 /  4. 12.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '1080p_hevc_mp3.mp4':
   Metadata:
     major_brand     : isom
     minor_version   : 512
     compatible_brands: isomiso2mp41
     title           : Big Buck Bunny, Sunflower version
     artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
     composer        : Sacha Goedegebure
     encoder         : Lavf60.16.100
     comment         : Creative Commons Attribution 3.0 - 
http://bbb3d.renderfarming.net
     genre           : Animation
   Duration: 00:01:00.00, start: 0.000000, bitrate: 1564 kb/s
   Stream #0:0[0x1](und): Video: hevc (Main) (hev1 / 0x31766568), 
yuv420p(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 1429 kb/s, 30 
fps, 30 tbr, 15360 tbn (default)
     Metadata:
       handler_name    : GPAC ISO Video Handler
       vendor_id       : [0][0][0][0]
       encoder         : Lavc60.31.102 libx265
   Stream #0:1[0x2](und): Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, 
stereo, fltp, 128 kb/s (default)
     Metadata:
       handler_name    : GPAC ISO Audio Handler
       vendor_id       : [0][0][0][0]
Stream mapping:
   Stream #0:0 -> #0:0 (hevc (native) -> wrapped_avframe (native))
   Stream #0:1 -> #0:1 (mp3 (mp3float) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Odd rotation angle.
If you want to help, upload a sample of this file to 
https://streams.videolan.org/upload/ and contact the ffmpeg-devel 
mailing list. (ffmpeg-devel at ffmpeg.org)Output #0, null, to 'pipe:':
   Metadata:
     major_brand     : isom
     minor_version   : 512
     compatible_brands: isomiso2mp41
     title           : Big Buck Bunny, Sunflower version
     artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
     composer        : Sacha Goedegebure
     genre           : Animation
     comment         : Creative Commons Attribution 3.0 - 
http://bbb3d.renderfarming.net
     encoder         : Lavf60.16.100
   Stream #0:0(und): Video: wrapped_avframe, yuv420p(tv, progressive), 
1080x1920 [SAR 1:1 DAR 9:16], q=2-31, 200 kb/s, 30 fps, 30 tbn (default)
     Metadata:
       handler_name    : GPAC ISO Video Handler
       vendor_id       : [0][0][0][0]
       encoder         : Lavc60.31.102 wrapped_avframe
   Stream #0:1(und): Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s 
(default)
     Metadata:
       handler_name    : GPAC ISO Audio Handler
       vendor_id       : [0][0][0][0]
       encoder         : Lavc60.31.102 pcm_s16le
[out#0/null @ 0x28a82e0] video:844kB audio:11250kB subtitle:0kB other 
streams:0kB global headers:0kB muxing overhead: unknown
frame= 1800 fps= 42 q=-0.0 Lsize=N/A time=00:00:59.97 bitrate=N/A 
speed=1.41x
bench: utime=207.150s stime=5.319s rtime=42.608s
bench: maxrss=162160kB

Without patch(same added the fno-tree-vectorize directly):

./ffp/bin/ffmpeg -benchmark -i 1080p_hevc_mp3.mp4 -f null -
ffmpeg version n6.1.2 Copyright (c) 2000-2024 the FFmpeg developers
   built with gcc 16.0.0 (g38163c874a3-dirty) 20250515 (experimental)
   configuration: --prefix=/home/pz9115/ffp --disable-ffplay 
--arch=riscv --sysroot=/home/pz9115/rv/sysroot 
--extra-cflags='-march=rv64gcv_zba_zbb_zbc_zbs_zca_zcd -mabi=lp64d -O3 
-fno-tree-vectorize -static' --extra-ldflags=-static 
--cross-prefix=/home/pz9115/rv/bin/riscv64-unknown-linux-gnu- 
--enable-static --enable-cross-compile --target-os=linux --disable-rvv
   libavutil      58. 29.100 / 58. 29.100
   libavcodec     60. 31.102 / 60. 31.102
   libavformat    60. 16.100 / 60. 16.100
   libavdevice    60.  3.100 / 60.  3.100
   libavfilter     9. 12.100 /  9. 12.100
   libswscale      7.  5.100 /  7.  5.100
   libswresample   4. 12.100 /  4. 12.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '1080p_hevc_mp3.mp4':
   Metadata:
     major_brand     : isom
     minor_version   : 512
     compatible_brands: isomiso2mp41
     title           : Big Buck Bunny, Sunflower version
     artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
     composer        : Sacha Goedegebure
     encoder         : Lavf60.16.100
     comment         : Creative Commons Attribution 3.0 - 
http://bbb3d.renderfarming.net
     genre           : Animation
   Duration: 00:01:00.00, start: 0.000000, bitrate: 1564 kb/s
   Stream #0:0[0x1](und): Video: hevc (Main) (hev1 / 0x31766568), 
yuv420p(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 1429 kb/s, 30 
fps, 30 tbr, 15360 tbn (default)
     Metadata:
       handler_name    : GPAC ISO Video Handler
       vendor_id       : [0][0][0][0]
       encoder         : Lavc60.31.102 libx265
   Stream #0:1[0x2](und): Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, 
stereo, fltp, 128 kb/s (default)
     Metadata:
       handler_name    : GPAC ISO Audio Handler
       vendor_id       : [0][0][0][0]
Stream mapping:
   Stream #0:0 -> #0:0 (hevc (native) -> wrapped_avframe (native))
   Stream #0:1 -> #0:1 (mp3 (mp3float) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, null, to 'pipe:':
   Metadata:
     major_brand     : isom
     minor_version   : 512
     compatible_brands: isomiso2mp41
     title           : Big Buck Bunny, Sunflower version
     artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
     composer        : Sacha Goedegebure
     genre           : Animation
     comment         : Creative Commons Attribution 3.0 - 
http://bbb3d.renderfarming.net
     encoder         : Lavf60.16.100
   Stream #0:0(und): Video: wrapped_avframe, yuv420p(tv, progressive), 
1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 30 fps, 30 tbn (default)
     Metadata:
       handler_name    : GPAC ISO Video Handler
       vendor_id       : [0][0][0][0]
       encoder         : Lavc60.31.102 wrapped_avframe
   Stream #0:1(und): Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s 
(default)
     Metadata:
       handler_name    : GPAC ISO Audio Handler
       vendor_id       : [0][0][0][0]
       encoder         : Lavc60.31.102 pcm_s16le
[out#0/null @ 0x2729630] video:844kB audio:11250kB subtitle:0kB other 
streams:0kB global headers:0kB muxing overhead: unknown
frame= 1800 fps= 30 q=-0.0 Lsize=N/A time=00:00:59.97 bitrate=N/A 
speed=   1x
bench: utime=321.145s stime=2.475s rtime=59.960s
bench: maxrss=131532kB


More information about the ffmpeg-devel mailing list