Commit Graph

51 Commits

Author SHA1 Message Date
Paul B Mahol
5da94413d1 avfilter/af_aiir: remove unused argument 2020-10-19 18:42:42 +02:00
Paul B Mahol
f7379eafd2 avfilter/af_aiir: fix sp2zp mapping 2020-10-19 18:42:42 +02:00
Paul B Mahol
847dc03787 avfilter/af_aiir: add analog transfer function format 2020-10-18 18:48:41 +02:00
Paul B Mahol
f372ce35f2 avfilter/af_aiir: use av_sscanf() 2020-10-17 18:43:47 +02:00
Paul B Mahol
7c1eef48e1 avfilter/af_aiir: reverse order of biquads in serial processing
This avoids most of clippings for fixed-point precision inputs.
Also add warning about filtering fixed-point precision with parallel processing.
2020-10-17 18:43:47 +02:00
Paul B Mahol
e704750a9f avfilter/af_aiir: use transposed II form for biquad sections 2020-10-16 23:07:27 +02:00
Paul B Mahol
0df0e12d02 avfilter/af_aiir: implement parallel processing 2020-10-16 23:07:27 +02:00
Nicolas George
2f76476549 lavfi: regroup formats lists in a single structure.
It will allow to refernce it as a whole without clunky macros.

Most of the changes have been automatically made with sed:

sed -i '
  s/-> *in_formats/->incfg.formats/g;
  s/-> *out_formats/->outcfg.formats/g;
  s/-> *in_channel_layouts/->incfg.channel_layouts/g;
  s/-> *out_channel_layouts/->outcfg.channel_layouts/g;
  s/-> *in_samplerates/->incfg.samplerates/g;
  s/-> *out_samplerates/->outcfg.samplerates/g;
  ' src/libavfilter/*(.)
2020-09-08 14:02:40 +02:00
Andreas Rheinhardt
97b1a2c564 avfilter/af_aiir: Fix segfault and leak upon allocation failure
The aiir filter adds output pads in its init function. Each of these
output pads had a name which was allocated and to be freed in the uninit
function. Given that the aiir filter has between one and two outputs,
one output pad's name was freed unconditionally and a second was freed
conditionally.

Yet if adding output pads fails, there are no output pads at all and
trying to free a nonexistent pad's name will lead to a segfault.

Furthermore, if the name could be successfully allocated, yet adding the
new pad fails, the name would leak.

