diff options
author | Daniel Kang <ddkang@google.com> | 2012-08-07 16:44:26 -0700 |
---|---|---|
committer | Daniel Kang <ddkang@google.com> | 2012-08-07 18:57:10 -0700 |
commit | d432f7e3cbaca3ca547fef71ec3216fdccf9b0c9 (patch) | |
tree | f6844cd948aeebd1d75c552e8a3ae2f0496a215d /vp8/encoder/mcomp.c | |
parent | dce0896249b9d3eebb52522beeebba00eface3b8 (diff) | |
download | libvpx-d432f7e3cbaca3ca547fef71ec3216fdccf9b0c9.tar libvpx-d432f7e3cbaca3ca547fef71ec3216fdccf9b0c9.tar.gz libvpx-d432f7e3cbaca3ca547fef71ec3216fdccf9b0c9.tar.bz2 libvpx-d432f7e3cbaca3ca547fef71ec3216fdccf9b0c9.zip |
Some refactoring of mcomp functions.
Change-Id: Ic7a7cb1199b085e98ede0e634619b3077c348d57
Diffstat (limited to 'vp8/encoder/mcomp.c')
-rw-r--r-- | vp8/encoder/mcomp.c | 87 |
1 files changed, 55 insertions, 32 deletions
diff --git a/vp8/encoder/mcomp.c b/vp8/encoder/mcomp.c index 2d46664b8..5a105595a 100644 --- a/vp8/encoder/mcomp.c +++ b/vp8/encoder/mcomp.c @@ -1249,20 +1249,11 @@ cal_neighbors: #undef CHECK_POINT #undef CHECK_BETTER -int vp8_diamond_search_sad -( - MACROBLOCK *x, - BLOCK *b, - BLOCKD *d, - int_mv *ref_mv, - int_mv *best_mv, - int search_param, - int sad_per_bit, - int *num00, - vp8_variance_fn_ptr_t *fn_ptr, - int *mvcost[2], - int_mv *center_mv -) { +int vp8_diamond_search_sad(MACROBLOCK *x, BLOCK *b, BLOCKD *d, + int_mv *ref_mv, int_mv *best_mv, + int search_param, int sad_per_bit, int *num00, + vp8_variance_fn_ptr_t *fn_ptr, int *mvcost[2], + int_mv *center_mv) { int i, j, step; unsigned char *what = (*(b->base_src) + b->src); @@ -1278,10 +1269,8 @@ int vp8_diamond_search_sad int best_site = 0; int last_site = 0; - int ref_row; - int ref_col; - int this_row_offset; - int this_col_offset; + int ref_row, ref_col; + int this_row_offset, this_col_offset; search_site *ss; unsigned char *check_here; @@ -1372,20 +1361,11 @@ int vp8_diamond_search_sad xd->allow_high_precision_mv); } -int vp8_diamond_search_sadx4 -( - MACROBLOCK *x, - BLOCK *b, - BLOCKD *d, - int_mv *ref_mv, - int_mv *best_mv, - int search_param, - int sad_per_bit, - int *num00, - vp8_variance_fn_ptr_t *fn_ptr, - int *mvcost[2], - int_mv *center_mv -) { +int vp8_diamond_search_sadx4(MACROBLOCK *x, BLOCK *b, BLOCKD *d, + int_mv *ref_mv, int_mv *best_mv, int search_param, + int sad_per_bit, int *num00, + vp8_variance_fn_ptr_t *fn_ptr, + int *mvcost[2], int_mv *center_mv) { int i, j, step; unsigned char *what = (*(b->base_src) + b->src); @@ -1528,6 +1508,49 @@ int vp8_diamond_search_sadx4 xd->allow_high_precision_mv); } +#define XMVCOST (x->e_mbd.allow_high_precision_mv?x->mvcost_hp:x->mvcost) +int vp8_full_pixel_diamond(VP8_COMP *cpi, MACROBLOCK *x, BLOCK *b, + BLOCKD *d, int_mv *mvp_full, int step_param, + int sadpb, int further_steps, + int *do_refine, vp8_variance_fn_ptr_t *fn_ptr, + int_mv *ref_mv, int_mv *dst_mv) { + int_mv temp_mv; + int thissme, n, num00; + int bestsme = cpi->diamond_search_sad(x, b, d, mvp_full, &temp_mv, + step_param, sadpb, &num00, + fn_ptr, XMVCOST, ref_mv); + dst_mv->as_int = temp_mv.as_int; + + n = num00; + num00 = 0; + + /* If there won't be more n-step search, check to see if refining search is needed. */ + if (n > further_steps) + *do_refine = 0; + + while (n < further_steps) { + n++; + + if (num00) + num00--; + else { + thissme = cpi->diamond_search_sad(x, b, d, mvp_full, &temp_mv, + step_param + n, sadpb, &num00, + fn_ptr, XMVCOST, ref_mv); + + /* check to see if refining search is needed. */ + if (num00 > (further_steps - n)) + *do_refine = 0; + + if (thissme < bestsme) { + bestsme = thissme; + dst_mv->as_int = temp_mv.as_int; + } + } + } + return bestsme; +} + int vp8_full_search_sad(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv, int sad_per_bit, int distance, vp8_variance_fn_ptr_t *fn_ptr, int *mvcost[2], |