Added intra mode probabilites into coding_context
authorYaowu Xu <yaowu@google.com>
Tue, 17 Apr 2012 16:26:19 +0000 (09:26 -0700)
committerYaowu Xu <yaowu@google.com>
Tue, 17 Apr 2012 16:29:27 +0000 (09:29 -0700)
These contexts need to be saved and restored for recode, otherwise
encoder/decoder mismatch happens for some clips (eg._mobcal 720p)

Change-Id: Ic65cfa0bf56ed0472ecab962ce31394d59d344bf

vp8/encoder/onyx_int.h
vp8/encoder/ratectrl.c

index 932e8ca..703235c 100644 (file)
@@ -90,6 +90,13 @@ typedef struct
     vp8_prob coef_probs_8x8[BLOCK_TYPES]
                            [COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
 
+    vp8_prob ymode_prob [VP8_YMODES-1];   /* interframe intra mode probs */
+#if CONFIG_UVINTRA
+    vp8_prob uv_mode_prob [VP8_YMODES][VP8_UV_MODES-1];
+#else
+    vp8_prob uv_mode_prob [VP8_UV_MODES-1];
+#endif
+
     int mv_ref_ct[6][4][2];
     int mode_context[6][4];
     int mv_ref_ct_a[6][4][2];
index 1ff1375..9c7b019 100644 (file)
@@ -155,6 +155,9 @@ void vp8_save_coding_context(VP8_COMP *cpi)
     vp8_copy( cc->mv_ref_ct_a, cm->mv_ref_ct_a );
     vp8_copy( cc->mode_context_a, cm->mode_context_a );
 
+    vp8_copy( cc->ymode_prob, cm->fc.ymode_prob );
+    vp8_copy( cc->uv_mode_prob, cm->fc.uv_mode_prob );
+
     // Stats
 #ifdef MODE_STATS
     vp8_copy(cc->y_modes,       y_modes);
@@ -201,6 +204,9 @@ void vp8_restore_coding_context(VP8_COMP *cpi)
     vp8_copy( cm->mv_ref_ct_a, cc->mv_ref_ct_a );
     vp8_copy( cm->mode_context_a, cc->mode_context_a );
 
+    vp8_copy( cm->fc.ymode_prob, cc->ymode_prob);
+    vp8_copy( cm->fc.uv_mode_prob, cc->uv_mode_prob);
+
     // Stats
 #ifdef MODE_STATS
     vp8_copy(y_modes, cc->y_modes);