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
18122This will slightly less reduce interlace 'twitter' and Moire18122This will slightly less reduce interlace 'twitter' and Moire
18123patterning but better retain detail and subjective sharpness impression.18123patterning but better retain detail and subjective sharpness impression.
18124 18124
18125@item bypass_il
18126Bypass already interlaced frames, only adjust the frame rate.
18125@end table18127@end table
18126 18128
18127Vertical low-pass filtering can only be enabled for @option{mode}18129Vertical low-pass filtering and bypassing already interlaced frames can only be
18128@var{interleave_top} and @var{interleave_bottom}.18130enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
18129 18131
18130@end table18132@end table
18131 18133
libavfilter/tinterlace.h+1−0
@@ -36,6 +36,7 @@ · 35 unmodified lines
36#define TINTERLACE_FLAG_VLPF 0136#define TINTERLACE_FLAG_VLPF 01
37#define TINTERLACE_FLAG_CVLPF 237#define TINTERLACE_FLAG_CVLPF 2
38#define TINTERLACE_FLAG_EXACT_TB 438#define TINTERLACE_FLAG_EXACT_TB 4
39#define TINTERLACE_FLAG_BYPASS_IL 8
39 40
40enum VLPFilter {41enum VLPFilter {
41 VLPF_OFF = 0,42 VLPF_OFF = 0,
libavfilter/version.h+1−1
@@ -31,7 +31,7 @@ · 30 unmodified lines
31 31
32#define LIBAVFILTER_VERSION_MAJOR 732#define LIBAVFILTER_VERSION_MAJOR 7
33#define LIBAVFILTER_VERSION_MINOR 6833#define LIBAVFILTER_VERSION_MINOR 68
34#define LIBAVFILTER_VERSION_MICRO 10034#define LIBAVFILTER_VERSION_MICRO 101
35 35
36 36
37#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \37#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
53 {"complex_filter", "enable complex vertical low-pass filter", 0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_CVLPF},INT_MIN, INT_MAX, FLAGS, "flags" },53 {"complex_filter", "enable complex vertical low-pass filter", 0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_CVLPF},INT_MIN, INT_MAX, FLAGS, "flags" },
54 {"cvlpf", "enable complex vertical low-pass filter", 0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_CVLPF},INT_MIN, INT_MAX, FLAGS, "flags" },54 {"cvlpf", "enable complex vertical low-pass filter", 0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_CVLPF},INT_MIN, INT_MAX, FLAGS, "flags" },
55 {"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" },55 {"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" },
56 57
57 {NULL}58 {NULL}
58};59};
@@ -439,6 +440,16 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref) · 380 unmodified lines
439 * halving the frame rate and preserving image height */440 * halving the frame rate and preserving image height */
440 case MODE_INTERLEAVE_TOP: /* top field first */441 case MODE_INTERLEAVE_TOP: /* top field first */
441 case MODE_INTERLEAVE_BOTTOM: /* bottom field first */442 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 }
442 tff = tinterlace->mode == MODE_INTERLEAVE_TOP;453 tff = tinterlace->mode == MODE_INTERLEAVE_TOP;
443 out = ff_get_video_buffer(outlink, outlink->w, outlink->h);454 out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
444 if (!out)455 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