History

avfilter/vf_tinterlace: add support for bypassing already interlaced frames

The old interlace filter worked this way before it was merged with tinterlace.

Marton Balint committed 6 years ago

Commit 64985221 parent 28b5dc64 files · +17 −3Browse files

Unified · Split

4 files
  1. doc/filters.texi +4 −2
  2. libavfilter/tinterlace.h +1 −0
  3. libavfilter/version.h +1 −1
  4. libavfilter/vf_tinterlace.c +11 −0
doc/filters.texi+4−2
@@ -18122,10 +18122,12 @@ Enable complex vertical low-pass filtering. · 18121 unmodified lines
1812218122 This will slightly less reduce interlace 'twitter' and Moire
1812318123 patterning but better retain detail and subjective sharpness impression.
1812418124
18125+@item bypass_il
18126+Bypass already interlaced frames, only adjust the frame rate.
1812518127 @end table
1812618128
18127−Vertical low-pass filtering can only be enabled for @option{mode}
18128−@var{interleave_top} and @var{interleave_bottom}.
18129+Vertical low-pass filtering and bypassing already interlaced frames can only be
18130+enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
1812918131
1813018132 @end table
1813118133
libavfilter/tinterlace.h+1−0
@@ -36,6 +36,7 @@ · 35 unmodified lines
3636 #define TINTERLACE_FLAG_VLPF 01
3737 #define TINTERLACE_FLAG_CVLPF 2
3838 #define TINTERLACE_FLAG_EXACT_TB 4
39+#define TINTERLACE_FLAG_BYPASS_IL 8
3940
4041 enum VLPFilter {
4142 VLPF_OFF = 0,
libavfilter/version.h+1−1
@@ -31,7 +31,7 @@ · 30 unmodified lines
3131
3232 #define LIBAVFILTER_VERSION_MAJOR 7
3333 #define LIBAVFILTER_VERSION_MINOR 68
34−#define LIBAVFILTER_VERSION_MICRO 100
34+#define LIBAVFILTER_VERSION_MICRO 101
3535
3636
3737 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
libavfilter/vf_tinterlace.c+11−0
@@ -53,6 +53,7 @@ static const AVOption tinterlace_options[] = { · 52 unmodified lines
5353 {"complex_filter", "enable complex vertical low-pass filter", 0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_CVLPF},INT_MIN, INT_MAX, FLAGS, "flags" },
5454 {"cvlpf", "enable complex vertical low-pass filter", 0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_CVLPF},INT_MIN, INT_MAX, FLAGS, "flags" },
5555 {"exact_tb", "force a timebase which can represent timestamps exactly", 0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_EXACT_TB}, INT_MIN, INT_MAX, FLAGS, "flags" },
56+ {"bypass_il", "bypass already interlaced frames", 0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_BYPASS_IL}, INT_MIN, INT_MAX, FLAGS, "flags" },
5657
5758 {NULL}
5859 };
@@ -439,6 +440,16 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref) · 380 unmodified lines
439440 * halving the frame rate and preserving image height */
440441 case MODE_INTERLEAVE_TOP: /* top field first */
441442 case MODE_INTERLEAVE_BOTTOM: /* bottom field first */
443+ if ((tinterlace->flags & TINTERLACE_FLAG_BYPASS_IL) && cur->interlaced_frame) {
444+ av_log(ctx, AV_LOG_WARNING,
445+ "video is already interlaced, adjusting framerate only\n");
446+ out = av_frame_clone(cur);
447+ if (!out)
448+ return AVERROR(ENOMEM);
449+ out->pts /= 2; // adjust pts to new framerate
450+ ret = ff_filter_frame(outlink, out);
451+ return ret;
452+ }
442453 tff = tinterlace->mode == MODE_INTERLEAVE_TOP;
443454 out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
444455 if (!out)

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