media/libvpx/vp9/common/vp9_findnearmv.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/libvpx/vp9/common/vp9_findnearmv.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,72 @@
     1.4 +/*
     1.5 + *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
     1.6 + *
     1.7 + *  Use of this source code is governed by a BSD-style license
     1.8 + *  that can be found in the LICENSE file in the root of the source
     1.9 + *  tree. An additional intellectual property rights grant can be found
    1.10 + *  in the file PATENTS.  All contributing project authors may
    1.11 + *  be found in the AUTHORS file in the root of the source tree.
    1.12 + */
    1.13 +
    1.14 +
    1.15 +#ifndef VP9_COMMON_VP9_FINDNEARMV_H_
    1.16 +#define VP9_COMMON_VP9_FINDNEARMV_H_
    1.17 +
    1.18 +#include "vp9/common/vp9_mv.h"
    1.19 +#include "vp9/common/vp9_blockd.h"
    1.20 +#include "vp9/common/vp9_treecoder.h"
    1.21 +#include "vp9/common/vp9_onyxc_int.h"
    1.22 +
    1.23 +#define LEFT_TOP_MARGIN     ((VP9BORDERINPIXELS - VP9_INTERP_EXTEND) << 3)
    1.24 +#define RIGHT_BOTTOM_MARGIN ((VP9BORDERINPIXELS - VP9_INTERP_EXTEND) << 3)
    1.25 +
    1.26 +// check a list of motion vectors by sad score using a number rows of pixels
    1.27 +// above and a number cols of pixels in the left to select the one with best
    1.28 +// score to use as ref motion vector
    1.29 +void vp9_find_best_ref_mvs(MACROBLOCKD *xd, int allow_hp,
    1.30 +                           int_mv *mvlist, int_mv *nearest, int_mv *near);
    1.31 +
    1.32 +// TODO(jingning): this mv clamping function should be block size dependent.
    1.33 +static void clamp_mv2(MV *mv, const MACROBLOCKD *xd) {
    1.34 +  clamp_mv(mv, xd->mb_to_left_edge - LEFT_TOP_MARGIN,
    1.35 +               xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN,
    1.36 +               xd->mb_to_top_edge - LEFT_TOP_MARGIN,
    1.37 +               xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN);
    1.38 +}
    1.39 +
    1.40 +void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *cm, MACROBLOCKD *xd,
    1.41 +                                   const TileInfo *const tile,
    1.42 +                                   int_mv *dst_nearest,
    1.43 +                                   int_mv *dst_near,
    1.44 +                                   int block_idx, int ref_idx,
    1.45 +                                   int mi_row, int mi_col);
    1.46 +
    1.47 +static MB_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mi,
    1.48 +                                          const MODE_INFO *left_mi, int b) {
    1.49 +  if (b == 0 || b == 2) {
    1.50 +    if (!left_mi || is_inter_block(&left_mi->mbmi))
    1.51 +      return DC_PRED;
    1.52 +
    1.53 +    return left_mi->mbmi.sb_type < BLOCK_8X8 ? left_mi->bmi[b + 1].as_mode
    1.54 +                                             : left_mi->mbmi.mode;
    1.55 +  } else {
    1.56 +    assert(b == 1 || b == 3);
    1.57 +    return cur_mi->bmi[b - 1].as_mode;
    1.58 +  }
    1.59 +}
    1.60 +
    1.61 +static MB_PREDICTION_MODE above_block_mode(const MODE_INFO *cur_mi,
    1.62 +                                           const MODE_INFO *above_mi, int b) {
    1.63 +  if (b == 0 || b == 1) {
    1.64 +    if (!above_mi || is_inter_block(&above_mi->mbmi))
    1.65 +      return DC_PRED;
    1.66 +
    1.67 +    return above_mi->mbmi.sb_type < BLOCK_8X8 ? above_mi->bmi[b + 2].as_mode
    1.68 +                                              : above_mi->mbmi.mode;
    1.69 +  } else {
    1.70 +    assert(b == 2 || b == 3);
    1.71 +    return cur_mi->bmi[b - 2].as_mode;
    1.72 +  }
    1.73 +}
    1.74 +
    1.75 +#endif  // VP9_COMMON_VP9_FINDNEARMV_H_

mercurial