Message ID | 20211213064055.17139-1-haihao.xiang@intel.com |
---|---|
State | Accepted |
Commit | 0d82613b7dcdbe9e51b77f06baa72d5715343b8f |
Headers | show |
Series | [FFmpeg-devel] lavc/qsvenc: set base address for V plane | expand |
Context | Check | Description |
---|---|---|
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
andriy/make_ppc | success | Make finished |
andriy/make_fate_ppc | success | Make fate finished |
On Mon, 2021-12-13 at 14:40 +0800, Haihao Xiang wrote: > The SDK checks Data.V when using system memory for VP9 encoding. This > fixed the error below: > > $ ffmpeg -qsv_device /dev/dri/renderD129 -f lavfi -i yuvtestsrc -c:v > vp9_qsv -f null - > > [vp9_qsv @ 0x55b8387cbe90] Error during encoding: NULL pointer (-2) > Video encoding failed > --- > libavcodec/qsvenc.c | 17 ++++++++++++++++- > 1 file changed, 16 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c > index 26a94cd419..7431ccfca5 100644 > --- a/libavcodec/qsvenc.c > +++ b/libavcodec/qsvenc.c > @@ -1389,8 +1389,23 @@ static int submit_frame(QSVEncContext *q, const AVFrame > *frame, > qf->surface.Data.PitchLow = qf->frame->linesize[0]; > qf->surface.Data.Y = qf->frame->data[0]; > qf->surface.Data.UV = qf->frame->data[1]; > - } > > + /* The SDK checks Data.V when using system memory for VP9 encoding */ > + switch (frame->format) { > + case AV_PIX_FMT_NV12: > + qf->surface.Data.V = qf->surface.Data.UV + 1; > + break; > + > + case AV_PIX_FMT_P010: > + qf->surface.Data.V = qf->surface.Data.UV + 2; > + break; > + > + default: > + /* should not reach here */ > + av_assert0(0); > + break; > + } > + } > qf->surface.Data.TimeStamp = av_rescale_q(frame->pts, q->avctx- > >time_base, (AVRational){1, 90000}); > > *new_frame = qf; Will apply if no objection -Haihao
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 26a94cd419..7431ccfca5 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -1389,8 +1389,23 @@ static int submit_frame(QSVEncContext *q, const AVFrame *frame, qf->surface.Data.PitchLow = qf->frame->linesize[0]; qf->surface.Data.Y = qf->frame->data[0]; qf->surface.Data.UV = qf->frame->data[1]; - } + /* The SDK checks Data.V when using system memory for VP9 encoding */ + switch (frame->format) { + case AV_PIX_FMT_NV12: + qf->surface.Data.V = qf->surface.Data.UV + 1; + break; + + case AV_PIX_FMT_P010: + qf->surface.Data.V = qf->surface.Data.UV + 2; + break; + + default: + /* should not reach here */ + av_assert0(0); + break; + } + } qf->surface.Data.TimeStamp = av_rescale_q(frame->pts, q->avctx->time_base, (AVRational){1, 90000}); *new_frame = qf;