[FFmpeg-devel] [PATCH][RFC] Lagarith Decoder.

Reimar Döffinger Reimar.Doeffinger
Wed Aug 12 15:21:31 CEST 2009


On Wed, Aug 12, 2009 at 02:12:55PM +0200, Michael Niedermayer wrote:
> > +static const uint8_t run_table[]={0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,
> > +	34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,
> > +	86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,
> > +	128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,
> > +	166,168,170,172,174,176,178,180,182,184,186,188,190,192,194,196,198,200,202,
> > +	204,206,208,210,212,214,216,218,220,222,224,226,228,230,232,234,236,238,240,
> > +	242,244,246,248,250,252,254,255,253,251,249,247,245,243,241,239,237,235,233,
> > +	231,229,227,225,223,221,219,217,215,213,211,209,207,205,203,201,199,197,195,
> > +	193,191,189,187,185,183,181,179,177,175,173,171,169,167,165,163,161,159,157,
> > +	155,153,151,149,147,145,143,141,139,137,135,133,131,129,127,125,123,121,119,
> > +	117,115,113,111,109,107,105,103,101,99,97,95,93,91,89,87,85,83,81,79,77,75,73,
> > +	71,69,67,65,63,61,59,57,55,53,51,49,47,45,43,41,39,37,35,33,31,29,27,25,23,21,
> > +	19,17,15,13,11,9,7,5,3,1};

Hm, this seems to be e.g.
int v;
v <<= 1;
if (v > 255) returr ~v;
return v;

or branchless

int8_t v;
return (v << 1) ^ (v >> 7);

I think there should be a way to be (almost?) as fast as the table without wasting
256 bytes for such a regular structure.



More information about the ffmpeg-devel mailing list