On Wed, Nov 4, 2015 at 4:51 PM, Kyle Swanson <k...@ylo.ph> wrote:
>> +static double pink_filter(double white, double *buf) {
>> +    double pink;
>> +
>> +    /* http://www.musicdsp.org/files/pink.txt */
>> +    buf[0] = 0.99886 * buf[0] + white * 0.0555179;
>> +    buf[1] = 0.99332 * buf[1] + white * 0.0750759;
>> +    buf[2] = 0.96900 * buf[2] + white * 0.1538520;
>> +    buf[3] = 0.86650 * buf[3] + white * 0.3104856;
>> +    buf[4] = 0.55000 * buf[4] + white * 0.5329522;
>> +    buf[5] = -0.7616 * buf[5] - white * 0.0168980;
>> +    pink = buf[0] + buf[1] + buf[2] + buf[3] + buf[4] + buf[5] + buf[6] + 
>> white * 0.5362;
>> +    buf[6] = white * 0.115926;
>> +    return pink * 0.11;
>> +}
>> +
>> +static double brown_filter(double white, double *buf) {
>> +    double brown;
>> +
>> +    brown = ((0.02 * white) + buf[0]) / 1.02;
>> +    buf[0] = brown;
>> +    return brown * 3.5;
>> +}
>
> Using a fixed-point sample format also means these filters will need
> to be re-done. Anyone know of a good fixed-point filter algorithms for
> pink and brown noise?

You could try converting directly from the above floats by one of a
number of standard approaches for float to fixed point. Yes, it is
slightly tedious, but it can be done.

Alternatively, it should not be hard to find on the web. I personally
am ok with your patch with floats, leaving fixed point for future
work, but Paul and Nicolas have greater expertise and knowledge of
this stuff and their opinion is definitely more important.

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to