The channel loop is now the outer loop for both planar and interleaved. This is needed by the next patch, and the speed difference is negligable if any.
Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -410,17 +410,18 @@ static void set_metadata(AudioStatsContext *s, AVDictionary **metadata) · 409 unmodified lines | ||
| 410 | 410 | for (int c = 0; c < channels; c++) { \ |
| 411 | 411 | ChannelStats *p = &s->chstats[c]; \ |
| 412 | 412 | const type *src = (const type *)data[c]; \ |
| 413 | − for (int i = 0; i < samples; i++, src++) \ | |
| 413 | + const type * const srcend = src + samples; \ | |
| 414 | + for (; src < srcend; src++) \ | |
| 414 | 415 | update_stat(s, p, double_sample, normalized_sample, int_sample); \ |
| 415 | 416 | } |
| 416 | 417 | |
| 417 | −#define UPDATE_STATS_I(type, double_sample, normalized_sample, int_sample) \ | |
| 418 | − { \ | |
| 419 | − const type *src = (const type *)data[0]; \ | |
| 420 | − for (int i = 0; i < samples; i++) { \ | |
| 421 | − for (int c = 0; c < channels; c++, src++) \ | |
| 422 | − update_stat(s, &s->chstats[c], double_sample, normalized_sample, int_sample); \ | |
| 423 | − } \ | |
| 418 | +#define UPDATE_STATS_I(type, double_sample, normalized_sample, int_sample) \ | |
| 419 | + for (int c = 0; c < channels; c++) { \ | |
| 420 | + ChannelStats *p = &s->chstats[c]; \ | |
| 421 | + const type *src = (const type *)data[0]; \ | |
| 422 | + const type * const srcend = src + samples * channels; \ | |
| 423 | + for (src += c; src < srcend; src += channels) \ | |
| 424 | + update_stat(s, p, double_sample, normalized_sample, int_sample); \ | |
| 424 | 425 | } |
| 425 | 426 | |
| 426 | 427 | #define UPDATE_STATS(planar, type, sample, normalizer_suffix, int_sample) \ |