1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/libvpx/vp9/encoder/vp9_mcomp.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,131 @@ 1.4 +/* 1.5 + * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 1.6 + * 1.7 + * Use of this source code is governed by a BSD-style license 1.8 + * that can be found in the LICENSE file in the root of the source 1.9 + * tree. An additional intellectual property rights grant can be found 1.10 + * in the file PATENTS. All contributing project authors may 1.11 + * be found in the AUTHORS file in the root of the source tree. 1.12 + */ 1.13 + 1.14 + 1.15 +#ifndef VP9_ENCODER_VP9_MCOMP_H_ 1.16 +#define VP9_ENCODER_VP9_MCOMP_H_ 1.17 + 1.18 +#include "vp9/encoder/vp9_block.h" 1.19 +#include "vp9/encoder/vp9_variance.h" 1.20 + 1.21 +// The maximum number of steps in a step search given the largest 1.22 +// allowed initial step 1.23 +#define MAX_MVSEARCH_STEPS 11 1.24 +// Max full pel mv specified in 1 pel units 1.25 +#define MAX_FULL_PEL_VAL ((1 << (MAX_MVSEARCH_STEPS)) - 1) 1.26 +// Maximum size of the first step in full pel units 1.27 +#define MAX_FIRST_STEP (1 << (MAX_MVSEARCH_STEPS-1)) 1.28 +// Allowed motion vector pixel distance outside image border 1.29 +// for Block_16x16 1.30 +#define BORDER_MV_PIXELS_B16 (16 + VP9_INTERP_EXTEND) 1.31 + 1.32 + 1.33 +void vp9_clamp_mv_min_max(MACROBLOCK *x, MV *mv); 1.34 +int vp9_mv_bit_cost(const MV *mv, const MV *ref, 1.35 + const int *mvjcost, int *mvcost[2], int weight); 1.36 +void vp9_init_dsmotion_compensation(MACROBLOCK *x, int stride); 1.37 +void vp9_init3smotion_compensation(MACROBLOCK *x, int stride); 1.38 + 1.39 +struct VP9_COMP; 1.40 +int vp9_init_search_range(struct VP9_COMP *cpi, int size); 1.41 + 1.42 +// Runs sequence of diamond searches in smaller steps for RD 1.43 +int vp9_full_pixel_diamond(struct VP9_COMP *cpi, MACROBLOCK *x, 1.44 + int_mv *mvp_full, int step_param, 1.45 + int sadpb, int further_steps, int do_refine, 1.46 + vp9_variance_fn_ptr_t *fn_ptr, 1.47 + int_mv *ref_mv, int_mv *dst_mv); 1.48 + 1.49 +int vp9_hex_search(MACROBLOCK *x, 1.50 + MV *ref_mv, 1.51 + int search_param, 1.52 + int error_per_bit, 1.53 + int do_init_search, 1.54 + const vp9_variance_fn_ptr_t *vf, 1.55 + int use_mvcost, 1.56 + const MV *center_mv, 1.57 + MV *best_mv); 1.58 +int vp9_bigdia_search(MACROBLOCK *x, 1.59 + MV *ref_mv, 1.60 + int search_param, 1.61 + int error_per_bit, 1.62 + int do_init_search, 1.63 + const vp9_variance_fn_ptr_t *vf, 1.64 + int use_mvcost, 1.65 + const MV *center_mv, 1.66 + MV *best_mv); 1.67 +int vp9_square_search(MACROBLOCK *x, 1.68 + MV *ref_mv, 1.69 + int search_param, 1.70 + int error_per_bit, 1.71 + int do_init_search, 1.72 + const vp9_variance_fn_ptr_t *vf, 1.73 + int use_mvcost, 1.74 + const MV *center_mv, 1.75 + MV *best_mv); 1.76 + 1.77 +typedef int (fractional_mv_step_fp) ( 1.78 + MACROBLOCK *x, 1.79 + MV *bestmv, const MV *ref_mv, 1.80 + int allow_hp, 1.81 + int error_per_bit, 1.82 + const vp9_variance_fn_ptr_t *vfp, 1.83 + int forced_stop, // 0 - full, 1 - qtr only, 2 - half only 1.84 + int iters_per_step, 1.85 + int *mvjcost, 1.86 + int *mvcost[2], 1.87 + int *distortion, 1.88 + unsigned int *sse); 1.89 +extern fractional_mv_step_fp vp9_find_best_sub_pixel_iterative; 1.90 +extern fractional_mv_step_fp vp9_find_best_sub_pixel_tree; 1.91 + 1.92 +typedef int (fractional_mv_step_comp_fp) ( 1.93 + MACROBLOCK *x, 1.94 + MV *bestmv, const MV *ref_mv, 1.95 + int allow_hp, 1.96 + int error_per_bit, 1.97 + const vp9_variance_fn_ptr_t *vfp, 1.98 + int forced_stop, // 0 - full, 1 - qtr only, 2 - half only 1.99 + int iters_per_step, 1.100 + int *mvjcost, int *mvcost[2], 1.101 + int *distortion, unsigned int *sse1, 1.102 + const uint8_t *second_pred, 1.103 + int w, int h); 1.104 +extern fractional_mv_step_comp_fp vp9_find_best_sub_pixel_comp_iterative; 1.105 +extern fractional_mv_step_comp_fp vp9_find_best_sub_pixel_comp_tree; 1.106 + 1.107 +typedef int (*vp9_full_search_fn_t)(MACROBLOCK *x, 1.108 + int_mv *ref_mv, int sad_per_bit, 1.109 + int distance, vp9_variance_fn_ptr_t *fn_ptr, 1.110 + int *mvjcost, int *mvcost[2], 1.111 + int_mv *center_mv, int n); 1.112 + 1.113 +typedef int (*vp9_refining_search_fn_t)(MACROBLOCK *x, 1.114 + int_mv *ref_mv, int sad_per_bit, 1.115 + int distance, 1.116 + vp9_variance_fn_ptr_t *fn_ptr, 1.117 + int *mvjcost, int *mvcost[2], 1.118 + int_mv *center_mv); 1.119 + 1.120 +typedef int (*vp9_diamond_search_fn_t)(MACROBLOCK *x, 1.121 + int_mv *ref_mv, int_mv *best_mv, 1.122 + int search_param, int sad_per_bit, 1.123 + int *num00, 1.124 + vp9_variance_fn_ptr_t *fn_ptr, 1.125 + int *mvjcost, int *mvcost[2], 1.126 + int_mv *center_mv); 1.127 + 1.128 +int vp9_refining_search_8p_c(MACROBLOCK *x, 1.129 + int_mv *ref_mv, int error_per_bit, 1.130 + int search_range, vp9_variance_fn_ptr_t *fn_ptr, 1.131 + int *mvjcost, int *mvcost[2], 1.132 + int_mv *center_mv, const uint8_t *second_pred, 1.133 + int w, int h); 1.134 +#endif // VP9_ENCODER_VP9_MCOMP_H_