diff mbox series

[FFmpeg-devel] libavcodec/qsvdec: use the parameter from decodeHeader to configure surface

Message ID 20220211023736.501863-1-wenbin.chen@intel.com
State New
Headers show
Series [FFmpeg-devel] libavcodec/qsvdec: use the parameter from decodeHeader to configure surface | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished
andriy/make_aarch64_jetson success Make finished
andriy/make_fate_aarch64_jetson success Make fate finished
andriy/make_armv7_RPi4 success Make finished
andriy/make_fate_armv7_RPi4 success Make fate finished

Commit Message

Wenbin Chen Feb. 11, 2022, 2:37 a.m. UTC
MSDK recognizes both yuv420p10 and yuv420p9 as MFX_FOURCC_P010, but
parameters are different. When decode yuv420p9 video, ffmpeg-qsv will use
yuv420p10le to configure surface which is different with param from
DecoderHeader and this will lead to error. Now change it use
param from decoderHeader to configure surface.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
---
 libavcodec/qsvdec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Xiang, Haihao Feb. 16, 2022, 5:45 a.m. UTC | #1
On Fri, 2022-02-11 at 10:37 +0800, Wenbin Chen wrote:
> MSDK recognizes both yuv420p10 and yuv420p9 as MFX_FOURCC_P010, but
> parameters are different. When decode yuv420p9 video, ffmpeg-qsv will use
> yuv420p10le to configure surface which is different with param from
> DecoderHeader and this will lead to error. Now change it use
> param from decoderHeader to configure surface.
> 
> Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
> ---
>  libavcodec/qsvdec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
> index f81737ab6d..6236391357 100644
> --- a/libavcodec/qsvdec.c
> +++ b/libavcodec/qsvdec.c
> @@ -423,13 +423,13 @@ static int alloc_frame(AVCodecContext *avctx, QSVContext
> *q, QSVFrame *frame)
>      if (frame->frame->format == AV_PIX_FMT_QSV) {
>          frame->surface = *(mfxFrameSurface1*)frame->frame->data[3];
>      } else {
> -        frame->surface.Info = q->frame_info;
> -
>          frame->surface.Data.PitchLow = frame->frame->linesize[0];
>          frame->surface.Data.Y        = frame->frame->data[0];
>          frame->surface.Data.UV       = frame->frame->data[1];
>      }
>  
> +    frame->surface.Info = q->frame_info;
> +
>      if (q->frames_ctx.mids) {
>          ret = ff_qsv_find_surface_idx(&q->frames_ctx, frame);
>          if (ret < 0)

LGTM, will apply

-Haihao
diff mbox series

Patch

diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index f81737ab6d..6236391357 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -423,13 +423,13 @@  static int alloc_frame(AVCodecContext *avctx, QSVContext *q, QSVFrame *frame)
     if (frame->frame->format == AV_PIX_FMT_QSV) {
         frame->surface = *(mfxFrameSurface1*)frame->frame->data[3];
     } else {
-        frame->surface.Info = q->frame_info;
-
         frame->surface.Data.PitchLow = frame->frame->linesize[0];
         frame->surface.Data.Y        = frame->frame->data[0];
         frame->surface.Data.UV       = frame->frame->data[1];
     }
 
+    frame->surface.Info = q->frame_info;
+
     if (q->frames_ctx.mids) {
         ret = ff_qsv_find_surface_idx(&q->frames_ctx, frame);
         if (ret < 0)