]> granicus.if.org Git - libvpx/commitdiff
Make nmv_count update 4x8/8x4 aware
authorJingning Han <jingning@google.com>
Fri, 17 May 2013 22:54:49 +0000 (15:54 -0700)
committerJingning Han <jingning@google.com>
Fri, 17 May 2013 22:57:42 +0000 (15:57 -0700)
This commit modifies the vp9_update_nmv_count_ to support rectangular
partition of 8x8 block.

Change-Id: I3e742f80f18f95b031c1c785d756d9365503c24c

vp9/encoder/vp9_encodemv.c

index 8858e206bcf38dac179b01eded90f7bd8010c619..d180e46cf88015103a8fa036e6168f1ca5e51276 100644 (file)
@@ -569,23 +569,32 @@ void vp9_update_nmv_count(VP9_COMP *cpi, MACROBLOCK *x,
                          int_mv *best_ref_mv, int_mv *second_best_ref_mv) {
   MB_MODE_INFO * mbmi = &x->e_mbd.mode_info_context->mbmi;
   MV mv;
+  int bwl = b_width_log2(mbmi->sb_type), bw = 1 << bwl;
+  int bhl = b_height_log2(mbmi->sb_type), bh = 1 << bhl;
+  int idx, idy;
 
   if (mbmi->mode == SPLITMV) {
     int i;
     PARTITION_INFO *pi = x->partition_info;
-    for (i = 0; i < pi->count; i++) {
-      if (pi->bmi[i].mode == NEW4X4) {
-        mv.row = (pi->bmi[i].mv.as_mv.row - best_ref_mv->as_mv.row);
-        mv.col = (pi->bmi[i].mv.as_mv.col - best_ref_mv->as_mv.col);
-        vp9_increment_nmv(&mv, &best_ref_mv->as_mv, &cpi->NMVcount,
-                          x->e_mbd.allow_high_precision_mv);
-        if (x->e_mbd.mode_info_context->mbmi.second_ref_frame > 0) {
-          mv.row = pi->bmi[i].second_mv.as_mv.row -
-                       second_best_ref_mv->as_mv.row;
-          mv.col = pi->bmi[i].second_mv.as_mv.col -
-                       second_best_ref_mv->as_mv.col;
-          vp9_increment_nmv(&mv, &second_best_ref_mv->as_mv, &cpi->NMVcount,
+#if !CONFIG_AB4X4
+    bw = 1, bh = 1;
+#endif
+    for (idy = 0; idy < 2; idy += bh) {
+      for (idx = 0; idx < 2; idx += bw) {
+        i = idy * 2 + idx;
+        if (pi->bmi[i].mode == NEW4X4) {
+          mv.row = (pi->bmi[i].mv.as_mv.row - best_ref_mv->as_mv.row);
+          mv.col = (pi->bmi[i].mv.as_mv.col - best_ref_mv->as_mv.col);
+          vp9_increment_nmv(&mv, &best_ref_mv->as_mv, &cpi->NMVcount,
                             x->e_mbd.allow_high_precision_mv);
+          if (x->e_mbd.mode_info_context->mbmi.second_ref_frame > 0) {
+            mv.row = pi->bmi[i].second_mv.as_mv.row -
+                         second_best_ref_mv->as_mv.row;
+            mv.col = pi->bmi[i].second_mv.as_mv.col -
+                         second_best_ref_mv->as_mv.col;
+            vp9_increment_nmv(&mv, &second_best_ref_mv->as_mv, &cpi->NMVcount,
+                              x->e_mbd.allow_high_precision_mv);
+          }
         }
       }
     }