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

Vitor Sessak vitor1001
Sat Oct 17 02:10:53 CEST 2009


Reimar D?ffinger wrote:
> 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.).

Indeed, your code is faster than mine. I've benchmarked it against the 
table-based version:

table (best user):
real	0m0.659s
user	0m0.544s
sys	0m0.116s

ff_sqrt (best user):
real	0m0.931s
user	0m0.836s
sys	0m0.096s

That is for a 16 minutes audio file. While it is measurably slower, this 
is the time it takes to encode ~3 video frames, so I think it is worth 
the extra simplicity.

Since I guess I'm the maintainer of this file, I'll apply the following 
patch if no one is against it.

-Vitor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: roqaudio.diff
Type: text/x-diff
Size: 1180 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091017/bf91e9a3/attachment.diff>



More information about the ffmpeg-devel mailing list