summaryrefslogtreecommitdiff
path: root/libavfilter/af_adynamicequalizer.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2023-04-28 23:16:28 +0200
committerPaul B Mahol <onemda@gmail.com>2023-04-28 23:31:25 +0200
commit5564ba49a16f82e3ccb98cd008d824bcbc2ada13 (patch)
tree67b10a8b179a7d77ecccb1f6af6a06451ad4582f /libavfilter/af_adynamicequalizer.c
parent153aaae45778589dda6573ab45da718e20334d2d (diff)
downloadffmpeg-5564ba49a16f82e3ccb98cd008d824bcbc2ada13.tar.gz
avfilter/af_adynamicequalizer: refactor code to gain small speedup
Diffstat (limited to 'libavfilter/af_adynamicequalizer.c')
-rw-r--r--libavfilter/af_adynamicequalizer.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/libavfilter/af_adynamicequalizer.c b/libavfilter/af_adynamicequalizer.c
index 77c98ed105..e741b55ead 100644
--- a/libavfilter/af_adynamicequalizer.c
+++ b/libavfilter/af_adynamicequalizer.c
@@ -199,16 +199,25 @@ static int filter_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo
if (detection > 0)
state[5] = fmax(state[5], detect);
- if (direction == 0 && mode == 0 && detect < threshold)
- detect = 1. / av_clipd(1. + makeup + (threshold - detect) * ratio, 1., range);
- else if (direction == 0 && mode == 1 && detect < threshold)
- detect = av_clipd(1. + makeup + (threshold - detect) * ratio, 1., range);
- else if (direction == 1 && mode == 0 && detect > threshold)
- detect = 1. / av_clipd(1. + makeup + (detect - threshold) * ratio, 1., range);
- else if (direction == 1 && mode == 1 && detect > threshold)
- detect = av_clipd(1. + makeup + (detect - threshold) * ratio, 1., range);
- else
- detect = 1.;
+ if (direction == 0) {
+ if (detect < threshold) {
+ if (mode == 0)
+ detect = 1. / av_clipd(1. + makeup + (threshold - detect) * ratio, 1., range);
+ else
+ detect = av_clipd(1. + makeup + (threshold - detect) * ratio, 1., range);
+ } else {
+ detect = 1.;
+ }
+ } else {
+ if (detect > threshold) {
+ if (mode == 0)
+ detect = 1. / av_clipd(1. + makeup + (detect - threshold) * ratio, 1., range);
+ else
+ detect = av_clipd(1. + makeup + (detect - threshold) * ratio, 1., range);
+ } else {
+ detect = 1.;
+ }
+ }
if (direction == 0) {
if (detect > state[4]) {