[FFmpeg-devel] [PATCH] aacenc: avoid double in quantize_bands.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Wed Mar 2 08:30:15 CET 2016


On 02.03.2016, at 04:48, Ganesh Ajjanagadde <gajjanag at gmail.com> wrote:

> On Tue, Mar 1, 2016 at 4:55 PM, Reimar Döffinger
> <Reimar.Doeffinger at gmx.de> wrote:
>> I cannot see any point whatsoever to use
>> double here instead of float.
> 
> There can be some negligible accuracy differences, but I do not see
> any harm myself; aac anyway sticks to floats in most places.

floating-point is difficult, but I really can't see any.
The only thing it changes at all is the addition of the rounding value.
However given that we convert to int after the range of relevant bits is very limited, and the rounding value is a fixed value != 0.5.
Thus I suspect that the two are actually exactly equivalent.

>> Using float allows for use of SIMD.
> 
> Not an accurate statement, there is SIMD for doubles as well. More
> precise variant is "allows for more effective/efficient use of SIMD".

Well... I don't know if I'll improve the statement, but the problem is that there are conditions in that code, and most SIMD does not have an cmov instruction equivalent.
Since SIMD registers generally fit only 2 doubles that basically does mean that with doubles using SIMD is in fact not possible (in a way that makes sense/does not make it slower).
At the very least the compiler won't do it on its own.


More information about the ffmpeg-devel mailing list