[FFmpeg-devel] [RFC] use ff_avc_find_startcode in ff_find_start_code
Reimar Döffinger
Reimar.Doeffinger
Tue Feb 19 19:47:16 CET 2008
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
> 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;
Greetings,
Reimar D?ffinger
More information about the ffmpeg-devel
mailing list