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_ENCODER_VP9_MCOMP_H_ | 12 #ifndef VP9_ENCODER_VP9_MCOMP_H_ |
13 #define VP9_ENCODER_VP9_MCOMP_H_ | 13 #define VP9_ENCODER_VP9_MCOMP_H_ |
14 | 14 |
15 #include "vp9/encoder/vp9_block.h" | 15 #include "vp9/encoder/vp9_block.h" |
16 #include "vp9/encoder/vp9_variance.h" | 16 #include "vp9/encoder/vp9_variance.h" |
17 | 17 |
18 // The maximum number of steps in a step search given the largest | 18 // The maximum number of steps in a step search given the largest |
19 // allowed initial step | 19 // allowed initial step |
20 #define MAX_MVSEARCH_STEPS 11 | 20 #define MAX_MVSEARCH_STEPS 11 |
21 // Max full pel mv specified in 1 pel units | 21 // Max full pel mv specified in 1 pel units |
22 #define MAX_FULL_PEL_VAL ((1 << (MAX_MVSEARCH_STEPS)) - 1) | 22 #define MAX_FULL_PEL_VAL ((1 << (MAX_MVSEARCH_STEPS)) - 1) |
23 // Maximum size of the first step in full pel units | 23 // Maximum size of the first step in full pel units |
24 #define MAX_FIRST_STEP (1 << (MAX_MVSEARCH_STEPS-1)) | 24 #define MAX_FIRST_STEP (1 << (MAX_MVSEARCH_STEPS-1)) |
| 25 // Allowed motion vector pixel distance outside image border |
| 26 // for Block_16x16 |
| 27 #define BORDER_MV_PIXELS_B16 (16 + VP9_INTERP_EXTEND) |
| 28 |
25 | 29 |
26 void vp9_clamp_mv_min_max(MACROBLOCK *x, MV *mv); | 30 void vp9_clamp_mv_min_max(MACROBLOCK *x, MV *mv); |
27 int vp9_mv_bit_cost(int_mv *mv, int_mv *ref, int *mvjcost, | 31 int vp9_mv_bit_cost(const MV *mv, const MV *ref, |
28 int *mvcost[2], int weight); | 32 const int *mvjcost, int *mvcost[2], int weight); |
29 void vp9_init_dsmotion_compensation(MACROBLOCK *x, int stride); | 33 void vp9_init_dsmotion_compensation(MACROBLOCK *x, int stride); |
30 void vp9_init3smotion_compensation(MACROBLOCK *x, int stride); | 34 void vp9_init3smotion_compensation(MACROBLOCK *x, int stride); |
31 | 35 |
32 struct VP9_COMP; | 36 struct VP9_COMP; |
33 int vp9_init_search_range(struct VP9_COMP *cpi, int size); | 37 int vp9_init_search_range(struct VP9_COMP *cpi, int size); |
34 | 38 |
35 // Runs sequence of diamond searches in smaller steps for RD | 39 // Runs sequence of diamond searches in smaller steps for RD |
36 int vp9_full_pixel_diamond(struct VP9_COMP *cpi, MACROBLOCK *x, | 40 int vp9_full_pixel_diamond(struct VP9_COMP *cpi, MACROBLOCK *x, |
37 int_mv *mvp_full, int step_param, | 41 int_mv *mvp_full, int step_param, |
38 int sadpb, int further_steps, int do_refine, | 42 int sadpb, int further_steps, int do_refine, |
39 vp9_variance_fn_ptr_t *fn_ptr, | 43 vp9_variance_fn_ptr_t *fn_ptr, |
40 int_mv *ref_mv, int_mv *dst_mv); | 44 int_mv *ref_mv, int_mv *dst_mv); |
41 | 45 |
42 int vp9_hex_search(MACROBLOCK *x, | 46 int vp9_hex_search(MACROBLOCK *x, |
43 int_mv *ref_mv, | 47 MV *ref_mv, |
44 int search_param, | 48 int search_param, |
45 int error_per_bit, | 49 int error_per_bit, |
46 int do_init_search, | 50 int do_init_search, |
47 const vp9_variance_fn_ptr_t *vf, | 51 const vp9_variance_fn_ptr_t *vf, |
48 int use_mvcost, | 52 int use_mvcost, |
49 int_mv *center_mv, | 53 const MV *center_mv, |
50 int_mv *best_mv); | 54 MV *best_mv); |
51 int vp9_bigdia_search(MACROBLOCK *x, | 55 int vp9_bigdia_search(MACROBLOCK *x, |
52 int_mv *ref_mv, | 56 MV *ref_mv, |
53 int search_param, | 57 int search_param, |
54 int error_per_bit, | 58 int error_per_bit, |
55 int do_init_search, | 59 int do_init_search, |
56 const vp9_variance_fn_ptr_t *vf, | 60 const vp9_variance_fn_ptr_t *vf, |
57 int use_mvcost, | 61 int use_mvcost, |
58 int_mv *center_mv, | 62 const MV *center_mv, |
59 int_mv *best_mv); | 63 MV *best_mv); |
60 int vp9_square_search(MACROBLOCK *x, | 64 int vp9_square_search(MACROBLOCK *x, |
61 int_mv *ref_mv, | 65 MV *ref_mv, |
62 int search_param, | 66 int search_param, |
63 int error_per_bit, | 67 int error_per_bit, |
64 int do_init_search, | 68 int do_init_search, |
65 const vp9_variance_fn_ptr_t *vf, | 69 const vp9_variance_fn_ptr_t *vf, |
66 int use_mvcost, | 70 int use_mvcost, |
67 int_mv *center_mv, | 71 const MV *center_mv, |
68 int_mv *best_mv); | 72 MV *best_mv); |
69 | 73 |
70 typedef int (fractional_mv_step_fp) ( | 74 typedef int (fractional_mv_step_fp) ( |
71 MACROBLOCK *x, | 75 MACROBLOCK *x, |
72 int_mv *bestmv, | 76 MV *bestmv, const MV *ref_mv, |
73 int_mv *ref_mv, | 77 int allow_hp, |
74 int error_per_bit, | 78 int error_per_bit, |
75 const vp9_variance_fn_ptr_t *vfp, | 79 const vp9_variance_fn_ptr_t *vfp, |
76 int forced_stop, // 0 - full, 1 - qtr only, 2 - half only | 80 int forced_stop, // 0 - full, 1 - qtr only, 2 - half only |
77 int iters_per_step, | 81 int iters_per_step, |
78 int *mvjcost, | 82 int *mvjcost, |
79 int *mvcost[2], | 83 int *mvcost[2], |
80 int *distortion, | 84 int *distortion, |
81 unsigned int *sse); | 85 unsigned int *sse); |
82 extern fractional_mv_step_fp vp9_find_best_sub_pixel_iterative; | 86 extern fractional_mv_step_fp vp9_find_best_sub_pixel_iterative; |
83 extern fractional_mv_step_fp vp9_find_best_sub_pixel_tree; | 87 extern fractional_mv_step_fp vp9_find_best_sub_pixel_tree; |
84 | 88 |
85 typedef int (fractional_mv_step_comp_fp) ( | 89 typedef int (fractional_mv_step_comp_fp) ( |
86 MACROBLOCK *x, | 90 MACROBLOCK *x, |
87 int_mv *bestmv, int_mv *ref_mv, | 91 MV *bestmv, const MV *ref_mv, |
| 92 int allow_hp, |
88 int error_per_bit, | 93 int error_per_bit, |
89 const vp9_variance_fn_ptr_t *vfp, | 94 const vp9_variance_fn_ptr_t *vfp, |
90 int forced_stop, // 0 - full, 1 - qtr only, 2 - half only | 95 int forced_stop, // 0 - full, 1 - qtr only, 2 - half only |
91 int iters_per_step, | 96 int iters_per_step, |
92 int *mvjcost, int *mvcost[2], | 97 int *mvjcost, int *mvcost[2], |
93 int *distortion, unsigned int *sse1, | 98 int *distortion, unsigned int *sse1, |
94 const uint8_t *second_pred, | 99 const uint8_t *second_pred, |
95 int w, int h); | 100 int w, int h); |
96 extern fractional_mv_step_comp_fp vp9_find_best_sub_pixel_comp_iterative; | 101 extern fractional_mv_step_comp_fp vp9_find_best_sub_pixel_comp_iterative; |
97 extern fractional_mv_step_comp_fp vp9_find_best_sub_pixel_comp_tree; | 102 extern fractional_mv_step_comp_fp vp9_find_best_sub_pixel_comp_tree; |
(...skipping 19 matching lines...) Expand all Loading... |
117 int *mvjcost, int *mvcost[2], | 122 int *mvjcost, int *mvcost[2], |
118 int_mv *center_mv); | 123 int_mv *center_mv); |
119 | 124 |
120 int vp9_refining_search_8p_c(MACROBLOCK *x, | 125 int vp9_refining_search_8p_c(MACROBLOCK *x, |
121 int_mv *ref_mv, int error_per_bit, | 126 int_mv *ref_mv, int error_per_bit, |
122 int search_range, vp9_variance_fn_ptr_t *fn_ptr, | 127 int search_range, vp9_variance_fn_ptr_t *fn_ptr, |
123 int *mvjcost, int *mvcost[2], | 128 int *mvjcost, int *mvcost[2], |
124 int_mv *center_mv, const uint8_t *second_pred, | 129 int_mv *center_mv, const uint8_t *second_pred, |
125 int w, int h); | 130 int w, int h); |
126 #endif // VP9_ENCODER_VP9_MCOMP_H_ | 131 #endif // VP9_ENCODER_VP9_MCOMP_H_ |
OLD | NEW |