[FFmpeg-trac] #11116(avutil:new): av_frame_get_buffer automatic alignment is incorrect for AVX512 CPUs
FFmpeg
trac at avcodec.org
Mon Jul 29 10:11:35 EEST 2024
#11116: av_frame_get_buffer automatic alignment is incorrect for AVX512 CPUs
-------------------------------------+-------------------------------------
Reporter: Aras | Type: defect
Pranckevicius |
Status: new | Priority: normal
Component: avutil | Version: git-
| master
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Summary of the bug:
av_frame_get_buffer with "automatic" (align=0) alignment ends up picking
32 alignment, even if on an AVX512 CPU it should have picked 64.
Actual get_video_buffer function implementation, in the original commit
that added automatic alignment (2017 Feb)
https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/4de220d2e3751c4?hp=f44ec22e095
used av_cpu_max_align. However, a later merge of that commit (2017 Sep)
https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/7aa6b8a68fce93d84?hp=24ee1b8c6343f
replaced usage of av_cpu_max_align with hardcoded value of 32, with a
comment saying that it should really be av_cpu_max_align.
The repro case is a bit involved, currently I don't have a clean one, only
an indirect one through investigating a Blender bug report
(https://projects.blender.org/blender/blender/issues/125446). Where it
ends up being a problem, is when a video frame is decoded through ffmpeg,
and then YUV -> RGBA conversion is done through libswscale. On an AVX512
CPU, where video width is not multiple of 16 pixels (i.e. RGBA image
stride is not multiple of 64 bytes), the swscale conversion ends up
emitting "wrapping artifacts" on the left side of the image.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/11116>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list