History

lavfi/vpp_qsv: add rate option

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

Haihao Xiang committed 3 years ago

Commit 077e6341 parent 7d49fef1 file · +15 −2Browse files

Unified · Split

libavfilter/vf_vpp_qsv.c+15−2
@@ -101,6 +101,7 @@ typedef struct VPPContext{ · 100 unmodified lines
101101 char *output_format_str;
102102
103103 int has_passthrough; /* apply pass through mode if possible */
104+ int field_rate; /* Generate output at frame rate or field rate for deinterlace mode, 0: frame, 1: field */
104105 } VPPContext;
105106
106107 static const char *const var_names[] = {
@@ -255,9 +256,14 @@ static int config_input(AVFilterLink *inlink) · 148 unmodified lines
255256 int ret;
256257 int64_t ow, oh;
257258
258− if (vpp->framerate.den == 0 || vpp->framerate.num == 0)
259+ if (vpp->framerate.den == 0 || vpp->framerate.num == 0) {
259260 vpp->framerate = inlink->frame_rate;
260261
262+ if (vpp->deinterlace && vpp->field_rate)
263+ vpp->framerate = av_mul_q(inlink->frame_rate,
264+ (AVRational){ 2, 1 });
265+ }
266+
261267 if (av_cmp_q(vpp->framerate, inlink->frame_rate))
262268 vpp->use_frc = 1;
263269
@@ -352,7 +358,7 @@ static int config_output(AVFilterLink *outlink) · 88 unmodified lines
352358 outlink->w = vpp->out_width;
353359 outlink->h = vpp->out_height;
354360 outlink->frame_rate = vpp->framerate;
355− outlink->time_base = inlink->time_base;
361+ outlink->time_base = av_inv_q(vpp->framerate);
356362
357363 param.filter_frame = NULL;
358364 param.num_ext_buf = 0;
@@ -678,6 +684,13 @@ static const AVOption vpp_options[] = { · 319 unmodified lines
678684 { "low_power", "low power mode", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_LOWPOWER}, INT_MIN, INT_MAX, FLAGS, "scale mode"},
679685 { "hq", "high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_QUALITY}, INT_MIN, INT_MAX, FLAGS, "scale mode"},
680686
687+ { "rate", "Generate output at frame rate or field rate, available only for deinterlace mode",
688+ OFFSET(field_rate), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS, "rate" },
689+ { "frame", "Output at frame rate (one frame of output for each field-pair)",
690+ 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, FLAGS, "rate" },
691+ { "field", "Output at field rate (one frame of output for each field)",
692+ 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, FLAGS, "rate" },
693+
681694 { NULL }
682695 };
683696

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t