[FFmpeg-cvslog] avfilter/af_adynamicequalizer: refactor code to gain small speedup
Paul B Mahol
git at videolan.org
Sat Apr 29 00:33:43 EEST 2023
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri Apr 28 23:16:28 2023 +0200| [5564ba49a16f82e3ccb98cd008d824bcbc2ada13] | committer: Paul B Mahol
avfilter/af_adynamicequalizer: refactor code to gain small speedup
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5564ba49a16f82e3ccb98cd008d824bcbc2ada13
---
libavfilter/af_adynamicequalizer.c | 29 +++++++++++++++++++----------
1 file 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]) {
More information about the ffmpeg-cvslog
mailing list