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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 const MV diff = { mv->row - ref->row, | 83 const MV diff = { mv->row - ref->row, |
84 mv->col - ref->col }; | 84 mv->col - ref->col }; |
85 return ROUND_POWER_OF_TWO(mv_cost(&diff, mvjcost, mvcost) * | 85 return ROUND_POWER_OF_TWO(mv_cost(&diff, mvjcost, mvcost) * |
86 error_per_bit, 13); | 86 error_per_bit, 13); |
87 } | 87 } |
88 return 0; | 88 return 0; |
89 } | 89 } |
90 | 90 |
91 static int mvsad_err_cost(const MACROBLOCK *x, const MV *mv, const MV *ref, | 91 static int mvsad_err_cost(const MACROBLOCK *x, const MV *mv, const MV *ref, |
92 int error_per_bit) { | 92 int error_per_bit) { |
93 const MV diff = { mv->row - ref->row, | 93 if (x->nmvsadcost) { |
94 mv->col - ref->col }; | 94 const MV diff = { mv->row - ref->row, |
95 return ROUND_POWER_OF_TWO(mv_cost(&diff, x->nmvjointsadcost, | 95 mv->col - ref->col }; |
96 x->nmvsadcost) * error_per_bit, 8); | 96 return ROUND_POWER_OF_TWO(mv_cost(&diff, x->nmvjointsadcost, |
| 97 x->nmvsadcost) * error_per_bit, 8); |
| 98 } |
| 99 return 0; |
97 } | 100 } |
98 | 101 |
99 void vp9_init_dsmotion_compensation(search_site_config *cfg, int stride) { | 102 void vp9_init_dsmotion_compensation(search_site_config *cfg, int stride) { |
100 int len, ss_count = 1; | 103 int len, ss_count = 1; |
101 | 104 |
102 cfg->ss[0].mv.col = cfg->ss[0].mv.row = 0; | 105 cfg->ss[0].mv.col = cfg->ss[0].mv.row = 0; |
103 cfg->ss[0].offset = 0; | 106 cfg->ss[0].offset = 0; |
104 | 107 |
105 for (len = MAX_FIRST_STEP; len > 0; len /= 2) { | 108 for (len = MAX_FIRST_STEP; len > 0; len /= 2) { |
106 // Generate offsets for 4 search sites per step. | 109 // Generate offsets for 4 search sites per step. |
(...skipping 2033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2140 break; | 2143 break; |
2141 default: | 2144 default: |
2142 assert(0 && "Invalid search method."); | 2145 assert(0 && "Invalid search method."); |
2143 } | 2146 } |
2144 | 2147 |
2145 if (method != NSTEP && rd && var < var_max) | 2148 if (method != NSTEP && rd && var < var_max) |
2146 var = vp9_get_mvpred_var(x, tmp_mv, ref_mv, fn_ptr, 1); | 2149 var = vp9_get_mvpred_var(x, tmp_mv, ref_mv, fn_ptr, 1); |
2147 | 2150 |
2148 return var; | 2151 return var; |
2149 } | 2152 } |
OLD | NEW |