Commit d04a0d77 authored by Yunqing Wang's avatar Yunqing Wang Committed by Gerrit Code Review
Browse files

Merge "Copy VP9 second-level sub-pixel search change to VP10"

parents 92946472 0ea70f77
...@@ -256,6 +256,27 @@ static INLINE const uint8_t *pre(const uint8_t *buf, int stride, int r, int c) { ...@@ -256,6 +256,27 @@ static INLINE const uint8_t *pre(const uint8_t *buf, int stride, int r, int c) {
} \ } \
} }
// TODO(yunqingwang): SECOND_LEVEL_CHECKS_BEST was a rewrote of
// SECOND_LEVEL_CHECKS, and SECOND_LEVEL_CHECKS should be rewritten
// later in the same way.
#define SECOND_LEVEL_CHECKS_BEST \
{ \
unsigned int second; \
int br0 = br; \
int bc0 = bc; \
assert(tr == br || tc == bc); \
if (tr == br && tc != bc) { \
kc = bc - tc; \
} else if (tr != br && tc == bc) { \
kr = br - tr; \
} \
CHECK_BETTER(second, br0 + kr, bc0); \
CHECK_BETTER(second, br0, bc0 + kc); \
if (br0 != br || bc0 != bc) { \
CHECK_BETTER(second, br0 + kr, bc0 + kc); \
} \
}
#define SETUP_SUBPEL_SEARCH \ #define SETUP_SUBPEL_SEARCH \
const uint8_t *const z = x->plane[0].src.buf; \ const uint8_t *const z = x->plane[0].src.buf; \
const int src_stride = x->plane[0].src.stride; \ const int src_stride = x->plane[0].src.stride; \
...@@ -636,7 +657,6 @@ int vp10_find_best_sub_pixel_tree(const MACROBLOCK *x, ...@@ -636,7 +657,6 @@ int vp10_find_best_sub_pixel_tree(const MACROBLOCK *x,
const MACROBLOCKD *xd = &x->e_mbd; const MACROBLOCKD *xd = &x->e_mbd;
unsigned int besterr = INT_MAX; unsigned int besterr = INT_MAX;
unsigned int sse; unsigned int sse;
unsigned int whichdir = 0;
int thismse; int thismse;
const int y_stride = xd->plane[0].pre[0].stride; const int y_stride = xd->plane[0].pre[0].stride;
const int offset = bestmv->row * y_stride + bestmv->col; const int offset = bestmv->row * y_stride + bestmv->col;
...@@ -657,6 +677,7 @@ int vp10_find_best_sub_pixel_tree(const MACROBLOCK *x, ...@@ -657,6 +677,7 @@ int vp10_find_best_sub_pixel_tree(const MACROBLOCK *x,
const MV *search_step = search_step_table; const MV *search_step = search_step_table;
int idx, best_idx = -1; int idx, best_idx = -1;
unsigned int cost_array[5]; unsigned int cost_array[5];
int kr, kc;
if (!(allow_hp && vp10_use_mv_hp(ref_mv))) if (!(allow_hp && vp10_use_mv_hp(ref_mv)))
if (round == 3) if (round == 3)
...@@ -703,8 +724,11 @@ int vp10_find_best_sub_pixel_tree(const MACROBLOCK *x, ...@@ -703,8 +724,11 @@ int vp10_find_best_sub_pixel_tree(const MACROBLOCK *x,
} }
// Check diagonal sub-pixel position // Check diagonal sub-pixel position
tc = bc + (cost_array[0] <= cost_array[1] ? -hstep : hstep); kc = (cost_array[0] <= cost_array[1] ? -hstep : hstep);
tr = br + (cost_array[2] <= cost_array[3] ? -hstep : hstep); kr = (cost_array[2] <= cost_array[3] ? -hstep : hstep);
tc = bc + kc;
tr = br + kr;
if (tc >= minc && tc <= maxc && tr >= minr && tr <= maxr) { if (tc >= minc && tc <= maxc && tr >= minr && tr <= maxr) {
const uint8_t *const pre_address = y + (tr >> 3) * y_stride + (tc >> 3); const uint8_t *const pre_address = y + (tr >> 3) * y_stride + (tc >> 3);
MV this_mv = {tr, tc}; MV this_mv = {tr, tc};
...@@ -736,7 +760,7 @@ int vp10_find_best_sub_pixel_tree(const MACROBLOCK *x, ...@@ -736,7 +760,7 @@ int vp10_find_best_sub_pixel_tree(const MACROBLOCK *x,
} }
if (iters_per_step > 1 && best_idx != -1) if (iters_per_step > 1 && best_idx != -1)
SECOND_LEVEL_CHECKS; SECOND_LEVEL_CHECKS_BEST;
tr = br; tr = br;
tc = bc; tc = bc;
...@@ -1704,7 +1728,7 @@ int vp10_diamond_search_sad_c(const MACROBLOCK *x, ...@@ -1704,7 +1728,7 @@ int vp10_diamond_search_sad_c(const MACROBLOCK *x,
} }
} }
break; break;
}; }
#endif #endif
} else if (best_address == in_what) { } else if (best_address == in_what) {
(*num00)++; (*num00)++;
......
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