diff mbox series

[FFmpeg-devel,v3] lavfi/telecine: Mark telecined frames as interlaced

Message ID CAB0OVGptBTWmiNJSk-x=VTi0LTP5ct6y8oXA1PzzSZpjakJSVw@mail.gmail.com
State Superseded
Headers show
Series [FFmpeg-devel,v3] lavfi/telecine: Mark telecined frames as interlaced | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork fail Make fate failed

Commit Message

Carl Eugen Hoyos April 4, 2020, 11:02 p.m. UTC
Am Sa., 4. Apr. 2020 um 00:44 Uhr schrieb Carl Eugen Hoyos <ceffmpeg@gmail.com>:
>
> Am Sa., 4. Apr. 2020 um 00:40 Uhr schrieb James Almer <jamrial@gmail.com>:
> >
> > On 4/3/2020 6:37 PM, Carl Eugen Hoyos wrote:
> > > Am Fr., 3. Apr. 2020 um 23:19 Uhr schrieb Carl Eugen Hoyos <ceffmpeg@gmail.com>:
> > >
> > >> Attached patch marks actually telecined frames as interlaced,
> > >> other frames as progressive.
> > >
> > > New patch with changes to fate attached.
> > >
> > > Please comment, Carl Eugen
> >
> > Those yadif tests look wrong. The patch shouldn't affect them.
>
> Clearly, thank you!
>
> New patch attached, it should now only change the telecined
> frames and leave the other frames as they are, the setfield
> filter can be used to force a progressive setting for them.

New patch attached that also sets top_field_first

Please comment, Carl Eugen

Comments

Carl Eugen Hoyos April 5, 2020, 12:05 a.m. UTC | #1
Am So., 5. Apr. 2020 um 01:02 Uhr schrieb Carl Eugen Hoyos <ceffmpeg@gmail.com>:
>
> Am Sa., 4. Apr. 2020 um 00:44 Uhr schrieb Carl Eugen Hoyos <ceffmpeg@gmail.com>:
> >
> > Am Sa., 4. Apr. 2020 um 00:40 Uhr schrieb James Almer <jamrial@gmail.com>:
> > >
> > > On 4/3/2020 6:37 PM, Carl Eugen Hoyos wrote:
> > > > Am Fr., 3. Apr. 2020 um 23:19 Uhr schrieb Carl Eugen Hoyos <ceffmpeg@gmail.com>:
> > > >
> > > >> Attached patch marks actually telecined frames as interlaced,
> > > >> other frames as progressive.
> > > >
> > > > New patch with changes to fate attached.
> > > >
> > > > Please comment, Carl Eugen
> > >
> > > Those yadif tests look wrong. The patch shouldn't affect them.
> >
> > Clearly, thank you!
> >
> > New patch attached, it should now only change the telecined
> > frames and leave the other frames as they are, the setfield
> > filter can be used to force a progressive setting for them.
>
> New patch attached that also sets top_field_first

Which had the effect that fate is correct again, new patch attached.

Please comment, Carl Eugen
diff mbox series

Patch

From cd2f7b4336c1d0b786ba613d525830ff152788a3 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Sun, 5 Apr 2020 01:00:44 +0200
Subject: [PATCH] lavfi/telecine: Mark telecined frames as interlaced.

---
 libavfilter/vf_telecine.c                |  8 ++++++++
 tests/ref/fate/filter-pixfmts-fieldmatch | 10 +++++-----
 tests/ref/fate/filter-pixfmts-pullup     | 24 ++++++++++++------------
 3 files changed, 25 insertions(+), 17 deletions(-)

diff --git a/libavfilter/vf_telecine.c b/libavfilter/vf_telecine.c
index 62599a7a3a..ff8151dfc9 100644
--- a/libavfilter/vf_telecine.c
+++ b/libavfilter/vf_telecine.c
@@ -207,6 +207,8 @@  static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
                                 s->stride[i],
                                 (s->planeheight[i] - !s->first_field + 1) / 2);
         }
+        s->frame[nout]->interlaced_frame = 1;
+        s->frame[nout]->top_field_first  = !s->first_field;
         nout++;
         len--;
         s->occupied = 0;
@@ -220,6 +222,8 @@  static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
                                 inpicref->data[i], inpicref->linesize[i],
                                 s->stride[i],
                                 s->planeheight[i]);
