Move RD intra block mode selection to rdopt.c
This change is analogous to I0b67dae1f8a74902378da7bdf565e39ab832dda7, which made the move for the non-RD path. Change-Id: If63fc1b0cd1eb7f932e710f83ff24d91454f8ed1
This commit is contained in:
parent
e90d17d240
commit
96a42aaa2d
@ -1015,34 +1015,11 @@ void adjust_act_zbin( VP8_COMP *cpi, int rate, MACROBLOCK *x )
|
||||
|
||||
int vp8cx_encode_intra_macro_block(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t)
|
||||
{
|
||||
int Error4x4, Error16x16;
|
||||
int rate4x4, rate16x16, rateuv;
|
||||
int dist4x4, dist16x16, distuv;
|
||||
int rate = 0;
|
||||
int rate4x4_tokenonly = 0;
|
||||
int rate16x16_tokenonly = 0;
|
||||
int rateuv_tokenonly = 0;
|
||||
|
||||
x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME;
|
||||
int rate;
|
||||
|
||||
if (cpi->sf.RD && cpi->compressor_speed != 2)
|
||||
{
|
||||
vp8_rd_pick_intra_mbuv_mode(cpi, x, &rateuv, &rateuv_tokenonly, &distuv);
|
||||
rate += rateuv;
|
||||
|
||||
Error16x16 = vp8_rd_pick_intra16x16mby_mode(cpi, x, &rate16x16, &rate16x16_tokenonly, &dist16x16);
|
||||
|
||||
Error4x4 = vp8_rd_pick_intra4x4mby_modes(cpi, x, &rate4x4, &rate4x4_tokenonly, &dist4x4, Error16x16);
|
||||
|
||||
if (Error4x4 < Error16x16)
|
||||
{
|
||||
x->e_mbd.mode_info_context->mbmi.mode = B_PRED;
|
||||
rate += rate4x4;
|
||||
}
|
||||
else
|
||||
{
|
||||
rate += rate16x16;
|
||||
}
|
||||
vp8_rd_pick_intra_mode(cpi, x, &rate);
|
||||
|
||||
if(cpi->oxcf.tuning == VP8_TUNE_SSIM)
|
||||
{
|
||||
|
@ -976,6 +976,8 @@ void vp8_pick_intra_mode(VP8_COMP *cpi, MACROBLOCK *x, int *rate_)
|
||||
MB_PREDICTION_MODE mode, best_mode = DC_PRED;
|
||||
int this_rd;
|
||||
|
||||
x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME;
|
||||
|
||||
pick_intra_mbuv_mode(x);
|
||||
|
||||
for (mode = DC_PRED; mode <= TM_PRED; mode ++)
|
||||
|
@ -657,8 +657,8 @@ static int rd_pick_intra4x4block(
|
||||
return best_rd;
|
||||
}
|
||||
|
||||
int vp8_rd_pick_intra4x4mby_modes(VP8_COMP *cpi, MACROBLOCK *mb, int *Rate,
|
||||
int *rate_y, int *Distortion, int best_rd)
|
||||
static int rd_pick_intra4x4mby_modes(VP8_COMP *cpi, MACROBLOCK *mb, int *Rate,
|
||||
int *rate_y, int *Distortion, int best_rd)
|
||||
{
|
||||
MACROBLOCKD *const xd = &mb->e_mbd;
|
||||
int i;
|
||||
@ -720,11 +720,13 @@ int vp8_rd_pick_intra4x4mby_modes(VP8_COMP *cpi, MACROBLOCK *mb, int *Rate,
|
||||
|
||||
return RDCOST(mb->rdmult, mb->rddiv, cost, distortion);
|
||||
}
|
||||
int vp8_rd_pick_intra16x16mby_mode(VP8_COMP *cpi,
|
||||
MACROBLOCK *x,
|
||||
int *Rate,
|
||||
int *rate_y,
|
||||
int *Distortion)
|
||||
|
||||
|
||||
static int rd_pick_intra16x16mby_mode(VP8_COMP *cpi,
|
||||
MACROBLOCK *x,
|
||||
int *Rate,
|
||||
int *rate_y,
|
||||
int *Distortion)
|
||||
{
|
||||
MB_PREDICTION_MODE mode;
|
||||
MB_PREDICTION_MODE UNINITIALIZED_IS_SAFE(mode_selected);
|
||||
@ -796,7 +798,7 @@ static int vp8_rd_inter_uv(VP8_COMP *cpi, MACROBLOCK *x, int *rate, int *distort
|
||||
return RDCOST(x->rdmult, x->rddiv, *rate, *distortion);
|
||||
}
|
||||
|
||||
void vp8_rd_pick_intra_mbuv_mode(VP8_COMP *cpi, MACROBLOCK *x, int *rate, int *rate_tokenonly, int *distortion)
|
||||
static void rd_pick_intra_mbuv_mode(VP8_COMP *cpi, MACROBLOCK *x, int *rate, int *rate_tokenonly, int *distortion)
|
||||
{
|
||||
MB_PREDICTION_MODE mode;
|
||||
MB_PREDICTION_MODE UNINITIALIZED_IS_SAFE(mode_selected);
|
||||
@ -1835,7 +1837,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
|
||||
vpx_memset(mode_mv, 0, sizeof(mode_mv));
|
||||
|
||||
x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME;
|
||||
vp8_rd_pick_intra_mbuv_mode(cpi, x, &uv_intra_rate, &uv_intra_rate_tokenonly, &uv_intra_distortion);
|
||||
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;
|
||||
|
||||
for (mode_index = 0; mode_index < MAX_MODES; mode_index++)
|
||||
@ -1958,7 +1960,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
|
||||
int tmp_rd;
|
||||
|
||||
// Note the rate value returned here includes the cost of coding the BPRED mode : x->mbmode_cost[x->e_mbd.frame_type][BPRED];
|
||||
tmp_rd = vp8_rd_pick_intra4x4mby_modes(cpi, x, &rate, &rate_y, &distortion, best_yrd);
|
||||
tmp_rd = rd_pick_intra4x4mby_modes(cpi, x, &rate, &rate_y, &distortion, best_yrd);
|
||||
rate2 += rate;
|
||||
distortion2 += distortion;
|
||||
|
||||
@ -2425,3 +2427,39 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
|
||||
rd_update_mvcount(cpi, x, &frame_best_ref_mv[xd->mode_info_context->mbmi.ref_frame]);
|
||||
|
||||
}
|
||||
|
||||
void vp8_rd_pick_intra_mode(VP8_COMP *cpi, MACROBLOCK *x, int *rate_)
|
||||
{
|
||||
int error4x4, error16x16;
|
||||
int rate4x4, rate16x16 = 0, rateuv;
|
||||
int dist4x4, dist16x16, distuv;
|
||||
int rate;
|
||||
int rate4x4_tokenonly = 0;
|
||||
int rate16x16_tokenonly = 0;
|
||||
int rateuv_tokenonly = 0;
|
||||
|
||||
x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME;
|
||||
|
||||
rd_pick_intra_mbuv_mode(cpi, x, &rateuv, &rateuv_tokenonly, &distuv);
|
||||
rate = rateuv;
|
||||
|
||||
error16x16 = rd_pick_intra16x16mby_mode(cpi, x,
|
||||
&rate16x16, &rate16x16_tokenonly,
|
||||
&dist16x16);
|
||||
|
||||
error4x4 = rd_pick_intra4x4mby_modes(cpi, x,
|
||||
&rate4x4, &rate4x4_tokenonly,
|
||||
&dist4x4, error16x16);
|
||||
|
||||
if (error4x4 < error16x16)
|
||||
{
|
||||
x->e_mbd.mode_info_context->mbmi.mode = B_PRED;
|
||||
rate += rate4x4;
|
||||
}
|
||||
else
|
||||
{
|
||||
rate += rate16x16;
|
||||
}
|
||||
|
||||
*rate_ = rate;
|
||||
}
|
||||
|
@ -15,10 +15,8 @@
|
||||
#define RDCOST(RM,DM,R,D) ( ((128+(R)*(RM)) >> 8) + (DM)*(D) )
|
||||
|
||||
extern void vp8_initialize_rd_consts(VP8_COMP *cpi, int Qvalue);
|
||||
extern int vp8_rd_pick_intra4x4mby_modes(VP8_COMP *cpi, MACROBLOCK *mb, int *rate, int *rate_to, int *distortion, int best_rd);
|
||||
extern int vp8_rd_pick_intra16x16mby_mode(VP8_COMP *cpi, MACROBLOCK *x, int *returnrate, int *rate_to, int *returndistortion);
|
||||
extern void vp8_rd_pick_intra_mbuv_mode(VP8_COMP *cpi, MACROBLOCK *x, int *rate, int *rate_to, int *distortion);
|
||||
extern void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int recon_uvoffset, int *returnrate, int *returndistortion, int *returnintra);
|
||||
extern void vp8_rd_pick_intra_mode(VP8_COMP *cpi, MACROBLOCK *x, int *rate);
|
||||
|
||||
extern void vp8_mv_pred
|
||||
(
|
||||
|
Loading…
Reference in New Issue
Block a user