Let symbolrate accounts for coeff number as well
Change-Id: Ibdf1de139e8ce63b0be2d0cd1fd098f06739d8cc
diff --git a/av1/common/entropymode.h b/av1/common/entropymode.h
index 2d09c24..1dcd283 100644
--- a/av1/common/entropymode.h
+++ b/av1/common/entropymode.h
@@ -442,6 +442,7 @@
#endif // CONFIG_LV_MAP
#if CONFIG_SYMBOLRATE
+ unsigned int coeff_num[2]; // 0: zero coeff 1: non-zero coeff
unsigned int symbol_num[2]; // 0: entropy symbol 1: non-entropy symbol
#endif
diff --git a/av1/decoder/decodetxb.c b/av1/decoder/decodetxb.c
index d2fabc3..8d4e95e 100644
--- a/av1/decoder/decodetxb.c
+++ b/av1/decoder/decodetxb.c
@@ -504,6 +504,9 @@
for (c = 0; c < *eob; ++c) {
int16_t dqv = (c == 0) ? dequant[0] : dequant[1];
tran_low_t *v = &tcoeffs[scan[c]];
+#if CONFIG_SYMBOLRATE
+ av1_record_coeff(counts, *v);
+#endif
int sign = (*v) < 0;
*v = (abs(*v) * dqv) >> shift;
if (sign) *v = -(*v);
diff --git a/av1/decoder/symbolrate.h b/av1/decoder/symbolrate.h
index f5b911b..6431733 100644
--- a/av1/decoder/symbolrate.h
+++ b/av1/decoder/symbolrate.h
@@ -17,7 +17,8 @@
#if CONFIG_SYMBOLRATE
static INLINE void av1_dump_symbol_rate(struct AV1Common *cm) {
const FRAME_COUNTS *counts = &cm->counts;
- printf("%d %d\n", counts->symbol_num[0], counts->symbol_num[1]);
+ printf("%d %d %d %d\n", counts->coeff_num[0], counts->coeff_num[1],
+ counts->symbol_num[0], counts->symbol_num[1]);
}
static INLINE int av1_read_record_symbol(FRAME_COUNTS *counts, aom_reader *r,
aom_cdf_prob *cdf, int nsymbs,
@@ -33,6 +34,10 @@
if (counts) ++counts->symbol_num[1];
return aom_read_bit(r, str);
}
+
+static INLINE void av1_record_coeff(FRAME_COUNTS *counts, tran_low_t qcoeff) {
+ if (counts) ++counts->coeff_num[qcoeff != 0];
+}
#else // CONFIG_SYMBOLRATE
#define av1_read_record_symbol(counts, r, cdf, nsymbs, ACCT_STR_NAME) \