1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-10 06:10:52 +02:00

avfilter/f_ebur128: multiply in integer first, before dividing in float

Restores the order of operations from before 15a1104, which reduces
errors from floating point calculations, and fixes FATE on mingw64.
This commit is contained in:
Hendrik Leppkes
2022-04-05 22:37:22 +02:00
parent 607ecc27ed
commit cd96211ace

View File

@@ -768,7 +768,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
/* get lower loudness to consider */ /* get lower loudness to consider */
n = 0; 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++) { for (i = gate_hist_pos; i < HIST_SIZE; i++) {
n += ebur128->i3000.histogram[i].count; n += ebur128->i3000.histogram[i].count;
if (n >= nb_pow) { if (n >= nb_pow) {
@@ -779,7 +779,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
/* get higher loudness to consider */ /* get higher loudness to consider */
n = nb_powers; 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--) { for (i = HIST_SIZE - 1; i >= 0; i--) {
n -= FFMIN(n, ebur128->i3000.histogram[i].count); n -= FFMIN(n, ebur128->i3000.histogram[i].count);
if (n < nb_pow) { if (n < nb_pow) {