Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2021-07-25 14:04:03 +0300
committerPaul B Mahol <onemda@gmail.com>2021-07-25 14:16:58 +0300
commit6f0f7bc7fe724731ed9b4f5a2c4cd6735a918276 (patch)
tree97afbc671f991618fb1fadeaedcb124c0f5fc50d /libavfilter/f_ebur128.c
parent274112c88d89d839a27c0766f558f065f9eee0d7 (diff)
avfilter/f_ebur128: fix video output regression
Diffstat (limited to 'libavfilter/f_ebur128.c')
-rw-r--r--libavfilter/f_ebur128.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c
index c4e77f434d..bf7bb3af68 100644
--- a/libavfilter/f_ebur128.c
+++ b/libavfilter/f_ebur128.c
@@ -435,8 +435,8 @@ static int config_audio_output(AVFilterLink *outlink)
if (!ebur128->ch_weighting)
return AVERROR(ENOMEM);
-#define I400_BINS (outlink->sample_rate * 4 / 10)
-#define I3000_BINS (outlink->sample_rate * 3)
+#define I400_BINS(x) ((x) * 4 / 10)
+#define I3000_BINS(x) ((x) * 3)
for (i = 0; i < nb_channels; i++) {
/* channel weighting */
@@ -453,8 +453,8 @@ static int config_audio_output(AVFilterLink *outlink)
continue;
/* bins buffer for the two integration window (400ms and 3s) */
- ebur128->i400.cache_size = I400_BINS;
- ebur128->i3000.cache_size = I3000_BINS;
+ ebur128->i400.cache_size = I400_BINS(outlink->sample_rate);
+ ebur128->i3000.cache_size = I3000_BINS(outlink->sample_rate);
ebur128->i400.cache[i] = av_calloc(ebur128->i400.cache_size, sizeof(*ebur128->i400.cache[0]));
ebur128->i3000.cache[i] = av_calloc(ebur128->i3000.cache_size, sizeof(*ebur128->i3000.cache[0]));
if (!ebur128->i400.cache[i] || !ebur128->i3000.cache[i])
@@ -687,7 +687,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
/* For integrated loudness, gating blocks are 400ms long with 75%
* overlap (see BS.1770-2 p5), so a re-computation is needed each 100ms
* (4800 samples at 48kHz). */
- if (++ebur128->sample_count == 4800) {
+ if (++ebur128->sample_count == inlink->sample_rate / 10) {
double loudness_400, loudness_3000;
double power_400 = 1e-12, power_3000 = 1e-12;
AVFilterLink *outlink = ctx->outputs[0];
@@ -702,7 +702,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
/* weighting sum of the last <time> ms */ \
for (ch = 0; ch < nb_channels; ch++) \
power_##time += ebur128->ch_weighting[ch] * ebur128->i##time.sum[ch]; \
- power_##time /= I##time##_BINS; \
+ power_##time /= I##time##_BINS(inlink->sample_rate); \
} \
loudness_##time = LOUDNESS(power_##time); \
} while (0)