[FFmpeg-devel] [RFC] use ff_avc_find_startcode in ff_find_start_code

Michael Niedermayer michaelni
Tue Feb 19 20:49:34 CET 2008


On Tue, Feb 19, 2008 at 07:47:16PM +0100, Reimar D?ffinger wrote:
> Hello,
> On Tue, Feb 19, 2008 at 06:22:30PM +0100, Michael Niedermayer wrote:
> > if(p[1]){
> >     if( p[2] == 0 && p[4] == 1 )
> >         return p+1;
> >     if( p[4] == 0 && p[5] == 1 )
> >         return p+2;
> > }else{
> >     if( p[0] == 0 && p[2] == 1 )
> >         return p-1;
> >     if( p[2] == 0 && p[3] == 1 )
> >         return p;
> > }
> 
> I think that does not work for
> 00 00 00 00 01

true, i missed that :(


> 
> > Should be faster IMO, also the original code in the if() should be faster
> > than your code. Only the change in the masks for BE/LE looks like it should
> > improve speed.
> 
> However it looks, at least my current variant is faster (for all I can
> test, and the difference is minimal, possibly even in the measurement
> error range):
>             if ((x & 0x0000ffff) == 0x00000100 && p[-1] == 0)
>                 return p-1;
>             if ((x & 0x00ffffff) == 0x00010000)
>                 return p;
>             if ((x & 0xffffff00) == 0x01000000)
>                 return p+1;
>             if ((x & 0xffff0000) == 0 && p[4] == 1)
>                 return p+2;

Until you use a working compiler i dont care at all what is faster for you.
:)

[...]
-- 
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: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080219/5e73d606/attachment.pgp>



More information about the ffmpeg-devel mailing list