Commit 2c1785c0 authored by Angie Chiang's avatar Angie Chiang

Let symbolrate accounts for coeff number as well

Change-Id: Ibdf1de139e8ce63b0be2d0cd1fd098f06739d8cc
parent 85e3b960
......@@ -442,6 +442,7 @@ typedef struct FRAME_COUNTS {
#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
......
......@@ -504,6 +504,9 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
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);
......
......@@ -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 @@ static INLINE int av1_read_record_bit(FRAME_COUNTS *counts, aom_reader *r,
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) \
......
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