[FFmpeg-devel] [PATCH] CONFIG_SMALL for roqaudioenc.c

Reimar Döffinger Reimar.Doeffinger
Fri Oct 16 08:43:57 CEST 2009

On Fri, Oct 16, 2009 at 04:38:21AM +0200, Vitor Sessak wrote:
> Vitor Sessak wrote:
> > M?ns Rullg?rd wrote:
> >> Reimar D?ffinger <Reimar.Doeffinger at gmx.de> writes:
> >>
> >>> Hello,
> >>> roqaudioenc uses a ca. 16kB lookup table by default, attached patch 
> >>> makes
> >>> it use ff_sqrt directly if CONFIG_SMALL is set.
> >>> Overall that means instead of a single table lookup it needs about
> >>> a table lookup, 2 shifts, 2 multiples, 2 adds and two branches per value
> >>> encoded.
> > 
> > I suppose it does not give exactly the same output.
> Ops, 10l, it probably does. But I imagine my version is slightly faster.

I suspect that your variant that uses ff_sqrt on 4 times as large values
is slower than the original code that used an extra multiply, two adds
and a branch (e.g.).
Also, that part could be avoided by generating a table that for each
result s of ff_sqrt returns s*s+s, which would only use up 254 bytes.

More information about the ffmpeg-devel mailing list