History

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.

Marton Balint committed 7 years ago

Commit 5cc4b791 parent 235228e1 file · +9 −8Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/af_astats.c+9−8
@@ -410,17 +410,18 @@ static void set_metadata(AudioStatsContext *s, AVDictionary **metadata) · 409 unmodified lines
410410 for (int c = 0; c < channels; c++) { \
411411 ChannelStats *p = &s->chstats[c]; \
412412 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++) \
414415 update_stat(s, p, double_sample, normalized_sample, int_sample); \
415416 }
416417
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); \
424425 }
425426
426427 #define UPDATE_STATS(planar, type, sample, normalizer_suffix, int_sample) \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t