| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 #ifndef VP9_COMMON_VP9_MVREF_COMMON_H_ | 10 #ifndef VP9_COMMON_VP9_MVREF_COMMON_H_ |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 if (ref_sign_bias[mbmi->ref_frame[ref]] != ref_sign_bias[this_ref_frame]) { | 151 if (ref_sign_bias[mbmi->ref_frame[ref]] != ref_sign_bias[this_ref_frame]) { |
| 152 mv.as_mv.row *= -1; | 152 mv.as_mv.row *= -1; |
| 153 mv.as_mv.col *= -1; | 153 mv.as_mv.col *= -1; |
| 154 } | 154 } |
| 155 return mv; | 155 return mv; |
| 156 } | 156 } |
| 157 | 157 |
| 158 // This macro is used to add a motion vector mv_ref list if it isn't | 158 // This macro is used to add a motion vector mv_ref list if it isn't |
| 159 // already in the list. If it's the second motion vector it will also | 159 // already in the list. If it's the second motion vector it will also |
| 160 // skip all additional processing and jump to done! | 160 // skip all additional processing and jump to done! |
| 161 #define ADD_MV_REF_LIST(mv) \ | 161 #define ADD_MV_REF_LIST(mv, refmv_count, mv_ref_list, Done) \ |
| 162 do { \ | 162 do { \ |
| 163 if (refmv_count) { \ | 163 if (refmv_count) { \ |
| 164 if ((mv).as_int != mv_ref_list[0].as_int) { \ | 164 if ((mv).as_int != (mv_ref_list)[0].as_int) { \ |
| 165 mv_ref_list[refmv_count] = (mv); \ | 165 (mv_ref_list)[(refmv_count)] = (mv); \ |
| 166 goto Done; \ | 166 goto Done; \ |
| 167 } \ | 167 } \ |
| 168 } else { \ | 168 } else { \ |
| 169 mv_ref_list[refmv_count++] = (mv); \ | 169 (mv_ref_list)[(refmv_count)++] = (mv); \ |
| 170 } \ | 170 } \ |
| 171 } while (0) | 171 } while (0) |
| 172 | 172 |
| 173 // If either reference frame is different, not INTRA, and they | 173 // If either reference frame is different, not INTRA, and they |
| 174 // are different from each other scale and add the mv to our list. | 174 // are different from each other scale and add the mv to our list. |
| 175 #define IF_DIFF_REF_FRAME_ADD_MV(mbmi) \ | 175 #define IF_DIFF_REF_FRAME_ADD_MV(mbmi, ref_frame, ref_sign_bias, refmv_count, \ |
| 176 mv_ref_list, Done) \ |
| 176 do { \ | 177 do { \ |
| 177 if (is_inter_block(mbmi)) { \ | 178 if (is_inter_block(mbmi)) { \ |
| 178 if ((mbmi)->ref_frame[0] != ref_frame) \ | 179 if ((mbmi)->ref_frame[0] != ref_frame) \ |
| 179 ADD_MV_REF_LIST(scale_mv((mbmi), 0, ref_frame, ref_sign_bias)); \ | 180 ADD_MV_REF_LIST(scale_mv((mbmi), 0, ref_frame, ref_sign_bias), \ |
| 181 refmv_count, mv_ref_list, Done); \ |
| 180 if (has_second_ref(mbmi) && \ | 182 if (has_second_ref(mbmi) && \ |
| 181 (mbmi)->ref_frame[1] != ref_frame && \ | 183 (mbmi)->ref_frame[1] != ref_frame && \ |
| 182 (mbmi)->mv[1].as_int != (mbmi)->mv[0].as_int) \ | 184 (mbmi)->mv[1].as_int != (mbmi)->mv[0].as_int) \ |
| 183 ADD_MV_REF_LIST(scale_mv((mbmi), 1, ref_frame, ref_sign_bias)); \ | 185 ADD_MV_REF_LIST(scale_mv((mbmi), 1, ref_frame, ref_sign_bias), \ |
| 186 refmv_count, mv_ref_list, Done); \ |
| 184 } \ | 187 } \ |
| 185 } while (0) | 188 } while (0) |
| 186 | 189 |
| 187 | 190 |
| 188 // Checks that the given mi_row, mi_col and search point | 191 // Checks that the given mi_row, mi_col and search point |
| 189 // are inside the borders of the tile. | 192 // are inside the borders of the tile. |
| 190 static INLINE int is_inside(const TileInfo *const tile, | 193 static INLINE int is_inside(const TileInfo *const tile, |
| 191 int mi_col, int mi_row, int mi_rows, | 194 int mi_col, int mi_row, int mi_rows, |
| 192 const POSITION *mi_pos) { | 195 const POSITION *mi_pos) { |
| 193 return !(mi_row + mi_pos->row < 0 || | 196 return !(mi_row + mi_pos->row < 0 || |
| (...skipping 24 matching lines...) Expand all Loading... |
| 218 void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *cm, MACROBLOCKD *xd, | 221 void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *cm, MACROBLOCKD *xd, |
| 219 const TileInfo *const tile, | 222 const TileInfo *const tile, |
| 220 int block, int ref, int mi_row, int mi_col, | 223 int block, int ref, int mi_row, int mi_col, |
| 221 int_mv *nearest, int_mv *near); | 224 int_mv *nearest, int_mv *near); |
| 222 | 225 |
| 223 #ifdef __cplusplus | 226 #ifdef __cplusplus |
| 224 } // extern "C" | 227 } // extern "C" |
| 225 #endif | 228 #endif |
| 226 | 229 |
| 227 #endif // VP9_COMMON_VP9_MVREF_COMMON_H_ | 230 #endif // VP9_COMMON_VP9_MVREF_COMMON_H_ |
| OLD | NEW |