[FFmpeg-devel] [PATCH, v4 1/2] lavf/qsvvpp:allocate continuous memory

Fu, Linjie 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,
see https://github.com/FFmpeg/FFmpeg/blob/8f6e65183354d1d402ae80c71cba2759fe152018/libavcodec/qsvenc.c#L1218

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[0]/data[1];

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.

Thanks,
Linjie



More information about the ffmpeg-devel mailing list