Commit a43ff153 authored by Deb Mukherjee's avatar Deb Mukherjee

New probs for filters/tx_size and a few others

* New probs for subpel filters/tx_count
* Makes a change to not reset to defaults for the tx_size
probs if an intermediate frame reverts to using a fixed tx_size.
* A few updates to the parameters for backward adaptation for mode/mv
* some cosmetic cleanups

derf300: +0.06%

Change-Id: I22994d659bc31ca7a4fc8820fde24001e64a2920
parent 44db42c1
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
/* Update probabilities for the nodes in the token entropy tree. /* Update probabilities for the nodes in the token entropy tree.
Generated file included by vp9_entropy.c */ Generated file included by vp9_entropy.c */
#define VP9_DEF_UPDATE_PROB 252
static const vp9_prob vp9_coef_update_prob[UNCONSTRAINED_NODES] = { static const vp9_prob vp9_coef_update_prob[UNCONSTRAINED_NODES] = {
252, 252, 252, 252, 252, 252,
}; };
......
...@@ -149,36 +149,21 @@ static const vp9_prob default_single_ref_p[REF_CONTEXTS][2] = { ...@@ -149,36 +149,21 @@ static const vp9_prob default_single_ref_p[REF_CONTEXTS][2] = {
{ 238, 247 } { 238, 247 }
}; };
#if TX_SIZE_CONTEXTS == 2
const vp9_prob vp9_default_tx_probs_32x32p[TX_SIZE_CONTEXTS] const vp9_prob vp9_default_tx_probs_32x32p[TX_SIZE_CONTEXTS]
[TX_SIZE_MAX_SB - 1] = { [TX_SIZE_MAX_SB - 1] = {
{ 16, 32, 64, }, { 3, 136, 37, },
{ 16, 32, 64, }, { 5, 52, 13, },
}; };
const vp9_prob vp9_default_tx_probs_16x16p[TX_SIZE_CONTEXTS] const vp9_prob vp9_default_tx_probs_16x16p[TX_SIZE_CONTEXTS]
[TX_SIZE_MAX_SB - 2] = { [TX_SIZE_MAX_SB - 2] = {
{ 32, 64, }, { 20, 152, },
{ 32, 64, }, { 15, 101, },
}; };
const vp9_prob vp9_default_tx_probs_8x8p[TX_SIZE_CONTEXTS] const vp9_prob vp9_default_tx_probs_8x8p[TX_SIZE_CONTEXTS]
[TX_SIZE_MAX_SB - 3] = { [TX_SIZE_MAX_SB - 3] = {
{ 64, }, { 100, },
{ 64, }, { 66, },
}; };
#else
const vp9_prob vp9_default_tx_probs_32x32p[TX_SIZE_CONTEXTS]
[TX_SIZE_MAX_SB - 1] = {
{ 16, 32, 64, },
};
const vp9_prob vp9_default_tx_probs_16x16p[TX_SIZE_CONTEXTS]
[TX_SIZE_MAX_SB - 2] = {
{ 32, 64, },
};
const vp9_prob vp9_default_tx_probs_8x8p[TX_SIZE_CONTEXTS]
[TX_SIZE_MAX_SB - 3] = {
{ 64, },
};
#endif
void tx_counts_to_branch_counts_32x32(unsigned int *tx_count_32x32p, void tx_counts_to_branch_counts_32x32(unsigned int *tx_count_32x32p,
unsigned int (*ct_32x32p)[2]) { unsigned int (*ct_32x32p)[2]) {
...@@ -254,7 +239,10 @@ const INTERPOLATIONFILTERTYPE vp9_switchable_interp[VP9_SWITCHABLE_FILTERS] = { ...@@ -254,7 +239,10 @@ const INTERPOLATIONFILTERTYPE vp9_switchable_interp[VP9_SWITCHABLE_FILTERS] = {
const int vp9_switchable_interp_map[SWITCHABLE+1] = {1, 0, 2, -1, -1}; const int vp9_switchable_interp_map[SWITCHABLE+1] = {1, 0, 2, -1, -1};
const vp9_prob vp9_switchable_interp_prob [VP9_SWITCHABLE_FILTERS+1] const vp9_prob vp9_switchable_interp_prob [VP9_SWITCHABLE_FILTERS+1]
[VP9_SWITCHABLE_FILTERS-1] = { [VP9_SWITCHABLE_FILTERS-1] = {
{248, 192}, { 32, 248}, { 32, 32}, {192, 160} { 235, 162, },
{ 36, 255, },
{ 34, 3, },
{ 149, 144, },
}; };
// Indicates if the filter is interpolating or non-interpolating // Indicates if the filter is interpolating or non-interpolating
...@@ -324,7 +312,7 @@ void vp9_adapt_mode_context(VP9_COMMON *pc) { ...@@ -324,7 +312,7 @@ void vp9_adapt_mode_context(VP9_COMMON *pc) {
} }
#define MODE_COUNT_SAT 20 #define MODE_COUNT_SAT 20
#define MODE_MAX_UPDATE_FACTOR 144 #define MODE_MAX_UPDATE_FACTOR 128
static int update_mode_ct(vp9_prob pre_prob, vp9_prob prob, static int update_mode_ct(vp9_prob pre_prob, vp9_prob prob,
unsigned int branch_ct[2]) { unsigned int branch_ct[2]) {
int factor, count = branch_ct[0] + branch_ct[1]; int factor, count = branch_ct[0] + branch_ct[1];
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#define SUBMVREF_COUNT 5 #define SUBMVREF_COUNT 5
#define TX_SIZE_CONTEXTS 2 #define TX_SIZE_CONTEXTS 2
#define VP9_MODE_UPDATE_PROB 252
// #define MODE_STATS // #define MODE_STATS
extern int vp9_mv_cont(const int_mv *l, const int_mv *a); extern int vp9_mv_cont(const int_mv *l, const int_mv *a);
......
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
//#define MV_COUNT_TESTING //#define MV_COUNT_TESTING
#define MV_COUNT_SAT 16 #define MV_COUNT_SAT 20
#define MV_MAX_UPDATE_FACTOR 160 #define MV_MAX_UPDATE_FACTOR 128
/* Integer pel reference mv threshold for use of high-precision 1/8 mv */ /* Integer pel reference mv threshold for use of high-precision 1/8 mv */
#define COMPANDED_MVREF_THRESH 8 #define COMPANDED_MVREF_THRESH 8
......
...@@ -24,7 +24,7 @@ void vp9_init_mv_probs(struct VP9Common *cm); ...@@ -24,7 +24,7 @@ void vp9_init_mv_probs(struct VP9Common *cm);
void vp9_adapt_nmv_probs(struct VP9Common *cm, int usehp); void vp9_adapt_nmv_probs(struct VP9Common *cm, int usehp);
int vp9_use_nmv_hp(const MV *ref); int vp9_use_nmv_hp(const MV *ref);
#define VP9_NMV_UPDATE_PROB 255 #define VP9_NMV_UPDATE_PROB 252
//#define MV_GROUP_UPDATE //#define MV_GROUP_UPDATE
......
...@@ -349,7 +349,6 @@ unsigned char vp9_get_pred_context(const VP9_COMMON *const cm, ...@@ -349,7 +349,6 @@ unsigned char vp9_get_pred_context(const VP9_COMMON *const cm,
} }
case PRED_TX_SIZE: { case PRED_TX_SIZE: {
#if TX_SIZE_CONTEXTS == 2
int above_context, left_context; int above_context, left_context;
int max_tx_size; int max_tx_size;
if (mi->mbmi.sb_type < BLOCK_SIZE_SB8X8) if (mi->mbmi.sb_type < BLOCK_SIZE_SB8X8)
...@@ -376,9 +375,6 @@ unsigned char vp9_get_pred_context(const VP9_COMMON *const cm, ...@@ -376,9 +375,6 @@ unsigned char vp9_get_pred_context(const VP9_COMMON *const cm,
above_context = left_context; above_context = left_context;
} }
pred_context = (above_context + left_context > max_tx_size); pred_context = (above_context + left_context > max_tx_size);
#else
pred_context = 0;
#endif
break; break;
} }
......
...@@ -307,7 +307,7 @@ static void read_switchable_interp_probs(VP9_COMMON* const cm, vp9_reader *r) { ...@@ -307,7 +307,7 @@ static void read_switchable_interp_probs(VP9_COMMON* const cm, vp9_reader *r) {
int i, j; int i, j;
for (j = 0; j <= VP9_SWITCHABLE_FILTERS; ++j) for (j = 0; j <= VP9_SWITCHABLE_FILTERS; ++j)
for (i = 0; i < VP9_SWITCHABLE_FILTERS - 1; ++i) { for (i = 0; i < VP9_SWITCHABLE_FILTERS - 1; ++i) {
if (vp9_read(r, VP9_DEF_UPDATE_PROB)) { if (vp9_read(r, VP9_MODE_UPDATE_PROB)) {
cm->fc.switchable_interp_prob[j][i] = cm->fc.switchable_interp_prob[j][i] =
// vp9_read_prob(r); // vp9_read_prob(r);
vp9_read_prob_diff_update(r, cm->fc.switchable_interp_prob[j][i]); vp9_read_prob_diff_update(r, cm->fc.switchable_interp_prob[j][i]);
...@@ -319,7 +319,7 @@ static void read_inter_mode_probs(VP9_COMMON *const cm, vp9_reader *r) { ...@@ -319,7 +319,7 @@ static void read_inter_mode_probs(VP9_COMMON *const cm, vp9_reader *r) {
int i, j; int i, j;
for (i = 0; i < INTER_MODE_CONTEXTS; ++i) for (i = 0; i < INTER_MODE_CONTEXTS; ++i)
for (j = 0; j < VP9_INTER_MODES - 1; ++j) { for (j = 0; j < VP9_INTER_MODES - 1; ++j) {
if (vp9_read(r, VP9_DEF_UPDATE_PROB)) { if (vp9_read(r, VP9_MODE_UPDATE_PROB)) {
// cm->fc.inter_mode_probs[i][j] = vp9_read_prob(r); // cm->fc.inter_mode_probs[i][j] = vp9_read_prob(r);
cm->fc.inter_mode_probs[i][j] = cm->fc.inter_mode_probs[i][j] =
vp9_read_prob_diff_update(r, cm->fc.inter_mode_probs[i][j]); vp9_read_prob_diff_update(r, cm->fc.inter_mode_probs[i][j]);
...@@ -348,7 +348,7 @@ static void mb_mode_mv_init(VP9D_COMP *pbi, vp9_reader *r) { ...@@ -348,7 +348,7 @@ static void mb_mode_mv_init(VP9D_COMP *pbi, vp9_reader *r) {
read_switchable_interp_probs(cm, r); read_switchable_interp_probs(cm, r);
for (i = 0; i < INTRA_INTER_CONTEXTS; i++) { for (i = 0; i < INTRA_INTER_CONTEXTS; i++) {
if (vp9_read(r, VP9_DEF_UPDATE_PROB)) if (vp9_read(r, VP9_MODE_UPDATE_PROB))
cm->fc.intra_inter_prob[i] = cm->fc.intra_inter_prob[i] =
vp9_read_prob_diff_update(r, cm->fc.intra_inter_prob[i]); vp9_read_prob_diff_update(r, cm->fc.intra_inter_prob[i]);
} }
...@@ -357,7 +357,7 @@ static void mb_mode_mv_init(VP9D_COMP *pbi, vp9_reader *r) { ...@@ -357,7 +357,7 @@ static void mb_mode_mv_init(VP9D_COMP *pbi, vp9_reader *r) {
cm->comp_pred_mode = read_comp_pred_mode(r); cm->comp_pred_mode = read_comp_pred_mode(r);
if (cm->comp_pred_mode == HYBRID_PREDICTION) if (cm->comp_pred_mode == HYBRID_PREDICTION)
for (i = 0; i < COMP_INTER_CONTEXTS; i++) for (i = 0; i < COMP_INTER_CONTEXTS; i++)
if (vp9_read(r, VP9_DEF_UPDATE_PROB)) if (vp9_read(r, VP9_MODE_UPDATE_PROB))
cm->fc.comp_inter_prob[i] = cm->fc.comp_inter_prob[i] =
vp9_read_prob_diff_update(r, cm->fc.comp_inter_prob[i]); vp9_read_prob_diff_update(r, cm->fc.comp_inter_prob[i]);
} else { } else {
...@@ -366,24 +366,24 @@ static void mb_mode_mv_init(VP9D_COMP *pbi, vp9_reader *r) { ...@@ -366,24 +366,24 @@ static void mb_mode_mv_init(VP9D_COMP *pbi, vp9_reader *r) {
if (cm->comp_pred_mode != COMP_PREDICTION_ONLY) if (cm->comp_pred_mode != COMP_PREDICTION_ONLY)
for (i = 0; i < REF_CONTEXTS; i++) { for (i = 0; i < REF_CONTEXTS; i++) {
if (vp9_read(r, VP9_DEF_UPDATE_PROB)) if (vp9_read(r, VP9_MODE_UPDATE_PROB))
cm->fc.single_ref_prob[i][0] = cm->fc.single_ref_prob[i][0] =
vp9_read_prob_diff_update(r, cm->fc.single_ref_prob[i][0]); vp9_read_prob_diff_update(r, cm->fc.single_ref_prob[i][0]);
if (vp9_read(r, VP9_DEF_UPDATE_PROB)) if (vp9_read(r, VP9_MODE_UPDATE_PROB))
cm->fc.single_ref_prob[i][1] = cm->fc.single_ref_prob[i][1] =
vp9_read_prob_diff_update(r, cm->fc.single_ref_prob[i][1]); vp9_read_prob_diff_update(r, cm->fc.single_ref_prob[i][1]);
} }
if (cm->comp_pred_mode != SINGLE_PREDICTION_ONLY) if (cm->comp_pred_mode != SINGLE_PREDICTION_ONLY)
for (i = 0; i < REF_CONTEXTS; i++) for (i = 0; i < REF_CONTEXTS; i++)
if (vp9_read(r, VP9_DEF_UPDATE_PROB)) if (vp9_read(r, VP9_MODE_UPDATE_PROB))
cm->fc.comp_ref_prob[i] = cm->fc.comp_ref_prob[i] =
vp9_read_prob_diff_update(r, cm->fc.comp_ref_prob[i]); vp9_read_prob_diff_update(r, cm->fc.comp_ref_prob[i]);
// VP9_INTRA_MODES // VP9_INTRA_MODES
for (j = 0; j < BLOCK_SIZE_GROUPS; j++) { for (j = 0; j < BLOCK_SIZE_GROUPS; j++) {
for (i = 0; i < VP9_INTRA_MODES - 1; ++i) { for (i = 0; i < VP9_INTRA_MODES - 1; ++i) {
if (vp9_read(r, VP9_DEF_UPDATE_PROB)) { if (vp9_read(r, VP9_MODE_UPDATE_PROB)) {
cm->fc.y_mode_prob[j][i] = cm->fc.y_mode_prob[j][i] =
vp9_read_prob_diff_update(r, cm->fc.y_mode_prob[j][i]); vp9_read_prob_diff_update(r, cm->fc.y_mode_prob[j][i]);
} }
...@@ -391,7 +391,7 @@ static void mb_mode_mv_init(VP9D_COMP *pbi, vp9_reader *r) { ...@@ -391,7 +391,7 @@ static void mb_mode_mv_init(VP9D_COMP *pbi, vp9_reader *r) {
} }
for (j = 0; j < NUM_PARTITION_CONTEXTS; ++j) { for (j = 0; j < NUM_PARTITION_CONTEXTS; ++j) {
for (i = 0; i < PARTITION_TYPES - 1; ++i) { for (i = 0; i < PARTITION_TYPES - 1; ++i) {
if (vp9_read(r, VP9_DEF_UPDATE_PROB)) { if (vp9_read(r, VP9_MODE_UPDATE_PROB)) {
cm->fc.partition_prob[INTER_FRAME][j][i] = cm->fc.partition_prob[INTER_FRAME][j][i] =
vp9_read_prob_diff_update(r, vp9_read_prob_diff_update(r,
cm->fc.partition_prob[INTER_FRAME][j][i]); cm->fc.partition_prob[INTER_FRAME][j][i]);
...@@ -797,7 +797,7 @@ void vp9_decode_mode_mvs_init(VP9D_COMP* const pbi, vp9_reader *r) { ...@@ -797,7 +797,7 @@ void vp9_decode_mode_mvs_init(VP9D_COMP* const pbi, vp9_reader *r) {
// TODO(jkoleszar): does this clear more than MBSKIP_CONTEXTS? Maybe remove. // TODO(jkoleszar): does this clear more than MBSKIP_CONTEXTS? Maybe remove.
// vpx_memset(cm->fc.mbskip_probs, 0, sizeof(cm->fc.mbskip_probs)); // vpx_memset(cm->fc.mbskip_probs, 0, sizeof(cm->fc.mbskip_probs));
for (k = 0; k < MBSKIP_CONTEXTS; ++k) { for (k = 0; k < MBSKIP_CONTEXTS; ++k) {
if (vp9_read(r, VP9_DEF_UPDATE_PROB)) { if (vp9_read(r, VP9_MODE_UPDATE_PROB)) {
cm->fc.mbskip_probs[k] = cm->fc.mbskip_probs[k] =
vp9_read_prob_diff_update(r, cm->fc.mbskip_probs[k]); vp9_read_prob_diff_update(r, cm->fc.mbskip_probs[k]);
} }
......
...@@ -61,32 +61,25 @@ static void setup_txfm_mode(VP9_COMMON *pc, int lossless, vp9_reader *r) { ...@@ -61,32 +61,25 @@ static void setup_txfm_mode(VP9_COMMON *pc, int lossless, vp9_reader *r) {
int i, j; int i, j;
for (i = 0; i < TX_SIZE_CONTEXTS; ++i) { for (i = 0; i < TX_SIZE_CONTEXTS; ++i) {
for (j = 0; j < TX_SIZE_MAX_SB - 3; ++j) { for (j = 0; j < TX_SIZE_MAX_SB - 3; ++j) {
if (vp9_read(r, VP9_DEF_UPDATE_PROB)) if (vp9_read(r, VP9_MODE_UPDATE_PROB))
pc->fc.tx_probs_8x8p[i][j] = pc->fc.tx_probs_8x8p[i][j] =
vp9_read_prob_diff_update(r, pc->fc.tx_probs_8x8p[i][j]); vp9_read_prob_diff_update(r, pc->fc.tx_probs_8x8p[i][j]);
} }
} }
for (i = 0; i < TX_SIZE_CONTEXTS; ++i) { for (i = 0; i < TX_SIZE_CONTEXTS; ++i) {
for (j = 0; j < TX_SIZE_MAX_SB - 2; ++j) { for (j = 0; j < TX_SIZE_MAX_SB - 2; ++j) {
if (vp9_read(r, VP9_DEF_UPDATE_PROB)) if (vp9_read(r, VP9_MODE_UPDATE_PROB))
pc->fc.tx_probs_16x16p[i][j] = pc->fc.tx_probs_16x16p[i][j] =
vp9_read_prob_diff_update(r, pc->fc.tx_probs_16x16p[i][j]); vp9_read_prob_diff_update(r, pc->fc.tx_probs_16x16p[i][j]);
} }
} }
for (i = 0; i < TX_SIZE_CONTEXTS; ++i) { for (i = 0; i < TX_SIZE_CONTEXTS; ++i) {
for (j = 0; j < TX_SIZE_MAX_SB - 1; ++j) { for (j = 0; j < TX_SIZE_MAX_SB - 1; ++j) {
if (vp9_read(r, VP9_DEF_UPDATE_PROB)) if (vp9_read(r, VP9_MODE_UPDATE_PROB))
pc->fc.tx_probs_32x32p[i][j] = pc->fc.tx_probs_32x32p[i][j] =
vp9_read_prob_diff_update(r, pc->fc.tx_probs_32x32p[i][j]); vp9_read_prob_diff_update(r, pc->fc.tx_probs_32x32p[i][j]);
} }
} }
} else {
vpx_memcpy(pc->fc.tx_probs_8x8p, vp9_default_tx_probs_8x8p,
sizeof(vp9_default_tx_probs_8x8p));
vpx_memcpy(pc->fc.tx_probs_16x16p, vp9_default_tx_probs_16x16p,
sizeof(vp9_default_tx_probs_16x16p));
vpx_memcpy(pc->fc.tx_probs_32x32p, vp9_default_tx_probs_32x32p,
sizeof(vp9_default_tx_probs_32x32p));
} }
} }
} }
......
...@@ -55,6 +55,8 @@ extern unsigned int active_section; ...@@ -55,6 +55,8 @@ extern unsigned int active_section;
int64_t tx_count_32x32p_stats[TX_SIZE_CONTEXTS][TX_SIZE_MAX_SB]; int64_t tx_count_32x32p_stats[TX_SIZE_CONTEXTS][TX_SIZE_MAX_SB];
int64_t tx_count_16x16p_stats[TX_SIZE_CONTEXTS][TX_SIZE_MAX_SB - 1]; int64_t tx_count_16x16p_stats[TX_SIZE_CONTEXTS][TX_SIZE_MAX_SB - 1];
int64_t tx_count_8x8p_stats[TX_SIZE_CONTEXTS][TX_SIZE_MAX_SB - 2]; int64_t tx_count_8x8p_stats[TX_SIZE_CONTEXTS][TX_SIZE_MAX_SB - 2];
int64_t switchable_interp_stats[VP9_SWITCHABLE_FILTERS+1]
[VP9_SWITCHABLE_FILTERS];
void init_tx_count_stats() { void init_tx_count_stats() {
vp9_zero(tx_count_32x32p_stats); vp9_zero(tx_count_32x32p_stats);
...@@ -62,6 +64,10 @@ void init_tx_count_stats() { ...@@ -62,6 +64,10 @@ void init_tx_count_stats() {
vp9_zero(tx_count_8x8p_stats); vp9_zero(tx_count_8x8p_stats);
} }
void init_switchable_interp_stats() {
vp9_zero(switchable_interp_stats);
}
static void update_tx_count_stats(VP9_COMMON *cm) { static void update_tx_count_stats(VP9_COMMON *cm) {
int i, j; int i, j;
for (i = 0; i < TX_SIZE_CONTEXTS; i++) { for (i = 0; i < TX_SIZE_CONTEXTS; i++) {
...@@ -81,6 +87,14 @@ static void update_tx_count_stats(VP9_COMMON *cm) { ...@@ -81,6 +87,14 @@ static void update_tx_count_stats(VP9_COMMON *cm) {
} }
} }
static void update_switchable_interp_stats(VP9_COMMON *cm) {
int i, j;
for (i = 0; i < VP9_SWITCHABLE_FILTERS+1; ++i)
for (j = 0; j < VP9_SWITCHABLE_FILTERS; ++j) {
switchable_interp_stats[i][j] += cm->fc.switchable_interp_count[i][j];
}
}
void write_tx_count_stats() { void write_tx_count_stats() {
int i, j; int i, j;
FILE *fp = fopen("tx_count.bin", "wb"); FILE *fp = fopen("tx_count.bin", "wb");
...@@ -120,6 +134,25 @@ void write_tx_count_stats() { ...@@ -120,6 +134,25 @@ void write_tx_count_stats() {
} }
printf("};\n"); printf("};\n");
} }
void write_switchable_interp_stats() {
int i, j;
FILE *fp = fopen("switchable_interp.bin", "wb");
fwrite(switchable_interp_stats, sizeof(switchable_interp_stats), 1, fp);
fclose(fp);
printf(
"vp9_default_switchable_filter_count[VP9_SWITCHABLE_FILTERS+1]"
"[VP9_SWITCHABLE_FILTERS] = {\n");
for (i = 0; i < VP9_SWITCHABLE_FILTERS+1; i++) {
printf(" { ");
for (j = 0; j < VP9_SWITCHABLE_FILTERS; j++) {
printf("%"PRId64", ", switchable_interp_stats[i][j]);
}
printf("},\n");
}
printf("};\n");
}
#endif #endif
static int update_bits[255]; static int update_bits[255];
...@@ -387,7 +420,7 @@ static void update_mode( ...@@ -387,7 +420,7 @@ static void update_mode(
n--; n--;
for (i = 0; i < n; ++i) { for (i = 0; i < n; ++i) {
vp9_cond_prob_diff_update(w, &Pcur[i], VP9_DEF_UPDATE_PROB, bct[i]); vp9_cond_prob_diff_update(w, &Pcur[i], VP9_MODE_UPDATE_PROB, bct[i]);
} }
} }
...@@ -411,11 +444,7 @@ void vp9_update_skip_probs(VP9_COMP *cpi, vp9_writer *bc) { ...@@ -411,11 +444,7 @@ void vp9_update_skip_probs(VP9_COMP *cpi, vp9_writer *bc) {
for (k = 0; k < MBSKIP_CONTEXTS; ++k) { for (k = 0; k < MBSKIP_CONTEXTS; ++k) {
vp9_cond_prob_diff_update(bc, &pc->fc.mbskip_probs[k], vp9_cond_prob_diff_update(bc, &pc->fc.mbskip_probs[k],
VP9_DEF_UPDATE_PROB, pc->fc.mbskip_count[k]); VP9_MODE_UPDATE_PROB, pc->fc.mbskip_count[k]);
/*
pc->fc.mbskip_probs[k] = get_binary_prob(pc->fc.mbskip_count[k][0],
pc->fc.mbskip_count[k][1]);
*/
} }
} }
...@@ -423,8 +452,9 @@ static void write_intra_mode(vp9_writer *bc, int m, const vp9_prob *p) { ...@@ -423,8 +452,9 @@ static void write_intra_mode(vp9_writer *bc, int m, const vp9_prob *p) {
write_token(bc, vp9_intra_mode_tree, p, vp9_intra_mode_encodings + m); write_token(bc, vp9_intra_mode_tree, p, vp9_intra_mode_encodings + m);
} }
static void update_switchable_interp_probs(VP9_COMMON *const pc, static void update_switchable_interp_probs(VP9_COMP *const cpi,
vp9_writer* const bc) { vp9_writer* const bc) {
VP9_COMMON *const pc = &cpi->common;
unsigned int branch_ct[VP9_SWITCHABLE_FILTERS + 1] unsigned int branch_ct[VP9_SWITCHABLE_FILTERS + 1]
[VP9_SWITCHABLE_FILTERS - 1][2]; [VP9_SWITCHABLE_FILTERS - 1][2];
vp9_prob new_prob[VP9_SWITCHABLE_FILTERS + 1][VP9_SWITCHABLE_FILTERS - 1]; vp9_prob new_prob[VP9_SWITCHABLE_FILTERS + 1][VP9_SWITCHABLE_FILTERS - 1];
...@@ -437,12 +467,14 @@ static void update_switchable_interp_probs(VP9_COMMON *const pc, ...@@ -437,12 +467,14 @@ static void update_switchable_interp_probs(VP9_COMMON *const pc,
} }
for (j = 0; j <= VP9_SWITCHABLE_FILTERS; ++j) { for (j = 0; j <= VP9_SWITCHABLE_FILTERS; ++j) {
for (i = 0; i < VP9_SWITCHABLE_FILTERS - 1; ++i) { for (i = 0; i < VP9_SWITCHABLE_FILTERS - 1; ++i) {
// vp9_cond_prob_update(bc, &pc->fc.switchable_interp_prob[j][i],
// VP9_DEF_UPDATE_PROB, branch_ct[j][i]);
vp9_cond_prob_diff_update(bc, &pc->fc.switchable_interp_prob[j][i], vp9_cond_prob_diff_update(bc, &pc->fc.switchable_interp_prob[j][i],
VP9_DEF_UPDATE_PROB, branch_ct[j][i]); VP9_MODE_UPDATE_PROB, branch_ct[j][i]);
} }
} }
#ifdef MODE_STATS
if (!cpi->dummy_packing)
update_switchable_interp_stats(pc);
#endif
} }
static void update_inter_mode_probs(VP9_COMMON *pc, vp9_writer* const bc) { static void update_inter_mode_probs(VP9_COMMON *pc, vp9_writer* const bc) {
...@@ -451,11 +483,8 @@ static void update_inter_mode_probs(VP9_COMMON *pc, vp9_writer* const bc) { ...@@ -451,11 +483,8 @@ static void update_inter_mode_probs(VP9_COMMON *pc, vp9_writer* const bc) {
for (i = 0; i < INTER_MODE_CONTEXTS; i++) { for (i = 0; i < INTER_MODE_CONTEXTS; i++) {
for (j = 0; j < VP9_INTER_MODES - 1; j++) { for (j = 0; j < VP9_INTER_MODES - 1; j++) {
vp9_cond_prob_diff_update(bc, &pc->fc.inter_mode_probs[i][j], vp9_cond_prob_diff_update(bc, &pc->fc.inter_mode_probs[i][j],
VP9_DEF_UPDATE_PROB, VP9_MODE_UPDATE_PROB,
pc->fc.inter_mode_counts[i][j]); pc->fc.inter_mode_counts[i][j]);
// vp9_cond_prob_update(
// bc, &pc->fc.inter_mode_probs[i][j],
// VP9_DEF_UPDATE_PROB, pc->fc.inter_mode_counts[i][j]);
} }
} }
} }
...@@ -1309,7 +1338,7 @@ static void encode_txfm_probs(VP9_COMP *cpi, vp9_writer *w) { ...@@ -1309,7 +1338,7 @@ static void encode_txfm_probs(VP9_COMP *cpi, vp9_writer *w) {
ct_8x8p); ct_8x8p);
for (j = 0; j < TX_SIZE_MAX_SB - 3; j++) { for (j = 0; j < TX_SIZE_MAX_SB - 3; j++) {
vp9_cond_prob_diff_update(w, &cm->fc.tx_probs_8x8p[i][j], vp9_cond_prob_diff_update(w, &cm->fc.tx_probs_8x8p[i][j],
VP9_DEF_UPDATE_PROB, ct_8x8p[j]); VP9_MODE_UPDATE_PROB, ct_8x8p[j]);
} }
} }
for (i = 0; i < TX_SIZE_CONTEXTS; i++) { for (i = 0; i < TX_SIZE_CONTEXTS; i++) {
...@@ -1317,7 +1346,7 @@ static void encode_txfm_probs(VP9_COMP *cpi, vp9_writer *w) { ...@@ -1317,7 +1346,7 @@ static void encode_txfm_probs(VP9_COMP *cpi, vp9_writer *w) {
ct_16x16p); ct_16x16p);
for (j = 0; j < TX_SIZE_MAX_SB - 2; j++) { for (j = 0; j < TX_SIZE_MAX_SB - 2; j++) {
vp9_cond_prob_diff_update(w, &cm->fc.tx_probs_16x16p[i][j], vp9_cond_prob_diff_update(w, &cm->fc.tx_probs_16x16p[i][j],
VP9_DEF_UPDATE_PROB, ct_16x16p[j]); VP9_MODE_UPDATE_PROB, ct_16x16p[j]);
} }
} }
for (i = 0; i < TX_SIZE_CONTEXTS; i++) { for (i = 0; i < TX_SIZE_CONTEXTS; i++) {
...@@ -1325,19 +1354,13 @@ static void encode_txfm_probs(VP9_COMP *cpi, vp9_writer *w) { ...@@ -1325,19 +1354,13 @@ static void encode_txfm_probs(VP9_COMP *cpi, vp9_writer *w) {
ct_32x32p); ct_32x32p);
for (j = 0; j < TX_SIZE_MAX_SB - 1; j++) { for (j = 0; j < TX_SIZE_MAX_SB - 1; j++) {
vp9_cond_prob_diff_update(w, &cm->fc.tx_probs_32x32p[i][j], vp9_cond_prob_diff_update(w, &cm->fc.tx_probs_32x32p[i][j],
VP9_DEF_UPDATE_PROB, ct_32x32p[j]); VP9_MODE_UPDATE_PROB, ct_32x32p[j]);
} }
} }
#ifdef MODE_STATS #ifdef MODE_STATS
update_tx_count_stats(cm); if (!cpi->dummy_packing)
update_tx_count_stats(cm);
#endif #endif
} else {
vpx_memcpy(cm->fc.tx_probs_32x32p, vp9_default_tx_probs_32x32p,
sizeof(vp9_default_tx_probs_32x32p));
vpx_memcpy(cm->fc.tx_probs_16x16p, vp9_default_tx_probs_16x16p,
sizeof(vp9_default_tx_probs_16x16p));
vpx_memcpy(cm->fc.tx_probs_8x8p, vp9_default_tx_probs_8x8p,
sizeof(vp9_default_tx_probs_8x8p));
} }
} }
...@@ -1635,11 +1658,12 @@ void vp9_pack_bitstream(VP9_COMP *cpi, uint8_t *dest, unsigned long *size) { ...@@ -1635,11 +1658,12 @@ void vp9_pack_bitstream(VP9_COMP *cpi, uint8_t *dest, unsigned long *size) {
vp9_zero(cpi->common.fc.inter_mode_counts); vp9_zero(cpi->common.fc.inter_mode_counts);
if (pc->mcomp_filter_type == SWITCHABLE) if (pc->mcomp_filter_type == SWITCHABLE)
update_switchable_interp_probs(pc, &header_bc); update_switchable_interp_probs(cpi, &header_bc);
for (i = 0; i < INTRA_INTER_CONTEXTS; i++) for (i = 0; i < INTRA_INTER_CONTEXTS; i++)
vp9_cond_prob_diff_update(&header_bc, &pc->fc.intra_inter_prob[i], vp9_cond_prob_diff_update(&header_bc, &pc->fc.intra_inter_prob[i],
VP9_DEF_UPDATE_PROB, cpi->intra_inter_count[i]); VP9_MODE_UPDATE_PROB,
cpi->intra_inter_count[i]);
if (pc->allow_comp_inter_inter) { if (pc->allow_comp_inter_inter) {
const int comp_pred_mode = cpi->common.comp_pred_mode; const int comp_pred_mode = cpi->common.comp_pred_mode;
...@@ -1652,7 +1676,7 @@ void vp9_pack_bitstream(VP9_COMP *cpi, uint8_t *dest, unsigned long *size) { ...@@ -1652,7 +1676,7 @@ void vp9_pack_bitstream(VP9_COMP *cpi, uint8_t *dest, unsigned long *size) {