]> granicus.if.org Git - libvpx/commitdiff
Merge "renamed pick_best_mbsegmentation and remove rd_check_segment_txsize"
authorJim Bankoski <jimbankoski@google.com>
Thu, 17 Apr 2014 22:42:36 +0000 (15:42 -0700)
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>
Thu, 17 Apr 2014 22:42:36 +0000 (15:42 -0700)
1  2 
vp9/encoder/vp9_rdopt.c

diff --combined vp9/encoder/vp9_rdopt.c
index 46ee4c7dc191e8f551e7c0197d726df437f75e0b,9ad7fa32b04ab24ed22a2f4ccc608e5818f0c1b9..36932cfacbc6eb99dd23d91fa37b39abce36be41
@@@ -451,7 -451,7 +451,7 @@@ static void model_rd_for_sb(VP9_COMP *c
        x->pred_sse[ref] = sse;
  
      // Fast approximate the modelling function.
 -    if (cpi->speed > 4) {
 +    if (cpi->oxcf.speed > 4) {
        int64_t rate;
        int64_t dist;
        int64_t square_error = sse;
@@@ -1713,18 -1713,28 +1713,28 @@@ static int check_best_zero_mv
    return 1;
  }
  
- static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
-                                     const TileInfo *const tile,
-                                     BEST_SEG_INFO *bsi_buf, int filter_idx,
-                                     int_mv seg_mvs[4][MAX_REF_FRAMES],
-                                     int mi_row, int mi_col) {
+ static int64_t rd_pick_best_sub8x8_mode(VP9_COMP *cpi, MACROBLOCK *x,
+                                         const TileInfo * const tile,
+                                         int_mv *best_ref_mv,
+                                         int_mv *second_best_ref_mv,
+                                         int64_t best_rd, int *returntotrate,
+                                         int *returnyrate,
+                                         int64_t *returndistortion,
+                                         int *skippable, int64_t *psse,
+                                         int mvthresh,
+                                         int_mv seg_mvs[4][MAX_REF_FRAMES],
+                                         BEST_SEG_INFO *bsi_buf, int filter_idx,
+                                         int mi_row, int mi_col) {
+   int i;
+   BEST_SEG_INFO *bsi = bsi_buf + filter_idx;
+   MACROBLOCKD *xd = &x->e_mbd;
+   MODE_INFO *mi = xd->mi[0];
+   MB_MODE_INFO *mbmi = &mi->mbmi;
+   int mode_idx;
    int k, br = 0, idx, idy;
    int64_t bd = 0, block_sse = 0;
    MB_PREDICTION_MODE this_mode;
-   MACROBLOCKD *xd = &x->e_mbd;
    VP9_COMMON *cm = &cpi->common;
-   MODE_INFO *mi = xd->mi[0];
-   MB_MODE_INFO *const mbmi = &mi->mbmi;
    struct macroblock_plane *const p = &x->plane[0];
    struct macroblockd_plane *const pd = &xd->plane[0];
    const int label_count = 4;
    const int num_4x4_blocks_high = num_4x4_blocks_high_lookup[bsize];
    vp9_variance_fn_ptr_t *v_fn_ptr = &cpi->fn_ptr[bsize];
    ENTROPY_CONTEXT t_above[2], t_left[2];
-   BEST_SEG_INFO *bsi = bsi_buf + filter_idx;
-   int mode_idx;
    int subpelmv = 1, have_ref = 0;
    const int has_second_rf = has_second_ref(mbmi);
    const int disable_inter_mode_mask = cpi->sf.disable_inter_mode_mask[bsize];
  
+   vp9_zero(*bsi);
+   bsi->segment_rd = best_rd;
+   bsi->ref_mv[0] = best_ref_mv;
+   bsi->ref_mv[1] = second_best_ref_mv;
+   bsi->mvp.as_int = best_ref_mv->as_int;
+   bsi->mvthresh = mvthresh;
+   for (i = 0; i < 4; i++)
+     bsi->modes[i] = ZEROMV;
    vpx_memcpy(t_above, pd->above_context, sizeof(t_above));
    vpx_memcpy(t_left, pd->left_context, sizeof(t_left));
  
            for (midx = 0; midx < INTER_MODES; ++midx)
              bsi->rdstat[iy][midx].brdcost = INT64_MAX;
          bsi->segment_rd = INT64_MAX;
-         return;
+         return INT64_MAX;;
        }
  
        mode_idx = INTER_OFFSET(mode_selected);
            for (midx = 0; midx < INTER_MODES; ++midx)
              bsi->rdstat[iy][midx].brdcost = INT64_MAX;
          bsi->segment_rd = INT64_MAX;
-         return;
+         return INT64_MAX;;
        }
      }
    } /* for each label */
    // update the coding decisions
    for (k = 0; k < 4; ++k)
      bsi->modes[k] = mi->bmi[k].as_mode;
