summaryrefslogtreecommitdiff
path: root/vp8/encoder/rdopt.c
diff options
context:
space:
mode:
authorDaniel Kang <ddkang@google.com>2012-08-07 16:44:26 -0700
committerDaniel Kang <ddkang@google.com>2012-08-07 18:57:10 -0700
commitd432f7e3cbaca3ca547fef71ec3216fdccf9b0c9 (patch)
treef6844cd948aeebd1d75c552e8a3ae2f0496a215d /vp8/encoder/rdopt.c
parentdce0896249b9d3eebb52522beeebba00eface3b8 (diff)
downloadlibvpx-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/rdopt.c')
-rw-r--r--vp8/encoder/rdopt.c93
1 files changed, 16 insertions, 77 deletions
diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c
index 2d6f34e80..f9e9e84c7 100644
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -1818,11 +1818,10 @@ static void rd_check_segment(VP8_COMP *cpi, MACROBLOCK *x,
// motion search for newmv (single predictor case only)
if (!x->e_mbd.mode_info_context->mbmi.second_ref_frame && this_mode == NEW4X4) {
- int sseshift, num00, n;
+ int sseshift, n;
int step_param = 0;
int further_steps;
int thissme, bestsme = INT_MAX;
- int_mv temp_mv;
BLOCK *c;
BLOCKD *e;
@@ -1851,6 +1850,7 @@ static void rd_check_segment(VP8_COMP *cpi, MACROBLOCK *x,
further_steps = (MAX_MVSEARCH_STEPS - 1) - step_param;
{
+ int dummy;
int sadpb = x->sadperbit4;
int_mv mvp_full;
@@ -1863,36 +1863,11 @@ static void rd_check_segment(VP8_COMP *cpi, MACROBLOCK *x,
c = &x->block[n];
e = &x->e_mbd.block[n];
- {
- bestsme = cpi->diamond_search_sad(x, c, e, &mvp_full,
- &mode_mv[NEW4X4], step_param,
- sadpb, &num00, v_fn_ptr,
- XMVCOST,
- bsi->ref_mv);
-
- n = num00;
- num00 = 0;
-
- while (n < further_steps) {
- n++;
-
- if (num00)
- num00--;
- else {
- thissme = cpi->diamond_search_sad(x, c, e,
- &mvp_full, &temp_mv,
- step_param + n, sadpb,
- &num00, v_fn_ptr,
- XMVCOST,
- bsi->ref_mv);
-
- if (thissme < bestsme) {
- bestsme = thissme;
- mode_mv[NEW4X4].as_int = temp_mv.as_int;
- }
- }
- }
- }
+ // dummy takes the place of do_refine -- which is used in other places
+ bestsme = vp8_full_pixel_diamond(cpi, x, c, e, &mvp_full,
+ step_param, sadpb, further_steps,
+ &dummy, v_fn_ptr, bsi->ref_mv,
+ &mode_mv[NEW4X4]);
sseshift = segmentation_to_sseshift[segmentation];
@@ -2664,8 +2639,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
int_mv best_ref_mv, second_best_ref_mv;
int_mv mode_mv[MB_MODE_COUNT];
MB_PREDICTION_MODE this_mode;
- int num00, i;
- int best_mode_index = 0;
+ int i, best_mode_index = 0;
int mode8x8[2][4];
unsigned char segment_id = xd->mode_info_context->mbmi.segment_id;
@@ -3117,7 +3091,6 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
int thissme, bestsme = INT_MAX;
int step_param = cpi->sf.first_step;
int further_steps;
- int n;
int do_refine = 1; /* If last step (1-away) of n-step search doesn't pick the center point as the best match,
we will do a final 1-away diamond refining search */
@@ -3146,48 +3119,14 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
if (sr > step_param)
step_param = sr;
- // Initial step/diamond search
- {
- bestsme = cpi->diamond_search_sad(x, b, d, &mvp_full, &d->bmi.as_mv.first,
- step_param, sadpb, &num00,
- &cpi->fn_ptr[BLOCK_16X16],
- XMVCOST, &best_ref_mv);
- mode_mv[NEWMV].as_int = d->bmi.as_mv.first.as_int;
-
- // Further step/diamond searches as necessary
- further_steps = (cpi->sf.max_step_search_steps - 1) - step_param;
-
- 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,
- &d->bmi.as_mv.first, step_param + n, sadpb, &num00,
- &cpi->fn_ptr[BLOCK_16X16],
- XMVCOST, &best_ref_mv);
-
- /* check to see if refining search is needed. */
- if (num00 > (further_steps - n))
- do_refine = 0;
-
- if (thissme < bestsme) {
- bestsme = thissme;
- mode_mv[NEWMV].as_int = d->bmi.as_mv.first.as_int;
- } else {
- d->bmi.as_mv.first.as_int = mode_mv[NEWMV].as_int;
- }
- }
- }
- }
+ // Further step/diamond searches as necessary
+ further_steps = (cpi->sf.max_step_search_steps - 1) - step_param;
+
+ bestsme = vp8_full_pixel_diamond(cpi, x, b, d, &mvp_full, step_param, sadpb,
+ further_steps, &do_refine,
+ &cpi->fn_ptr[BLOCK_16X16], &best_ref_mv,
+ &mode_mv[NEWMV]);
+ d->bmi.as_mv.first.as_int = mode_mv[NEWMV].as_int;
/* final 1-away diamond refining search */
if (do_refine == 1) {