Small decode performance gain (~1%) on keyframes.  No
noticeable gains on encode.  Also changed pick_intra4x4mby_modes()
to read the above and left block modes for keyframes only.

Change-Id: I1f4885252f5b3e9caf04d4e01e643960f910aba5
This commit is contained in:
Scott LaVarnway 2011-06-13 17:14:11 -04:00
Родитель e71a010646
Коммит 223d1b54cf
4 изменённых файлов: 45 добавлений и 71 удалений

Просмотреть файл

@ -123,7 +123,21 @@ static B_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mb, int b)
{
/* On L edge, get from MB to left of us */
--cur_mb;
b += 4;
switch (cur_mb->mbmi.mode)
{
case B_PRED:
return (cur_mb->bmi + b + 3)->as_mode;
case DC_PRED:
return B_DC_PRED;
case V_PRED:
return B_VE_PRED;
case H_PRED:
return B_HE_PRED;
case TM_PRED:
return B_TM_PRED;
default:
return B_DC_PRED;
}
}
return (cur_mb->bmi + b - 1)->as_mode;
@ -135,7 +149,22 @@ static B_PREDICTION_MODE above_block_mode(const MODE_INFO *cur_mb, int b, int mi
{
/* On top edge, get from MB above us */
cur_mb -= mi_stride;
b += 16;
switch (cur_mb->mbmi.mode)
{
case B_PRED:
return (cur_mb->bmi + b + 12)->as_mode;
case DC_PRED:
return B_DC_PRED;
case V_PRED:
return B_VE_PRED;
case H_PRED:
return B_HE_PRED;
case TM_PRED:
return B_TM_PRED;
default:
return B_DC_PRED;
}
}
return (cur_mb->bmi + b - 4)->as_mode;

Просмотреть файл

@ -101,36 +101,6 @@ static void vp8_kfread_modes(VP8D_COMP *pbi, MODE_INFO *m, int mb_row, int mb_co
}
while (++i < 16);
}
else
{
int BMode;
int i = 0;
switch (y_mode)
{
case DC_PRED:
BMode = B_DC_PRED;
break;
case V_PRED:
BMode = B_VE_PRED;
break;
case H_PRED:
BMode = B_HE_PRED;
break;
case TM_PRED:
BMode = B_TM_PRED;
break;
default:
BMode = B_DC_PRED;
break;
}
do
{
m->bmi[i].as_mode = (B_PREDICTION_MODE)BMode;
}
while (++i < 16);
}
m->mbmi.uv_mode = (MB_PREDICTION_MODE)vp8_read_uv_mode(bc, pbi->common.kf_uv_mode_prob);
}

Просмотреть файл

@ -81,30 +81,6 @@ void vp8_encode_intra16x16mby(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x)
RECON_INVOKE(&rtcd->common->recon, recon_mby)
(IF_RTCD(&rtcd->common->recon), &x->e_mbd);
// make sure block modes are set the way we want them for context updates
for (b = 0; b < 16; b++)
{
BLOCKD *d = &x->e_mbd.block[b];
switch (x->e_mbd.mode_info_context->mbmi.mode)
{
case DC_PRED:
d->bmi.as_mode = B_DC_PRED;
break;
case V_PRED:
d->bmi.as_mode = B_VE_PRED;
break;
case H_PRED:
d->bmi.as_mode = B_HE_PRED;
break;
case TM_PRED:
d->bmi.as_mode = B_TM_PRED;
break;
default:
d->bmi.as_mode = B_DC_PRED;
break;
}
}
}
void vp8_encode_intra16x16mbuv(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x)

Просмотреть файл

@ -140,8 +140,7 @@ static int pick_intra4x4block(
MACROBLOCK *x,
int ib,
B_PREDICTION_MODE *best_mode,
B_PREDICTION_MODE above,
B_PREDICTION_MODE left,
unsigned int *mode_costs,
int *bestrate,
int *bestdistortion)
@ -153,16 +152,6 @@ static int pick_intra4x4block(
int best_rd = INT_MAX; // 1<<30
int rate;
int distortion;
unsigned int *mode_costs;
if (x->e_mbd.frame_type == KEY_FRAME)
{
mode_costs = x->bmode_costs[above][left];
}
else
{
mode_costs = x->inter_bmode_costs;
}
for (mode = B_DC_PRED; mode <= B_HE_PRED /*B_HU_PRED*/; mode++)
{
@ -202,20 +191,30 @@ static int pick_intra4x4mby_modes
int cost = mb->mbmode_cost [xd->frame_type] [B_PRED];
int error;
int distortion = 0;
unsigned int *bmode_costs;
vp8_intra_prediction_down_copy(xd);
bmode_costs = mb->inter_bmode_costs;
for (i = 0; i < 16; i++)
{
MODE_INFO *const mic = xd->mode_info_context;
const int mis = xd->mode_info_stride;
const B_PREDICTION_MODE A = above_block_mode(mic, i, mis);
const B_PREDICTION_MODE L = left_block_mode(mic, i);
B_PREDICTION_MODE UNINITIALIZED_IS_SAFE(best_mode);
int UNINITIALIZED_IS_SAFE(r), UNINITIALIZED_IS_SAFE(d);
pick_intra4x4block(rtcd, mb, i, &best_mode, A, L, &r, &d);
if (mb->e_mbd.frame_type == KEY_FRAME)
{
const B_PREDICTION_MODE A = above_block_mode(mic, i, mis);
const B_PREDICTION_MODE L = left_block_mode(mic, i);
bmode_costs = mb->bmode_costs[A][L];
}
pick_intra4x4block(rtcd, mb, i, &best_mode, bmode_costs, &r, &d);
cost += r;
distortion += d;