[FFmpeg-cvslog] lavfi/qsvvpp: use the right picture struct for vpp initilaization

Haihao Xiang git at videolan.org
Tue Jun 20 04:53:54 EEST 2023


ffmpeg | branch: master | Haihao Xiang <haihao.xiang at intel.com> | Mon Jun 12 16:14:48 2023 +0800| [88b3841149b9f41d6c5ec7930dcd5c6caf28b198] | committer: Haihao Xiang

lavfi/qsvvpp: use the right picture struct for vpp initilaization

Signed-off-by: Haihao Xiang <haihao.xiang at intel.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=88b3841149b9f41d6c5ec7930dcd5c6caf28b198
---

 libavfilter/qsvvpp.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
index f2e8e5fd73..a03de05d9c 100644
--- a/libavfilter/qsvvpp.c
+++ b/libavfilter/qsvvpp.c
@@ -536,6 +536,20 @@ static QSVFrame *query_frame(QSVVPPContext *s, AVFilterLink *outlink, const AVFr
     out_frame->frame->height = outlink->h;
     out_frame->surface.Info = s->vpp_param.vpp.Out;
 
+    for (int i = 0; i < s->vpp_param.NumExtParam; i++) {
+        mfxExtBuffer *extbuf = s->vpp_param.ExtParam[i];
+
+        if (extbuf->BufferId == MFX_EXTBUFF_VPP_DEINTERLACING) {
+            out_frame->frame->interlaced_frame = 0;
+            break;
+        }
+    }
+
+    out_frame->surface.Info.PicStruct =
+        !out_frame->frame->interlaced_frame ? MFX_PICSTRUCT_PROGRESSIVE :
+        (out_frame->frame->top_field_first ? MFX_PICSTRUCT_FIELD_TFF :
+         MFX_PICSTRUCT_FIELD_BFF);
+
     return out_frame;
 }
 
@@ -851,13 +865,16 @@ failed:
     return ret;
 }
 
-static int qsvvpp_init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s)
+static int qsvvpp_init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s, const QSVFrame *in, QSVFrame *out)
 {
     int ret;
 
     if (s->vpp_initted)
         return 0;
 
+    s->vpp_param.vpp.In.PicStruct = in->surface.Info.PicStruct;
+    s->vpp_param.vpp.Out.PicStruct = out->surface.Info.PicStruct;
+
     /* Query VPP params again, including params for frame */
     ret = MFXVideoVPP_Query(s->session, &s->vpp_param, &s->vpp_param);
     if (ret < 0)
@@ -940,7 +957,7 @@ int ff_qsvvpp_filter_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *picr
             return AVERROR(ENOMEM);
         }
 
-        ret = qsvvpp_init_vpp_session(ctx, s);
+        ret = qsvvpp_init_vpp_session(ctx, s, in_frame, out_frame);
         if (ret)
             return ret;
 



More information about the ffmpeg-cvslog mailing list