Commit f7f87ff2 authored by Thomas Davies's avatar Thomas Davies

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
parent b7bb0976
......@@ -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;
}
......
......@@ -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",
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment