ffmpeg | branch: master | Paul B Mahol <[email protected]> | Thu Nov 18 22:14:11 2021 +0100| [8c150d3d9794c29a54bbdf2f2a88066277c7197e] | committer: Paul B Mahol
avfilter/af_drmeter: improve measurement precision > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8c150d3d9794c29a54bbdf2f2a88066277c7197e --- libavfilter/af_drmeter.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavfilter/af_drmeter.c b/libavfilter/af_drmeter.c index 1ff769a29f..6e0d80a3f1 100644 --- a/libavfilter/af_drmeter.c +++ b/libavfilter/af_drmeter.c @@ -26,7 +26,7 @@ #include "avfilter.h" #include "internal.h" -#define BINS 10000 +#define BINS 32768 typedef struct ChannelStats { uint64_t nb_samples; @@ -75,8 +75,8 @@ static void finish_block(ChannelStats *p) rms = sqrt(2 * p->sum / p->nb_samples); peak = p->peak; - rms_bin = av_clip(rms * BINS, 0, BINS); - peak_bin = av_clip(peak * BINS, 0, BINS); + rms_bin = av_clip(lrintf(rms * BINS), 0, BINS); + peak_bin = av_clip(lrintf(peak * BINS), 0, BINS); p->rms[rms_bin]++; p->peaks[peak_bin]++; @@ -158,7 +158,7 @@ static void print_stats(AVFilterContext *ctx) for (i = BINS, j = 0; i >= 0 && j < 0.2 * p->blknum; i--) { if (p->rms[i]) { - rmssum += SQR(i / (double)BINS) * p->rms[i]; + rmssum += SQR(i / (double)BINS); j += p->rms[i]; } } _______________________________________________ ffmpeg-cvslog mailing list [email protected] https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
