[FFmpeg-devel] yadif: Fix pts for is_second when next frame is seeked

Michael Niedermayer michaelni at gmx.at
Sun Apr 15 16:02:50 CEST 2012


On Sun, Apr 15, 2012 at 03:31:31PM +0200, Robert Nagy wrote:
> This is probably a bad idea, I'm unsure how to solve this.
> 
> The problem is the following, the pts for is_second frames is calculated
> like this:
> 
>             yadif->out->pts =
>                 (yadif->next->pts&yadif->cur->pts) +
>                 ((yadif->next->pts^yadif->cur->pts)>>1);
> 
> However, if the source have seeked then the "yadif->next->pts" will not be
> in relation to "yadif->cur->pts", thus yadif->out->pts is bogus.
> 
> e.g.
> 
> yadif->next->pts == 0; // seek to start, first frame
> yadif->cur->pts == 1000; // last frame
> yadif->out->pts == 500; // hm...

one random idea: (with 3 timestamps)
frametime = MIN(B-A,C-B,(C-A)/2)

if(C-B < 2*frametime)
    N = (C+B)/2
else
    N = B + frametime/2

above should be unsigned so B<A doesnt blow up and it needs some care
so that nothing overflows

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120415/79d9d218/attachment.asc>


More information about the ffmpeg-devel mailing list