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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 int vp9_init_search_range(const SPEED_FEATURES *sf, int size) { | 54 int vp9_init_search_range(const SPEED_FEATURES *sf, int size) { |
55 int sr = 0; | 55 int sr = 0; |
56 | 56 |
57 // Minimum search size no matter what the passed in value. | 57 // Minimum search size no matter what the passed in value. |
58 size = MAX(16, size); | 58 size = MAX(16, size); |
59 | 59 |
60 while ((size << sr) < MAX_FULL_PEL_VAL) | 60 while ((size << sr) < MAX_FULL_PEL_VAL) |
61 sr++; | 61 sr++; |
62 | 62 |
63 sr += sf->mv.reduce_first_step_size; | 63 sr = MIN(sr, MAX_MVSEARCH_STEPS - 2); |
64 sr = MIN(sr, (sf->mv.max_step_search_steps - 2)); | |
65 return sr; | 64 return sr; |
66 } | 65 } |
67 | 66 |
68 static INLINE int mv_cost(const MV *mv, | 67 static INLINE int mv_cost(const MV *mv, |
69 const int *joint_cost, int *const comp_cost[2]) { | 68 const int *joint_cost, int *const comp_cost[2]) { |
70 return joint_cost[vp9_get_mv_joint(mv)] + | 69 return joint_cost[vp9_get_mv_joint(mv)] + |
71 comp_cost[0][mv->row] + comp_cost[1][mv->col]; | 70 comp_cost[0][mv->row] + comp_cost[1][mv->col]; |
72 } | 71 } |
73 | 72 |
74 int vp9_mv_bit_cost(const MV *mv, const MV *ref, | 73 int vp9_mv_bit_cost(const MV *mv, const MV *ref, |
(...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1620 case SQUARE: | 1619 case SQUARE: |
1621 var = vp9_square_search(x, mvp_full, step_param, error_per_bit, 1, | 1620 var = vp9_square_search(x, mvp_full, step_param, error_per_bit, 1, |
1622 fn_ptr, 1, ref_mv, tmp_mv); | 1621 fn_ptr, 1, ref_mv, tmp_mv); |
1623 break; | 1622 break; |
1624 case BIGDIA: | 1623 case BIGDIA: |
1625 var = vp9_bigdia_search(x, mvp_full, step_param, error_per_bit, 1, | 1624 var = vp9_bigdia_search(x, mvp_full, step_param, error_per_bit, 1, |
1626 fn_ptr, 1, ref_mv, tmp_mv); | 1625 fn_ptr, 1, ref_mv, tmp_mv); |
1627 break; | 1626 break; |
1628 case NSTEP: | 1627 case NSTEP: |
1629 var = vp9_full_pixel_diamond(cpi, x, mvp_full, step_param, error_per_bit, | 1628 var = vp9_full_pixel_diamond(cpi, x, mvp_full, step_param, error_per_bit, |
1630 (sf->mv.max_step_search_steps - 1) - | 1629 MAX_MVSEARCH_STEPS - 1 - step_param, |
1631 step_param, | |
1632 1, fn_ptr, ref_mv, tmp_mv); | 1630 1, fn_ptr, ref_mv, tmp_mv); |
1633 break; | 1631 break; |
1634 default: | 1632 default: |
1635 assert(!"Invalid search method."); | 1633 assert(!"Invalid search method."); |
1636 } | 1634 } |
1637 | 1635 |
1638 if (method != NSTEP && rd && var < var_max) | 1636 if (method != NSTEP && rd && var < var_max) |
1639 var = vp9_get_mvpred_var(x, tmp_mv, ref_mv, fn_ptr, 1); | 1637 var = vp9_get_mvpred_var(x, tmp_mv, ref_mv, fn_ptr, 1); |
1640 | 1638 |
1641 return var; | 1639 return var; |
1642 } | 1640 } |
OLD | NEW |