This commit fixes this by not allocating the pads' names at all any
more: They are constant anyway. This allows to remove the code to free
them and hence fixes the aforementioned bugs.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-26 23:52:56 +02:00
Paul B Mahol
1329db8cfb avfilter/af_aiir: simplify polynomial evaluation 2020-05-30 18:04:14 +02:00
Paul B Mahol
aac16abd92 avfilter/af_aiir: use correct size when allocating in zp2tf 2020-05-30 18:04:14 +02:00
Jun Zhao
018cd437f8 lavfi/aiir: Refine the pad/vpad related operation
move the pad/vpad related operation with more natural
coding style.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-05-30 19:02:43 +08:00
Paul B Mahol
6485b54477 Revert "avfilter/af_aiir: move response drawing as last step"
This reverts commit ca7095a907.
2020-05-30 10:05:19 +02:00
Paul B Mahol
3fc7b01c52 avfilter/af_aiir: improve response calculation with zp coefficients 2020-05-30 10:05:19 +02:00
Paul B Mahol
e2e8121eaa avfilter/af_aiir: add S-plane support 2020-05-30 10:05:19 +02:00
Paul B Mahol
327b52412d avfilter/af_aiir: make it clear that transfer function is digital one 2020-05-30 10:05:19 +02:00
Paul B Mahol
ca7095a907 avfilter/af_aiir: move response drawing as last step 2020-05-22 14:14:15 +02:00
Paul B Mahol
8c825e43f8 avfilter/af_aiir: fix first denominator calculation 2020-05-22 14:12:06 +02:00
Paul B Mahol
07a9e5ec5e avfilter/af_aiir: add more descriptive options aliases 2020-05-22 12:37:17 +02:00
Paul B Mahol
ffda57b800 avfilter/af_aiir: export normalize option
And enable it in all modes by default.
2020-05-22 12:30:59 +02:00
Paul B Mahol
1fc5ddf774 avfilter/af_aiir: fix first delay value 2020-05-22 11:02:45 +02:00
Paul B Mahol
86822cfcd9 avfilter/af_aiir: fix phase and group delay calculation
Properly unwrap phase.
2020-05-20 12:08:32 +02:00
Paul B Mahol
b559a5882f avfilter/af_aiir: fix invalid memory access with tf filtering 2020-05-19 20:10:34 +02:00
Paul B Mahol
80c4c336f9 avfilter/af_aiir: check if frame clone is set 2020-01-14 16:52:07 +01:00
Paul B Mahol
89aa1342b1 avfilter/af_aiir: normalize biquads only if divisor is big enough 2019-11-22 21:10:43 +01:00
Paul B Mahol
f2a01b4c8b avfilter/af_aiir: fix biquads normalization 2019-11-22 20:24:29 +01:00
Paul B Mahol
eecc45cea5 avfilter/af_aiir: add missing normalization of biquads gains 2019-11-22 17:42:04 +01:00
Paul B Mahol
2f5fb9e60f avfilter/af_aiir: make a/b coefficients array 2019-11-22 16:13:06 +01:00
Paul B Mahol
e169d3756e avfilter/af_aiir: factor out response calculation 2019-11-22 16:07:03 +01:00
Paul B Mahol
c36e72ed27 avfilter/af_aiir: check for stability 2019-11-22 16:07:02 +01:00
Paul B Mahol
9cd56bb94c avfilter/af_aiir: fix array length when selecting conjugate poles 2019-11-21 23:27:34 +01:00
Paul B Mahol
80dacbedba avfilter/af_aiir: calculate group delay too 2019-07-13 15:45:06 +02:00
Paul B Mahol
60e6db2f5b avfilter/af_aiir: do not ignore k option for audio filtering
Previously it was used only for displaying frequency response.
2019-07-13 12:29:52 +02:00
Paul B Mahol
2a801e8856 avfilter/af_aiir: implement mix option 2019-07-08 16:48:10 +02:00
Paul B Mahol
0f0f840716 avfilter/af_aiir: implement rate option 2018-11-08 13:05:08 +01:00
Michael Niedermayer
8dd7c2c6a7 avfilter/af_aiir: Remove l from %lf in av_log environment
The l modifier does nothing in C99 and it was undefined in C89 for %f

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-10-07 03:03:09 +02:00
Carl Eugen Hoyos
9cb3d8fcb7 lavfi/af_afir,af_aiir: Remove a variable that is always -1.
Fixes two warnings:
libavfilter/af_afir.c:194:45: warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false [-Wstrict-overflow]
     int dx = FFABS(x1-x0), sx = x0 < x1 ? 1 : -1;
                                 ~~~~~~~~~~~~^~~~
libavfilter/af_aiir.c:689:45: warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false [-Wstrict-overflow]
     int dx = FFABS(x1-x0), sx = x0 < x1 ? 1 : -1;
                                 ~~~~~~~~~~~~^~~~
2018-07-19 23:13:24 +02:00
Paul B Mahol
1aa5192451 avfilter/af_aiir: draw IR frequency response
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-05-30 17:26:08 +02:00
Paul B Mahol
de8a1d8d4d avfilter/af_aiir: add polar zeros/poles format variant
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-01-10 20:25:50 +01:00
Paul B Mahol
de5b12c93f avfilter/af_aiir: unbreak clipping detection
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-01-10 19:24:41 +01:00
Paul B Mahol
3c29f68b4d avfilter/af_aiir: do not leak memory on failure in convert_zp2tf()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-01-10 18:38:01 +01:00
Paul B Mahol
e9edd61965 avfilter/af_aiir: refactor code so it uses IIRChannel struct
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-01-09 17:46:27 +01:00
Paul B Mahol
21c99f4b40 avfilter/af_aiir: make default processing to serially cascaded
Also add several helpfull log messages.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-01-09 13:08:01 +01:00
Paul B Mahol
d9a3074b93 avfilter/af_aiir: add slice threading support
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-01-09 12:25:35 +01:00
Paul B Mahol
7add1ca2b5 avfilter/af_aiir: add cascaded biquads support
Also add precision option.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-01-09 12:25:35 +01:00
Paul B Mahol
3f234a0b22 avfilter/af_aiir: do not forget to free gains too
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-01-08 11:22:21 +01:00
Paul B Mahol
205046420d avfilter/af_aiir: fix typo which may cause overread
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-01-08 08:45:02 +01:00
Paul B Mahol
2d3df8e2e9 avfilter/af_aiir: rename options, provide gains in separate option
This way it can be also used for other format.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-01-07 21:22:38 +01:00
Paul B Mahol
6c65de3db0 avfilter/af_aiir: add support for alternative coefficients format
Support for zeros/poles syntax on Z-plane.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-01-07 17:03:46 +01:00
Paul B Mahol
52c959a237 avfilter/af_aiir: do not crash with invalid options
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-01-05 19:58:07 +01:00