Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH v2 1/4] lavfi/qsvvpp: change the output frame's width and height
@ 2022-11-28  4:43 Xiang, Haihao
  2022-11-28  4:43 ` [FFmpeg-devel] [PATCH v2 2/4] lavfi/qsvvpp: avoid overriding the returned value Xiang, Haihao
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Xiang, Haihao @ 2022-11-28  4:43 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Chen,Wenbin

From: "Chen,Wenbin" <wenbin.chen@intel.com>

Make sure the size of the output frame always matches the agreed upon
image size.

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

diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
index 8428ee89ab..bf719b2a29 100644
--- a/libavfilter/qsvvpp.c
+++ b/libavfilter/qsvvpp.c
@@ -487,15 +487,14 @@ static QSVFrame *query_frame(QSVVPPContext *s, AVFilterLink *outlink)
         if (!out_frame->frame)
             return NULL;
 
-        out_frame->frame->width  = outlink->w;
-        out_frame->frame->height = outlink->h;
-
         ret = map_frame_to_surface(out_frame->frame,
                                    &out_frame->surface);
         if (ret < 0)
             return NULL;
     }
 
+    out_frame->frame->width  = outlink->w;
+    out_frame->frame->height = outlink->h;
     out_frame->surface.Info = s->vpp_param.vpp.Out;
 
     return out_frame;
-- 
2.25.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [FFmpeg-devel] [PATCH v2 2/4] lavfi/qsvvpp: avoid overriding the returned value
  2022-11-28  4:43 [FFmpeg-devel] [PATCH v2 1/4] lavfi/qsvvpp: change the output frame's width and height Xiang, Haihao
@ 2022-11-28  4:43 ` Xiang, Haihao
  2022-11-28  4:43 ` [FFmpeg-devel] [PATCH v2 3/4] lavfi/qsvvpp: provide a default framerate if needed Xiang, Haihao
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Xiang, Haihao @ 2022-11-28  4:43 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Haihao Xiang

From: Haihao Xiang <haihao.xiang@intel.com>

It means more than one output is ready when
MFXVideoVPP_RunFrameVPPAsync() returns MFX_ERR_MORE_SURFACE [1].
Currently the returned value from MFXVideoVPP_RunFrameVPPAsync() might
be overridden, so the check of 'ret == MFX_ERR_MORE_SURFACE' is always
false when MFX_ERR_MORE_SURFACE is returned from
MFXVideoVPP_RunFrameVPPAsync()

[1] https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#video-processing-procedures

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
---
 libavfilter/qsvvpp.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
index bf719b2a29..a088f6b61f 100644
--- a/libavfilter/qsvvpp.c
+++ b/libavfilter/qsvvpp.c
@@ -833,7 +833,7 @@ int ff_qsvvpp_filter_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *picr
     QSVAsyncFrame     aframe;
     mfxSyncPoint      sync;
     QSVFrame         *in_frame, *out_frame;
-    int               ret, filter_ret;
+    int               ret, ret1, filter_ret;
 
     while (s->eof && av_fifo_read(s->async_fifo, &aframe, 1) >= 0) {
         if (MFXVideoCORE_SyncOperation(s->session, aframe.sync, 1000) < 0)
@@ -890,8 +890,13 @@ int ff_qsvvpp_filter_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *picr
             av_fifo_read(s->async_fifo, &aframe, 1);
 
             do {
-                ret = MFXVideoCORE_SyncOperation(s->session, aframe.sync, 1000);
-            } while (ret == MFX_WRN_IN_EXECUTION);
+                ret1 = MFXVideoCORE_SyncOperation(s->session, aframe.sync, 1000);
+            } while (ret1 == MFX_WRN_IN_EXECUTION);
+
+            if (ret1 < 0) {
+                ret = ret1;
+                break;
+            }
 
             filter_ret = s->filter_frame(outlink, aframe.frame->frame);
             if (filter_ret < 0) {
-- 
2.25.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [FFmpeg-devel] [PATCH v2 3/4] lavfi/qsvvpp: provide a default framerate if needed
  2022-11-28  4:43 [FFmpeg-devel] [PATCH v2 1/4] lavfi/qsvvpp: change the output frame's width and height Xiang, Haihao
  2022-11-28  4:43 ` [FFmpeg-devel] [PATCH v2 2/4] lavfi/qsvvpp: avoid overriding the returned value Xiang, Haihao
