Home | History | Annotate | Download | only in encoder
      1 /*
      2  *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
      3  *
      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
      6  *  tree. An additional intellectual property rights grant can be found
      7  *  in the file PATENTS.  All contributing project authors may
      8  *  be found in the AUTHORS file in the root of the source tree.
      9  */
     10 
     11 #ifndef VP8_ENCODER_MCOMP_H_
     12 #define VP8_ENCODER_MCOMP_H_
     13 
     14 #include "block.h"
     15 #include "vpx_dsp/variance.h"
     16 
     17 #ifdef __cplusplus
     18 extern "C" {
     19 #endif
     20 
     21 #ifdef VP8_ENTROPY_STATS
     22 extern void init_mv_ref_counts();
     23 extern void accum_mv_refs(MB_PREDICTION_MODE, const int near_mv_ref_cts[4]);
     24 #endif
     25 
     26 /* The maximum number of steps in a step search given the largest allowed
     27  * initial step
     28  */
     29 #define MAX_MVSEARCH_STEPS 8
     30 
     31 /* Max full pel mv specified in 1 pel units */
     32 #define MAX_FULL_PEL_VAL ((1 << (MAX_MVSEARCH_STEPS)) - 1)
     33 
     34 /* Maximum size of the first step in full pel units */
     35 #define MAX_FIRST_STEP (1 << (MAX_MVSEARCH_STEPS - 1))
     36 
     37 extern void print_mode_context(void);
     38 extern int vp8_mv_bit_cost(int_mv *mv, int_mv *ref, int *mvcost[2], int Weight);
     39 extern void vp8_init_dsmotion_compensation(MACROBLOCK *x, int stride);
     40 extern void vp8_init3smotion_compensation(MACROBLOCK *x, int stride);
     41 
     42 extern int vp8_hex_search(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
     43                           int_mv *best_mv, int search_param, int error_per_bit,
     44                           const vp8_variance_fn_ptr_t *vf, int *mvsadcost[2],
     45                           int *mvcost[2], int_mv *center_mv);
     46 
     47 typedef int(fractional_mv_step_fp)(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
     48                                    int_mv *bestmv, int_mv *ref_mv,
     49                                    int error_per_bit,
     50                                    const vp8_variance_fn_ptr_t *vfp,
     51                                    int *mvcost[2], int *distortion,
     52                                    unsigned int *sse);
     53 
     54 extern fractional_mv_step_fp vp8_find_best_sub_pixel_step_iteratively;
     55 extern fractional_mv_step_fp vp8_find_best_sub_pixel_step;
     56 extern fractional_mv_step_fp vp8_find_best_half_pixel_step;
     57 extern fractional_mv_step_fp vp8_skip_fractional_mv_step;
     58 
     59 typedef int (*vp8_full_search_fn_t)(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
     60                                     int_mv *ref_mv, int sad_per_bit,
     61                                     int distance, vp8_variance_fn_ptr_t *fn_ptr,
     62                                     int *mvcost[2], int_mv *center_mv);
     63 
     64 typedef int (*vp8_refining_search_fn_t)(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
     65                                         int_mv *ref_mv, int sad_per_bit,
     66                                         int distance,
     67                                         vp8_variance_fn_ptr_t *fn_ptr,
     68                                         int *mvcost[2], int_mv *center_mv);
     69 
     70 typedef int (*vp8_diamond_search_fn_t)(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
     71                                        int_mv *ref_mv, int_mv *best_mv,
     72                                        int search_param, int sad_per_bit,
     73                                        int *num00,
     74                                        vp8_variance_fn_ptr_t *fn_ptr,
     75                                        int *mvcost[2], int_mv *center_mv);
     76 
     77 #ifdef __cplusplus
     78 }  // extern "C"
     79 #endif
     80 
     81 #endif  // VP8_ENCODER_MCOMP_H_
     82