Commit a288cb3b authored by Ronald S. Bultje's avatar Ronald S. Bultje Committed by Gerrit Code Review
Browse files

Merge "Merge all various transform size data trackers into single variables." into experimental

parents 1e025dbf e9d68a5e
......@@ -483,14 +483,14 @@ int vp9_get_coef_context(const int *scan, const int *neighbors,
};
void vp9_default_coef_probs(VP9_COMMON *pc) {
vpx_memcpy(pc->fc.coef_probs_4x4, default_coef_probs_4x4,
sizeof(pc->fc.coef_probs_4x4));
vpx_memcpy(pc->fc.coef_probs_8x8, default_coef_probs_8x8,
sizeof(pc->fc.coef_probs_8x8));
vpx_memcpy(pc->fc.coef_probs_16x16, default_coef_probs_16x16,
sizeof(pc->fc.coef_probs_16x16));
vpx_memcpy(pc->fc.coef_probs_32x32, default_coef_probs_32x32,
sizeof(pc->fc.coef_probs_32x32));
vpx_memcpy(pc->fc.coef_probs[TX_4X4], default_coef_probs_4x4,
sizeof(pc->fc.coef_probs[TX_4X4]));
vpx_memcpy(pc->fc.coef_probs[TX_8X8], default_coef_probs_8x8,
sizeof(pc->fc.coef_probs[TX_8X8]));
vpx_memcpy(pc->fc.coef_probs[TX_16X16], default_coef_probs_16x16,
sizeof(pc->fc.coef_probs[TX_16X16]));
vpx_memcpy(pc->fc.coef_probs[TX_32X32], default_coef_probs_32x32,
sizeof(pc->fc.coef_probs[TX_32X32]));
}
// Neighborhood 5-tuples for various scans and blocksizes,
......@@ -677,13 +677,13 @@ void vp9_full_to_model_counts(
}
}
static void adapt_coef_probs(
vp9_coeff_probs_model *dst_coef_probs,
vp9_coeff_probs_model *pre_coef_probs,
vp9_coeff_count_model *coef_counts,
unsigned int (*eob_branch_count)[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS],
int count_sat,
int update_factor) {
static void adapt_coef_probs(VP9_COMMON *cm, TX_SIZE txfm_size,
int count_sat, int update_factor) {
vp9_coeff_probs_model *dst_coef_probs = cm->fc.coef_probs[txfm_size];
vp9_coeff_probs_model *pre_coef_probs = cm->fc.pre_coef_probs[txfm_size];
vp9_coeff_count_model *coef_counts = cm->fc.coef_counts[txfm_size];
unsigned int (*eob_branch_count)[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS] =
cm->fc.eob_branch_counts[txfm_size];
int t, i, j, k, l, count;
int factor;
unsigned int branch_ct[UNCONSTRAINED_NODES][2];
......@@ -719,6 +719,7 @@ static void adapt_coef_probs(
}
void vp9_adapt_coef_probs(VP9_COMMON *cm) {
TX_SIZE t;
int count_sat;
int update_factor; /* denominator 256 */
......@@ -732,20 +733,6 @@ void vp9_adapt_coef_probs(VP9_COMMON *cm) {
update_factor = COEF_MAX_UPDATE_FACTOR;
count_sat = COEF_COUNT_SAT;
}
adapt_coef_probs(cm->fc.coef_probs_4x4, cm->fc.pre_coef_probs_4x4,
cm->fc.coef_counts_4x4,
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);
for (t = TX_4X4; t <= TX_32X32; t++)
adapt_coef_probs(cm, t, count_sat, update_factor);
}
......@@ -62,18 +62,9 @@ typedef struct frame_contexts {
unsigned int uv_mode_counts[VP9_INTRA_MODES][VP9_INTRA_MODES];
unsigned int partition_counts[NUM_PARTITION_CONTEXTS][PARTITION_TYPES];
vp9_coeff_probs_model coef_probs_4x4[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];
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];
vp9_coeff_probs_model coef_probs[TX_SIZE_MAX_SB][BLOCK_TYPES];
vp9_coeff_probs_model pre_coef_probs[TX_SIZE_MAX_SB][BLOCK_TYPES];
vp9_coeff_count_model coef_counts[TX_SIZE_MAX_SB][BLOCK_TYPES];
unsigned int eob_branch_counts[TX_SIZE_MAX_SB][BLOCK_TYPES][REF_TYPES]
[COEF_BANDS][PREV_COEF_CONTEXTS];
......
......@@ -580,11 +580,10 @@ static void init_frame(VP9D_COMP *pbi) {
xd->mode_info_stride = pc->mode_info_stride;
}
static void read_coef_probs_common(
vp9_coeff_probs_model *coef_probs,
TX_SIZE tx_size,
vp9_reader *r) {
static void read_coef_probs_common(FRAME_CONTEXT *fc, TX_SIZE tx_size,
vp9_reader *r) {
const int entropy_nodes_update = UNCONSTRAINED_NODES;
vp9_coeff_probs_model *coef_probs = fc->coef_probs[tx_size];
int i, j, k, l, m;
......@@ -615,16 +614,16 @@ static void read_coef_probs(VP9D_COMP *pbi, vp9_reader *r) {
const TXFM_MODE mode = pbi->common.txfm_mode;
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)
read_coef_probs_common(fc->coef_probs_8x8, TX_8X8, r);
read_coef_probs_common(fc, TX_8X8, r);
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)
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) {
......@@ -801,19 +800,13 @@ static void setup_frame_size(VP9D_COMP *pbi, int scaling_active,
}
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_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_coef_probs, fc->coef_probs);
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_partition_prob, fc->partition_prob);
fc->pre_nmvc = fc->nmvc;
vp9_zero(fc->coef_counts_4x4);
vp9_zero(fc->coef_counts_8x8);
vp9_zero(fc->coef_counts_16x16);
vp9_zero(fc->coef_counts_32x32);
vp9_zero(fc->coef_counts);
vp9_zero(fc->eob_branch_counts);
vp9_zero(fc->y_mode_counts);
vp9_zero(fc->uv_mode_counts);
......
......@@ -120,6 +120,8 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
int skip_eob_node = 0;
#endif
coef_probs = fc->coef_probs[txfm_size][type][ref];
coef_counts = fc->coef_counts[txfm_size];
switch (txfm_size) {
default:
case TX_4X4: {
......@@ -128,8 +130,6 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
scan = get_scan_4x4(tx_type);
above_ec = A[0] != 0;
left_ec = L[0] != 0;
coef_probs = fc->coef_probs_4x4[type][ref];
coef_counts = fc->coef_counts_4x4;
default_eob = 16;
band_translate = vp9_coefband_trans_4x4;
break;
......@@ -142,8 +142,6 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
get_tx_type_8x8(xd, y + (x >> 1)) : DCT_DCT;
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;
left_ec = (L[0] + L[1]) != 0;
default_eob = 64;
......@@ -158,8 +156,6 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
get_tx_type_16x16(xd, y + (x >> 2)) : DCT_DCT;
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;
left_ec = (L[0] + L[1] + L[2] + L[3]) != 0;
default_eob = 256;
......@@ -168,8 +164,6 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
}
case TX_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;
left_ec = (L[0] + L[1] + L[2] + L[3] + L[4] + L[5] + L[6] + L[7]) != 0;
default_eob = 1024;
......
......@@ -43,10 +43,7 @@ unsigned __int64 Sectionbits[500];
int intra_mode_stats[VP9_INTRA_MODES]
[VP9_INTRA_MODES]
[VP9_INTRA_MODES];
vp9_coeff_stats tree_update_hist_4x4[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];
vp9_coeff_stats tree_update_hist[TX_SIZE_MAX_SB][BLOCK_TYPES];
extern unsigned int active_section;
#endif
......@@ -1014,24 +1011,20 @@ static void print_prob_tree(vp9_coeff_probs *coef_probs, int block_types) {
fclose(f);
}
static void build_tree_distribution(vp9_coeff_probs_model *coef_probs,
vp9_coeff_count *coef_counts,
unsigned int (*eob_branch_ct)[REF_TYPES]
[COEF_BANDS]
[PREV_COEF_CONTEXTS],
#ifdef ENTROPY_STATS
VP9_COMP *cpi,
vp9_coeff_accum *context_counters,
#endif
vp9_coeff_stats *coef_branch_ct,
int block_types) {
int i, j, k, l;
static void build_tree_distribution(VP9_COMP *cpi, TX_SIZE txfm_size) {
vp9_coeff_probs_model *coef_probs = cpi->frame_coef_probs[txfm_size];
vp9_coeff_count *coef_counts = cpi->coef_counts[txfm_size];
unsigned int (*eob_branch_ct)[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS] =
cpi->common.fc.eob_branch_counts[txfm_size];
vp9_coeff_stats *coef_branch_ct = cpi->frame_branch_ct[txfm_size];
#ifdef ENTROPY_STATS
vp9_coeff_accum *context_counters = context_counters[txfm_size];
int t = 0;
#endif
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 (k = 0; k < COEF_BANDS; ++k) {
for (l = 0; l < PREV_COEF_CONTEXTS; ++l) {
......@@ -1071,46 +1064,20 @@ static void build_tree_distribution(vp9_coeff_probs_model *coef_probs,
}
static void build_coeff_contexts(VP9_COMP *cpi) {
build_tree_distribution(cpi->frame_coef_probs_4x4,
cpi->coef_counts_4x4,
cpi->common.fc.eob_branch_counts[TX_4X4],
#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);
TX_SIZE t;
for (t = TX_4X4; t <= TX_32X32; t++)
build_tree_distribution(cpi, t);
}
static void update_coef_probs_common(
vp9_writer* const bc,
VP9_COMP *cpi,
static void update_coef_probs_common(vp9_writer* const bc, VP9_COMP *cpi,
TX_SIZE tx_size) {
#ifdef ENTROPY_STATS
vp9_coeff_stats *tree_update_hist,
vp9_coeff_stats *tree_update_hist = tree_update_hist[tx_size];
#endif
vp9_coeff_probs_model *new_frame_coef_probs,
vp9_coeff_probs_model *old_frame_coef_probs,
vp9_coeff_stats *frame_branch_ct,
TX_SIZE tx_size) {
vp9_coeff_probs_model *new_frame_coef_probs = cpi->frame_coef_probs[tx_size];
vp9_coeff_probs_model *old_frame_coef_probs =
cpi->common.fc.coef_probs[tx_size];
vp9_coeff_stats *frame_branch_ct = cpi->frame_branch_ct[tx_size];
int i, j, k, l, t;
int update[2] = {0, 0};
int savings;
......@@ -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_coeff_contexts(cpi);
update_coef_probs_common(bc,
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);
update_coef_probs_common(bc, cpi, TX_4X4);
/* do not do this if not even allowed */
if (cpi->common.txfm_mode != ONLY_4X4) {
update_coef_probs_common(bc,
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);
update_coef_probs_common(bc, cpi, TX_8X8);
}
if (cpi->common.txfm_mode > ALLOW_8X8) {
update_coef_probs_common(bc,
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);
update_coef_probs_common(bc, cpi, TX_16X16);
}
if (cpi->common.txfm_mode > ALLOW_16X16) {
update_coef_probs_common(bc,
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);
update_coef_probs_common(bc, cpi, TX_32X32);
}
}
......@@ -1665,15 +1600,7 @@ void vp9_pack_bitstream(VP9_COMP *cpi, uint8_t *dest, unsigned long *size) {
vp9_clear_system_state(); // __asm emms;
vp9_copy(cpi->common.fc.pre_coef_probs_4x4,
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_coef_probs, cpi->common.fc.coef_probs);
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_partition_prob, cpi->common.fc.partition_prob);
......@@ -1839,21 +1766,18 @@ void print_tree_update_probs() {
FILE *f = fopen("coefupdprob.h", "w");
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]");
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]");
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]");
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]");
fclose(f);
f = fopen("treeupdate.bin", "wb");
fwrite(tree_update_hist_4x4, sizeof(tree_update_hist_4x4), 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);
fwrite(tree_update_hist, sizeof(tree_update_hist), 1, f);
fclose(f);
}
#endif
......@@ -1537,10 +1537,7 @@ static void encode_frame_internal(VP9_COMP *cpi) {
xd->prev_mode_info_context = cm->prev_mi;
vp9_zero(cpi->NMVcount);
vp9_zero(cpi->coef_counts_4x4);
vp9_zero(cpi->coef_counts_8x8);
vp9_zero(cpi->coef_counts_16x16);
vp9_zero(cpi->coef_counts_32x32);
vp9_zero(cpi->coef_counts);
vp9_zero(cm->fc.eob_branch_counts);
cpi->mb.e_mbd.lossless = cm->base_qindex == 0 &&
......
......@@ -466,8 +466,8 @@ static void configure_static_seg_features(VP9_COMP *cpi) {
void vp9_update_mode_context_stats(VP9_COMP *cpi) {
VP9_COMMON *cm = &cpi->common;
int i, j;
unsigned int (*mv_ref_ct)[4][2] = cm->fc.mv_ref_ct;
int64_t (*mv_ref_stats)[4][2] = cpi->mv_ref_stats;
unsigned int (*mv_ref_ct)[VP9_MVREFS - 1][2] = cm->fc.mv_ref_ct;
int64_t (*mv_ref_stats)[VP9_MVREFS - 1][2] = cpi->mv_ref_stats;
FILE *f;
// Read the past stats counters
......@@ -2422,7 +2422,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
unsigned int *frame_flags) {
VP9_COMMON *cm = &cpi->common;
MACROBLOCKD *xd = &cpi->mb.e_mbd;
TX_SIZE t;
int q;
int frame_over_shoot_limit;
int frame_under_shoot_limit;
......@@ -3100,14 +3100,9 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
release_scaled_references(cpi);
update_reference_frames(cpi);
vp9_full_to_model_counts(cpi->common.fc.coef_counts_4x4,
cpi->coef_counts_4x4);
vp9_full_to_model_counts(cpi->common.fc.coef_counts_8x8,
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);
for (t = TX_4X4; t <= TX_32X32; t++)
vp9_full_to_model_counts(cpi->common.fc.coef_counts[t],
cpi->coef_counts[t]);
if (!cpi->common.error_resilient_mode &&
!cpi->common.frame_parallel_decoding_mode) {
vp9_adapt_coef_probs(&cpi->common);
......
......@@ -76,10 +76,7 @@ typedef struct {
// 0 = I4X4_PRED, ZERO_MV, MV, SPLIT
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_8x8[BLOCK_TYPES];
vp9_coeff_probs_model coef_probs_16x16[BLOCK_TYPES];
vp9_coeff_probs_model coef_probs_32x32[BLOCK_TYPES];
vp9_coeff_probs_model coef_probs[TX_SIZE_MAX_SB][BLOCK_TYPES];
vp9_prob y_mode_prob[VP9_INTRA_MODES - 1]; /* interframe intra mode probs */
vp9_prob uv_mode_prob[VP9_INTRA_MODES][VP9_INTRA_MODES - 1];
......@@ -414,21 +411,9 @@ typedef struct VP9_COMP {
nmv_context_counts NMVcount;
vp9_coeff_count coef_counts_4x4[BLOCK_TYPES];
vp9_coeff_probs_model frame_coef_probs_4x4[BLOCK_TYPES];
vp9_coeff_stats frame_branch_ct_4x4[BLOCK_TYPES];
vp9_coeff_count coef_counts_8x8[BLOCK_TYPES];
vp9_coeff_probs_model frame_coef_probs_8x8[BLOCK_TYPES];
vp9_coeff_stats frame_branch_ct_8x8[BLOCK_TYPES];
vp9_coeff_count coef_counts_16x16[BLOCK_TYPES];
vp9_coeff_probs_model frame_coef_probs_16x16[BLOCK_TYPES];
vp9_coeff_stats frame_branch_ct_16x16[BLOCK_TYPES];
vp9_coeff_count coef_counts_32x32[BLOCK_TYPES];
vp9_coeff_probs_model frame_coef_probs_32x32[BLOCK_TYPES];
vp9_coeff_stats frame_branch_ct_32x32[BLOCK_TYPES];
vp9_coeff_count coef_counts[TX_SIZE_MAX_SB][BLOCK_TYPES];
vp9_coeff_probs_model frame_coef_probs[TX_SIZE_MAX_SB][BLOCK_TYPES];
vp9_coeff_stats frame_branch_ct[TX_SIZE_MAX_SB][BLOCK_TYPES];
int gfu_boost;
int last_boost;
......
......@@ -139,10 +139,7 @@ void vp9_save_coding_context(VP9_COMP *cpi) {
vp9_copy(cc->last_ref_lf_deltas, xd->last_ref_lf_deltas);
vp9_copy(cc->last_mode_lf_deltas, xd->last_mode_lf_deltas);
vp9_copy(cc->coef_probs_4x4, cm->fc.coef_probs_4x4);
vp9_copy(cc->coef_probs_8x8, cm->fc.coef_probs_8x8);
vp9_copy(cc->coef_probs_16x16, cm->fc.coef_probs_16x16);
vp9_copy(cc->coef_probs_32x32, cm->fc.coef_probs_32x32);
vp9_copy(cc->coef_probs, cm->fc.coef_probs);
vp9_copy(cc->switchable_interp_prob, cm->fc.switchable_interp_prob);
}
......@@ -177,10 +174,7 @@ void vp9_restore_coding_context(VP9_COMP *cpi) {
vp9_copy(xd->last_ref_lf_deltas, cc->last_ref_lf_deltas);
vp9_copy(xd->last_mode_lf_deltas, cc->last_mode_lf_deltas);
vp9_copy(cm->fc.coef_probs_4x4, cc->coef_probs_4x4);
vp9_copy(cm->fc.coef_probs_8x8, cc->coef_probs_8x8);
vp9_copy(cm->fc.coef_probs_16x16, cc->coef_probs_16x16);
vp9_copy(cm->fc.coef_probs_32x32, cc->coef_probs_32x32);
vp9_copy(cm->fc.coef_probs, cc->coef_probs);
vp9_copy(cm->fc.switchable_interp_prob, cc->switchable_interp_prob);
}
......
......@@ -112,39 +112,41 @@ const MODE_DEFINITION vp9_mode_order[MAX_MODES] = {
};
#if CONFIG_BALANCED_COEFTREE
static void fill_token_costs(vp9_coeff_count *c,
vp9_coeff_count *cnoskip,
vp9_coeff_probs_model *p,
TX_SIZE tx_size) {
static void fill_token_costs(vp9_coeff_count (*c)[BLOCK_TYPES],
vp9_coeff_count (*cnoskip)[BLOCK_TYPES],
vp9_coeff_probs_model (*p)[BLOCK_TYPES]) {
int i, j, k, l;
for (i = 0; i < BLOCK_TYPES; i++)
for (j = 0; j < REF_TYPES; j++)
for (k = 0; k < COEF_BANDS; k++)
for (l = 0; l < PREV_COEF_CONTEXTS; l++) {
vp9_prob probs[ENTROPY_NODES];
vp9_model_to_full_probs(p[i][j][k][l], probs);
vp9_cost_tokens((int *)cnoskip[i][j][k][l], probs,
vp9_coef_tree);
// Replace the eob node prob with a very small value so that the
// cost approximately equals the cost without the eob node
probs[1] = 1;
vp9_cost_tokens((int *)c[i][j][k][l], probs, vp9_coef_tree);
}
TX_SIZE t;
for (t = TX_4X4; t <= TX_32X32; t++)
for (i = 0; i < BLOCK_TYPES; i++)
for (j = 0; j < REF_TYPES; j++)
for (k = 0; k < COEF_BANDS; k++)
for (l = 0; l < PREV_COEF_CONTEXTS; l++) {
vp9_prob probs[ENTROPY_NODES];
vp9_model_to_full_probs(p[t][i][j][k][l], probs);
vp9_cost_tokens((int *)cnoskip[t][i][j][k][l], probs,
vp9_coef_tree);
// Replace the eob node prob with a very small value so that the
// cost approximately equals the cost without the eob node
probs[1] = 1;
vp9_cost_tokens((int *)c[t][i][j][k][l], probs, vp9_coef_tree);
}
}
#else
static void fill_token_costs(vp9_coeff_count *c,
vp9_coeff_probs_model *p,
TX_SIZE tx_size) {
static void fill_token_costs(vp9_coeff_count (*c)[BLOCK_TYPES],
vp9_coeff_probs_model (*p)[BLOCK_TYPES]) {
int i, j, k, l;
for (i = 0; i < BLOCK_TYPES; i++)
for (j = 0; j < REF_TYPES; j++)
for (k = 0; k < COEF_BANDS; k++)
for (l = 0; l < PREV_COEF_CONTEXTS; l++) {
vp9_prob probs[ENTROPY_NODES];
vp9_model_to_full_probs(p[i][j][k][l], probs);
vp9_cost_tokens_skip((int *)c[i][j][k][l], probs,
vp9_coef_tree);
}
TX_SIZE t;
for (t = TX_4X4; t <= TX_32X32; t++)
for (i = 0; i < BLOCK_TYPES; i++)
for (j = 0; j < REF_TYPES; j++)
for (k = 0; k < COEF_BANDS; k++)
for (l = 0; l < PREV_COEF_CONTEXTS; l++) {
vp9_prob probs[ENTROPY_NODES];
vp9_model_to_full_probs(p[t][i][j][k][l], probs);
vp9_cost_tokens_skip((int *)c[t][i][j][k][l], probs,
vp9_coef_tree);
}
}
#endif
......@@ -238,27 +240,12 @@ void vp9_initialize_rd_consts(VP9_COMP *cpi, int qindex) {
}
#if CONFIG_BALANCED_COEFTREE
fill_token_costs(cpi->mb.token_costs[TX_4X4],
cpi->mb.token_costs_noskip[TX_4X4],