[FFmpeg-devel] [PATCH 4/4] avfilter/vf_zscale: realign output buffer if needed

Marton Balint cus at passwd.hu
Thu Mar 17 00:01:19 EET 2022



On Wed, 16 Mar 2022, James Almer wrote:

> On 3/14/2022 6:06 PM, Marton Balint wrote:
>>  Output buffer alignment might be different to ZIMG_ALIGNMENT or it may not
>>  be
>>  aligned at all if a downstream filter (e.g. vf_pad) intentionally
>>  misaligns it.
>
> av_frame_get_buffer() align parameter is used to align linesizes, not 
> buffers. av_malloc() has a hardcoded alignment defined at compile time based 
> on configure settings.

Good point.

>
> If what you need is aligned data pointers, you should either use the trick i 
> used in the libdav1d wrapper, or change av_malloc() in order to use 
> av_cpu_max_align().

Actually av_cpu_max_align() also depends on compile time, so your trick is 
the only way to ensure ZIMG alignment as far as I see...

Regards,
Marton


More information about the ffmpeg-devel mailing list