[FFmpeg-devel] [PATCH] Optionally hardcode PCM tables

Michael Niedermayer michaelni
Sat Jan 12 02:26:42 CET 2008


On Fri, Jan 11, 2008 at 08:13:04PM -0500, Rich Felker wrote:
> On Fri, Jan 11, 2008 at 11:00:04PM +0100, Michael Niedermayer wrote:
> > On Fri, Jan 11, 2008 at 08:42:25PM +0100, Diego 'Flameeyes' Petten? wrote:
> > > Vitor Sessak <vitor1001 at gmail.com> writes:
> > > 
> > > > I've found a cosmetical change:
> > > 
> > > Was due to a missing de-tabify in previous patch, should be fixed now.
> > 
> > btw, what about changing the algorithm so it doesnt need 16k tables?
> > 
> > maybe something along the lines of
> > e= av_log2_16bit(v) - 1234;
> > (v>>e) | (e<<123)
> > 
> > or
> > 
> > if(v<123) v= tab1[v];
> > else      v= tab2[v>>4];
> 
> v = ((v-123)>>31 & tab1[v]) | ((122-v)>>31 & tab2[v>>4]);

This would segfault, anyway it was just an example and wont work
as is. It needs some changes to get the sign and rounding
(approximately) correct.


> 
> And I agree that using a 16k table in a decoder is a very bad idea as
> it will clobber the cache and will likely slow down video decoding
> significantly even if it doesn't hurt audio-only playback... Of course

yes


> the extent of the damage depends on the access patterns about which I
> have no idea, so more info would be useful in determining what to do.

output_sample[i]=  tab[(input_sample[i] + 32768) >> 2];

this should of course be changed to
tab += 8192;
and
tab[input_sample[i]>>2];
but thats a seperate issue ...
access patterns will be bad if the audio is loud ...

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

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- 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/20080112/ddd5e40d/attachment.pgp>



More information about the ffmpeg-devel mailing list