* be found in the AUTHORS file in the root of the source tree.
*/
-
#include <limits.h>
#include "vp9/common/vp9_findnearmv.h"
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
};
-static void lower_mv_precision(int_mv *mv, int usehp)
-{
+static void lower_mv_precision(int_mv *mv, int usehp) {
if (!usehp || !vp9_use_nmv_hp(&mv->as_mv)) {
if (mv->as_mv.row & 1)
mv->as_mv.row += (mv->as_mv.row > 0 ? -1 : 1);
}
}
-vp9_prob *vp9_mv_ref_probs(VP9_COMMON *pc,
- vp9_prob p[4], const int context) {
+vp9_prob *vp9_mv_ref_probs(VP9_COMMON *pc, vp9_prob p[4], int context) {
p[0] = pc->fc.vp9_mode_contexts[context][0];
p[1] = pc->fc.vp9_mode_contexts[context][1];
p[2] = pc->fc.vp9_mode_contexts[context][2];
#define LEFT_TOP_MARGIN ((VP9BORDERINPIXELS - VP9_INTERP_EXTEND) << 3)
#define RIGHT_BOTTOM_MARGIN ((VP9BORDERINPIXELS - VP9_INTERP_EXTEND) << 3)
-/* check a list of motion vectors by sad score using a number rows of pixels
- * above and a number cols of pixels in the left to select the one with best
- * score to use as ref motion vector
- */
+// check a list of motion vectors by sad score using a number rows of pixels
+// above and a number cols of pixels in the left to select the one with best
+// score to use as ref motion vector
void vp9_find_best_ref_mvs(MACROBLOCKD *xd,
uint8_t *ref_y_buffer,
int ref_y_stride,
int mb_to_right_edge,
int mb_to_top_edge,
int mb_to_bottom_edge) {
- mv->as_mv.col = (mv->as_mv.col < mb_to_left_edge) ?
- mb_to_left_edge : mv->as_mv.col;
- mv->as_mv.col = (mv->as_mv.col > mb_to_right_edge) ?
- mb_to_right_edge : mv->as_mv.col;
- mv->as_mv.row = (mv->as_mv.row < mb_to_top_edge) ?
- mb_to_top_edge : mv->as_mv.row;
- mv->as_mv.row = (mv->as_mv.row > mb_to_bottom_edge) ?
- mb_to_bottom_edge : mv->as_mv.row;
+ mv->as_mv.col = clamp(mv->as_mv.col, mb_to_left_edge, mb_to_right_edge);
+ mv->as_mv.row = clamp(mv->as_mv.row, mb_to_top_edge, mb_to_bottom_edge);
}
static int clamp_mv2(int_mv *mv, const MACROBLOCKD *xd) {
int_mv tmp_mv;
- int mv_clampped = 0;
tmp_mv.as_int = mv->as_int;
clamp_mv(mv,
xd->mb_to_left_edge - LEFT_TOP_MARGIN,
xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN,
xd->mb_to_top_edge - LEFT_TOP_MARGIN,
xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN);
- if (tmp_mv.as_int != mv->as_int)
- mv_clampped = 1;
-
- return mv_clampped;
+ return tmp_mv.as_int != mv->as_int;
}
static int check_mv_bounds(int_mv *mv,