Revision 37cb3eb5

View differences:

libavcodec/iirfilter.c
256 256
    }                                                                       \
257 257
}
258 258

  
259
#define FILTER_O2(type, fmt) {                                              \
260
    int i;                                                                  \
261
    const type *src0 = src;                                                 \
262
    type       *dst0 = dst;                                                 \
263
    for (i = 0; i < size; i++) {                                            \
264
        float in = *src0   * c->gain  +                                     \
265
                   s->x[0] * c->cy[0] +                                     \
266
                   s->x[1] * c->cy[1];                                      \
267
        CONV_##fmt(*dst0, s->x[0] + in + s->x[1] * c->cx[1])                \
268
        s->x[0] = s->x[1];                                                  \
269
        s->x[1] = in;                                                       \
270
        src0 += sstep;                                                      \
271
        dst0 += dstep;                                                      \
272
    }                                                                       \
273
}
274

  
259 275
void ff_iir_filter(const struct FFIIRFilterCoeffs *c,
260 276
                   struct FFIIRFilterState *s, int size,
261 277
                   const int16_t *src, int sstep, int16_t *dst, int dstep)
262 278
{
263
    if (c->order == 4) {
279
    if (c->order == 2) {
280
        FILTER_O2(int16_t, S16)
281
    } else if (c->order == 4) {
264 282
        FILTER_BW_O4(int16_t, S16)
265 283
    } else {
266 284
        FILTER_DIRECT_FORM_II(int16_t, S16)
......
271 289
                       struct FFIIRFilterState *s, int size,
272 290
                       const float *src, int sstep, float *dst, int dstep)
273 291
{
274
    if (c->order == 4) {
292
    if (c->order == 2) {
293
        FILTER_O2(float, FLT)
294
    } else if (c->order == 4) {
275 295
        FILTER_BW_O4(float, FLT)
276 296
    } else {
277 297
        FILTER_DIRECT_FORM_II(float, FLT)

Also available in: Unified diff