| 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 | 25 |
| 26 void vp9_clamp_mv_min_max(MACROBLOCK *x, int_mv *ref_mv); | 26 void vp9_clamp_mv_min_max(MACROBLOCK *x, MV *mv); |
| 27 int vp9_mv_bit_cost(int_mv *mv, int_mv *ref, int *mvjcost, | 27 int vp9_mv_bit_cost(int_mv *mv, int_mv *ref, int *mvjcost, |
| 28 int *mvcost[2], int weight, int ishp); | 28 int *mvcost[2], int weight); |
| 29 void vp9_init_dsmotion_compensation(MACROBLOCK *x, int stride); | 29 void vp9_init_dsmotion_compensation(MACROBLOCK *x, int stride); |
| 30 void vp9_init3smotion_compensation(MACROBLOCK *x, int stride); | 30 void vp9_init3smotion_compensation(MACROBLOCK *x, int stride); |
| 31 | 31 |
| 32 struct VP9_COMP; | 32 struct VP9_COMP; |
| 33 int vp9_init_search_range(struct VP9_COMP *cpi, int size); | 33 int vp9_init_search_range(struct VP9_COMP *cpi, int size); |
| 34 | 34 |
| 35 // Runs sequence of diamond searches in smaller steps for RD | 35 // Runs sequence of diamond searches in smaller steps for RD |
| 36 int vp9_full_pixel_diamond(struct VP9_COMP *cpi, MACROBLOCK *x, | 36 int vp9_full_pixel_diamond(struct VP9_COMP *cpi, MACROBLOCK *x, |
| 37 int_mv *mvp_full, int step_param, | 37 int_mv *mvp_full, int step_param, |
| 38 int sadpb, int further_steps, int do_refine, | 38 int sadpb, int further_steps, int do_refine, |
| 39 vp9_variance_fn_ptr_t *fn_ptr, | 39 vp9_variance_fn_ptr_t *fn_ptr, |
| 40 int_mv *ref_mv, int_mv *dst_mv); | 40 int_mv *ref_mv, int_mv *dst_mv); |
| 41 | 41 |
| 42 int vp9_hex_search(MACROBLOCK *x, | 42 int vp9_hex_search(MACROBLOCK *x, |
| 43 int_mv *ref_mv, int_mv *best_mv, | 43 int_mv *ref_mv, |
| 44 int search_param, int error_per_bit, | 44 int search_param, |
| 45 int error_per_bit, |
| 46 int do_init_search, |
| 45 const vp9_variance_fn_ptr_t *vf, | 47 const vp9_variance_fn_ptr_t *vf, |
| 46 int *mvjsadcost, int *mvsadcost[2], | 48 int use_mvcost, |
| 47 int *mvjcost, int *mvcost[2], | 49 int_mv *center_mv, |
| 48 int_mv *center_mv); | 50 int_mv *best_mv); |
| 51 int vp9_bigdia_search(MACROBLOCK *x, |
| 52 int_mv *ref_mv, |
| 53 int search_param, |
| 54 int error_per_bit, |
| 55 int do_init_search, |
| 56 const vp9_variance_fn_ptr_t *vf, |
| 57 int use_mvcost, |
| 58 int_mv *center_mv, |
| 59 int_mv *best_mv); |
| 60 int vp9_square_search(MACROBLOCK *x, |
| 61 int_mv *ref_mv, |
| 62 int search_param, |
| 63 int error_per_bit, |
| 64 int do_init_search, |
| 65 const vp9_variance_fn_ptr_t *vf, |
| 66 int use_mvcost, |
| 67 int_mv *center_mv, |
| 68 int_mv *best_mv); |
| 49 | 69 |
| 50 typedef int (fractional_mv_step_fp) (MACROBLOCK *x, int_mv | 70 typedef int (fractional_mv_step_fp) ( |
| 51 *bestmv, int_mv *ref_mv, int error_per_bit, const vp9_variance_fn_ptr_t *vfp, | 71 MACROBLOCK *x, |
| 52 int *mvjcost, int *mvcost[2], int *distortion, unsigned int *sse); | 72 int_mv *bestmv, |
| 53 extern fractional_mv_step_fp vp9_find_best_sub_pixel_step_iteratively; | 73 int_mv *ref_mv, |
| 54 extern fractional_mv_step_fp vp9_find_best_sub_pixel_step; | 74 int error_per_bit, |
| 55 extern fractional_mv_step_fp vp9_find_best_half_pixel_step; | 75 const vp9_variance_fn_ptr_t *vfp, |
| 76 int forced_stop, // 0 - full, 1 - qtr only, 2 - half only |
| 77 int iters_per_step, |
| 78 int *mvjcost, |
| 79 int *mvcost[2], |
| 80 int *distortion, |
| 81 unsigned int *sse); |
| 82 extern fractional_mv_step_fp vp9_find_best_sub_pixel_iterative; |
| 83 extern fractional_mv_step_fp vp9_find_best_sub_pixel_tree; |
| 84 |
| 85 typedef int (fractional_mv_step_comp_fp) ( |
| 86 MACROBLOCK *x, |
| 87 int_mv *bestmv, int_mv *ref_mv, |
| 88 int error_per_bit, |
| 89 const vp9_variance_fn_ptr_t *vfp, |
| 90 int forced_stop, // 0 - full, 1 - qtr only, 2 - half only |
| 91 int iters_per_step, |
| 92 int *mvjcost, int *mvcost[2], |
| 93 int *distortion, unsigned int *sse1, |
| 94 const uint8_t *second_pred, |
| 95 int w, int h); |
| 96 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; |
| 56 | 98 |
| 57 typedef int (*vp9_full_search_fn_t)(MACROBLOCK *x, | 99 typedef int (*vp9_full_search_fn_t)(MACROBLOCK *x, |
| 58 int_mv *ref_mv, int sad_per_bit, | 100 int_mv *ref_mv, int sad_per_bit, |
| 59 int distance, vp9_variance_fn_ptr_t *fn_ptr, | 101 int distance, vp9_variance_fn_ptr_t *fn_ptr, |
| 60 int *mvjcost, int *mvcost[2], | 102 int *mvjcost, int *mvcost[2], |
| 61 int_mv *center_mv, int n); | 103 int_mv *center_mv, int n); |
| 62 | 104 |
| 63 typedef int (*vp9_refining_search_fn_t)(MACROBLOCK *x, | 105 typedef int (*vp9_refining_search_fn_t)(MACROBLOCK *x, |
| 64 int_mv *ref_mv, int sad_per_bit, | 106 int_mv *ref_mv, int sad_per_bit, |
| 65 int distance, | 107 int distance, |
| 66 vp9_variance_fn_ptr_t *fn_ptr, | 108 vp9_variance_fn_ptr_t *fn_ptr, |
| 67 int *mvjcost, int *mvcost[2], | 109 int *mvjcost, int *mvcost[2], |
| 68 int_mv *center_mv); | 110 int_mv *center_mv); |
| 69 | 111 |
| 70 typedef int (*vp9_diamond_search_fn_t)(MACROBLOCK *x, | 112 typedef int (*vp9_diamond_search_fn_t)(MACROBLOCK *x, |
| 71 int_mv *ref_mv, int_mv *best_mv, | 113 int_mv *ref_mv, int_mv *best_mv, |
| 72 int search_param, int sad_per_bit, | 114 int search_param, int sad_per_bit, |
| 73 int *num00, | 115 int *num00, |
| 74 vp9_variance_fn_ptr_t *fn_ptr, | 116 vp9_variance_fn_ptr_t *fn_ptr, |
| 75 int *mvjcost, int *mvcost[2], | 117 int *mvjcost, int *mvcost[2], |
| 76 int_mv *center_mv); | 118 int_mv *center_mv); |
| 77 | 119 |
| 78 int vp9_find_best_sub_pixel_comp(MACROBLOCK *x, | |
| 79 int_mv *bestmv, int_mv *ref_mv, | |
| 80 int error_per_bit, | |
| 81 const vp9_variance_fn_ptr_t *vfp, | |
| 82 int *mvjcost, int *mvcost[2], | |
| 83 int *distortion, unsigned int *sse1, | |
| 84 const uint8_t *second_pred, | |
| 85 int w, int h); | |
| 86 | |
| 87 int vp9_refining_search_8p_c(MACROBLOCK *x, | 120 int vp9_refining_search_8p_c(MACROBLOCK *x, |
| 88 int_mv *ref_mv, int error_per_bit, | 121 int_mv *ref_mv, int error_per_bit, |
| 89 int search_range, vp9_variance_fn_ptr_t *fn_ptr, | 122 int search_range, vp9_variance_fn_ptr_t *fn_ptr, |
| 90 int *mvjcost, int *mvcost[2], | 123 int *mvjcost, int *mvcost[2], |
| 91 int_mv *center_mv, const uint8_t *second_pred, | 124 int_mv *center_mv, const uint8_t *second_pred, |
| 92 int w, int h); | 125 int w, int h); |
| 93 #endif // VP9_ENCODER_VP9_MCOMP_H_ | 126 #endif // VP9_ENCODER_VP9_MCOMP_H_ |
| OLD | NEW |