Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avfilter/f_ebur128: multiply in integer first, before dividing in float
@ 2022-04-05 20:41 Hendrik Leppkes
  2022-04-06 14:38 ` Paul B Mahol
  0 siblings, 1 reply; 2+ messages in thread
From: Hendrik Leppkes @ 2022-04-05 20:41 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Hendrik Leppkes

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".

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avfilter/f_ebur128: multiply in integer first, before dividing in float
  2022-04-05 20:41 [FFmpeg-devel] [PATCH] avfilter/f_ebur128: multiply in integer first, before dividing in float Hendrik Leppkes
@ 2022-04-06 14:38 ` Paul B Mahol
  0 siblings, 0 replies; 2+ messages in thread
From: Paul B Mahol @ 2022-04-06 14:38 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Hendrik Leppkes

ok, if other fates are not regressed.
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-06 14:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-05 20:41 [FFmpeg-devel] [PATCH] avfilter/f_ebur128: multiply in integer first, before dividing in float Hendrik Leppkes
2022-04-06 14:38 ` Paul B Mahol

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