[MPlayer-dev-eng] Soft volume clip methods
Michael Niedermayer
michaelni at gmx.at
Sun Feb 20 02:02:10 CET 2005
Hi
On Saturday 19 February 2005 23:52, Zoltan Hidvegi wrote:
> The current softclip method used my libaf is sin(x), which is slow,
wait a second, libaf directly calls sin(x) for every sample instead of using a
LUT, thats just a joke right?
> and becomes hard at 4dB. What are the requirements for a good clip
> functions? Obviously, it must clip to [-1,+1], it's first derivative
> at zero must be 1, it must be strictly increasing and and it must
> satisfy f(-x) = -f(x). The rest are fuzzy, like it should be
> reasonable smooth etc. For example, what about this much faster
> function:
>
> sign(x) * (1 - (2-abs(x))^2/4) for -2 < x < 2 and sign(x) otherwise.
>
> This hard clips above 6dB. And there are other possible clip
> functions which have no hard limit, e.g. sign(x) * (1 - exp(-abs(x)))
> or 2*atan(2x/pi)/pi or similar, like in
> http://www.musicdsp.org/showone.php?id=104, but these are slow, what
please use a look up table, then it doesnt matter at all how slow it is, its
just calculated once at startup
you can also linearly interpolate between LUT entries to reduce their number
if needed (its obviously needed for float/int samples)
and if theres a quality issue or audiophilitis issue then higher order
polynomial interpolation can be used
[...]
--
Michael
"nothing is evil in the beginning. Even Sauron was not so." -- Elrond
More information about the MPlayer-dev-eng
mailing list