[FFmpeg-cvslog] s->target_i and global are in dB but s->target_tp and true_peak are
Sebastian Dröge
git at videolan.org
Sat May 2 07:48:26 EEST 2020
ffmpeg | branch: master | Sebastian Dröge <sebastian at centricular.com> | Fri May 1 20:52:00 2020 -0700| [ed3da72583298ed04a488e363bd3fa6d69ade165] | committer: Kyle Swanson
s->target_i and global are in dB but s->target_tp and true_peak are
linear. Instead of mixing these in the calculations, convert the former
first to have all following calculations in the same unit.
Signed-off-by: Kyle Swanson <k at ylo.ph>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ed3da72583298ed04a488e363bd3fa6d69ade165
---
libavfilter/af_loudnorm.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/libavfilter/af_loudnorm.c b/libavfilter/af_loudnorm.c
index 314b25fa39..8e3cdc36db 100644
--- a/libavfilter/af_loudnorm.c
+++ b/libavfilter/af_loudnorm.c
@@ -453,10 +453,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
true_peak = tmp;
}
- offset = s->target_i - global;
- offset_tp = true_peak + offset;
+ offset = pow(10., (s->target_i - global) / 20.);
+ offset_tp = true_peak * offset;
s->offset = offset_tp < s->target_tp ? offset : s->target_tp - true_peak;
- s->offset = pow(10., s->offset / 20.);
s->frame_type = LINEAR_MODE;
}
More information about the ffmpeg-cvslog
mailing list