[FFmpeg-devel] [PATCH, v3] lavc/qsvdec: Add GPU-accelerated memory copy support
Li, Zhong
zhong.li at intel.com
Sun Sep 29 12:31:17 EEST 2019
> +static int ff_qsv_get_continuous_buffer(AVCodecContext *avctx, AVFrame
> +*frame, AVBufferPool *pool) {
> + int ret = 0;
> +
> + ff_decode_frame_props(avctx, frame);
> +
> + frame->width = avctx->width;
> + frame->height = avctx->height;
> + frame->linesize[0] = FFALIGN(avctx->width, 128);
> + frame->linesize[1] = frame->linesize[0];
> + frame->buf[0] = av_buffer_pool_get(pool);
> + if (!frame->buf[0])
> + return AVERROR(ENOMEM);
> +
> + frame->data[0] = frame->buf[0]->data;
> + frame->data[1] = frame->data[0] +
> + frame->linesize[0] * FFALIGN(avctx->height,
> + 64);
It is assumed there are only two planes , but this is not correct for some formats, such as RGB32.
Probably ok since currently all decoder output is NV12/P010, but would be better add an assert check,
since it is possible for decoder to output some other formats (e.g: it is plan to add RGB format for JPEG decoding output).
More information about the ffmpeg-devel
mailing list