@ 2022-11-28  4:43 ` Xiang, Haihao
  2022-11-28  4:43 ` [FFmpeg-devel] [PATCH v2 4/4] lavfi/vf_vpp_qsv: scale_mode can be applied to color conversion Xiang, Haihao
  2022-11-30  1:59 ` [FFmpeg-devel] [PATCH v2 1/4] lavfi/qsvvpp: change the output frame's width and height Xiang, Haihao
  3 siblings, 0 replies; 5+ messages in thread
From: Xiang, Haihao @ 2022-11-28  4:43 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Haihao Xiang

From: Haihao Xiang <haihao.xiang@intel.com>

VPP in the SDK requires the frame rate to be set to a valid value,
otherwise init will fail, so always set a default framerate when the
input link doesn't have a valid framerate.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
---
 libavfilter/qsvvpp.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
index a088f6b61f..a588a37610 100644
--- a/libavfilter/qsvvpp.c
+++ b/libavfilter/qsvvpp.c
@@ -324,6 +324,14 @@ static int fill_frameinfo_by_link(mfxFrameInfo *frameinfo, AVFilterLink *link)
     frameinfo->CropH          = link->h;
     frameinfo->FrameRateExtN  = link->frame_rate.num;
     frameinfo->FrameRateExtD  = link->frame_rate.den;
+
+    /* Apparently VPP in the SDK requires the frame rate to be set to some value, otherwise
+     * init will fail */
+    if (frameinfo->FrameRateExtD == 0 || frameinfo->FrameRateExtN == 0) {
+        frameinfo->FrameRateExtN = 25;
+        frameinfo->FrameRateExtD = 1;
+    }
+
     frameinfo->AspectRatioW   = link->sample_aspect_ratio.num ? link->sample_aspect_ratio.num : 1;
     frameinfo->AspectRatioH   = link->sample_aspect_ratio.den ? link->sample_aspect_ratio.den : 1;
 
-- 
2.25.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [FFmpeg-devel] [PATCH v2 4/4] lavfi/vf_vpp_qsv: scale_mode can be applied to color conversion
  2022-11-28  4:43 [FFmpeg-devel] [PATCH v2 1/4] lavfi/qsvvpp: change the output frame's width and height Xiang, Haihao
  2022-11-28  4:43 ` [FFmpeg-devel] [PATCH v2 2/4] lavfi/qsvvpp: avoid overriding the returned value Xiang, Haihao
  2022-11-28  4:43 ` [FFmpeg-devel] [PATCH v2 3/4] lavfi/qsvvpp: provide a default framerate if needed Xiang, Haihao
@ 2022-11-28  4:43 ` Xiang, Haihao
  2022-11-30  1:59 ` [FFmpeg-devel] [PATCH v2 1/4] lavfi/qsvvpp: change the output frame's width and height Xiang, Haihao
  3 siblings, 0 replies; 5+ messages in thread
From: Xiang, Haihao @ 2022-11-28  4:43 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Haihao Xiang

From: Haihao Xiang <haihao.xiang@intel.com>

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
---
 libavfilter/vf_vpp_qsv.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c
index 4a053f9145..a14b3de7b5 100644
--- a/libavfilter/vf_vpp_qsv.c
+++ b/libavfilter/vf_vpp_qsv.c
@@ -133,7 +133,7 @@ static const AVOption options[] = {
     { "height", "Output video height", OFFSET(oh), AV_OPT_TYPE_STRING, { .str="w*ch/cw" }, 0, 255, .flags = FLAGS },
     { "format", "Output pixel format", OFFSET(output_format_str), AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS },
     { "async_depth", "Internal parallelization depth, the higher the value the higher the latency.", OFFSET(async_depth), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, .flags = FLAGS },
-    { "scale_mode", "scale mode: 0=auto, 1=low power, 2=high quality", OFFSET(scale_mode), AV_OPT_TYPE_INT, { .i64 = MFX_SCALING_MODE_DEFAULT }, MFX_SCALING_MODE_DEFAULT, MFX_SCALING_MODE_QUALITY, .flags = FLAGS, "scale mode" },
+    { "scale_mode", "scale & format conversion mode: 0=auto, 1=low power, 2=high quality", OFFSET(scale_mode), AV_OPT_TYPE_INT, { .i64 = MFX_SCALING_MODE_DEFAULT }, MFX_SCALING_MODE_DEFAULT, MFX_SCALING_MODE_QUALITY, .flags = FLAGS, "scale mode" },
     { NULL }
 };
 
@@ -492,7 +492,7 @@ static int config_output(AVFilterLink *outlink)
         }
     }
 
-    if (inlink->w != outlink->w || inlink->h != outlink->h) {
+    if (inlink->w != outlink->w || inlink->h != outlink->h || in_format != vpp->out_format) {
         if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 19)) {
             memset(&vpp->scale_conf, 0, sizeof(mfxExtVPPScaling));
             vpp->scale_conf.Header.BufferId    = MFX_EXTBUFF_VPP_SCALING;
@@ -501,8 +501,8 @@ static int config_output(AVFilterLink *outlink)
 
             param.ext_buf[param.num_ext_buf++] = (mfxExtBuffer*)&vpp->scale_conf;
         } else
-            av_log(ctx, AV_LOG_WARNING, "The QSV VPP Scale option is "
-                "not supported with this MSDK version.\n");
+            av_log(ctx, AV_LOG_WARNING, "The QSV VPP Scale & format conversion "
+                   "option is not supported with this MSDK version.\n");
     }
 
     if (vpp->use_frc || vpp->use_crop || vpp->deinterlace || vpp->denoise ||
-- 
2.25.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2 1/4] lavfi/qsvvpp: change the output frame's width and height
  2022-11-28  4:43 [FFmpeg-devel] [PATCH v2 1/4] lavfi/qsvvpp: change the output frame's width and height Xiang, Haihao
                   ` (2 preceding siblings ...)
  2022-11-28  4:43 ` [FFmpeg-devel] [PATCH v2 4/4] lavfi/vf_vpp_qsv: scale_mode can be applied to color conversion Xiang, Haihao
@ 2022-11-30  1:59 ` Xiang, Haihao
  3 siblings, 0 replies; 5+ messages in thread
