[FFmpeg-cvslog] yadif: Improve pts calculation for is_second.

Robert Nagy git at videolan.org
Tue Apr 17 20:28:40 CEST 2012


ffmpeg | branch: master | Robert Nagy <ronag89 at gmail.com> | Sun Apr 15 17:12:02 2012 +0200| [e90dfa6881afccf23a3dc494fa30c58d75945cbc] | committer: Michael Niedermayer

yadif: Improve pts calculation for is_second.

Tested-by: Robert Nagy <ronag89 at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavfilter/vf_yadif.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c
index c31a283..d8e2ad6 100644
--- a/libavfilter/vf_yadif.c
+++ b/libavfilter/vf_yadif.c
@@ -218,9 +218,20 @@ static void return_frame(AVFilterContext *ctx, int is_second)
     if (is_second) {
         if (yadif->next->pts != AV_NOPTS_VALUE &&
             yadif->cur->pts != AV_NOPTS_VALUE) {
-            yadif->out->pts =
-                (yadif->next->pts&yadif->cur->pts) +
-                ((yadif->next->pts^yadif->cur->pts)>>1);
+            uint64_t next_pts = yadif->next->pts;
+            uint64_t cur_pts  = yadif->cur->pts;
+            uint64_t prev_pts = yadif->prev->pts;
+
+            uint64_t ft = FFMIN3( cur_pts-prev_pts,
+                                  next_pts-cur_pts,
+                                 (next_pts-prev_pts)/2);
+
+            if(next_pts - cur_pts < 2*ft)
+                yadif->out->pts =
+                    (next_pts&cur_pts) +
+                    ((next_pts^cur_pts)>>1);
+            else
+                yadif->out->pts = cur_pts + ft/2;
         } else {
             yadif->out->pts = AV_NOPTS_VALUE;
         }



More information about the ffmpeg-cvslog mailing list