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 |
11 | 11 |
12 #ifndef VP9_COMMON_VP9_FINDNEARMV_H_ | 12 #ifndef VP9_COMMON_VP9_FINDNEARMV_H_ |
13 #define VP9_COMMON_VP9_FINDNEARMV_H_ | 13 #define VP9_COMMON_VP9_FINDNEARMV_H_ |
14 | 14 |
15 #include "vp9/common/vp9_mv.h" | 15 #include "vp9/common/vp9_mv.h" |
16 #include "vp9/common/vp9_blockd.h" | 16 #include "vp9/common/vp9_blockd.h" |
17 #include "vp9/common/vp9_treecoder.h" | 17 #include "vp9/common/vp9_treecoder.h" |
18 #include "vp9/common/vp9_onyxc_int.h" | 18 #include "vp9/common/vp9_onyxc_int.h" |
19 | 19 |
20 #define LEFT_TOP_MARGIN ((VP9BORDERINPIXELS - VP9_INTERP_EXTEND) << 3) | 20 #define LEFT_TOP_MARGIN ((VP9BORDERINPIXELS - VP9_INTERP_EXTEND) << 3) |
21 #define RIGHT_BOTTOM_MARGIN ((VP9BORDERINPIXELS - VP9_INTERP_EXTEND) << 3) | 21 #define RIGHT_BOTTOM_MARGIN ((VP9BORDERINPIXELS - VP9_INTERP_EXTEND) << 3) |
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, int allow_hp, |
27 int_mv *mvlist, | 27 int_mv *mvlist, int_mv *nearest, int_mv *near); |
28 int_mv *nearest, | |
29 int_mv *near); | |
30 | 28 |
31 // TODO(jingning): this mv clamping function should be block size dependent. | 29 // TODO(jingning): this mv clamping function should be block size dependent. |
32 static void clamp_mv2(MV *mv, const MACROBLOCKD *xd) { | 30 static void clamp_mv2(MV *mv, const MACROBLOCKD *xd) { |
33 clamp_mv(mv, xd->mb_to_left_edge - LEFT_TOP_MARGIN, | 31 clamp_mv(mv, xd->mb_to_left_edge - LEFT_TOP_MARGIN, |
34 xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN, | 32 xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN, |
35 xd->mb_to_top_edge - LEFT_TOP_MARGIN, | 33 xd->mb_to_top_edge - LEFT_TOP_MARGIN, |
36 xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN); | 34 xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN); |
37 } | 35 } |
38 | 36 |
39 void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *cm, | 37 void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *cm, MACROBLOCKD *xd, |
40 MACROBLOCKD *xd, | 38 const TileInfo *const tile, |
41 int_mv *dst_nearest, | 39 int_mv *dst_nearest, |
42 int_mv *dst_near, | 40 int_mv *dst_near, |
43 int block_idx, int ref_idx, | 41 int block_idx, int ref_idx, |
44 int mi_row, int mi_col); | 42 int mi_row, int mi_col); |
45 | 43 |
46 static MB_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mb, | 44 static MB_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mi, |
47 const MODE_INFO *left_mb, int b) { | 45 const MODE_INFO *left_mi, int b) { |
48 // FIXME(rbultje, jingning): temporary hack because jenkins doesn't | |
49 // understand this condition. This will go away soon. | |
50 const MODE_INFO *mi = cur_mb; | |
51 | |
52 if (b == 0 || b == 2) { | 46 if (b == 0 || b == 2) { |
53 /* On L edge, get from MB to left of us */ | 47 if (!left_mi || is_inter_block(&left_mi->mbmi)) |
54 mi = left_mb; | |
55 if (!mi) | |
56 return DC_PRED; | 48 return DC_PRED; |
57 | 49 |
58 if (mi->mbmi.ref_frame[0] != INTRA_FRAME) { | 50 return left_mi->mbmi.sb_type < BLOCK_8X8 ? left_mi->bmi[b + 1].as_mode |
59 return DC_PRED; | 51 : left_mi->mbmi.mode; |
60 } else if (mi->mbmi.sb_type < BLOCK_8X8) { | 52 } else { |
61 return ((mi->bmi + 1 + b)->as_mode); | 53 assert(b == 1 || b == 3); |
62 } else { | 54 return cur_mi->bmi[b - 1].as_mode; |
63 return mi->mbmi.mode; | |
64 } | |
65 } | 55 } |
66 assert(b == 1 || b == 3); | |
67 return (mi->bmi + b - 1)->as_mode; | |
68 } | 56 } |
69 | 57 |
70 static MB_PREDICTION_MODE above_block_mode(const MODE_INFO *cur_mb, | 58 static MB_PREDICTION_MODE above_block_mode(const MODE_INFO *cur_mi, |
71 const MODE_INFO *above_mb, int b) { | 59 const MODE_INFO *above_mi, int b) { |
72 const MODE_INFO *mi = cur_mb; | 60 if (b == 0 || b == 1) { |
73 | 61 if (!above_mi || is_inter_block(&above_mi->mbmi)) |
74 if (!(b >> 1)) { | |
75 /* On top edge, get from MB above us */ | |
76 mi = above_mb; | |
77 if (!mi) | |
78 return DC_PRED; | 62 return DC_PRED; |
79 | 63 |
80 if (mi->mbmi.ref_frame[0] != INTRA_FRAME) { | 64 return above_mi->mbmi.sb_type < BLOCK_8X8 ? above_mi->bmi[b + 2].as_mode |
81 return DC_PRED; | 65 : above_mi->mbmi.mode; |
82 } else if (mi->mbmi.sb_type < BLOCK_8X8) { | 66 } else { |
83 return ((mi->bmi + 2 + b)->as_mode); | 67 assert(b == 2 || b == 3); |
84 } else { | 68 return cur_mi->bmi[b - 2].as_mode; |
85 return mi->mbmi.mode; | |
86 } | |
87 } | 69 } |
88 | |
89 return (mi->bmi + b - 2)->as_mode; | |
90 } | 70 } |
91 | 71 |
92 #endif // VP9_COMMON_VP9_FINDNEARMV_H_ | 72 #endif // VP9_COMMON_VP9_FINDNEARMV_H_ |
OLD | NEW |