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 1/3] lavfi/vpp_qsv: add rate option
@ 2023-01-30  1:37 Xiang, Haihao
  2023-01-30  1:37 ` [FFmpeg-devel] [PATCH 2/3] lavfi/deinterlace_qsv: simplify deinterlace_qsv filter Xiang, Haihao
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Xiang, Haihao @ 2023-01-30  1:37 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Haihao Xiang

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

This is used to control the output at frame rate or field rate when
deinterlace is expected and framerate is not specified.

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

diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c
index 34e530e244..aac0a234c3 100644
--- a/libavfilter/vf_vpp_qsv.c
+++ b/libavfilter/vf_vpp_qsv.c
@@ -101,6 +101,7 @@ typedef struct VPPContext{
     char *output_format_str;
 
     int has_passthrough;        /* apply pass through mode if possible */
+    int field_rate;             /* Generate output at frame rate or field rate for deinterlace mode, 0: frame, 1: field */
 } VPPContext;
 
 static const char *const var_names[] = {
@@ -255,9 +256,14 @@ static int config_input(AVFilterLink *inlink)
     int              ret;
     int64_t          ow, oh;
 
-    if (vpp->framerate.den == 0 || vpp->framerate.num == 0)
+    if (vpp->framerate.den == 0 || vpp->framerate.num == 0) {
         vpp->framerate = inlink->frame_rate;
 
+        if (vpp->deinterlace && vpp->field_rate)
+            vpp->framerate = av_mul_q(inlink->frame_rate,
+                                      (AVRational){ 2, 1 });
+    }
+
     if (av_cmp_q(vpp->framerate, inlink->frame_rate))
         vpp->use_frc = 1;
 
@@ -352,7 +358,7 @@ static int config_output(AVFilterLink *outlink)
     outlink->w          = vpp->out_width;
     outlink->h          = vpp->out_height;
     outlink->frame_rate = vpp->framerate;
-    outlink->time_base  = inlink->time_base;
+    outlink->time_base  = av_inv_q(vpp->framerate);
 
     param.filter_frame  = NULL;
     param.num_ext_buf   = 0;
@@ -678,6 +684,13 @@ static const AVOption vpp_options[] = {
     { "low_power", "low power mode",        0,    AV_OPT_TYPE_CONST,  { .i64 = MFX_SCALING_MODE_LOWPOWER}, INT_MIN, INT_MAX, FLAGS, "scale mode"},
     { "hq",        "high quality mode",     0,    AV_OPT_TYPE_CONST,  { .i64 = MFX_SCALING_MODE_QUALITY},  INT_MIN, INT_MAX, FLAGS, "scale mode"},
 
+    { "rate", "Generate output at frame rate or field rate, available only for deinterlace mode",
+      OFFSET(field_rate), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS, "rate" },
+    { "frame", "Output at frame rate (one frame of output for each field-pair)",
+      0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, FLAGS, "rate" },
+    { "field", "Output at field rate (one frame of output for each field)",
+      0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, FLAGS, "rate" },
+
     { NULL }
 };
 
-- 
2.17.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] 4+ messages in thread

end of thread, other threads:[~2023-02-02  3:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-30  1:37 [FFmpeg-devel] [PATCH 1/3] lavfi/vpp_qsv: add rate option Xiang, Haihao
2023-01-30  1:37 ` [FFmpeg-devel] [PATCH 2/3] lavfi/deinterlace_qsv: simplify deinterlace_qsv filter Xiang, Haihao
2023-01-30  1:37 ` [FFmpeg-devel] [PATCH 3/3] lavfi/deinterlace_qsv: re-use VPPContext for " Xiang, Haihao
2023-02-02  3:00 ` [FFmpeg-devel] [PATCH 1/3] lavfi/vpp_qsv: add rate option 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