From: Hendrik Leppkes <h.leppkes@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Hendrik Leppkes <h.leppkes@gmail.com>
Subject: [FFmpeg-devel] [PATCH] avfilter/f_ebur128: multiply in integer first, before dividing in float
Date: Tue, 5 Apr 2022 22:41:28 +0200
Message-ID: <20220405204128.1606-1-h.leppkes@gmail.com> (raw)
Restores the order of operations from before 15a1104, which reduces
errors from floating point calculations, and fixes FATE on mingw64.
---
libavfilter/f_ebur128.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c
index 1b1bcf1bff..a036aa0c86 100644
--- a/libavfilter/f_ebur128.c
+++ b/libavfilter/f_ebur128.c
@@ -768,7 +768,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
/* get lower loudness to consider */
n = 0;
- nb_pow = LRA_LOWER_PRC * 0.01 * nb_powers + 0.5;
+ nb_pow = LRA_LOWER_PRC * nb_powers * 0.01 + 0.5;
for (i = gate_hist_pos; i < HIST_SIZE; i++) {
n += ebur128->i3000.histogram[i].count;
if (n >= nb_pow) {
@@ -779,7 +779,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
/* get higher loudness to consider */
n = nb_powers;
- nb_pow = LRA_HIGHER_PRC * 0.01 * nb_powers + 0.5;
+ nb_pow = LRA_HIGHER_PRC * nb_powers * 0.01 + 0.5;
for (i = HIST_SIZE - 1; i >= 0; i--) {
n -= FFMIN(n, ebur128->i3000.histogram[i].count);
if (n < nb_pow) {
--
2.33.0.windows.2
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next reply other threads:[~2022-04-05 20:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-05 20:41 Hendrik Leppkes [this message]
2022-04-06 14:38 ` Paul B Mahol
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220405204128.1606-1-h.leppkes@gmail.com \
--to=h.leppkes@gmail.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git