+        s->frame[nout]->interlaced_frame = inpicref->interlaced_frame;
+        s->frame[nout]->top_field_first  = inpicref->top_field_first;
         nout++;
         len -= 2;
     }
@@ -236,6 +240,8 @@  static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
 
     for (i = 0; i < nout; i++) {
         AVFrame *frame = av_frame_clone(s->frame[i]);
+        int interlaced = frame->interlaced_frame;
+        int tff        = frame->top_field_first;
 
         if (!frame) {
             av_frame_free(&inpicref);
@@ -243,6 +249,8 @@  static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
         }
 
         av_frame_copy_props(frame, inpicref);
+        frame->interlaced_frame = interlaced;
+        frame->top_field_first  = tff;
         frame->pts = ((s->start_time == AV_NOPTS_VALUE) ? 0 : s->start_time) +
                      av_rescale(outlink->frame_count_in, s->ts_unit.num,
                                 s->ts_unit.den);
diff --git a/tests/ref/fate/filter-pixfmts-fieldmatch b/tests/ref/fate/filter-pixfmts-fieldmatch
index c3165b872d..eb0fc3c224 100644
--- a/tests/ref/fate/filter-pixfmts-fieldmatch
+++ b/tests/ref/fate/filter-pixfmts-fieldmatch
@@ -1,5 +1,5 @@ 
-yuv410p             a6c9b4065e8253d8120772f69be0bf04
-yuv411p             b913e634ad37ce046240252bed8681fb
-yuv420p             a9286560141eb14595e427dbe5829b00
-yuv422p             11ad22ce00c5e8a30d0472f29fb15434
-yuv444p             6c5b0c1343d625d0656b6755906fd874
+yuv410p             572e4416ae6988dab3dbdbed3296b57c
+yuv411p             ce9ccbb1985b7840955e57c23d4bc003
+yuv420p             f06c53990f577893fef6a4270aab691b
+yuv422p             1c6ad2c3198ad577593214ebc9bc5705
+yuv444p             24813e175b1b09c01f5ec16149d83fce
diff --git a/tests/ref/fate/filter-pixfmts-pullup b/tests/ref/fate/filter-pixfmts-pullup
index c6ddb3489a..88c1dd565d 100644
--- a/tests/ref/fate/filter-pixfmts-pullup
+++ b/tests/ref/fate/filter-pixfmts-pullup
@@ -1,12 +1,12 @@ 
-gray                415c928947f83f9b45c24ad15a094bda
-yuv410p             0f29d0b6394871e1e6cde484b4f351f4
-yuv411p             ec059b1992e1acda472b9b2dd3e4506b
-yuv420p             dba6303cd02cc39cb0db7b546793d565
-yuv422p             d7d3224dd900bb1b96608a28a704360d
-yuv440p             d4c5f20701cfceb4bbf7d75cfcc13514
-yuv444p             7e405274037e7f2ab845d7413a71e16d
-yuvj411p            dc602e7bd3449d16e17e695815616b1e
-yuvj420p            b98ec86eeef2d512aeb2fc4d32ffa656
-yuvj422p            f09c3240bb662477b76ce4da34b4feed
-yuvj440p            8d3ab69e2bbbbbd2f9be323c18922533
-yuvj444p            2dc27560eed5d685354796dcccce853c
+gray                0af7cbb0cfb3efcb946e697c4b7bd5f9
+yuv410p             c7a9e3aeb6b30eadcdf6ca5acb52c5b2
+yuv411p             2e19fb03dd57e4700ff560da3a84402e
+yuv420p             7019c5de9774970eb3a7828cb92439e8
+yuv422p             8fc1c9fff0aa2566a50ff10a54e80ba7
+yuv440p             16775691a106117ecd244c45252f4ba7
+yuv444p             b6ec514e4c30fea6b0dd696bf7d147d5
+yuvj411p            0b899555985616330109a2381d9828a4
+yuvj420p            1f51fe0c2c8d5ba12409bc4c821fed56
+yuvj422p            5e9a13247fe5201ea83d3a64241631e3
+yuvj440p            2e22b2e340f372792bec5ba0a8f46822
+yuvj444p            becc016653bb26b472625d87dbfc10c4
-- 
2.24.1