]> granicus.if.org Git - libvpx/commitdiff
Merge "Enable mode search threshold update in non-RD coding mode"
authorJingning Han <jingning@google.com>
Wed, 29 Oct 2014 19:42:22 +0000 (12:42 -0700)
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>
Wed, 29 Oct 2014 19:42:22 +0000 (12:42 -0700)
1  2 
vp9/encoder/vp9_rd.c

index d611532c1ffa85cbfa20a51daf7aff369aa55d60,587ffad8d7bec07bd7215e084dc291d363f12c09..13e317d6d78cee8d001a249aa3c4c00fc8f23a85
@@@ -594,17 -594,46 +594,40 @@@ void vp9_set_rd_speed_thresholds_sub8x8
    const SPEED_FEATURES *const sf = &cpi->sf;
    RD_OPT *const rd = &cpi->rd;
    int i;
 -
 -  for (i = 0; i < MAX_REFS; ++i)
 -    rd->thresh_mult_sub8x8[i] = cpi->oxcf.mode == BEST ? -500 : 0;
 -
 -  rd->thresh_mult_sub8x8[THR_LAST] += 2500;
 -  rd->thresh_mult_sub8x8[THR_GOLD] += 2500;
 -  rd->thresh_mult_sub8x8[THR_ALTR] += 2500;
 -  rd->thresh_mult_sub8x8[THR_INTRA] += 2500;
 -  rd->thresh_mult_sub8x8[THR_COMP_LA] += 4500;
 -  rd->thresh_mult_sub8x8[THR_COMP_GA] += 4500;
 -
 -  // Check for masked out split cases.
 -  for (i = 0; i < MAX_REFS; ++i)
 -    if (sf->disable_split_mask & (1 << i))
 -      rd->thresh_mult_sub8x8[i] = INT_MAX;
 +  static const int thresh_mult[2][MAX_REFS] =
 +      {{2500, 2500, 2500, 4500, 4500, 2500},
 +       {2000, 2000, 2000, 4000, 4000, 2000}};
 +
 +  for (i = 0; i < MAX_REFS; ++i) {
 +    rd->thresh_mult_sub8x8[i] =
 +        (sf->disable_split_mask & (1 << i)) ?
 +            INT_MAX : thresh_mult[cpi->oxcf.mode == BEST][i];
 +  }
  }
  
+ // TODO(jingning) Refactor this function. Use targeted smaller struct as inputs.
+ void vp9_update_rd_thresh_fact(VP9_COMP *cpi, TileDataEnc *tile_data,
+                                int bsize, int best_mode_index) {
+   if (cpi->sf.adaptive_rd_thresh > 0) {
+     const int top_mode = bsize < BLOCK_8X8 ? MAX_REFS : MAX_MODES;
+     int mode;
+     for (mode = 0; mode < top_mode; ++mode) {
+       const BLOCK_SIZE min_size = MAX(bsize - 1, BLOCK_4X4);
+       const BLOCK_SIZE max_size = MIN(bsize + 2, BLOCK_64X64);
+       BLOCK_SIZE bs;
+       for (bs = min_size; bs <= max_size; ++bs) {
+         int *const fact = &tile_data->thresh_freq_fact[bs][mode];
+         if (mode == best_mode_index) {
+           *fact -= (*fact >> 4);
+         } else {
+           *fact = MIN(*fact + RD_THRESH_INC,
+                       cpi->sf.adaptive_rd_thresh * RD_THRESH_MAX_FACT);
+         }
+       }
+     }
+   }
+ }
  int vp9_get_intra_cost_penalty(int qindex, int qdelta,
                                 vpx_bit_depth_t bit_depth) {
    const int q = vp9_dc_quant(qindex, qdelta, bit_depth);