- }
- static int64_t rd_pick_best_mbsegmentation(VP9_COMP *cpi, MACROBLOCK *x,
-                                            const TileInfo *const tile,
-                                            int_mv *best_ref_mv,
-                                            int_mv *second_best_ref_mv,
-                                            int64_t best_rd,
-                                            int *returntotrate,
-                                            int *returnyrate,
-                                            int64_t *returndistortion,
-                                            int *skippable, int64_t *psse,
-                                            int mvthresh,
-                                            int_mv seg_mvs[4][MAX_REF_FRAMES],
-                                            BEST_SEG_INFO *bsi_buf,
-                                            int filter_idx,
-                                            int mi_row, int mi_col) {
-   int i;
-   BEST_SEG_INFO *bsi = bsi_buf + filter_idx;
-   MACROBLOCKD *xd = &x->e_mbd;
-   MODE_INFO *mi = xd->mi[0];
-   MB_MODE_INFO *mbmi = &mi->mbmi;
-   int mode_idx;
-   vp9_zero(*bsi);
-   bsi->segment_rd = best_rd;
-   bsi->ref_mv[0] = best_ref_mv;
-   bsi->ref_mv[1] = second_best_ref_mv;
-   bsi->mvp.as_int = best_ref_mv->as_int;
-   bsi->mvthresh = mvthresh;
-   for (i = 0; i < 4; i++)
-     bsi->modes[i] = ZEROMV;
-   rd_check_segment_txsize(cpi, x, tile, bsi_buf, filter_idx, seg_mvs,
-                           mi_row, mi_col);
  
    if (bsi->segment_rd > best_rd)
      return INT64_MAX;
@@@ -4050,15 -4033,14 +4033,14 @@@ int64_t vp9_rd_pick_inter_mode_sub8x8(V
              int newbest, rs;
              int64_t rs_rd;
              mbmi->interp_filter = switchable_filter_index;
-             tmp_rd = rd_pick_best_mbsegmentation(cpi, x, tile,
-                                                  &mbmi->ref_mvs[ref_frame][0],
-                                                  second_ref,
-                                                  best_yrd,
-                                                  &rate, &rate_y, &distortion,
-                                                  &skippable, &total_sse,
-                                                  (int)this_rd_thresh, seg_mvs,
-                                                  bsi, switchable_filter_index,
-                                                  mi_row, mi_col);
+             tmp_rd = rd_pick_best_sub8x8_mode(cpi, x, tile,
+                                               &mbmi->ref_mvs[ref_frame][0],
+                                               second_ref, best_yrd, &rate,
+                                               &rate_y, &distortion,
+                                               &skippable, &total_sse,
+                                               (int) this_rd_thresh, seg_mvs,
+                                               bsi, switchable_filter_index,
+                                               mi_row, mi_col);
  
              if (tmp_rd == INT64_MAX)
                continue;
        if (!pred_exists) {
          // Handles the special case when a filter that is not in the
          // switchable list (bilinear, 6-tap) is indicated at the frame level
-         tmp_rd = rd_pick_best_mbsegmentation(cpi, x, tile,
-                      &mbmi->ref_mvs[ref_frame][0],
-                      second_ref,
-                      best_yrd,
-                      &rate, &rate_y, &distortion,
-                      &skippable, &total_sse,
-                      (int)this_rd_thresh, seg_mvs,
-                      bsi, 0,
-                      mi_row, mi_col);
+         tmp_rd = rd_pick_best_sub8x8_mode(cpi, x, tile,
+                                           &mbmi->ref_mvs[ref_frame][0],
+                                           second_ref, best_yrd, &rate, &rate_y,
+                                           &distortion, &skippable, &total_sse,
+                                           (int) this_rd_thresh, seg_mvs, bsi, 0,
+                                           mi_row, mi_col);
          if (tmp_rd == INT64_MAX)
            continue;
        } else {