Skip to content

Commit

Permalink
avfilter/af_astats: rework sample loops
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Marton Balint <[email protected]>
  • Loading branch information
cus committed Mar 20, 2019
1 parent 235228e commit 5cc4b79
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions libavfilter/af_astats.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,17 +410,18 @@ static void set_metadata(AudioStatsContext *s, AVDictionary **metadata)
for (int c = 0; c < channels; c++) { \
ChannelStats *p = &s->chstats[c]; \
const type *src = (const type *)data[c]; \
for (int i = 0; i < samples; i++, src++) \
const type * const srcend = src + samples; \
for (; src < srcend; src++) \
update_stat(s, p, double_sample, normalized_sample, int_sample); \
}

#define UPDATE_STATS_I(type, double_sample, normalized_sample, int_sample) \
{ \
const type *src = (const type *)data[0]; \
for (int i = 0; i < samples; i++) { \
for (int c = 0; c < channels; c++, src++) \
update_stat(s, &s->chstats[c], double_sample, normalized_sample, int_sample); \
} \
#define UPDATE_STATS_I(type, double_sample, normalized_sample, int_sample) \
for (int c = 0; c < channels; c++) { \
ChannelStats *p = &s->chstats[c]; \
const type *src = (const type *)data[0]; \
const type * const srcend = src + samples * channels; \
for (src += c; src < srcend; src += channels) \
update_stat(s, p, double_sample, normalized_sample, int_sample); \
}

#define UPDATE_STATS(planar, type, sample, normalizer_suffix, int_sample) \
Expand Down

0 comments on commit 5cc4b79

Please sign in to comment.