ref: 019384f2d365e4265b554e235c7d669b69ef35c0
parent: b5ce9456db8626e69e4aa30519dafdf7e397619f
author: Yunqing Wang <yunqingwang@google.com>
date: Mon Feb 27 12:38:53 EST 2012
Only do uv intra-mode evaluation when intra mode is checked When we encode slide-show clips, for the majority of the time, only ZEROMV mode is checked, and all other modes are skipped. This change delayed uv intra-mode evaluation until intra mode is actually checked. This gave big performance gain for slide-show video encoding (2nd pass gain: 18% to 28%). But, this change doesn't help other types of videos. Also, zbin_mode_boost is adjusted in mode-checking loop, which causes bitstream mismatch before/after this change when --best or --good with --cpu-used=0 are used. Change-Id: I582b3e69fd384039994360e870e6e059c36a64cc
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -1738,11 +1738,12 @@
int rate2, distortion2;
int uv_intra_rate, uv_intra_distortion, uv_intra_rate_tokenonly;
int uv_intra_tteob = 0;
+ int uv_intra_done = 0;
int rate_y, UNINITIALIZED_IS_SAFE(rate_uv);
int distortion_uv;
int best_yrd = INT_MAX;
- MB_PREDICTION_MODE uv_intra_mode;
+ MB_PREDICTION_MODE uv_intra_mode = 0;
int_mv mvp;
int near_sadidx[8] = {0, 1, 2, 3, 4, 5, 6, 7};
int saddone=0;
@@ -1785,17 +1786,6 @@
x->skip = 0;
- x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME;
- rd_pick_intra_mbuv_mode(cpi, x, &uv_intra_rate, &uv_intra_rate_tokenonly, &uv_intra_distortion);
- uv_intra_mode = x->e_mbd.mode_info_context->mbmi.uv_mode;
- /*
- * Total of the eobs is used later to further adjust rate2. Since uv block's
- * intra eobs will be overwritten when we check inter modes in following
- * for-loop, we need to save uv_intra_tteob here.
- */
- for (i = 16; i < 24; i++)
- uv_intra_tteob += x->e_mbd.eobs[i];
-
for (mode_index = 0; mode_index < MAX_MODES; mode_index++)
{
int this_rd = INT_MAX;
@@ -1817,7 +1807,6 @@
this_mode = vp8_mode_order[mode_index];
x->e_mbd.mode_info_context->mbmi.mode = this_mode;
- x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED;
x->e_mbd.mode_info_context->mbmi.ref_frame = this_ref_frame;
// Only consider ZEROMV/ALTREF_FRAME for alt ref frame,
@@ -1886,6 +1875,24 @@
}
vp8_update_zbin_extra(cpi, x);
+ }
+
+ if(!uv_intra_done && this_ref_frame == INTRA_FRAME)
+ {
+ rd_pick_intra_mbuv_mode(cpi, x, &uv_intra_rate,
+ &uv_intra_rate_tokenonly,
+ &uv_intra_distortion);
+ uv_intra_mode = x->e_mbd.mode_info_context->mbmi.uv_mode;
+
+ /*
+ * Total of the eobs is used later to further adjust rate2. Since uv
+ * block's intra eobs will be overwritten when we check inter modes,
+ * we need to save uv_intra_tteob here.
+ */
+ for (i = 16; i < 24; i++)
+ uv_intra_tteob += x->e_mbd.eobs[i];
+
+ uv_intra_done = 1;
}
switch (this_mode)
--
⑨