[FFmpeg-cvslog] Fix detelecine filter for patterns like 3444 or 33333334.

Benjamin Steffes git at videolan.org
Wed Mar 16 19:58:52 CET 2016


ffmpeg | branch: master | Benjamin Steffes <benjaminst123 at gmail.com> | Mon Mar 14 13:44:24 2016 +0100| [06267afe1cec91656447458e029900dbe8536603] | committer: Carl Eugen Hoyos

Fix detelecine filter for patterns like 3444 or 33333334.

Signed-off-by: Benjamin Steffes <benjaminst123 at gmail.com>
Signed-off-by: Carl Eugen Hoyos <cehoyos at ag.or.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=06267afe1cec91656447458e029900dbe8536603
---

 libavfilter/vf_detelecine.c |   40 +++++++++++++++++++---------------------
 1 file changed, 19 insertions(+), 21 deletions(-)

diff --git a/libavfilter/vf_detelecine.c b/libavfilter/vf_detelecine.c
index 6fd9aad..f5ae350 100644
--- a/libavfilter/vf_detelecine.c
+++ b/libavfilter/vf_detelecine.c
@@ -195,21 +195,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
         s->nskip_fields -= 2;
         return 0;
     } else if (s->nskip_fields >= 1) {
-        if (s->occupied) {
-            s->occupied = 0;
-            s->nskip_fields--;
-        }
-        else {
-            for (i = 0; i < s->nb_planes; i++) {
-                av_image_copy_plane(s->temp->data[i], s->temp->linesize[i],
-                                    inpicref->data[i], inpicref->linesize[i],
-                                    s->stride[i],
-                                    s->planeheight[i]);
-            }
-            s->occupied = 1;
-            s->nskip_fields--;
-            return 0;
+        for (i = 0; i < s->nb_planes; i++) {
+            av_image_copy_plane(s->temp->data[i], s->temp->linesize[i],
+                                inpicref->data[i], inpicref->linesize[i],
+                                s->stride[i],
+                                s->planeheight[i]);
         }
+        s->occupied = 1;
+        s->nskip_fields--;
+        return 0;
     }
 
     if (s->nskip_fields == 0) {
@@ -243,15 +237,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
                                     s->stride[i],
                                     (s->planeheight[i] - !s->first_field + 1) / 2);
             }
-            len -= 2;
-            for (i = 0; i < s->nb_planes; i++) {
-                av_image_copy_plane(s->temp->data[i], s->temp->linesize[i],
-                                    inpicref->data[i], inpicref->linesize[i],
-                                    s->stride[i],
-                                    s->planeheight[i]);
+
+            s->occupied = 0;
+            if (len <= 2) {
+                for (i = 0; i < s->nb_planes; i++) {
+                    av_image_copy_plane(s->temp->data[i], s->temp->linesize[i],
+                                        inpicref->data[i], inpicref->linesize[i],
+                                        s->stride[i],
+                                        s->planeheight[i]);
+                }
+                s->occupied = 1;
             }
-            s->occupied = 1;
             out = 1;
+            len = (len >= 3) ? len - 3 : 0;
         } else {
             if (len >= 2) {
                 // output THIS image as-is



More information about the ffmpeg-cvslog mailing list