[FFmpeg-devel] [PATCH] split interleave per dts func

Michael Niedermayer michaelni
Fri Jan 30 18:13:34 CET 2009


On Thu, Jan 29, 2009 at 04:29:50PM -0800, Baptiste Coudurier wrote:
> Hi,
> 
> I'd like to factorize the code between oggenc, and interleave_per_dts,
> also mxf muxer will soon use a different compare function too.
> 
> How is it ?
> 
> -- 
> Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
> Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
> checking for life_signs in -lkenny... no
> FFmpeg maintainer                                  http://www.ffmpeg.org

[...]

> +    while(*next_point){
> +        if(compare(s, &(*next_point)->pkt, pkt))
> +            break;
> +        next_point= &(*next_point)->next;
> +    }

I guess we wont have more than O(stream_count) packets but if we had
a heap sort would be much faster for this
anyway such optim of course doesnt belong in this patch ...


> +    this_pktl->next= *next_point;
> +    *next_point= this_pktl;
> +}
> +
> +int ff_interleave_compare_dts(AVFormatContext *s, AVPacket *next, AVPacket *pkt)
> +{

> +    AVStream *st= s->streams[ pkt->stream_index];
> +    AVStream *st2= s->streams[ next->stream_index];

vertical align


> +    int64_t left=  st2->time_base.num * (int64_t)st ->time_base.den;
> +    int64_t right= st ->time_base.num * (int64_t)st2->time_base.den;
> +

> +    return next->dts * left > pkt->dts * right; //FIXME this can overflow

unrelated to your patch but this should use the method described in
nut.txt compare_ts()

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090130/e72e0ab5/attachment.pgp>



More information about the ffmpeg-devel mailing list