It is only used by the test.
Showing the changes to libavcodec (3 of 3 files). Show all
Unified · Split
| @@ -277,20 +277,6 @@ av_cold struct FFIIRFilterState *ff_iir_filter_init_state(int order) · 276 unmodified lines | ||
| 277 | 277 | } \ |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | −void ff_iir_filter(const struct FFIIRFilterCoeffs *c, | |
| 281 | − struct FFIIRFilterState *s, int size, | |
| 282 | − const int16_t *src, ptrdiff_t sstep, | |
| 283 | − int16_t *dst, ptrdiff_t dstep) | |
| 284 | −{ | |
| 285 | − if (c->order == 2) { | |
| 286 | − FILTER_O2(int16_t, S16) | |
| 287 | − } else if (c->order == 4) { | |
| 288 | − FILTER_BW_O4(int16_t, S16) | |
| 289 | − } else { | |
| 290 | − FILTER_DIRECT_FORM_II(int16_t, S16) | |
| 291 | − } | |
| 292 | −} | |
| 293 | − | |
| 294 | 280 | /** |
| 295 | 281 | * Perform IIR filtering on floating-point input samples. |
| 296 | 282 | * |
| @@ -28,7 +28,6 @@ · 27 unmodified lines | ||
| 28 | 28 | #define AVCODEC_IIRFILTER_H |
| 29 | 29 | |
| 30 | 30 | #include <stddef.h> |
| 31 | −#include <stdint.h> | |
| 32 | 31 | |
| 33 | 32 | struct FFIIRFilterCoeffs; |
| 34 | 33 | struct FFIIRFilterState; |
| @@ -114,18 +113,4 @@ void ff_iir_filter_free_coeffsp(struct FFIIRFilterCoeffs **coeffs); · 79 unmodified lines | ||
| 114 | 113 | */ |
| 115 | 114 | void ff_iir_filter_free_statep(struct FFIIRFilterState **state); |
| 116 | 115 | |
| 117 | −/** | |
| 118 | − * Perform IIR filtering on signed 16-bit input samples. | |
| 119 | − * | |
| 120 | − * @param coeffs pointer to filter coefficients | |
| 121 | − * @param state pointer to filter state | |
| 122 | − * @param size input length | |
| 123 | − * @param src source samples | |
| 124 | − * @param sstep source stride | |
| 125 | − * @param dst filtered samples (destination may be the same as input) | |
| 126 | − * @param dstep destination stride | |
| 127 | − */ | |
| 128 | −void ff_iir_filter(const struct FFIIRFilterCoeffs *coeffs, struct FFIIRFilterState *state, | |
| 129 | − int size, const int16_t *src, ptrdiff_t sstep, int16_t *dst, ptrdiff_t dstep); | |
| 130 | − | |
| 131 | 116 | #endif /* AVCODEC_IIRFILTER_H */ |
| @@ -23,10 +23,25 @@ · 22 unmodified lines | ||
| 23 | 23 | #include "libavutil/libm.h" |
| 24 | 24 | |
| 25 | 25 | #include "libavcodec/iirfilter.h" |
| 26 | +#include "libavcodec/iirfilter.c" | |
| 26 | 27 | |
| 27 | 28 | #define FILT_ORDER 4 |
| 28 | 29 | #define SIZE 1024 |
| 29 | 30 | |
| 31 | +static void iir_filter_int16(const struct FFIIRFilterCoeffs *c, | |
| 32 | + struct FFIIRFilterState *s, int size, | |
| 33 | + const int16_t *src, ptrdiff_t sstep, | |
| 34 | + int16_t *dst, ptrdiff_t dstep) | |
| 35 | +{ | |
| 36 | + if (c->order == 2) { | |
| 37 | + FILTER_O2(int16_t, S16) | |
| 38 | + } else if (c->order == 4) { | |
| 39 | + FILTER_BW_O4(int16_t, S16) | |
| 40 | + } else { | |
| 41 | + FILTER_DIRECT_FORM_II(int16_t, S16) | |
| 42 | + } | |
| 43 | +} | |
| 44 | + | |
| 30 | 45 | int main(void) |
| 31 | 46 | { |
| 32 | 47 | struct FFIIRFilterCoeffs *fcoeffs = NULL; |
| @@ -43,7 +58,7 @@ int main(void) · 10 unmodified lines | ||
| 43 | 58 | for (i = 0; i < SIZE; i++) |
| 44 | 59 | x[i] = lrint(0.75 * INT16_MAX * sin(0.5 * M_PI * i * i / SIZE)); |
| 45 | 60 | |
| 46 | − ff_iir_filter(fcoeffs, fstate, SIZE, x, 1, y, 1); | |
| 61 | + iir_filter_int16(fcoeffs, fstate, SIZE, x, 1, y, 1); | |
| 47 | 62 | |
| 48 | 63 | for (i = 0; i < SIZE; i++) |
| 49 | 64 | printf("%6d %6d\n", x[i], y[i]); |