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 #include <limits.h> | 11 #include <limits.h> |
12 | 12 |
13 #include "vp9/common/vp9_findnearmv.h" | 13 #include "vp9/common/vp9_findnearmv.h" |
14 #include "vp9/common/vp9_mvref_common.h" | 14 #include "vp9/common/vp9_mvref_common.h" |
15 #include "vp9/common/vp9_sadmxn.h" | 15 #include "vp9/common/vp9_sadmxn.h" |
16 #include "vp9/common/vp9_subpelvar.h" | |
17 | 16 |
18 static void lower_mv_precision(int_mv *mv, int usehp) { | 17 static void lower_mv_precision(int_mv *mv, int usehp) { |
19 if (!usehp || !vp9_use_nmv_hp(&mv->as_mv)) { | 18 if (!usehp || !vp9_use_mv_hp(&mv->as_mv)) { |
20 if (mv->as_mv.row & 1) | 19 if (mv->as_mv.row & 1) |
21 mv->as_mv.row += (mv->as_mv.row > 0 ? -1 : 1); | 20 mv->as_mv.row += (mv->as_mv.row > 0 ? -1 : 1); |
22 if (mv->as_mv.col & 1) | 21 if (mv->as_mv.col & 1) |
23 mv->as_mv.col += (mv->as_mv.col > 0 ? -1 : 1); | 22 mv->as_mv.col += (mv->as_mv.col > 0 ? -1 : 1); |
24 } | 23 } |
25 } | 24 } |
26 | 25 |
27 vp9_prob *vp9_mv_ref_probs(VP9_COMMON *pc, vp9_prob *p, int context) { | |
28 p[0] = pc->fc.inter_mode_probs[context][0]; | |
29 p[1] = pc->fc.inter_mode_probs[context][1]; | |
30 p[2] = pc->fc.inter_mode_probs[context][2]; | |
31 return p; | |
32 } | |
33 | 26 |
34 void vp9_find_best_ref_mvs(MACROBLOCKD *xd, | 27 void vp9_find_best_ref_mvs(MACROBLOCKD *xd, |
35 int_mv *mvlist, | 28 int_mv *mvlist, |
36 int_mv *nearest, | 29 int_mv *nearest, |
37 int_mv *near) { | 30 int_mv *near) { |
38 int i; | 31 int i; |
39 // Make sure all the candidates are properly clamped etc | 32 // Make sure all the candidates are properly clamped etc |
40 for (i = 0; i < MAX_MV_REF_CANDIDATES; ++i) { | 33 for (i = 0; i < MAX_MV_REF_CANDIDATES; ++i) { |
41 lower_mv_precision(&mvlist[i], xd->allow_high_precision_mv); | 34 lower_mv_precision(&mvlist[i], xd->allow_high_precision_mv); |
42 clamp_mv2(&mvlist[i], xd); | 35 clamp_mv2(&mvlist[i], xd); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 dst_list[dst++].as_int = bmi[0].as_mv[ref_idx].as_int; | 80 dst_list[dst++].as_int = bmi[0].as_mv[ref_idx].as_int; |
88 for (n = 0; dst < MAX_MV_REF_CANDIDATES && | 81 for (n = 0; dst < MAX_MV_REF_CANDIDATES && |
89 n < MAX_MV_REF_CANDIDATES; n++) | 82 n < MAX_MV_REF_CANDIDATES; n++) |
90 if (mv_list[n].as_int != dst_list[0].as_int) | 83 if (mv_list[n].as_int != dst_list[0].as_int) |
91 dst_list[dst++].as_int = mv_list[n].as_int; | 84 dst_list[dst++].as_int = mv_list[n].as_int; |
92 } | 85 } |
93 | 86 |
94 dst_nearest->as_int = dst_list[0].as_int; | 87 dst_nearest->as_int = dst_list[0].as_int; |
95 dst_near->as_int = dst_list[1].as_int; | 88 dst_near->as_int = dst_list[1].as_int; |
96 } | 89 } |
OLD | NEW |