summaryrefslogtreecommitdiff
path: root/vp8/encoder/mcomp.c
diff options
context:
space:
mode:
authorDaniel Kang <ddkang@google.com>2012-08-08 11:52:22 -0700
committerDaniel Kang <ddkang@google.com>2012-08-09 09:48:36 -0700
commitd4a4c3c06f109f59fe150dd00398eb09c12b841d (patch)
treede1fa2a641a209c45f30f6b5191d886406174076 /vp8/encoder/mcomp.c
parent6d0097737d03de3c9491aa74094dad91892e574f (diff)
downloadlibvpx-d4a4c3c06f109f59fe150dd00398eb09c12b841d.tar
libvpx-d4a4c3c06f109f59fe150dd00398eb09c12b841d.tar.gz
libvpx-d4a4c3c06f109f59fe150dd00398eb09c12b841d.tar.bz2
libvpx-d4a4c3c06f109f59fe150dd00398eb09c12b841d.zip
More refactoring of diamond search.
This should make merging inter code paths easier. Change-Id: I5cb81f25d56fa4790b4e9cfa4bc32b9062c2cfdf
Diffstat (limited to 'vp8/encoder/mcomp.c')
-rw-r--r--vp8/encoder/mcomp.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/vp8/encoder/mcomp.c b/vp8/encoder/mcomp.c
index 585008002..ba4cd897d 100644
--- a/vp8/encoder/mcomp.c
+++ b/vp8/encoder/mcomp.c
@@ -1497,10 +1497,13 @@ int vp8_diamond_search_sadx4(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
}
#define XMVCOST (x->e_mbd.allow_high_precision_mv?x->mvcost_hp:x->mvcost)
+/* do_refine: 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 */
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 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;
@@ -1514,7 +1517,7 @@ int vp8_full_pixel_diamond(VP8_COMP *cpi, MACROBLOCK *x, BLOCK *b,
/* If there won't be more n-step search, check to see if refining search is needed. */
if (n > further_steps)
- *do_refine = 0;
+ do_refine = 0;
while (n < further_steps) {
n++;
@@ -1528,7 +1531,7 @@ int vp8_full_pixel_diamond(VP8_COMP *cpi, MACROBLOCK *x, BLOCK *b,
/* check to see if refining search is needed. */
if (num00 > (further_steps - n))
- *do_refine = 0;
+ do_refine = 0;
if (thissme < bestsme) {
bestsme = thissme;
@@ -1536,6 +1539,20 @@ int vp8_full_pixel_diamond(VP8_COMP *cpi, MACROBLOCK *x, BLOCK *b,
}
}
}
+
+ /* final 1-away diamond refining search */
+ if (do_refine == 1) {
+ int search_range = 8;
+ int_mv best_mv;
+ best_mv.as_int = dst_mv->as_int;
+ thissme = cpi->refining_search_sad(x, b, d, &best_mv, sadpb, search_range,
+ fn_ptr, XMVCOST, ref_mv);
+
+ if (thissme < bestsme) {
+ bestsme = thissme;
+ dst_mv->as_int = best_mv.as_int;
+ }
+ }
return bestsme;
}