[Libav-user] Audio quality loss while encoding

Claudio Freire klaussfreire at gmail.com
Fri May 3 17:11:35 CEST 2013


On Fri, May 3, 2013 at 7:32 AM, Nicolas George <
nicolas.george at normalesup.org> wrote:

> > +    float lowlambda = av_clip(120.f / lambda, 0.25f, 1.f);
> > +    float rlambda = av_clip(120.f / lambda, 0.3f, 2.f);
> > +    const int minq = av_clip(2 * log2f(120.f / lambda) + 150, 100, 218
> - SCALE_MAX_DIFF);
> > +    const int maxq = minq + SCALE_MAX_DIFF - 1;
>
> Do you have a specific reason to use float instead of double?
>


lambda is a quality scaler, it's clipped to the range 0..65535, so double
would be overkill IMO.
Lambda's also a float everywhere else. Mixing float and double arithmetic
creates unnecessary conversion steps, slowing things down.
Here in particular, I don't think it's critical, but it's good practice to
never mix them up - except, perhaps, on trig functions, where the float
versions are rather imprecise.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130503/d23c74b1/attachment.html>


More information about the Libav-user mailing list