ref: 5e766ccee030a207a2edd37a5f7012665bc43796
parent: 89b8c7a51390351db4fd5f7bbf1c8a3c547898e5
author: Jingning Han <jingning@google.com>
date: Wed Oct 15 08:18:48 EDT 2014
Use rate/distortion thresholds to control non-RD partition search Compare the estimated rate and distortion to the thresholds scaled according to the operating block size and determine if further split partition search will be run. The compression performance of speed -5 is changed by -0.074%. The encoding speed is 10% - 15% faster. vidyo1 720p 16545 b/f, 40.492 dB, 11475 ms -> 16535 b/f, 40.486 dB, 10100 ms nik720p 16624 b/f, 36.310 dB, 10071 ms -> 16617 b/f, 36.313 dB, 8346 ms Change-Id: Ic9197ab5761279ae55d2fb7813b2af0e0db497b8
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -2834,9 +2834,14 @@
this_rate += cpi->partition_cost[pl][PARTITION_NONE];
sum_rd = RDCOST(x->rdmult, x->rddiv, this_rate, this_dist);
if (sum_rd < best_rd) {
- int64_t stop_thresh = 4096;
- int64_t stop_thresh_rd;
+ int dist_breakout_thr = sf->partition_search_breakout_dist_thr;
+ int64_t rate_breakout_thr = sf->partition_search_breakout_rate_thr;
+ dist_breakout_thr >>= 8 - (b_width_log2_lookup[bsize] +
+ b_height_log2_lookup[bsize]);
+
+ rate_breakout_thr *= num_pels_log2_lookup[bsize];
+
best_rate = this_rate;
best_dist = this_dist;
best_rd = sum_rd;
@@ -2843,14 +2848,9 @@
if (bsize >= BLOCK_8X8)
pc_tree->partitioning = PARTITION_NONE;
- // Adjust threshold according to partition size.
- stop_thresh >>= 8 - (b_width_log2_lookup[bsize] +
- b_height_log2_lookup[bsize]);
-
- stop_thresh_rd = RDCOST(x->rdmult, x->rddiv, 0, stop_thresh);
- // If obtained distortion is very small, choose current partition
- // and stop splitting.
- if (!x->e_mbd.lossless && best_rd < stop_thresh_rd) {
+ if (!x->e_mbd.lossless &&
+ this_rate < rate_breakout_thr &&
+ this_dist < dist_breakout_thr) {
do_split = 0;
do_rect = 0;
}
--- a/vp9/encoder/vp9_speed_features.c
+++ b/vp9/encoder/vp9_speed_features.c
@@ -275,6 +275,12 @@
sf->inter_mode_mask[BLOCK_32X64] = INTER_NEAREST_NEW_ZERO;
sf->inter_mode_mask[BLOCK_64X32] = INTER_NEAREST_NEW_ZERO;
sf->inter_mode_mask[BLOCK_64X64] = INTER_NEAREST_NEW_ZERO;
+
+ if (MIN(cm->width, cm->height) >= 720)
+ sf->partition_search_breakout_dist_thr = (1 << 25);
+ else
+ sf->partition_search_breakout_dist_thr = (1 << 23);
+ sf->partition_search_breakout_rate_thr = 200;
}
if (speed >= 6) {