Revision 0361d13c libavcodec/iirfilter.c
libavcodec/iirfilter.c | ||
---|---|---|
164 | 164 |
float stopband, float ripple) |
165 | 165 |
{ |
166 | 166 |
FFIIRFilterCoeffs *c; |
167 |
int ret = 0; |
|
167 | 168 |
|
168 | 169 |
if (order <= 0 || order > MAXORDER || cutoff_ratio >= 1.0) |
169 | 170 |
return NULL; |
... | ... | |
176 | 177 |
init_fail); |
177 | 178 |
c->order = order; |
178 | 179 |
|
179 |
if (filt_type == FF_FILTER_TYPE_BUTTERWORTH) { |
|
180 |
if (butterworth_init_coeffs(avc, c, filt_mode, order, cutoff_ratio, |
|
181 |
stopband)) { |
|
182 |
goto init_fail; |
|
183 |
} |
|
184 |
} else if (filt_type == FF_FILTER_TYPE_BIQUAD) { |
|
185 |
if (biquad_init_coeffs(avc, c, filt_mode, order, cutoff_ratio, |
|
186 |
stopband)) { |
|
187 |
goto init_fail; |
|
188 |
} |
|
189 |
} else { |
|
180 |
switch (filt_type) { |
|
181 |
case FF_FILTER_TYPE_BUTTERWORTH: |
|
182 |
ret = butterworth_init_coeffs(avc, c, filt_mode, order, cutoff_ratio, |
|
183 |
stopband); |
|
184 |
break; |
|
185 |
case FF_FILTER_TYPE_BIQUAD: |
|
186 |
ret = biquad_init_coeffs(avc, c, filt_mode, order, cutoff_ratio, |
|
187 |
stopband); |
|
188 |
break; |
|
189 |
default: |
|
190 | 190 |
av_log(avc, AV_LOG_ERROR, "filter type is not currently implemented\n"); |
191 | 191 |
goto init_fail; |
192 | 192 |
} |
193 | 193 |
|
194 |
return c; |
|
194 |
if (!ret) |
|
195 |
return c; |
|
195 | 196 |
|
196 | 197 |
init_fail: |
197 | 198 |
ff_iir_filter_free_coeffs(c); |
Also available in: Unified diff