[FFmpeg-devel] [PATCH, v4 1/2] lavf/qsvvpp:allocate continuous memory
linjie.fu at intel.com
Tue Jun 18 11:12:01 EEST 2019
From: Max Dmitrichenko [mailto:maxim.d33 at gmail.com]
Sent: Tuesday, June 18, 2019 15:06
To: FFmpeg development discussions and patches <ffmpeg-devel at ffmpeg.org>
Cc: Fu, Linjie <linjie.fu at intel.com>
Subject: Re: [FFmpeg-devel] [PATCH, v4 1/2] lavf/qsvvpp:allocate continuous memory
On Tue, Jun 18, 2019 at 9:52 AM Linjie Fu <linjie.fu at intel.com<mailto:linjie.fu at intel.com>> wrote:
Mediasdk calls CMRT to copy from video to system memory and requires
memory to be continuously allocated across Y and UV.
Add a new path to allocate continuous memory when using system out.
Use get_continuous_buffer to arrange data according to pixfmt.
it would be good to keep such continuous allocations consistent with encoder's implementation,
if needed, needs to be checked before re-allocation.
Thanks for the advice and I agree consistency is important.
And I’ve thought about the behavior in qsvenc.c as well to make sure the memory is continuous.
However, I got some concerns:
1. av_frame_get_buffer() will introduce plane_padding, and it will lead to un-continuous data/data;
And the paddings will lead to wrong offset of U/V, and will cause garbage on chroma filed of image. (when using mirror methods)
So I choose to use get_continuous_buffer() which is similar but introduced no paddings.
2. Since here is the first the position to allocate memory for output frame, directly allocate a continuous memory seems to be good IMHO.
More information about the ffmpeg-devel