Correct the time interval between logged data rows to the expected
value of 100 milliseconds by naming a new loop counter variable
to be distinct from loop counters for inner loops that
inadvertently change the outer loop operation.
This suggested patch is 1 of 3 for Ticket #2144 "libavfilter ebur128
loudness inaccuracy, irregular time interval, LFE interference".
This suggested patch supersedes the contribution of January 15, 2013
in the thread “[PATCH] lavfi: EBU R.128 irreg time, ch weights, skip
LFE” which combined multiple fixes in one patch.
Reviewed-by: Clément Bœsch <ubitux@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
... | ... |
@@ -438,7 +438,7 @@ static int gate_update(struct integrator *integ, double power, |
438 | 438 |
|
439 | 439 |
static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *insamples) |
440 | 440 |
{ |
441 |
- int i, ch; |
|
441 |
+ int i, ch, idx_insample; |
|
442 | 442 |
AVFilterContext *ctx = inlink->dst; |
443 | 443 |
EBUR128Context *ebur128 = ctx->priv; |
444 | 444 |
const int nb_channels = ebur128->nb_channels; |
... | ... |
@@ -446,7 +446,7 @@ static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *insamples) |
446 | 446 |
const double *samples = (double *)insamples->data[0]; |
447 | 447 |
AVFilterBufferRef *pic = ebur128->outpicref; |
448 | 448 |
|
449 |
- for (i = 0; i < nb_samples; i++) { |
|
449 |
+ for (idx_insample = 0; idx_insample < nb_samples; idx_insample++) { |
|
450 | 450 |
const int bin_id_400 = ebur128->i400.cache_pos; |
451 | 451 |
const int bin_id_3000 = ebur128->i3000.cache_pos; |
452 | 452 |
|
... | ... |
@@ -505,7 +505,7 @@ static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *insamples) |
505 | 505 |
double power_400 = 1e-12, power_3000 = 1e-12; |
506 | 506 |
AVFilterLink *outlink = ctx->outputs[0]; |
507 | 507 |
const int64_t pts = insamples->pts + |
508 |
- av_rescale_q(i, (AVRational){ 1, inlink->sample_rate }, |
|
508 |
+ av_rescale_q(idx_insample, (AVRational){ 1, inlink->sample_rate }, |
|
509 | 509 |
outlink->time_base); |
510 | 510 |
|
511 | 511 |
ebur128->sample_count = 0; |