Commit 0e06bc81 authored by John Koleszar's avatar John Koleszar Committed by Gerrit Code Review

Merge changes I1ebe76aa,Ia079b52b

* changes:
  rdopt/pickinter: factor out some common setup
  rdopt: remove unused frame_lf_or_gf
parents d3879738 4ade0796
...@@ -490,10 +490,7 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, ...@@ -490,10 +490,7 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
int saddone=0; int saddone=0;
int sr=0; //search range got from mv_pred(). It uses step_param levels. (0-7) int sr=0; //search range got from mv_pred(). It uses step_param levels. (0-7)
unsigned char *y_buffer[4]; unsigned char *plane[4][3];
unsigned char *u_buffer[4];
unsigned char *v_buffer[4];
int i;
int ref_frame_map[4]; int ref_frame_map[4];
int sign_bias = 0; int sign_bias = 0;
...@@ -515,16 +512,7 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, ...@@ -515,16 +512,7 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
vpx_memset(&best_mbmode, 0, sizeof(best_mbmode)); vpx_memset(&best_mbmode, 0, sizeof(best_mbmode));
/* Setup search priorities */ /* Setup search priorities */
i=0; get_reference_search_order(cpi, ref_frame_map);
ref_frame_map[i++] = INTRA_FRAME;
if (cpi->ref_frame_flags & VP8_LAST_FLAG)
ref_frame_map[i++] = LAST_FRAME;
if (cpi->ref_frame_flags & VP8_GOLD_FLAG)
ref_frame_map[i++] = GOLDEN_FRAME;
if (cpi->ref_frame_flags & VP8_ALT_FLAG) // &&(cpi->source_alt_ref_active || cpi->oxcf.number_of_layers > 1)
ref_frame_map[i++] = ALTREF_FRAME;
for(; i<4; i++)
ref_frame_map[i] = -1;
/* Check to see if there is at least 1 valid reference frame that we need /* Check to see if there is at least 1 valid reference frame that we need
* to calculate near_mvs. * to calculate near_mvs.
...@@ -542,30 +530,7 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, ...@@ -542,30 +530,7 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
sign_bias = cpi->common.ref_frame_sign_bias[ref_frame_map[1]]; sign_bias = cpi->common.ref_frame_sign_bias[ref_frame_map[1]];
} }
// set up all the refframe dependent pointers. get_predictor_pointers(cpi, plane, recon_yoffset, recon_uvoffset);
if (cpi->ref_frame_flags & VP8_LAST_FLAG)
{
YV12_BUFFER_CONFIG *lst_yv12 = &cpi->common.yv12_fb[cpi->common.lst_fb_idx];
y_buffer[LAST_FRAME] = lst_yv12->y_buffer + recon_yoffset;
u_buffer[LAST_FRAME] = lst_yv12->u_buffer + recon_uvoffset;
v_buffer[LAST_FRAME] = lst_yv12->v_buffer + recon_uvoffset;
}
if (cpi->ref_frame_flags & VP8_GOLD_FLAG)
{
YV12_BUFFER_CONFIG *gld_yv12 = &cpi->common.yv12_fb[cpi->common.gld_fb_idx];
y_buffer[GOLDEN_FRAME] = gld_yv12->y_buffer + recon_yoffset;
u_buffer[GOLDEN_FRAME] = gld_yv12->u_buffer + recon_uvoffset;
v_buffer[GOLDEN_FRAME] = gld_yv12->v_buffer + recon_uvoffset;
}
if (cpi->ref_frame_flags & VP8_ALT_FLAG)
{
YV12_BUFFER_CONFIG *alt_yv12 = &cpi->common.yv12_fb[cpi->common.alt_fb_idx];
y_buffer[ALTREF_FRAME] = alt_yv12->y_buffer + recon_yoffset;
u_buffer[ALTREF_FRAME] = alt_yv12->u_buffer + recon_uvoffset;
v_buffer[ALTREF_FRAME] = alt_yv12->v_buffer + recon_uvoffset;
}
cpi->mbs_tested_so_far++; // Count of the number of MBs tested so far this frame cpi->mbs_tested_so_far++; // Count of the number of MBs tested so far this frame
...@@ -609,9 +574,9 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, ...@@ -609,9 +574,9 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
// everything but intra // everything but intra
if (x->e_mbd.mode_info_context->mbmi.ref_frame) if (x->e_mbd.mode_info_context->mbmi.ref_frame)
{ {
x->e_mbd.pre.y_buffer = y_buffer[x->e_mbd.mode_info_context->mbmi.ref_frame]; x->e_mbd.pre.y_buffer = plane[this_ref_frame][0];
x->e_mbd.pre.u_buffer = u_buffer[x->e_mbd.mode_info_context->mbmi.ref_frame]; x->e_mbd.pre.u_buffer = plane[this_ref_frame][1];
x->e_mbd.pre.v_buffer = v_buffer[x->e_mbd.mode_info_context->mbmi.ref_frame]; x->e_mbd.pre.v_buffer = plane[this_ref_frame][2];
if (sign_bias != if (sign_bias !=
cpi->common.ref_frame_sign_bias[x->e_mbd.mode_info_context->mbmi.ref_frame]) cpi->common.ref_frame_sign_bias[x->e_mbd.mode_info_context->mbmi.ref_frame])
......
...@@ -1715,6 +1715,7 @@ static void rd_update_mvcount(VP8_COMP *cpi, MACROBLOCK *x, int_mv *best_ref_mv) ...@@ -1715,6 +1715,7 @@ static void rd_update_mvcount(VP8_COMP *cpi, MACROBLOCK *x, int_mv *best_ref_mv)
} }
} }
void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
int recon_uvoffset, int *returnrate, int recon_uvoffset, int *returnrate,
int *returndistortion, int *returnintra) int *returndistortion, int *returnintra)
...@@ -1750,10 +1751,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, ...@@ -1750,10 +1751,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
int saddone=0; int saddone=0;
int sr=0; //search range got from mv_pred(). It uses step_param levels. (0-7) int sr=0; //search range got from mv_pred(). It uses step_param levels. (0-7)
int frame_lf_or_gf[4]; unsigned char *plane[4][3];
unsigned char *y_buffer[4];
unsigned char *u_buffer[4];
unsigned char *v_buffer[4];
int ref_frame_map[4]; int ref_frame_map[4];
int sign_bias = 0; int sign_bias = 0;
...@@ -1762,16 +1760,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, ...@@ -1762,16 +1760,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
vpx_memset(&best_bmodes, 0, sizeof(best_bmodes)); vpx_memset(&best_bmodes, 0, sizeof(best_bmodes));
/* Setup search priorities */ /* Setup search priorities */
i=0; get_reference_search_order(cpi, ref_frame_map);
ref_frame_map[i++] = INTRA_FRAME;
if (cpi->ref_frame_flags & VP8_LAST_FLAG)
ref_frame_map[i++] = LAST_FRAME;
if (cpi->ref_frame_flags & VP8_GOLD_FLAG)
ref_frame_map[i++] = GOLDEN_FRAME;
if (cpi->ref_frame_flags & VP8_ALT_FLAG)
ref_frame_map[i++] = ALTREF_FRAME;
for(; i<4; i++)
ref_frame_map[i] = -1;
/* Check to see if there is at least 1 valid reference frame that we need /* Check to see if there is at least 1 valid reference frame that we need
* to calculate near_mvs. * to calculate near_mvs.
...@@ -1789,35 +1778,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, ...@@ -1789,35 +1778,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
sign_bias = cpi->common.ref_frame_sign_bias[ref_frame_map[1]]; sign_bias = cpi->common.ref_frame_sign_bias[ref_frame_map[1]];
} }
if (cpi->ref_frame_flags & VP8_LAST_FLAG) get_predictor_pointers(cpi, plane, recon_yoffset, recon_uvoffset);
{
YV12_BUFFER_CONFIG *lst_yv12 = &cpi->common.yv12_fb[cpi->common.lst_fb_idx];
y_buffer[LAST_FRAME] = lst_yv12->y_buffer + recon_yoffset;
u_buffer[LAST_FRAME] = lst_yv12->u_buffer + recon_uvoffset;
v_buffer[LAST_FRAME] = lst_yv12->v_buffer + recon_uvoffset;
frame_lf_or_gf[LAST_FRAME] = 0;
}
if (cpi->ref_frame_flags & VP8_GOLD_FLAG)
{
YV12_BUFFER_CONFIG *gld_yv12 = &cpi->common.yv12_fb[cpi->common.gld_fb_idx];
y_buffer[GOLDEN_FRAME] = gld_yv12->y_buffer + recon_yoffset;
u_buffer[GOLDEN_FRAME] = gld_yv12->u_buffer + recon_uvoffset;
v_buffer[GOLDEN_FRAME] = gld_yv12->v_buffer + recon_uvoffset;
frame_lf_or_gf[GOLDEN_FRAME] = 1;
}
if (cpi->ref_frame_flags & VP8_ALT_FLAG)
{
YV12_BUFFER_CONFIG *alt_yv12 = &cpi->common.yv12_fb[cpi->common.alt_fb_idx];
y_buffer[ALTREF_FRAME] = alt_yv12->y_buffer + recon_yoffset;
u_buffer[ALTREF_FRAME] = alt_yv12->u_buffer + recon_uvoffset;
v_buffer[ALTREF_FRAME] = alt_yv12->v_buffer + recon_uvoffset;
frame_lf_or_gf[ALTREF_FRAME] = 1;
}
*returnintra = INT_MAX; *returnintra = INT_MAX;
cpi->mbs_tested_so_far++; // Count of the number of MBs tested so far this frame cpi->mbs_tested_so_far++; // Count of the number of MBs tested so far this frame
...@@ -1831,7 +1792,6 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, ...@@ -1831,7 +1792,6 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
for (mode_index = 0; mode_index < MAX_MODES; mode_index++) for (mode_index = 0; mode_index < MAX_MODES; mode_index++)
{ {
int this_rd = INT_MAX; int this_rd = INT_MAX;
int lf_or_gf = 0; // Lat Frame (01) or gf/arf (1)
int disable_skip = 0; int disable_skip = 0;
int other_cost = 0; int other_cost = 0;
int this_ref_frame = ref_frame_map[vp8_ref_frame_order[mode_index]]; int this_ref_frame = ref_frame_map[vp8_ref_frame_order[mode_index]];
...@@ -1865,9 +1825,9 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, ...@@ -1865,9 +1825,9 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
/* everything but intra */ /* everything but intra */
if (x->e_mbd.mode_info_context->mbmi.ref_frame) if (x->e_mbd.mode_info_context->mbmi.ref_frame)
{ {
x->e_mbd.pre.y_buffer = y_buffer[x->e_mbd.mode_info_context->mbmi.ref_frame]; x->e_mbd.pre.y_buffer = plane[this_ref_frame][0];
x->e_mbd.pre.u_buffer = u_buffer[x->e_mbd.mode_info_context->mbmi.ref_frame]; x->e_mbd.pre.u_buffer = plane[this_ref_frame][1];
x->e_mbd.pre.v_buffer = v_buffer[x->e_mbd.mode_info_context->mbmi.ref_frame]; x->e_mbd.pre.v_buffer = plane[this_ref_frame][2];
if (sign_bias != if (sign_bias !=
cpi->common.ref_frame_sign_bias[x->e_mbd.mode_info_context->mbmi.ref_frame]) cpi->common.ref_frame_sign_bias[x->e_mbd.mode_info_context->mbmi.ref_frame])
...@@ -1881,8 +1841,6 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, ...@@ -1881,8 +1841,6 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
sign_bias sign_bias
= cpi->common.ref_frame_sign_bias[x->e_mbd.mode_info_context->mbmi.ref_frame]; = cpi->common.ref_frame_sign_bias[x->e_mbd.mode_info_context->mbmi.ref_frame];
} }
lf_or_gf = frame_lf_or_gf[x->e_mbd.mode_info_context->mbmi.ref_frame];
} }
// Check to see if the testing frequency for this mode is at its max // Check to see if the testing frequency for this mode is at its max
......
...@@ -69,6 +69,54 @@ extern void vp8_initialize_rd_consts(VP8_COMP *cpi, int Qvalue); ...@@ -69,6 +69,54 @@ extern void vp8_initialize_rd_consts(VP8_COMP *cpi, int Qvalue);
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_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_rd_pick_intra_mode(VP8_COMP *cpi, MACROBLOCK *x, int *rate);
static void get_plane_pointers(const YV12_BUFFER_CONFIG *fb,
unsigned char *plane[3],
unsigned int recon_yoffset,
unsigned int recon_uvoffset)
{
plane[0] = fb->y_buffer + recon_yoffset;
plane[1] = fb->u_buffer + recon_uvoffset;
plane[2] = fb->u_buffer + recon_uvoffset;
}
static void get_predictor_pointers(const VP8_COMP *cpi,
unsigned char *plane[4][3],
unsigned int recon_yoffset,
unsigned int recon_uvoffset)
{
if (cpi->ref_frame_flags & VP8_LAST_FLAG)
get_plane_pointers(&cpi->common.yv12_fb[cpi->common.lst_fb_idx],
plane[LAST_FRAME], recon_yoffset, recon_uvoffset);
if (cpi->ref_frame_flags & VP8_GOLD_FLAG)
get_plane_pointers(&cpi->common.yv12_fb[cpi->common.gld_fb_idx],
plane[GOLDEN_FRAME], recon_yoffset, recon_uvoffset);
if (cpi->ref_frame_flags & VP8_ALT_FLAG)
get_plane_pointers(&cpi->common.yv12_fb[cpi->common.alt_fb_idx],
plane[ALTREF_FRAME], recon_yoffset, recon_uvoffset);
}
static void get_reference_search_order(const VP8_COMP *cpi,
int ref_frame_map[4])
{
int i=0;
ref_frame_map[i++] = INTRA_FRAME;
if (cpi->ref_frame_flags & VP8_LAST_FLAG)
ref_frame_map[i++] = LAST_FRAME;
if (cpi->ref_frame_flags & VP8_GOLD_FLAG)
ref_frame_map[i++] = GOLDEN_FRAME;
if (cpi->ref_frame_flags & VP8_ALT_FLAG)
ref_frame_map[i++] = ALTREF_FRAME;
for(; i<4; i++)
ref_frame_map[i] = -1;
}
extern void vp8_mv_pred extern void vp8_mv_pred
( (
VP8_COMP *cpi, VP8_COMP *cpi,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment