[FFmpeg-cvslog] avfilter/f_ebur128: use unsigned for hist_entry.count
Paul B Mahol
git at videolan.org
Thu Feb 24 12:18:33 EET 2022
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Feb 24 10:04:43 2022 +0100| [d5ad1d7847ebfa4da1f1476c4af18fa2701e4d24] | committer: Paul B Mahol
avfilter/f_ebur128: use unsigned for hist_entry.count
Also when summing multiple hist_entry.count use uint64_t for accumulator.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d5ad1d7847ebfa4da1f1476c4af18fa2701e4d24
---
libavfilter/f_ebur128.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c
index 0c635f3d36..d5ffab7ca1 100644
--- a/libavfilter/f_ebur128.c
+++ b/libavfilter/f_ebur128.c
@@ -55,7 +55,7 @@
* infinitely over the time and is thus more scalable.
*/
struct hist_entry {
- int count; ///< how many times the corresponding value occurred
+ unsigned count; ///< how many times the corresponding value occurred
double energy; ///< E = 10^((L + 0.691) / 10)
double loudness; ///< L = -0.691 + 10 * log10(E)
};
@@ -722,15 +722,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
#define I_GATE_THRES -10 // initially defined to -8 LU in the first EBU standard
if (loudness_400 >= ABS_THRES) {
- double integrated_sum = 0;
- int nb_integrated = 0;
+ double integrated_sum = 0.0;
+ uint64_t nb_integrated = 0;
int gate_hist_pos = gate_update(&ebur128->i400, power_400,
loudness_400, I_GATE_THRES);
/* compute integrated loudness by summing the histogram values
* above the relative threshold */
for (i = gate_hist_pos; i < HIST_SIZE; i++) {
- const int nb_v = ebur128->i400.histogram[i].count;
+ const unsigned nb_v = ebur128->i400.histogram[i].count;
nb_integrated += nb_v;
integrated_sum += nb_v * ebur128->i400.histogram[i].energy;
}
@@ -751,14 +751,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
/* XXX: example code in EBU 3342 is ">=" but formula in BS.1770
* specs is ">" */
if (loudness_3000 >= ABS_THRES) {
- int nb_powers = 0;
+ uint64_t nb_powers = 0;
int gate_hist_pos = gate_update(&ebur128->i3000, power_3000,
loudness_3000, LRA_GATE_THRES);
for (i = gate_hist_pos; i < HIST_SIZE; i++)
nb_powers += ebur128->i3000.histogram[i].count;
if (nb_powers) {
- int n, nb_pow;
+ uint64_t n, nb_pow;
/* get lower loudness to consider */
n = 0;
More information about the ffmpeg-cvslog
mailing list