]> granicus.if.org Git - libvpx/commitdiff
Make comp_inter_inter support 4x4 partition coding
authorJingning Han <jingning@google.com>
Thu, 23 May 2013 04:09:28 +0000 (21:09 -0700)
committerPaul Wilkins <paulwilkins@google.com>
Thu, 23 May 2013 12:13:42 +0000 (13:13 +0100)
This commit refactors the iterative motion search for compound
inter-inter mode, to make it support all partition types including
4x4/4x8/8x4 block sizes.

Change-Id: I5f1212b0f307377291763e45c6bdc9693b5f04c8

vp9/encoder/vp9_rdopt.c

index 815fa05d7d266b81d56e155b524bc4af77df36a8..1ca323e729686e06e6a796e9c227cae2f1075145 100644 (file)
@@ -2104,26 +2104,10 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
 
       if (is_comp_pred) {
         if (cpi->sf.comp_inter_joint_serach) {
-          const int b_sz[BLOCK_SIZE_TYPES][2] = {
-              {4, 4},
-              {4, 8},
-              {8, 4},
-              {8, 8},
-              {8, 16},
-              {16, 8},
-              {16, 16},
-              {16, 32},
-              {32, 16},
-              {32, 32},
-              {32, 64},
-              {64, 32},
-              {64, 64}
-          };
-
+          int pw = 4 << b_width_log2(bsize), ph = 4 << b_height_log2(bsize);
           int ite;
           // Prediction buffer from second frame.
-          uint8_t *second_pred = vpx_memalign(16, b_sz[bsize][0] *
-                                              b_sz[bsize][1] * sizeof(uint8_t));
+          uint8_t *second_pred = vpx_memalign(16, pw * ph * sizeof(uint8_t));
 
           // Do joint motion search in compound mode to get more accurate mv.
           struct buf_2d backup_yv12[MAX_MB_PLANE] = {{0}};
@@ -2186,10 +2170,10 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
             // Get pred block from second frame.
             vp9_build_inter_predictor(ref_yv12[!id].buf,
                                       ref_yv12[!id].stride,
-                                      second_pred, b_sz[bsize][0],
+                                      second_pred, pw,
                                       &frame_mv[NEWMV][refs[!id]],
                                       &xd->scale_factor[!id],
-                                      b_sz[bsize][0], b_sz[bsize][1], 0,
+                                      pw, ph, 0,
                                       &xd->subpix);
 
             // Compound motion search on first ref frame.
@@ -2209,7 +2193,7 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
                                                &cpi->fn_ptr[block_size],
                                                x->nmvjointcost, x->mvcost,
                                                &ref_mv[id], second_pred,
-                                               b_sz[bsize][0], b_sz[bsize][1]);
+                                               pw, ph);
 
             x->mv_col_min = tmp_col_min;
             x->mv_col_max = tmp_col_max;
@@ -2226,8 +2210,7 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
                                                      &cpi->fn_ptr[block_size],
                                                      x->nmvjointcost, x->mvcost,
                                                      &dis, &sse, second_pred,
-                                                     b_sz[bsize][0],
-                                                     b_sz[bsize][1]);
+                                                     pw, ph);
             }
 
             if (id)