Commit e9d68a5e authored by Ronald S. Bultje's avatar Ronald S. Bultje

Merge all various transform size data trackers into single variables.

Change-Id: I2dfc569106b29fbe4da20585a0e85e5e9ea6a4db
parent 5da753be
...@@ -483,14 +483,14 @@ int vp9_get_coef_context(const int *scan, const int *neighbors, ...@@ -483,14 +483,14 @@ int vp9_get_coef_context(const int *scan, const int *neighbors,
}; };
void vp9_default_coef_probs(VP9_COMMON *pc) { void vp9_default_coef_probs(VP9_COMMON *pc) {
vpx_memcpy(pc->fc.coef_probs_4x4, default_coef_probs_4x4, vpx_memcpy(pc->fc.coef_probs[TX_4X4], default_coef_probs_4x4,
sizeof(pc->fc.coef_probs_4x4)); sizeof(pc->fc.coef_probs[TX_4X4]));
vpx_memcpy(pc->fc.coef_probs_8x8, default_coef_probs_8x8, vpx_memcpy(pc->fc.coef_probs[TX_8X8], default_coef_probs_8x8,
sizeof(pc->fc.coef_probs_8x8)); sizeof(pc->fc.coef_probs[TX_8X8]));
vpx_memcpy(pc->fc.coef_probs_16x16, default_coef_probs_16x16, vpx_memcpy(pc->fc.coef_probs[TX_16X16], default_coef_probs_16x16,
sizeof(pc->fc.coef_probs_16x16)); sizeof(pc->fc.coef_probs[TX_16X16]));
vpx_memcpy(pc->fc.coef_probs_32x32, default_coef_probs_32x32, vpx_memcpy(pc->fc.coef_probs[TX_32X32], default_coef_probs_32x32,
sizeof(pc->fc.coef_probs_32x32)); sizeof(pc->fc.coef_probs[TX_32X32]));
} }
// Neighborhood 5-tuples for various scans and blocksizes, // Neighborhood 5-tuples for various scans and blocksizes,
...@@ -677,13 +677,13 @@ void vp9_full_to_model_counts( ...@@ -677,13 +677,13 @@ void vp9_full_to_model_counts(
} }
} }
static void adapt_coef_probs( static void adapt_coef_probs(VP9_COMMON *cm, TX_SIZE txfm_size,
vp9_coeff_probs_model *dst_coef_probs, int count_sat, int update_factor) {
vp9_coeff_probs_model *pre_coef_probs, vp9_coeff_probs_model *dst_coef_probs = cm->fc.coef_probs[txfm_size];
vp9_coeff_count_model *coef_counts, vp9_coeff_probs_model *pre_coef_probs = cm->fc.pre_coef_probs[txfm_size];
unsigned int (*eob_branch_count)[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS], vp9_coeff_count_model *coef_counts = cm->fc.coef_counts[txfm_size];
int count_sat, unsigned int (*eob_branch_count)[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS] =
int update_factor) { cm->fc.eob_branch_counts[txfm_size];
int t, i, j, k, l, count; int t, i, j, k, l, count;
int factor; int factor;
unsigned int branch_ct[UNCONSTRAINED_NODES][2]; unsigned int branch_ct[UNCONSTRAINED_NODES][2];
...@@ -719,6 +719,7 @@ static void adapt_coef_probs( ...@@ -719,6 +719,7 @@ static void adapt_coef_probs(
} }
void vp9_adapt_coef_probs(VP9_COMMON *cm) { void vp9_adapt_coef_probs(VP9_COMMON *cm) {
TX_SIZE t;
int count_sat; int count_sat;
int update_factor; /* denominator 256 */ int update_factor; /* denominator 256 */
...@@ -732,20 +733,6 @@ void vp9_adapt_coef_probs(VP9_COMMON *cm) { ...@@ -732,20 +733,6 @@ void vp9_adapt_coef_probs(VP9_COMMON *cm) {
update_factor = COEF_MAX_UPDATE_FACTOR; update_factor = COEF_MAX_UPDATE_FACTOR;
count_sat = COEF_COUNT_SAT; count_sat = COEF_COUNT_SAT;
} }
adapt_coef_probs(cm->fc.coef_probs_4x4, cm->fc.pre_coef_probs_4x4, for (t = TX_4X4; t <= TX_32X32; t++)
cm->fc.coef_counts_4x4, adapt_coef_probs(cm, t, count_sat, update_factor);
cm->fc.eob_branch_counts[TX_4X4],
count_sat, update_factor);
adapt_coef_probs(cm->fc.coef_probs_8x8, cm->fc.pre_coef_probs_8x8,
cm->fc.coef_counts_8x8,
cm->fc.eob_branch_counts[TX_8X8],
count_sat, update_factor);
adapt_coef_probs(cm->fc.coef_probs_16x16, cm->fc.pre_coef_probs_16x16,
cm->fc.coef_counts_16x16,
cm->fc.eob_branch_counts[TX_16X16],
count_sat, update_factor);
adapt_coef_probs(cm->fc.coef_probs_32x32, cm->fc.pre_coef_probs_32x32,
cm->fc.coef_counts_32x32,
cm->fc.eob_branch_counts[TX_32X32],
count_sat, update_factor);
} }
...@@ -62,18 +62,9 @@ typedef struct frame_contexts { ...@@ -62,18 +62,9 @@ typedef struct frame_contexts {
unsigned int uv_mode_counts[VP9_INTRA_MODES][VP9_INTRA_MODES]; unsigned int uv_mode_counts[VP9_INTRA_MODES][VP9_INTRA_MODES];
unsigned int partition_counts[NUM_PARTITION_CONTEXTS][PARTITION_TYPES]; unsigned int partition_counts[NUM_PARTITION_CONTEXTS][PARTITION_TYPES];
vp9_coeff_probs_model coef_probs_4x4[BLOCK_TYPES]; vp9_coeff_probs_model coef_probs[TX_SIZE_MAX_SB][BLOCK_TYPES];
vp9_coeff_probs_model coef_probs_8x8[BLOCK_TYPES]; vp9_coeff_probs_model pre_coef_probs[TX_SIZE_MAX_SB][BLOCK_TYPES];
vp9_coeff_probs_model coef_probs_16x16[BLOCK_TYPES]; vp9_coeff_count_model coef_counts[TX_SIZE_MAX_SB][BLOCK_TYPES];
vp9_coeff_probs_model coef_probs_32x32[BLOCK_TYPES];
vp9_coeff_probs_model pre_coef_probs_4x4[BLOCK_TYPES];
vp9_coeff_probs_model pre_coef_probs_8x8[BLOCK_TYPES];
vp9_coeff_probs_model pre_coef_probs_16x16[BLOCK_TYPES];
vp9_coeff_probs_model pre_coef_probs_32x32[BLOCK_TYPES];
vp9_coeff_count_model coef_counts_4x4[BLOCK_TYPES];
vp9_coeff_count_model coef_counts_8x8[BLOCK_TYPES];
vp9_coeff_count_model coef_counts_16x16[BLOCK_TYPES];
vp9_coeff_count_model coef_counts_32x32[BLOCK_TYPES];
unsigned int eob_branch_counts[TX_SIZE_MAX_SB][BLOCK_TYPES][REF_TYPES] unsigned int eob_branch_counts[TX_SIZE_MAX_SB][BLOCK_TYPES][REF_TYPES]
[COEF_BANDS][PREV_COEF_CONTEXTS]; [COEF_BANDS][PREV_COEF_CONTEXTS];
......
...@@ -577,11 +577,10 @@ static void init_frame(VP9D_COMP *pbi) { ...@@ -577,11 +577,10 @@ static void init_frame(VP9D_COMP *pbi) {
xd->mode_info_stride = pc->mode_info_stride; xd->mode_info_stride = pc->mode_info_stride;
} }
static void read_coef_probs_common( static void read_coef_probs_common(FRAME_CONTEXT *fc, TX_SIZE tx_size,
vp9_coeff_probs_model *coef_probs, vp9_reader *r) {
TX_SIZE tx_size,
vp9_reader *r) {
const int entropy_nodes_update = UNCONSTRAINED_NODES; const int entropy_nodes_update = UNCONSTRAINED_NODES;
vp9_coeff_probs_model *coef_probs = fc->coef_probs[tx_size];
int i, j, k, l, m; int i, j, k, l, m;
...@@ -612,16 +611,16 @@ static void read_coef_probs(VP9D_COMP *pbi, vp9_reader *r) { ...@@ -612,16 +611,16 @@ static void read_coef_probs(VP9D_COMP *pbi, vp9_reader *r) {
const TXFM_MODE mode = pbi->common.txfm_mode; const TXFM_MODE mode = pbi->common.txfm_mode;
FRAME_CONTEXT *const fc = &pbi->common.fc; FRAME_CONTEXT *const fc = &pbi->common.fc;
read_coef_probs_common(fc->coef_probs_4x4, TX_4X4, r); read_coef_probs_common(fc, TX_4X4, r);
if (mode > ONLY_4X4) if (mode > ONLY_4X4)
read_coef_probs_common(fc->coef_probs_8x8, TX_8X8, r); read_coef_probs_common(fc, TX_8X8, r);
if (mode > ALLOW_8X8) if (mode > ALLOW_8X8)
read_coef_probs_common(fc->coef_probs_16x16, TX_16X16, r); read_coef_probs_common(fc, TX_16X16, r);
if (mode > ALLOW_16X16) if (mode > ALLOW_16X16)
read_coef_probs_common(fc->coef_probs_32x32, TX_32X32, r); read_coef_probs_common(fc, TX_32X32, r);
} }
static void setup_segmentation(VP9_COMMON *pc, MACROBLOCKD *xd, vp9_reader *r) { static void setup_segmentation(VP9_COMMON *pc, MACROBLOCKD *xd, vp9_reader *r) {
...@@ -798,19 +797,13 @@ static void setup_frame_size(VP9D_COMP *pbi, int scaling_active, ...@@ -798,19 +797,13 @@ static void setup_frame_size(VP9D_COMP *pbi, int scaling_active,
} }
static void update_frame_context(FRAME_CONTEXT *fc) { static void update_frame_context(FRAME_CONTEXT *fc) {
vp9_copy(fc->pre_coef_probs_4x4, fc->coef_probs_4x4); vp9_copy(fc->pre_coef_probs, fc->coef_probs);
vp9_copy(fc->pre_coef_probs_8x8, fc->coef_probs_8x8);
vp9_copy(fc->pre_coef_probs_16x16, fc->coef_probs_16x16);
vp9_copy(fc->pre_coef_probs_32x32, fc->coef_probs_32x32);
vp9_copy(fc->pre_y_mode_prob, fc->y_mode_prob); vp9_copy(fc->pre_y_mode_prob, fc->y_mode_prob);
vp9_copy(fc->pre_uv_mode_prob, fc->uv_mode_prob); vp9_copy(fc->pre_uv_mode_prob, fc->uv_mode_prob);
vp9_copy(fc->pre_partition_prob, fc->partition_prob); vp9_copy(fc->pre_partition_prob, fc->partition_prob);
fc->pre_nmvc = fc->nmvc; fc->pre_nmvc = fc->nmvc;
vp9_zero(fc->coef_counts_4x4); vp9_zero(fc->coef_counts);
vp9_zero(fc->coef_counts_8x8);
vp9_zero(fc->coef_counts_16x16);
vp9_zero(fc->coef_counts_32x32);
vp9_zero(fc->eob_branch_counts); vp9_zero(fc->eob_branch_counts);
vp9_zero(fc->y_mode_counts); vp9_zero(fc->y_mode_counts);
vp9_zero(fc->uv_mode_counts); vp9_zero(fc->uv_mode_counts);
......
...@@ -120,6 +120,8 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd, ...@@ -120,6 +120,8 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
int skip_eob_node = 0; int skip_eob_node = 0;
#endif #endif
coef_probs = fc->coef_probs[txfm_size][type][ref];
coef_counts = fc->coef_counts[txfm_size];
switch (txfm_size) { switch (txfm_size) {
default: default:
case TX_4X4: { case TX_4X4: {
...@@ -128,8 +130,6 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd, ...@@ -128,8 +130,6 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
scan = get_scan_4x4(tx_type); scan = get_scan_4x4(tx_type);
above_ec = A[0] != 0; above_ec = A[0] != 0;
left_ec = L[0] != 0; left_ec = L[0] != 0;
coef_probs = fc->coef_probs_4x4[type][ref];
coef_counts = fc->coef_counts_4x4;
default_eob = 16; default_eob = 16;
band_translate = vp9_coefband_trans_4x4; band_translate = vp9_coefband_trans_4x4;
break; break;
...@@ -142,8 +142,6 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd, ...@@ -142,8 +142,6 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
tx_type = (type == PLANE_TYPE_Y_WITH_DC) ? tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
get_tx_type_8x8(xd, y + (x >> 1)) : DCT_DCT; get_tx_type_8x8(xd, y + (x >> 1)) : DCT_DCT;
scan = get_scan_8x8(tx_type); scan = get_scan_8x8(tx_type);
coef_probs = fc->coef_probs_8x8[type][ref];
coef_counts = fc->coef_counts_8x8;
above_ec = (A[0] + A[1]) != 0; above_ec = (A[0] + A[1]) != 0;
left_ec = (L[0] + L[1]) != 0; left_ec = (L[0] + L[1]) != 0;
default_eob = 64; default_eob = 64;
...@@ -158,8 +156,6 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd, ...@@ -158,8 +156,6 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
tx_type = (type == PLANE_TYPE_Y_WITH_DC) ? tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
get_tx_type_16x16(xd, y + (x >> 2)) : DCT_DCT; get_tx_type_16x16(xd, y + (x >> 2)) : DCT_DCT;
scan = get_scan_16x16(tx_type); scan = get_scan_16x16(tx_type);
coef_probs = fc->coef_probs_16x16[type][ref];
coef_counts = fc->coef_counts_16x16;
above_ec = (A[0] + A[1] + A[2] + A[3]) != 0; above_ec = (A[0] + A[1] + A[2] + A[3]) != 0;
left_ec = (L[0] + L[1] + L[2] + L[3]) != 0; left_ec = (L[0] + L[1] + L[2] + L[3]) != 0;
default_eob = 256; default_eob = 256;
...@@ -168,8 +164,6 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd, ...@@ -168,8 +164,6 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
} }
case TX_32X32: case TX_32X32:
scan = vp9_default_scan_32x32; scan = vp9_default_scan_32x32;
coef_probs = fc->coef_probs_32x32[type][ref];
coef_counts = fc->coef_counts_32x32;
above_ec = (A[0] + A[1] + A[2] + A[3] + A[4] + A[5] + A[6] + A[7]) != 0; above_ec = (A[0] + A[1] + A[2] + A[3] + A[4] + A[5] + A[6] + A[7]) != 0;
left_ec = (L[0] + L[1] + L[2] + L[3] + L[4] + L[5] + L[6] + L[7]) != 0; left_ec = (L[0] + L[1] + L[2] + L[3] + L[4] + L[5] + L[6] + L[7]) != 0;
default_eob = 1024; default_eob = 1024;
......
...@@ -43,10 +43,7 @@ unsigned __int64 Sectionbits[500]; ...@@ -43,10 +43,7 @@ unsigned __int64 Sectionbits[500];
int intra_mode_stats[VP9_INTRA_MODES] int intra_mode_stats[VP9_INTRA_MODES]
[VP9_INTRA_MODES] [VP9_INTRA_MODES]
[VP9_INTRA_MODES]; [VP9_INTRA_MODES];
vp9_coeff_stats tree_update_hist_4x4[BLOCK_TYPES]; vp9_coeff_stats tree_update_hist[TX_SIZE_MAX_SB][BLOCK_TYPES];
vp9_coeff_stats tree_update_hist_8x8[BLOCK_TYPES];
vp9_coeff_stats tree_update_hist_16x16[BLOCK_TYPES];
vp9_coeff_stats tree_update_hist_32x32[BLOCK_TYPES];
extern unsigned int active_section; extern unsigned int active_section;
#endif #endif
...@@ -1014,24 +1011,20 @@ static void print_prob_tree(vp9_coeff_probs *coef_probs, int block_types) { ...@@ -1014,24 +1011,20 @@ static void print_prob_tree(vp9_coeff_probs *coef_probs, int block_types) {
fclose(f); fclose(f);
} }
static void build_tree_distribution(vp9_coeff_probs_model *coef_probs, static void build_tree_distribution(VP9_COMP *cpi, TX_SIZE txfm_size) {
vp9_coeff_count *coef_counts, vp9_coeff_probs_model *coef_probs = cpi->frame_coef_probs[txfm_size];
unsigned int (*eob_branch_ct)[REF_TYPES] vp9_coeff_count *coef_counts = cpi->coef_counts[txfm_size];
[COEF_BANDS] unsigned int (*eob_branch_ct)[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS] =
[PREV_COEF_CONTEXTS], cpi->common.fc.eob_branch_counts[txfm_size];
#ifdef ENTROPY_STATS vp9_coeff_stats *coef_branch_ct = cpi->frame_branch_ct[txfm_size];
VP9_COMP *cpi,
vp9_coeff_accum *context_counters,
#endif
vp9_coeff_stats *coef_branch_ct,
int block_types) {
int i, j, k, l;
#ifdef ENTROPY_STATS #ifdef ENTROPY_STATS
vp9_coeff_accum *context_counters = context_counters[txfm_size];
int t = 0; int t = 0;
#endif #endif
vp9_prob full_probs[ENTROPY_NODES]; vp9_prob full_probs[ENTROPY_NODES];
int i, j, k, l;
for (i = 0; i < block_types; ++i) { for (i = 0; i < BLOCK_TYPES; ++i) {
for (j = 0; j < REF_TYPES; ++j) { for (j = 0; j < REF_TYPES; ++j) {
for (k = 0; k < COEF_BANDS; ++k) { for (k = 0; k < COEF_BANDS; ++k) {
for (l = 0; l < PREV_COEF_CONTEXTS; ++l) { for (l = 0; l < PREV_COEF_CONTEXTS; ++l) {
...@@ -1071,46 +1064,20 @@ static void build_tree_distribution(vp9_coeff_probs_model *coef_probs, ...@@ -1071,46 +1064,20 @@ static void build_tree_distribution(vp9_coeff_probs_model *coef_probs,
} }
static void build_coeff_contexts(VP9_COMP *cpi) { static void build_coeff_contexts(VP9_COMP *cpi) {
build_tree_distribution(cpi->frame_coef_probs_4x4, TX_SIZE t;
cpi->coef_counts_4x4, for (t = TX_4X4; t <= TX_32X32; t++)
cpi->common.fc.eob_branch_counts[TX_4X4], build_tree_distribution(cpi, t);
#ifdef ENTROPY_STATS
cpi, context_counters_4x4,
#endif
cpi->frame_branch_ct_4x4, BLOCK_TYPES);
build_tree_distribution(cpi->frame_coef_probs_8x8,
cpi->coef_counts_8x8,
cpi->common.fc.eob_branch_counts[TX_8X8],
#ifdef ENTROPY_STATS
cpi, context_counters_8x8,
#endif
cpi->frame_branch_ct_8x8, BLOCK_TYPES);
build_tree_distribution(cpi->frame_coef_probs_16x16,
cpi->coef_counts_16x16,
cpi->common.fc.eob_branch_counts[TX_16X16],
#ifdef ENTROPY_STATS
cpi, context_counters_16x16,
#endif
cpi->frame_branch_ct_16x16, BLOCK_TYPES);
build_tree_distribution(cpi->frame_coef_probs_32x32,
cpi->coef_counts_32x32,
cpi->common.fc.eob_branch_counts[TX_32X32],
#ifdef ENTROPY_STATS
cpi, context_counters_32x32,
#endif
cpi->frame_branch_ct_32x32, BLOCK_TYPES);
} }
static void update_coef_probs_common( static void update_coef_probs_common(vp9_writer* const bc, VP9_COMP *cpi,
vp9_writer* const bc, TX_SIZE tx_size) {
VP9_COMP *cpi,
#ifdef ENTROPY_STATS #ifdef ENTROPY_STATS
vp9_coeff_stats *tree_update_hist, vp9_coeff_stats *tree_update_hist = tree_update_hist[tx_size];
#endif #endif
vp9_coeff_probs_model *new_frame_coef_probs, vp9_coeff_probs_model *new_frame_coef_probs = cpi->frame_coef_probs[tx_size];
vp9_coeff_probs_model *old_frame_coef_probs, vp9_coeff_probs_model *old_frame_coef_probs =
vp9_coeff_stats *frame_branch_ct, cpi->common.fc.coef_probs[tx_size];
TX_SIZE tx_size) { vp9_coeff_stats *frame_branch_ct = cpi->frame_branch_ct[tx_size];
int i, j, k, l, t; int i, j, k, l, t;
int update[2] = {0, 0}; int update[2] = {0, 0};
int savings; int savings;
...@@ -1208,51 +1175,19 @@ static void update_coef_probs(VP9_COMP* const cpi, vp9_writer* const bc) { ...@@ -1208,51 +1175,19 @@ static void update_coef_probs(VP9_COMP* const cpi, vp9_writer* const bc) {
// Build the cofficient contexts based on counts collected in encode loop // Build the cofficient contexts based on counts collected in encode loop
build_coeff_contexts(cpi); build_coeff_contexts(cpi);
update_coef_probs_common(bc, update_coef_probs_common(bc, cpi, TX_4X4);
cpi,
#ifdef ENTROPY_STATS
tree_update_hist_4x4,
#endif
cpi->frame_coef_probs_4x4,
cpi->common.fc.coef_probs_4x4,
cpi->frame_branch_ct_4x4,
TX_4X4);
/* do not do this if not even allowed */ /* do not do this if not even allowed */
if (cpi->common.txfm_mode != ONLY_4X4) { if (cpi->common.txfm_mode != ONLY_4X4) {
update_coef_probs_common(bc, update_coef_probs_common(bc, cpi, TX_8X8);
cpi,
#ifdef ENTROPY_STATS
tree_update_hist_8x8,
#endif
cpi->frame_coef_probs_8x8,
cpi->common.fc.coef_probs_8x8,
cpi->frame_branch_ct_8x8,
TX_8X8);
} }
if (cpi->common.txfm_mode > ALLOW_8X8) { if (cpi->common.txfm_mode > ALLOW_8X8) {
update_coef_probs_common(bc, update_coef_probs_common(bc, cpi, TX_16X16);
cpi,
#ifdef ENTROPY_STATS
tree_update_hist_16x16,
#endif
cpi->frame_coef_probs_16x16,
cpi->common.fc.coef_probs_16x16,
cpi->frame_branch_ct_16x16,
TX_16X16);
} }
if (cpi->common.txfm_mode > ALLOW_16X16) { if (cpi->common.txfm_mode > ALLOW_16X16) {
update_coef_probs_common(bc, update_coef_probs_common(bc, cpi, TX_32X32);
cpi,
#ifdef ENTROPY_STATS
tree_update_hist_32x32,
#endif
cpi->frame_coef_probs_32x32,
cpi->common.fc.coef_probs_32x32,
cpi->frame_branch_ct_32x32,
TX_32X32);
} }
} }
...@@ -1665,15 +1600,7 @@ void vp9_pack_bitstream(VP9_COMP *cpi, uint8_t *dest, unsigned long *size) { ...@@ -1665,15 +1600,7 @@ void vp9_pack_bitstream(VP9_COMP *cpi, uint8_t *dest, unsigned long *size) {
vp9_clear_system_state(); // __asm emms; vp9_clear_system_state(); // __asm emms;
vp9_copy(cpi->common.fc.pre_coef_probs_4x4, vp9_copy(cpi->common.fc.pre_coef_probs, cpi->common.fc.coef_probs);
cpi->common.fc.coef_probs_4x4);
vp9_copy(cpi->common.fc.pre_coef_probs_8x8,
cpi->common.fc.coef_probs_8x8);
vp9_copy(cpi->common.fc.pre_coef_probs_16x16,
cpi->common.fc.coef_probs_16x16);
vp9_copy(cpi->common.fc.pre_coef_probs_32x32,
cpi->common.fc.coef_probs_32x32);
vp9_copy(cpi->common.fc.pre_y_mode_prob, cpi->common.fc.y_mode_prob); vp9_copy(cpi->common.fc.pre_y_mode_prob, cpi->common.fc.y_mode_prob);
vp9_copy(cpi->common.fc.pre_uv_mode_prob, cpi->common.fc.uv_mode_prob); vp9_copy(cpi->common.fc.pre_uv_mode_prob, cpi->common.fc.uv_mode_prob);
vp9_copy(cpi->common.fc.pre_partition_prob, cpi->common.fc.partition_prob); vp9_copy(cpi->common.fc.pre_partition_prob, cpi->common.fc.partition_prob);
...@@ -1839,21 +1766,18 @@ void print_tree_update_probs() { ...@@ -1839,21 +1766,18 @@ void print_tree_update_probs() {
FILE *f = fopen("coefupdprob.h", "w"); FILE *f = fopen("coefupdprob.h", "w");
fprintf(f, "\n/* Update probabilities for token entropy tree. */\n\n"); fprintf(f, "\n/* Update probabilities for token entropy tree. */\n\n");
print_tree_update_for_type(f, tree_update_hist_4x4, BLOCK_TYPES, print_tree_update_for_type(f, tree_update_hist[TX_4X4], BLOCK_TYPES,
"vp9_coef_update_probs_4x4[BLOCK_TYPES]"); "vp9_coef_update_probs_4x4[BLOCK_TYPES]");
print_tree_update_for_type(f, tree_update_hist_8x8, BLOCK_TYPES, print_tree_update_for_type(f, tree_update_hist[TX_8X8], BLOCK_TYPES,
"vp9_coef_update_probs_8x8[BLOCK_TYPES]"); "vp9_coef_update_probs_8x8[BLOCK_TYPES]");
print_tree_update_for_type(f, tree_update_hist_16x16, BLOCK_TYPES, print_tree_update_for_type(f, tree_update_hist[TX_16X16], BLOCK_TYPES,
"vp9_coef_update_probs_16x16[BLOCK_TYPES]"); "vp9_coef_update_probs_16x16[BLOCK_TYPES]");
print_tree_update_for_type(f, tree_update_hist_32x32, BLOCK_TYPES, print_tree_update_for_type(f, tree_update_hist[TX_32X32], BLOCK_TYPES,
"vp9_coef_update_probs_32x32[BLOCK_TYPES]"); "vp9_coef_update_probs_32x32[BLOCK_TYPES]");
fclose(f); fclose(f);
f = fopen("treeupdate.bin", "wb"); f = fopen("treeupdate.bin", "wb");
fwrite(tree_update_hist_4x4, sizeof(tree_update_hist_4x4), 1, f); fwrite(tree_update_hist, sizeof(tree_update_hist), 1, f);
fwrite(tree_update_hist_8x8, sizeof(tree_update_hist_8x8), 1, f);
fwrite(tree_update_hist_16x16, sizeof(tree_update_hist_16x16), 1, f);
fwrite(tree_update_hist_32x32, sizeof(tree_update_hist_32x32), 1, f);
fclose(f); fclose(f);
} }
#endif #endif
...@@ -1534,10 +1534,7 @@ static void encode_frame_internal(VP9_COMP *cpi) { ...@@ -1534,10 +1534,7 @@ static void encode_frame_internal(VP9_COMP *cpi) {
xd->prev_mode_info_context = cm->prev_mi; xd->prev_mode_info_context = cm->prev_mi;
vp9_zero(cpi->NMVcount); vp9_zero(cpi->NMVcount);
vp9_zero(cpi->coef_counts_4x4); vp9_zero(cpi->coef_counts);
vp9_zero(cpi->coef_counts_8x8);
vp9_zero(cpi->coef_counts_16x16);
vp9_zero(cpi->coef_counts_32x32);
vp9_zero(cm->fc.eob_branch_counts); vp9_zero(cm->fc.eob_branch_counts);
cpi->mb.e_mbd.lossless = cm->base_qindex == 0 && cpi->mb.e_mbd.lossless = cm->base_qindex == 0 &&
......
...@@ -466,8 +466,8 @@ static void configure_static_seg_features(VP9_COMP *cpi) { ...@@ -466,8 +466,8 @@ static void configure_static_seg_features(VP9_COMP *cpi) {
void vp9_update_mode_context_stats(VP9_COMP *cpi) { void vp9_update_mode_context_stats(VP9_COMP *cpi) {
VP9_COMMON *cm = &cpi->common; VP9_COMMON *cm = &cpi->common;
int i, j; int i, j;
unsigned int (*mv_ref_ct)[4][2] = cm->fc.mv_ref_ct; unsigned int (*mv_ref_ct)[VP9_MVREFS - 1][2] = cm->fc.mv_ref_ct;
int64_t (*mv_ref_stats)[4][2] = cpi->mv_ref_stats; int64_t (*mv_ref_stats)[VP9_MVREFS - 1][2] = cpi->mv_ref_stats;
FILE *f; FILE *f;
// Read the past stats counters // Read the past stats counters
...@@ -2422,7 +2422,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, ...@@ -2422,7 +2422,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
unsigned int *frame_flags) { unsigned int *frame_flags) {
VP9_COMMON *cm = &cpi->common; VP9_COMMON *cm = &cpi->common;
MACROBLOCKD *xd = &cpi->mb.e_mbd; MACROBLOCKD *xd = &cpi->mb.e_mbd;
TX_SIZE t;
int q; int q;
int frame_over_shoot_limit; int frame_over_shoot_limit;
int frame_under_shoot_limit; int frame_under_shoot_limit;
...@@ -3100,14 +3100,9 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, ...@@ -3100,14 +3100,9 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
release_scaled_references(cpi); release_scaled_references(cpi);
update_reference_frames(cpi); update_reference_frames(cpi);
vp9_full_to_model_counts(cpi->common.fc.coef_counts_4x4, for (t = TX_4X4; t <= TX_32X32; t++)
cpi->coef_counts_4x4); vp9_full_to_model_counts(cpi->common.fc.coef_counts[t],
vp9_full_to_model_counts(cpi->common.fc.coef_counts_8x8, cpi->coef_counts[t]);
cpi->coef_counts_8x8);
vp9_full_to_model_counts(cpi->common.fc.coef_counts_16x16,
cpi->coef_counts_16x16);
vp9_full_to_model_counts(cpi->common.fc.coef_counts_32x32,
cpi->coef_counts_32x32);
if (!cpi->common.error_resilient_mode && if (!cpi->common.error_resilient_mode &&
!cpi->common.frame_parallel_decoding_mode) { !cpi->common.frame_parallel_decoding_mode) {
vp9_adapt_coef_probs(&cpi->common); vp9_adapt_coef_probs(&cpi->common);
......
...@@ -76,10 +76,7 @@ typedef struct { ...@@ -76,10 +76,7 @@ typedef struct {
// 0 = I4X4_PRED, ZERO_MV, MV, SPLIT // 0 = I4X4_PRED, ZERO_MV, MV, SPLIT
signed char last_mode_lf_deltas[MAX_MODE_LF_DELTAS]; signed char last_mode_lf_deltas[MAX_MODE_LF_DELTAS];
vp9_coeff_probs_model coef_probs_4x4[BLOCK_TYPES]; vp9_coeff_probs_model coef_probs[TX_SIZE_MAX_SB][BLOCK_TYPES];
vp9_coeff_probs_model coef_probs_8x8[BLOCK_TYPES];
vp9_coeff_probs_model coef_probs_16x16[BLOCK_TYPES];
vp9_coeff_probs_model coef_probs_32x32[BLOCK_TYPES];