From: Xiang, Haihao @ 2022-11-30  1:59 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Chen, Wenbin

On Mon, 2022-11-28 at 12:43 +0800, Xiang, Haihao wrote:
> From: "Chen,Wenbin" <wenbin.chen@intel.com>
> 
> Make sure the size of the output frame always matches the agreed upon
> image size.
> 
> Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
> ---
>  libavfilter/qsvvpp.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
> index 8428ee89ab..bf719b2a29 100644
> --- a/libavfilter/qsvvpp.c
> +++ b/libavfilter/qsvvpp.c
> @@ -487,15 +487,14 @@ static QSVFrame *query_frame(QSVVPPContext *s,
> AVFilterLink *outlink)
>          if (!out_frame->frame)
>              return NULL;
>  
> -        out_frame->frame->width  = outlink->w;
> -        out_frame->frame->height = outlink->h;
> -
>          ret = map_frame_to_surface(out_frame->frame,
>                                     &out_frame->surface);
>          if (ret < 0)
>              return NULL;
>      }
>  
> +    out_frame->frame->width  = outlink->w;
> +    out_frame->frame->height = outlink->h;
>      out_frame->surface.Info = s->vpp_param.vpp.Out;
>  
>      return out_frame;

Will apply the patchset

-Haihao


_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-11-30  1:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-28  4:43 [FFmpeg-devel] [PATCH v2 1/4] lavfi/qsvvpp: change the output frame's width and height Xiang, Haihao
2022-11-28  4:43 ` [FFmpeg-devel] [PATCH v2 2/4] lavfi/qsvvpp: avoid overriding the returned value Xiang, Haihao
2022-11-28  4:43 ` [FFmpeg-devel] [PATCH v2 3/4] lavfi/qsvvpp: provide a default framerate if needed Xiang, Haihao
2022-11-28  4:43 ` [FFmpeg-devel] [PATCH v2 4/4] lavfi/vf_vpp_qsv: scale_mode can be applied to color conversion Xiang, Haihao
2022-11-30  1:59 ` [FFmpeg-devel] [PATCH v2 1/4] lavfi/qsvvpp: change the output frame's width and height Xiang, Haihao

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git