Commit 9c168370 authored by Angie Chiang's avatar Angie Chiang
Browse files

Collect coeff level distribution in symbolrate

Change-Id: If77800c0904b5e004508274acb32ae46a641405b
parent d9af8ac3
......@@ -439,7 +439,7 @@ typedef struct FRAME_COUNTS {
#if CONFIG_SYMBOLRATE
unsigned int superblock_num;
unsigned int coeff_num[2]; // 0: zero coeff 1: non-zero coeff
unsigned int coeff_num[COEFF_LEVELS]; // 0: zero coeff 1: non-zero coeff
unsigned int symbol_num[2]; // 0: entropy symbol 1: non-entropy symbol
#endif
......
......@@ -622,6 +622,9 @@ typedef enum ATTRIBUTE_PACKED {
FILTER_INTRA_MODES,
} FILTER_INTRA_MODE;
#endif // CONFIG_FILTER_INTRA
#if CONFIG_SYMBOLRATE
#define COEFF_LEVELS 18
#endif
#if CONFIG_EXT_INTRA
#define DIRECTIONAL_MODES 8
......
......@@ -10,6 +10,7 @@
*/
#include "aom_dsp/bitreader.h"
#include "av1/common/enums.h"
#ifndef AV1_DECODER_SYMBOLRATE_H_
#define AV1_DECODER_SYMBOLRATE_H_
......@@ -17,9 +18,11 @@
#if CONFIG_SYMBOLRATE
static INLINE void av1_dump_symbol_rate(struct AV1Common *cm) {
const FRAME_COUNTS *counts = &cm->counts;
printf("%d %d %d %d %d %d %d\n", cm->current_video_frame, cm->show_frame,
counts->superblock_num, counts->coeff_num[0], counts->coeff_num[1],
counts->symbol_num[0], counts->symbol_num[1]);
printf("fidx %d show %d superblock_num %d\n", cm->current_video_frame,
cm->show_frame, counts->superblock_num);
printf("%d %d\n", counts->symbol_num[0], counts->symbol_num[1]);
for (int i = 0; i < COEFF_LEVELS; ++i) printf("%d ", counts->coeff_num[i]);
printf("\n");
}
static INLINE int av1_read_record_symbol(FRAME_COUNTS *counts, aom_reader *r,
aom_cdf_prob *cdf, int nsymbs,
......@@ -63,7 +66,9 @@ static INLINE int av1_read_record_bit(FRAME_COUNTS *counts, aom_reader *r,
static INLINE void av1_record_coeff(FRAME_COUNTS *counts, tran_low_t qcoeff) {
assert(qcoeff >= 0);
if (counts) ++counts->coeff_num[qcoeff != 0];
int abs_qc = abs(qcoeff);
abs_qc = clamp(abs_qc, 0, COEFF_LEVELS - 1);
if (counts) ++counts->coeff_num[abs_qc];
}
static INLINE void av1_record_superblock(FRAME_COUNTS *counts) {
......
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