Commit 57d95347 authored by Deb Mukherjee's avatar Deb Mukherjee
Browse files

Adding contextual coding of mb_skip_coeff flag.

Using contextual coding of the mkb_skip_coeff flag using the
values of this flag from the left and above. There is a small
improvement of about 0.15% on Derf:
http://www.corp.google.com/~debargha/vp8_results/mbskipcontext.html

Refactored to use pred_common.c by adding a new context type.

Results on HD set (about 0.66% improvement):
http://www.corp.google.com/~debargha/vp8_results/mbskipcontext_hd.html

Incliding missing refactoring to use the pred_common utilities.

Change-Id: I95373382d429b5a59610d77f69a0fea2be628278
parent 21d3612a
...@@ -223,6 +223,7 @@ EXPERIMENT_LIST=" ...@@ -223,6 +223,7 @@ EXPERIMENT_LIST="
high_precision_mv high_precision_mv
sixteenth_subpel_uv sixteenth_subpel_uv
comp_intra_pred comp_intra_pred
newentropy
" "
CONFIG_LIST=" CONFIG_LIST="
external_build external_build
......
...@@ -40,6 +40,7 @@ void vp8_arch_arm_common_init(VP8_COMMON *ctx) ...@@ -40,6 +40,7 @@ void vp8_arch_arm_common_init(VP8_COMMON *ctx)
rtcd->subpix.sixtap8x8 = vp8_sixtap_predict8x8_armv6; rtcd->subpix.sixtap8x8 = vp8_sixtap_predict8x8_armv6;
rtcd->subpix.sixtap8x4 = vp8_sixtap_predict8x4_armv6; rtcd->subpix.sixtap8x4 = vp8_sixtap_predict8x4_armv6;
rtcd->subpix.sixtap4x4 = vp8_sixtap_predict_armv6; rtcd->subpix.sixtap4x4 = vp8_sixtap_predict_armv6;
rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_armv6; rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_armv6;
rtcd->subpix.bilinear8x8 = vp8_bilinear_predict8x8_armv6; rtcd->subpix.bilinear8x8 = vp8_bilinear_predict8x8_armv6;
rtcd->subpix.bilinear8x4 = vp8_bilinear_predict8x4_armv6; rtcd->subpix.bilinear8x4 = vp8_bilinear_predict8x4_armv6;
...@@ -77,6 +78,7 @@ void vp8_arch_arm_common_init(VP8_COMMON *ctx) ...@@ -77,6 +78,7 @@ void vp8_arch_arm_common_init(VP8_COMMON *ctx)
rtcd->subpix.sixtap8x8 = vp8_sixtap_predict8x8_neon; rtcd->subpix.sixtap8x8 = vp8_sixtap_predict8x8_neon;
rtcd->subpix.sixtap8x4 = vp8_sixtap_predict8x4_neon; rtcd->subpix.sixtap8x4 = vp8_sixtap_predict8x4_neon;
rtcd->subpix.sixtap4x4 = vp8_sixtap_predict_neon; rtcd->subpix.sixtap4x4 = vp8_sixtap_predict_neon;
rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_neon; rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_neon;
rtcd->subpix.bilinear8x8 = vp8_bilinear_predict8x8_neon; rtcd->subpix.bilinear8x8 = vp8_bilinear_predict8x8_neon;
rtcd->subpix.bilinear8x4 = vp8_bilinear_predict8x4_neon; rtcd->subpix.bilinear8x4 = vp8_bilinear_predict8x4_neon;
......
...@@ -34,6 +34,10 @@ void vpx_log(const char *format, ...); ...@@ -34,6 +34,10 @@ void vpx_log(const char *format, ...);
#define MB_FEATURE_TREE_PROBS 3 #define MB_FEATURE_TREE_PROBS 3
#define PREDICTION_PROBS 3 #define PREDICTION_PROBS 3
#if CONFIG_NEWENTROPY
#define MBSKIP_CONTEXTS 3
#endif
#define MAX_MB_SEGMENTS 4 #define MAX_MB_SEGMENTS 4
#define MAX_REF_LF_DELTAS 4 #define MAX_REF_LF_DELTAS 4
......
...@@ -233,6 +233,10 @@ typedef struct VP8Common ...@@ -233,6 +233,10 @@ typedef struct VP8Common
vp8_prob prob_comppred[COMP_PRED_CONTEXTS]; vp8_prob prob_comppred[COMP_PRED_CONTEXTS];
#if CONFIG_NEWENTROPY
vp8_prob mbskip_pred_probs[MBSKIP_CONTEXTS];
#endif
FRAME_CONTEXT lfc_a; /* last alt ref entropy */ FRAME_CONTEXT lfc_a; /* last alt ref entropy */
FRAME_CONTEXT lfc; /* last frame entropy */ FRAME_CONTEXT lfc; /* last frame entropy */
FRAME_CONTEXT fc; /* this frame entropy */ FRAME_CONTEXT fc; /* this frame entropy */
......
...@@ -58,6 +58,13 @@ unsigned char get_pred_context( VP8_COMMON *const cm, ...@@ -58,6 +58,13 @@ unsigned char get_pred_context( VP8_COMMON *const cm,
break; break;
#if CONFIG_NEWENTROPY
case PRED_MBSKIP:
pred_context = (m - 1)->mbmi.mb_skip_coeff +
(m - cm->mode_info_stride)->mbmi.mb_skip_coeff;
break;
#endif
default: default:
// TODO *** add error trap code. // TODO *** add error trap code.
pred_context = 0; pred_context = 0;
...@@ -96,6 +103,12 @@ vp8_prob get_pred_prob( VP8_COMMON *const cm, ...@@ -96,6 +103,12 @@ vp8_prob get_pred_prob( VP8_COMMON *const cm,
pred_probability = cm->prob_comppred[pred_context]; pred_probability = cm->prob_comppred[pred_context];
break; break;
#if CONFIG_NEWENTROPY
case PRED_MBSKIP:
pred_probability = cm->mbskip_pred_probs[pred_context];
break;
#endif
default: default:
// TODO *** add error trap code. // TODO *** add error trap code.
pred_probability = 128; pred_probability = 128;
...@@ -122,11 +135,17 @@ unsigned char get_pred_flag( MACROBLOCKD *const xd, ...@@ -122,11 +135,17 @@ unsigned char get_pred_flag( MACROBLOCKD *const xd,
pred_flag = xd->mode_info_context->mbmi.ref_predicted; pred_flag = xd->mode_info_context->mbmi.ref_predicted;
break; break;
#if CONFIG_NEWENTROPY
case PRED_MBSKIP:
pred_flag = xd->mode_info_context->mbmi.mb_skip_coeff;
break;
#endif
default: default:
// TODO *** add error trap code. // TODO *** add error trap code.
pred_flag = 0; pred_flag = 0;
break; break;
} }
return pred_flag; return pred_flag;
} }
...@@ -147,6 +166,12 @@ void set_pred_flag( MACROBLOCKD *const xd, ...@@ -147,6 +166,12 @@ void set_pred_flag( MACROBLOCKD *const xd,
xd->mode_info_context->mbmi.ref_predicted = pred_flag; xd->mode_info_context->mbmi.ref_predicted = pred_flag;
break; break;
#if CONFIG_NEWENTROPY
case PRED_MBSKIP:
xd->mode_info_context->mbmi.mb_skip_coeff = pred_flag;
break;
#endif
default: default:
// TODO *** add error trap code. // TODO *** add error trap code.
break; break;
......
...@@ -21,7 +21,10 @@ typedef enum ...@@ -21,7 +21,10 @@ typedef enum
{ {
PRED_SEG_ID = 0, // Segment identifier PRED_SEG_ID = 0, // Segment identifier
PRED_REF = 1, PRED_REF = 1,
PRED_COMP = 2 PRED_COMP = 2,
#if CONFIG_NEWENTROPY
PRED_MBSKIP = 3,
#endif
} PRED_ID; } PRED_ID;
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "vp8/common/seg_common.h" #include "vp8/common/seg_common.h"
#include "vp8/common/pred_common.h" #include "vp8/common/pred_common.h"
#include "vp8/common/entropy.h"
#if CONFIG_DEBUG #if CONFIG_DEBUG
#include <assert.h> #include <assert.h>
...@@ -77,12 +78,14 @@ static void vp8_read_mb_segid(vp8_reader *r, MB_MODE_INFO *mi, MACROBLOCKD *x) ...@@ -77,12 +78,14 @@ static void vp8_read_mb_segid(vp8_reader *r, MB_MODE_INFO *mi, MACROBLOCKD *x)
mi->segment_id = (unsigned char)(vp8_read(r, x->mb_segment_tree_probs[1])); mi->segment_id = (unsigned char)(vp8_read(r, x->mb_segment_tree_probs[1]));
} }
} }
extern const int vp8_i8x8_block[4]; extern const int vp8_i8x8_block[4];
static void vp8_kfread_modes(VP8D_COMP *pbi, static void vp8_kfread_modes(VP8D_COMP *pbi,
MODE_INFO *m, MODE_INFO *m,
int mb_row, int mb_row,
int mb_col) int mb_col)
{ {
VP8_COMMON *const cm = & pbi->common;
vp8_reader *const bc = & pbi->bc; vp8_reader *const bc = & pbi->bc;
const int mis = pbi->common.mode_info_stride; const int mis = pbi->common.mode_info_stride;
int map_index = mb_row * pbi->common.mb_cols + mb_col; int map_index = mb_row * pbi->common.mb_cols + mb_col;
...@@ -97,13 +100,20 @@ static void vp8_kfread_modes(VP8D_COMP *pbi, ...@@ -97,13 +100,20 @@ static void vp8_kfread_modes(VP8D_COMP *pbi,
pbi->common.last_frame_seg_map[map_index] = m->mbmi.segment_id; pbi->common.last_frame_seg_map[map_index] = m->mbmi.segment_id;
} }
m->mbmi.mb_skip_coeff = 0;
if ( pbi->common.mb_no_coeff_skip && if ( pbi->common.mb_no_coeff_skip &&
( !segfeature_active( &pbi->mb, ( !segfeature_active( &pbi->mb,
m->mbmi.segment_id, SEG_LVL_EOB ) || m->mbmi.segment_id, SEG_LVL_EOB ) ||
( get_segdata( &pbi->mb, ( get_segdata( &pbi->mb,
m->mbmi.segment_id, SEG_LVL_EOB ) != 0 ) ) ) m->mbmi.segment_id, SEG_LVL_EOB ) != 0 ) ) )
{ {
#if CONFIG_NEWENTROPY
MACROBLOCKD *const xd = & pbi->mb;
xd->mode_info_context = m;
m->mbmi.mb_skip_coeff = vp8_read(bc, get_pred_prob(cm, xd, PRED_MBSKIP));
#else
m->mbmi.mb_skip_coeff = vp8_read(bc, pbi->prob_skip_false); m->mbmi.mb_skip_coeff = vp8_read(bc, pbi->prob_skip_false);
#endif
} }
else else
{ {
...@@ -511,9 +521,21 @@ static void mb_mode_mv_init(VP8D_COMP *pbi) ...@@ -511,9 +521,21 @@ static void mb_mode_mv_init(VP8D_COMP *pbi)
MACROBLOCKD *const xd = & pbi->mb; MACROBLOCKD *const xd = & pbi->mb;
#endif #endif
#if CONFIG_NEWENTROPY
vpx_memset(cm->mbskip_pred_probs, 0, sizeof(cm->mbskip_pred_probs));
#else
pbi->prob_skip_false = 0; pbi->prob_skip_false = 0;
#endif
if (pbi->common.mb_no_coeff_skip) if (pbi->common.mb_no_coeff_skip)
{
#if CONFIG_NEWENTROPY
int k;
for (k=0; k<MBSKIP_CONTEXTS; ++k)
cm->mbskip_pred_probs[k] = (vp8_prob)vp8_read_literal(bc, 8);
#else
pbi->prob_skip_false = (vp8_prob)vp8_read_literal(bc, 8); pbi->prob_skip_false = (vp8_prob)vp8_read_literal(bc, 8);
#endif
}
if(pbi->common.frame_type != KEY_FRAME) if(pbi->common.frame_type != KEY_FRAME)
{ {
...@@ -683,7 +705,11 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi, ...@@ -683,7 +705,11 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
{ {
// Read the macroblock coeff skip flag if this feature is in use, // Read the macroblock coeff skip flag if this feature is in use,
// else default to 0 // else default to 0
#if CONFIG_NEWENTROPY
mbmi->mb_skip_coeff = vp8_read(bc, get_pred_prob(cm, xd, PRED_MBSKIP));
#else
mbmi->mb_skip_coeff = vp8_read(bc, pbi->prob_skip_false); mbmi->mb_skip_coeff = vp8_read(bc, pbi->prob_skip_false);
#endif
} }
else else
{ {
...@@ -1034,11 +1060,16 @@ void vp8_decode_mode_mvs(VP8D_COMP *pbi) ...@@ -1034,11 +1060,16 @@ void vp8_decode_mode_mvs(VP8D_COMP *pbi)
{ {
/*read_mb_modes_mv(pbi, xd->mode_info_context, &xd->mode_info_context->mbmi, mb_row, mb_col);*/ /*read_mb_modes_mv(pbi, xd->mode_info_context, &xd->mode_info_context->mbmi, mb_row, mb_col);*/
if(pbi->common.frame_type == KEY_FRAME) if(pbi->common.frame_type == KEY_FRAME)
{
//printf("<%d %d> \n", mb_row, mb_col);
vp8_kfread_modes(pbi, mi, mb_row, mb_col); vp8_kfread_modes(pbi, mi, mb_row, mb_col);
}
else else
{
read_mb_modes_mv(pbi, mi, &mi->mbmi, read_mb_modes_mv(pbi, mi, &mi->mbmi,
prev_mi, prev_mi,
mb_row, mb_col); mb_row, mb_col);
}
//printf("%3d", mi->mbmi.mode); //printf("%3d", mi->mbmi.mode);
......
...@@ -97,6 +97,7 @@ void vp8_reset_mb_tokens_context(MACROBLOCKD *x) ...@@ -97,6 +97,7 @@ void vp8_reset_mb_tokens_context(MACROBLOCKD *x)
} }
DECLARE_ALIGNED(16, extern const unsigned char, vp8_norm[256]); DECLARE_ALIGNED(16, extern const unsigned char, vp8_norm[256]);
#define FILL \ #define FILL \
if(count < 0) \ if(count < 0) \
VP8DX_BOOL_DECODER_FILL(count, value, bufptr, bufend); VP8DX_BOOL_DECODER_FILL(count, value, bufptr, bufend);
...@@ -289,7 +290,7 @@ int vp8_decode_mb_tokens_8x8(VP8D_COMP *dx, MACROBLOCKD *x) ...@@ -289,7 +290,7 @@ int vp8_decode_mb_tokens_8x8(VP8D_COMP *dx, MACROBLOCKD *x)
INT16 val, bits_count; INT16 val, bits_count;
INT16 c; INT16 c;
INT16 v; INT16 v;
const vp8_prob *Prob;// const vp8_prob *Prob;
int seg_eob; int seg_eob;
int segment_id = x->mode_info_context->mbmi.segment_id; int segment_id = x->mode_info_context->mbmi.segment_id;
...@@ -323,6 +324,7 @@ BLOCK_LOOP_8x8: ...@@ -323,6 +324,7 @@ BLOCK_LOOP_8x8:
a = A + vp8_block2above_8x8[i]; a = A + vp8_block2above_8x8[i];
l = L + vp8_block2left_8x8[i]; l = L + vp8_block2left_8x8[i];
c = (INT16)(!type); c = (INT16)(!type);
// Dest = ((A)!=0) + ((B)!=0); // Dest = ((A)!=0) + ((B)!=0);
...@@ -363,11 +365,11 @@ DO_WHILE_8x8: ...@@ -363,11 +365,11 @@ DO_WHILE_8x8:
CHECK_0_8x8_: CHECK_0_8x8_:
if (i==24) if (i==24)
{ {
DECODE_AND_LOOP_IF_ZERO_8x8_2(Prob[ZERO_CONTEXT_NODE], CHECK_0_8x8_); DECODE_AND_LOOP_IF_ZERO_8x8_2(Prob[ZERO_CONTEXT_NODE], CHECK_0_8x8_);
} }
else else
{ {
DECODE_AND_LOOP_IF_ZERO_8X8(Prob[ZERO_CONTEXT_NODE], CHECK_0_8x8_); DECODE_AND_LOOP_IF_ZERO_8X8(Prob[ZERO_CONTEXT_NODE], CHECK_0_8x8_);
} }
DECODE_AND_BRANCH_IF_ZERO(Prob[ONE_CONTEXT_NODE], ONE_CONTEXT_NODE_0_8x8_); DECODE_AND_BRANCH_IF_ZERO(Prob[ONE_CONTEXT_NODE], ONE_CONTEXT_NODE_0_8x8_);
DECODE_AND_BRANCH_IF_ZERO(Prob[LOW_VAL_CONTEXT_NODE], DECODE_AND_BRANCH_IF_ZERO(Prob[LOW_VAL_CONTEXT_NODE],
...@@ -516,6 +518,7 @@ ONE_CONTEXT_NODE_0_8x8_: ...@@ -516,6 +518,7 @@ ONE_CONTEXT_NODE_0_8x8_:
{ {
qcoeff_ptr [ scan[c] ] = (INT16) v; qcoeff_ptr [ scan[c] ] = (INT16) v;
++c; ++c;
goto DO_WHILE_8x8; goto DO_WHILE_8x8;
} }
} }
...@@ -539,7 +542,7 @@ BLOCK_FINISHED_8x8: ...@@ -539,7 +542,7 @@ BLOCK_FINISHED_8x8:
*a = *l = ((eobs[i] = c) != !type); // any nonzero data? *a = *l = ((eobs[i] = c) != !type); // any nonzero data?
if (i!=24) if (i!=24)
{ {
*(a + 1) = *a; *(a + 1) = *a;
*(l + 1) = *l; *(l + 1) = *l;
} }
...@@ -757,6 +760,7 @@ ONE_CONTEXT_NODE_0_: ...@@ -757,6 +760,7 @@ ONE_CONTEXT_NODE_0_:
qcoeff_ptr [ 15 ] = (INT16) v; qcoeff_ptr [ 15 ] = (INT16) v;
BLOCK_FINISHED: BLOCK_FINISHED:
*a = *l = ((eobs[i] = c) != !type); /* any nonzero data? */ *a = *l = ((eobs[i] = c) != !type); /* any nonzero data? */
eobtotal += c; eobtotal += c;
qcoeff_ptr += 16; qcoeff_ptr += 16;
......
...@@ -151,6 +151,18 @@ static void write_split(vp8_writer *bc, int x) ...@@ -151,6 +151,18 @@ static void write_split(vp8_writer *bc, int x)
); );
} }
static int prob_update_savings(const unsigned int *ct,
const vp8_prob oldp, const vp8_prob newp,
const vp8_prob upd)
{
const int old_b = vp8_cost_branch(ct, oldp);
const int new_b = vp8_cost_branch(ct, newp);
const int update_b = 8 +
((vp8_cost_one(upd) - vp8_cost_zero(upd)) >> 8);
return old_b - new_b - update_b;
}
static void pack_tokens_c(vp8_writer *w, const TOKENEXTRA *p, int xcount) static void pack_tokens_c(vp8_writer *w, const TOKENEXTRA *p, int xcount)
{ {
const TOKENEXTRA *const stop = p + xcount; const TOKENEXTRA *const stop = p + xcount;
...@@ -170,10 +182,11 @@ static void pack_tokens_c(vp8_writer *w, const TOKENEXTRA *p, int xcount) ...@@ -170,10 +182,11 @@ static void pack_tokens_c(vp8_writer *w, const TOKENEXTRA *p, int xcount)
int v = a->value; int v = a->value;
int n = a->Len; int n = a->Len;
/* skip one or two nodes */
if (p->skip_eob_node) if (p->skip_eob_node)
{ {
n--; n-=p->skip_eob_node;
i = 2; i = 2*p->skip_eob_node;
} }
do do
...@@ -581,7 +594,11 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi) ...@@ -581,7 +594,11 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
const int mis = pc->mode_info_stride; const int mis = pc->mode_info_stride;
int mb_row = -1; int mb_row = -1;
#if CONFIG_NEWENTROPY
int prob_skip_false[3] = {0, 0, 0};
#else
int prob_skip_false = 0; int prob_skip_false = 0;
#endif
// Values used in prediction model coding // Values used in prediction model coding
vp8_prob pred_prob; vp8_prob pred_prob;
...@@ -599,6 +616,28 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi) ...@@ -599,6 +616,28 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
if (pc->mb_no_coeff_skip) if (pc->mb_no_coeff_skip)
{ {
// Divide by 0 check. 0 case possible with segment features // Divide by 0 check. 0 case possible with segment features
#if CONFIG_NEWENTROPY
int k;
for (k=0;k<MBSKIP_CONTEXTS;++k)
{
if ( (cpi->skip_false_count[k] + cpi->skip_true_count[k]) )
{
prob_skip_false[k] = cpi->skip_false_count[k] * 256 /
(cpi->skip_false_count[k] + cpi->skip_true_count[k]);
if (prob_skip_false[k] <= 1)
prob_skip_false[k] = 1;
if (prob_skip_false[k] > 255)
prob_skip_false[k] = 255;
}
else
prob_skip_false[k] = 255;
pc->mbskip_pred_probs[k] = prob_skip_false[k];
vp8_write_literal(w, prob_skip_false[k], 8);
}
#else
if ( (cpi->skip_false_count + cpi->skip_true_count) ) if ( (cpi->skip_false_count + cpi->skip_true_count) )
{ {
prob_skip_false = cpi->skip_false_count * 256 / prob_skip_false = cpi->skip_false_count * 256 /
...@@ -615,6 +654,7 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi) ...@@ -615,6 +654,7 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
cpi->prob_skip_false = prob_skip_false; cpi->prob_skip_false = prob_skip_false;
vp8_write_literal(w, prob_skip_false, 8); vp8_write_literal(w, prob_skip_false, 8);
#endif
} }
vp8_write_literal(w, pc->prob_intra_coded, 8); vp8_write_literal(w, pc->prob_intra_coded, 8);
...@@ -715,7 +755,12 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi) ...@@ -715,7 +755,12 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
( !segfeature_active( xd, segment_id, SEG_LVL_EOB ) || ( !segfeature_active( xd, segment_id, SEG_LVL_EOB ) ||
( get_segdata( xd, segment_id, SEG_LVL_EOB ) != 0 ) ) ) ( get_segdata( xd, segment_id, SEG_LVL_EOB ) != 0 ) ) )
{ {
#if CONFIG_NEWENTROPY
vp8_encode_bool(w, mi->mb_skip_coeff,
get_pred_prob(pc, xd, PRED_MBSKIP));
#else
vp8_encode_bool(w, mi->mb_skip_coeff, prob_skip_false); vp8_encode_bool(w, mi->mb_skip_coeff, prob_skip_false);
#endif
} }
// Encode the reference frame. // Encode the reference frame.
...@@ -920,17 +965,44 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi) ...@@ -920,17 +965,44 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
static void write_kfmodes(VP8_COMP *cpi) static void write_kfmodes(VP8_COMP *cpi)
{ {
vp8_writer *const bc = & cpi->bc; vp8_writer *const bc = & cpi->bc;
const VP8_COMMON *const c = & cpi->common; VP8_COMMON *const c = & cpi->common;
const int mis = c->mode_info_stride;
/* const */ /* const */
MODE_INFO *m = c->mi; MODE_INFO *m = c->mi;
int mb_row = -1; int mb_row = -1;
#if CONFIG_NEWENTROPY
int prob_skip_false[3] = {0, 0, 0};
#else
int prob_skip_false = 0; int prob_skip_false = 0;
#endif
MACROBLOCKD *xd = &cpi->mb.e_mbd; MACROBLOCKD *xd = &cpi->mb.e_mbd;
if (c->mb_no_coeff_skip) if (c->mb_no_coeff_skip)
{ {
// Divide by 0 check. 0 case possible with segment features // Divide by 0 check. 0 case possible with segment features
#if CONFIG_NEWENTROPY
int k;
for (k=0;k<MBSKIP_CONTEXTS;++k)
{
if ( (cpi->skip_false_count[k] + cpi->skip_true_count[k]) )
{
prob_skip_false[k] = cpi->skip_false_count[k] * 256 /
(cpi->skip_false_count[k] + cpi->skip_true_count[k]);
if (prob_skip_false[k] <= 1)
prob_skip_false[k] = 1;
if (prob_skip_false[k] > 255)
prob_skip_false[k] = 255;
}
else
prob_skip_false[k] = 255;
c->mbskip_pred_probs[k] = prob_skip_false[k];
vp8_write_literal(bc, prob_skip_false[k], 8);
}
#else
if ( (cpi->skip_false_count + cpi->skip_true_count) ) if ( (cpi->skip_false_count + cpi->skip_true_count) )
{ {
prob_skip_false = cpi->skip_false_count * 256 / prob_skip_false = cpi->skip_false_count * 256 /
...@@ -947,6 +1019,7 @@ static void write_kfmodes(VP8_COMP *cpi) ...@@ -947,6 +1019,7 @@ static void write_kfmodes(VP8_COMP *cpi)
cpi->prob_skip_false = prob_skip_false; cpi->prob_skip_false = prob_skip_false;
vp8_write_literal(bc, prob_skip_false, 8); vp8_write_literal(bc, prob_skip_false, 8);
#endif
} }
#if CONFIG_QIMODE #if CONFIG_QIMODE
...@@ -965,6 +1038,8 @@ static void write_kfmodes(VP8_COMP *cpi) ...@@ -965,6 +1038,8 @@ static void write_kfmodes(VP8_COMP *cpi)
const int ym = m->mbmi.mode; const int ym = m->mbmi.mode;
int segment_id = m->mbmi.segment_id; int segment_id = m->mbmi.segment_id;
xd->mode_info_context = m;
if (cpi->mb.e_mbd.update_mb_segmentation_map) if (cpi->mb.e_mbd.update_mb_segmentation_map)
{ {
write_mb_segid(bc, &m->mbmi, &cpi->mb.e_mbd); write_mb_segid(bc, &m->mbmi, &cpi->mb.e_mbd);
...@@ -974,7 +1049,12 @@ static void write_kfmodes(VP8_COMP *cpi) ...@@ -974,7 +1049,12 @@ static void write_kfmodes(VP8_COMP *cpi)