[FFmpeg-devel] [PATCH 1/2] Add biquad high-pass and low-pass IIR filters. (original) (raw)
Måns Rullgård mans
Fri Jan 21 00:52:49 CET 2011
- Previous message: [FFmpeg-devel] [PATCH 1/2] Add biquad high-pass and low-pass IIR filters.
- Next message: [FFmpeg-devel] [PATCH] Make valid HTML on ffmpeg.org pages
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Ronald S. Bultje" writes:
Hi,
On Thu, Jan 20, 2011 at 4:26 PM, Justin Ruggles <justin.ruggles at gmail.com> wrote: --- ?libavcodec/iirfilter.c | ? 50 ++++++++++++++++++++++++++++++++++++++++++++++++ ?libavcodec/iirfilter.h | ? ?1 + ?2 files changed, 51 insertions(+), 0 deletions(-) [..] + a0 = 1.0 + (sinw0 / 2.0); + + if (filtmode == FFFILTERMODEHIGHPASS) { + c->gain = ((1.0 + cosw0) / 2.0) / a0; + x0 = (-(1.0 + cosw0)) / a0; + x1 = ((1.0 + cosw0) / 2.0) / a0; + } else { // FFFILTERMODELOWPASS + c->gain = ((1.0 - cosw0) / 2.0) / a0; + x0 = (1.0 - cosw0) / a0; + x1 = ((1.0 - cosw0) / 2.0) / a0; + } + c->cy[0] = (2.0 * cosw0) / a0; + c->cy[1] = (-1.0 + (sinw0 / 2.0)) / a0; + + // divide by gain to make the x coeffs integers. + // during filtering, the delay state will include the gain multiplication + c->cx[0] = lrintf(x0 / c->gain); + c->cx[1] = lrintf(x1 / c->gain); + c->cy[0] /= c->gain; + c->cy[1] /= c->gain; Patch is fine.
Queued.
-- M?ns Rullg?rd mans at mansr.com
- Previous message: [FFmpeg-devel] [PATCH 1/2] Add biquad high-pass and low-pass IIR filters.
- Next message: [FFmpeg-devel] [PATCH] Make valid HTML on ffmpeg.org pages
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]