Commit 74502757 authored by Dmitry Kovalev's avatar Dmitry Kovalev
Browse files

Setup pre[0] buffer before calls to {first_pass, zz}_motion_search.

Change-Id: I9b94e741201eacb1982014724a532bdaae31f130
parent 63fb34c9
......@@ -369,14 +369,11 @@ static vp9_variance_fn_t get_block_variance_fn(BLOCK_SIZE bsize) {
}
}
static unsigned int zz_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
YV12_BUFFER_CONFIG *recon_buffer,
int recon_yoffset) {
MACROBLOCKD *const xd = &x->e_mbd;
static unsigned int zz_motion_search(const VP9_COMP *cpi, const MACROBLOCK *x) {
const MACROBLOCKD *const xd = &x->e_mbd;
const uint8_t *const src = x->plane[0].src.buf;
const int src_stride = x->plane[0].src.stride;
const uint8_t *const ref = xd->plane[0].pre[0].buf
= recon_buffer->y_buffer + recon_yoffset;
const uint8_t *const ref = xd->plane[0].pre[0].buf;
const int ref_stride = xd->plane[0].pre[0].stride;
unsigned int sse;
......@@ -387,8 +384,7 @@ static unsigned int zz_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
static void first_pass_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
const MV *ref_mv, MV *best_mv,
YV12_BUFFER_CONFIG *recon_buffer,
int *best_motion_err, int recon_yoffset) {
int *best_motion_err) {
MACROBLOCKD *const xd = &x->e_mbd;
MV tmp_mv = {0, 0};
MV ref_mv_full = {ref_mv->row >> 3, ref_mv->col >> 3};
......@@ -411,9 +407,6 @@ static void first_pass_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
// override the default variance function to use MSE
v_fn_ptr.vf = get_block_variance_fn(bsize);
// Set up pointers for this macro block recon buffer
xd->plane[0].pre[0].buf = recon_buffer->y_buffer + recon_yoffset;
// Initial step/diamond search centred on best mv
tmp_err = cpi->diamond_search_sad(x, &ref_mv_full, &tmp_mv,
step_param,
......@@ -549,7 +542,6 @@ void vp9_first_pass(VP9_COMP *cpi) {
// for each macroblock col in image
for (mb_col = 0; mb_col < cm->mb_cols; mb_col++) {
int this_error;
int gf_motion_error = INT_MAX;
int use_dc_pred = (mb_col || mb_row) && (!mb_col || !mb_row);
double error_weight = 1.0;
......@@ -613,16 +605,18 @@ void vp9_first_pass(VP9_COMP *cpi) {
// Other than for the first frame do a motion search
if (cm->current_video_frame > 0) {
int tmp_err;
int motion_error = zz_motion_search(cpi, x, lst_yv12, recon_yoffset);
int tmp_err, motion_error;
int_mv mv, tmp_mv;
xd->plane[0].pre[0].buf = lst_yv12->y_buffer + recon_yoffset;
motion_error = zz_motion_search(cpi, x);
// Simple 0,0 motion with no mv overhead
mv.as_int = tmp_mv.as_int = 0;
// Test last reference frame using the previous best mv as the
// starting point (best reference) for the search
first_pass_motion_search(cpi, x, &best_ref_mv.as_mv, &mv.as_mv,
lst_yv12, &motion_error, recon_yoffset);
&motion_error);
if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
vp9_clear_system_state(); // __asm emms;
motion_error *= error_weight;
......@@ -633,7 +627,7 @@ void vp9_first_pass(VP9_COMP *cpi) {
if (best_ref_mv.as_int) {
tmp_err = INT_MAX;
first_pass_motion_search(cpi, x, &zero_ref_mv.as_mv, &tmp_mv.as_mv,
lst_yv12, &tmp_err, recon_yoffset);
&tmp_err);
if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
vp9_clear_system_state(); // __asm emms;
tmp_err *= error_weight;
......@@ -648,10 +642,13 @@ void vp9_first_pass(VP9_COMP *cpi) {
// Experimental search in an older reference frame
if (cm->current_video_frame > 1) {
// Simple 0,0 motion with no mv overhead
gf_motion_error = zz_motion_search(cpi, x, gld_yv12, recon_yoffset);
int gf_motion_error;
xd->plane[0].pre[0].buf = gld_yv12->y_buffer + recon_yoffset;
gf_motion_error = zz_motion_search(cpi, x);
first_pass_motion_search(cpi, x, &zero_ref_mv.as_mv, &tmp_mv.as_mv,
gld_yv12, &gf_motion_error, recon_yoffset);
&gf_motion_error);
if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
vp9_clear_system_state(); // __asm emms;
gf_motion_error *= error_weight;
......
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