Add forward probability model update for partition
authorJingning Han <jingning@google.com>
Sat, 27 Apr 2013 04:52:53 +0000 (21:52 -0700)
committerPaul Wilkins <paulwilkins@google.com>
Sat, 27 Apr 2013 15:47:04 +0000 (16:47 +0100)
Enable forward model update for partition syntax coding.

Change-Id: If47b423b6d12f34614c57f25d235dc9ba688efc5

vp9/decoder/vp9_decodemv.c
vp9/encoder/vp9_bitstream.c

index fbb7dbd..c51d0b2 100644 (file)
@@ -475,7 +475,7 @@ static void mb_mode_mv_init(VP9D_COMP *pbi, vp9_reader *r) {
   } else {
     nmv_context *const nmvc = &pbi->common.fc.nmvc;
     MACROBLOCKD *const xd = &pbi->mb;
-    int i;
+    int i, j;
 
     if (cm->mcomp_filter_type == SWITCHABLE)
       read_switchable_interp_probs(pbi, r);
@@ -509,6 +509,11 @@ static void mb_mode_mv_init(VP9D_COMP *pbi, vp9_reader *r) {
       for (i = 0; i < VP9_I32X32_MODES - 1; ++i)
         cm->fc.sb_ymode_prob[i] = vp9_read_prob(r);
 
+    for (j = 0; j < NUM_PARTITION_CONTEXTS; ++j)
+      if (vp9_read_bit(r))
+        for (i = 0; i < PARTITION_TYPES - 1; ++i)
+          cm->fc.partition_prob[j][i] = vp9_read_prob(r);
+
     read_nmvprobs(r, nmvc, xd->allow_high_precision_mv);
   }
 }
index d099960..2453054 100644 (file)
@@ -2257,6 +2257,14 @@ void vp9_pack_bitstream(VP9_COMP *cpi, unsigned char *dest,
     }
     update_mbintra_mode_probs(cpi, &header_bc);
 
+    for (i = 0; i < NUM_PARTITION_CONTEXTS; ++i) {
+      vp9_prob Pnew[PARTITION_TYPES - 1];
+      unsigned int bct[PARTITION_TYPES - 1][2];
+      update_mode(&header_bc, PARTITION_TYPES, vp9_partition_encodings,
+                  vp9_partition_tree, Pnew, pc->fc.partition_prob[i], bct,
+                  (unsigned int *)cpi->partition_count[i]);
+    }
+
     vp9_write_nmv_probs(cpi, xd->allow_high_precision_mv, &header_bc);
   }