| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 // check a list of motion vectors by sad score using a number rows of pixels | 23 // check a list of motion vectors by sad score using a number rows of pixels |
| 24 // above and a number cols of pixels in the left to select the one with best | 24 // above and a number cols of pixels in the left to select the one with best |
| 25 // score to use as ref motion vector | 25 // score to use as ref motion vector |
| 26 void vp9_find_best_ref_mvs(MACROBLOCKD *xd, | 26 void vp9_find_best_ref_mvs(MACROBLOCKD *xd, |
| 27 int_mv *mvlist, | 27 int_mv *mvlist, |
| 28 int_mv *nearest, | 28 int_mv *nearest, |
| 29 int_mv *near); | 29 int_mv *near); |
| 30 | 30 |
| 31 // TODO(jingning): this mv clamping function should be block size dependent. | 31 // TODO(jingning): this mv clamping function should be block size dependent. |
| 32 static void clamp_mv(int_mv *mv, | 32 static void clamp_mv2(MV *mv, const MACROBLOCKD *xd) { |
| 33 int mb_to_left_edge, | 33 clamp_mv(mv, xd->mb_to_left_edge - LEFT_TOP_MARGIN, |
| 34 int mb_to_right_edge, | 34 xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN, |
| 35 int mb_to_top_edge, | 35 xd->mb_to_top_edge - LEFT_TOP_MARGIN, |
| 36 int mb_to_bottom_edge) { | 36 xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN); |
| 37 mv->as_mv.col = clamp(mv->as_mv.col, mb_to_left_edge, mb_to_right_edge); | |
| 38 mv->as_mv.row = clamp(mv->as_mv.row, mb_to_top_edge, mb_to_bottom_edge); | |
| 39 } | |
| 40 | |
| 41 static int clamp_mv2(int_mv *mv, const MACROBLOCKD *xd) { | |
| 42 int_mv tmp_mv; | |
| 43 tmp_mv.as_int = mv->as_int; | |
| 44 clamp_mv(mv, | |
| 45 xd->mb_to_left_edge - LEFT_TOP_MARGIN, | |
| 46 xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN, | |
| 47 xd->mb_to_top_edge - LEFT_TOP_MARGIN, | |
| 48 xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN); | |
| 49 return tmp_mv.as_int != mv->as_int; | |
| 50 } | 37 } |
| 51 | 38 |
| 52 void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *pc, | 39 void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *pc, |
| 53 MACROBLOCKD *xd, | 40 MACROBLOCKD *xd, |
| 54 int_mv *dst_nearest, | 41 int_mv *dst_nearest, |
| 55 int_mv *dst_near, | 42 int_mv *dst_near, |
| 56 int block_idx, int ref_idx); | 43 int block_idx, int ref_idx, |
| 44 int mi_row, int mi_col); |
| 57 | 45 |
| 58 static MB_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mb, int b) { | 46 static MB_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mb, int b) { |
| 59 // FIXME(rbultje, jingning): temporary hack because jenkins doesn't | 47 // FIXME(rbultje, jingning): temporary hack because jenkins doesn't |
| 60 // understand this condition. This will go away soon. | 48 // understand this condition. This will go away soon. |
| 61 if (b == 0 || b == 2) { | 49 if (b == 0 || b == 2) { |
| 62 /* On L edge, get from MB to left of us */ | 50 /* On L edge, get from MB to left of us */ |
| 63 --cur_mb; | 51 --cur_mb; |
| 64 | 52 |
| 65 if (cur_mb->mbmi.ref_frame[0] != INTRA_FRAME) { | 53 if (is_inter_block(&cur_mb->mbmi)) { |
| 66 return DC_PRED; | 54 return DC_PRED; |
| 67 } else if (cur_mb->mbmi.sb_type < BLOCK_SIZE_SB8X8) { | 55 } else if (cur_mb->mbmi.sb_type < BLOCK_8X8) { |
| 68 return ((cur_mb->bmi + 1 + b)->as_mode); | 56 return (cur_mb->bmi + 1 + b)->as_mode; |
| 69 } else { | 57 } else { |
| 70 return cur_mb->mbmi.mode; | 58 return cur_mb->mbmi.mode; |
| 71 } | 59 } |
| 72 } | 60 } |
| 73 assert(b == 1 || b == 3); | 61 assert(b == 1 || b == 3); |
| 74 return (cur_mb->bmi + b - 1)->as_mode; | 62 return (cur_mb->bmi + b - 1)->as_mode; |
| 75 } | 63 } |
| 76 | 64 |
| 77 static MB_PREDICTION_MODE above_block_mode(const MODE_INFO *cur_mb, | 65 static MB_PREDICTION_MODE above_block_mode(const MODE_INFO *cur_mb, |
| 78 int b, int mi_stride) { | 66 int b, int mi_stride) { |
| 79 if (!(b >> 1)) { | 67 if (!(b >> 1)) { |
| 80 /* On top edge, get from MB above us */ | 68 /* On top edge, get from MB above us */ |
| 81 cur_mb -= mi_stride; | 69 cur_mb -= mi_stride; |
| 82 | 70 |
| 83 if (cur_mb->mbmi.ref_frame[0] != INTRA_FRAME) { | 71 if (is_inter_block(&cur_mb->mbmi)) { |
| 84 return DC_PRED; | 72 return DC_PRED; |
| 85 } else if (cur_mb->mbmi.sb_type < BLOCK_SIZE_SB8X8) { | 73 } else if (cur_mb->mbmi.sb_type < BLOCK_8X8) { |
| 86 return ((cur_mb->bmi + 2 + b)->as_mode); | 74 return (cur_mb->bmi + 2 + b)->as_mode; |
| 87 } else { | 75 } else { |
| 88 return cur_mb->mbmi.mode; | 76 return cur_mb->mbmi.mode; |
| 89 } | 77 } |
| 90 } | 78 } |
| 91 | 79 |
| 92 return (cur_mb->bmi + b - 2)->as_mode; | 80 return (cur_mb->bmi + b - 2)->as_mode; |
| 93 } | 81 } |
| 94 | 82 |
| 95 #endif // VP9_COMMON_VP9_FINDNEARMV_H_ | 83 #endif // VP9_COMMON_VP9_FINDNEARMV_H_ |
| OLD | NEW |