From f7f87ff2e64157dc7ef6fb7e2e21f393538069df Mon Sep 17 00:00:00 2001 From: Thomas Davies Date: Wed, 1 Mar 2017 16:24:56 +0000 Subject: [PATCH] Add a symbol decode call count to accounting. This keeps track of how many calls have been made to read symbols or bits. A given syntax element may make multiple calls to symbol decoding functions, and these variables keep track of the entropy decoding engine throughput. Change-Id: Iab3a720cbfe68f8d5ca3e4c415f7baa683b24268 --- aom_dsp/bitreader.h | 12 ++++++++++++ av1/common/accounting.c | 8 +++++++- av1/common/accounting.h | 6 +++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/aom_dsp/bitreader.h b/aom_dsp/bitreader.h index b6bf06c70..aefa01d15 100644 --- a/aom_dsp/bitreader.h +++ b/aom_dsp/bitreader.h @@ -144,6 +144,14 @@ static INLINE void aom_process_accounting(const aom_reader *r ACCT_STR_PARAM) { r->accounting->last_tell_frac = tell_frac; } } + +static INLINE void aom_update_symb_counts(const aom_reader *r, + const int is_binary) { + if (r->accounting != NULL) { + r->accounting->syms.num_multi_syms += !is_binary; + r->accounting->syms.num_binary_syms += !!is_binary; + } +} #endif static INLINE int aom_read_(aom_reader *r, int prob ACCT_STR_PARAM) { @@ -157,6 +165,7 @@ static INLINE int aom_read_(aom_reader *r, int prob ACCT_STR_PARAM) { #endif #if CONFIG_ACCOUNTING if (ACCT_STR_NAME) aom_process_accounting(r, ACCT_STR_NAME); + aom_update_symb_counts(r, 1); #endif return ret; } @@ -167,6 +176,7 @@ static INLINE int aom_read_bit_(aom_reader *r ACCT_STR_PARAM) { ret = rabs_read_bit(r); // Non trivial optimization at half probability #elif CONFIG_DAALA_EC && CONFIG_RAWBITS // Note this uses raw bits and is not the same as aom_daala_read(r, 128); + // Calls to this function are omitted from raw symbol accounting. ret = aom_daala_read_bit(r); #else ret = aom_read(r, 128, NULL); // aom_prob_half @@ -213,6 +223,7 @@ static INLINE int aom_read_cdf_(aom_reader *r, const aom_cdf_prob *cdf, #if CONFIG_ACCOUNTING if (ACCT_STR_NAME) aom_process_accounting(r, ACCT_STR_NAME); + aom_update_symb_counts(r, (nsymbs == 2)); #endif return ret; } @@ -239,6 +250,7 @@ static INLINE int aom_read_cdf_unscaled_(aom_reader *r, const aom_cdf_prob *cdf, #if CONFIG_ACCOUNTING if (ACCT_STR_NAME) aom_process_accounting(r, ACCT_STR_NAME); + aom_update_raw_counts(r, (nsymbs == 2)); #endif return ret; } diff --git a/av1/common/accounting.c b/av1/common/accounting.c index 41280afe8..ba243c9e1 100644 --- a/av1/common/accounting.c +++ b/av1/common/accounting.c @@ -66,6 +66,8 @@ void aom_accounting_init(Accounting *accounting) { void aom_accounting_reset(Accounting *accounting) { accounting->syms.num_syms = 0; + accounting->syms.num_binary_syms = 0; + accounting->syms.num_multi_syms = 0; accounting->context.x = -1; accounting->context.y = -1; accounting->last_tell_frac = 0; @@ -122,7 +124,11 @@ void aom_accounting_record(Accounting *accounting, const char *str, void aom_accounting_dump(Accounting *accounting) { int i; AccountingSymbol *sym; - printf("----- %d -----\n", accounting->syms.num_syms); + printf("\n----- Number of recorded syntax elements = %d -----\n", + accounting->syms.num_syms); + printf("----- Total number of symbol calls = %d (%d binary) -----\n", + accounting->syms.num_multi_syms + accounting->syms.num_binary_syms, + accounting->syms.num_binary_syms); for (i = 0; i < accounting->syms.num_syms; i++) { sym = &accounting->syms.syms[i]; printf("%s x: %d, y: %d bits: %f samples: %d\n", diff --git a/av1/common/accounting.h b/av1/common/accounting.h index 1fe1d9a8d..889865b2e 100644 --- a/av1/common/accounting.h +++ b/av1/common/accounting.h @@ -48,8 +48,12 @@ typedef struct { typedef struct { /** All recorded symbols decoded. */ AccountingSymbol *syms; - /** Number of symbols actually recorded. */ + /** Number of syntax actually recorded. */ int num_syms; + /** Raw symbol decoding calls for non-binary values. */ + int num_multi_syms; + /** Raw binary symbol decoding calls. */ + int num_binary_syms; /** Dictionary for translating strings into id. */ AccountingDictionary dictionary; } AccountingSymbols; -- GitLab