aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/af_astats.c
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2019-03-01 23:48:04 +0100
committerMarton Balint <cus@passwd.hu>2019-03-21 00:39:57 +0100
commit5cc4b79b295d01c103eb221e4c8899f33b4cd6bc (patch)
tree1870d1cce035653b0838d6b24ad06f91550489e5 /libavfilter/af_astats.c
parent235228ea50908a566931b4d24bc878651033c054 (diff)
downloadffmpeg-5cc4b79b295d01c103eb221e4c8899f33b4cd6bc.tar.gz
avfilter/af_astats: rework sample loops
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 <cus@passwd.hu>
Diffstat (limited to 'libavfilter/af_astats.c')
-rw-r--r--libavfilter/af_astats.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/libavfilter/af_astats.c b/libavfilter/af_astats.c
index f45558909a..9915a7965e 100644
--- a/libavfilter/af_astats.c
+++ b/libavfilter/af_astats.c
@@ -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) \