• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
12 #ifndef __INC_MCOMP_H
13 #define __INC_MCOMP_H
14 
15 #include "block.h"
16 #include "variance.h"
17 
18 #ifdef ENTROPY_STATS
19 extern void init_mv_ref_counts();
20 extern void accum_mv_refs(MB_PREDICTION_MODE, const int near_mv_ref_cts[4]);
21 #endif
22 
23 
24 #define MAX_MVSEARCH_STEPS 8                                    // The maximum number of steps in a step search given the largest allowed initial step
25 #define MAX_FULL_PEL_VAL ((1 << (MAX_MVSEARCH_STEPS+3)) - 8)    // Max full pel mv specified in 1/8 pel units
26 #define MAX_FIRST_STEP (1 << (MAX_MVSEARCH_STEPS-1))            // Maximum size of the first step in full pel units
27 
28 
29 extern void print_mode_context(void);
30 extern int vp8_mv_bit_cost(MV *mv, MV *ref, int *mvcost[2], int Weight);
31 extern void vp8_init_dsmotion_compensation(MACROBLOCK *x, int stride);
32 extern void vp8_init3smotion_compensation(MACROBLOCK *x,  int stride);
33 
34 
35 extern int vp8_hex_search
36 (
37     MACROBLOCK *x,
38     BLOCK *b,
39     BLOCKD *d,
40     MV *ref_mv,
41     MV *best_mv,
42     int search_param,
43     int error_per_bit,
44     int *num00,
45     const vp8_variance_fn_ptr_t *vf,
46     int *mvsadcost[2],
47     int *mvcost[2]
48 
49 );
50 
51 typedef int (fractional_mv_step_fp)
52     (MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *bestmv, MV *ref_mv,
53      int error_per_bit, const vp8_variance_fn_ptr_t *vfp, int *mvcost[2]);
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 #define prototype_full_search_sad(sym)\
60     int (sym)\
61     (\
62      MACROBLOCK *x, \
63      BLOCK *b, \
64      BLOCKD *d, \
65      MV *ref_mv, \
66      int error_per_bit, \
67      int distance, \
68      vp8_variance_fn_ptr_t *fn_ptr, \
69      int *mvcost[2], \
70      int *mvsadcost[2] \
71     )
72 
73 #define prototype_diamond_search_sad(sym)\
74     int (sym)\
75     (\
76      MACROBLOCK *x, \
77      BLOCK *b, \
78      BLOCKD *d, \
79      MV *ref_mv, \
80      MV *best_mv, \
81      int search_param, \
82      int error_per_bit, \
83      int *num00, \
84      vp8_variance_fn_ptr_t *fn_ptr, \
85      int *mvsadcost[2], \
86      int *mvcost[2] \
87     )
88 
89 #if ARCH_X86 || ARCH_X86_64
90 #include "x86/mcomp_x86.h"
91 #endif
92 
93 typedef prototype_full_search_sad(*vp8_full_search_fn_t);
94 extern prototype_full_search_sad(vp8_full_search_sad);
95 extern prototype_full_search_sad(vp8_full_search_sadx3);
96 extern prototype_full_search_sad(vp8_full_search_sadx8);
97 
98 typedef prototype_diamond_search_sad(*vp8_diamond_search_fn_t);
99 extern prototype_diamond_search_sad(vp8_diamond_search_sad);
100 extern prototype_diamond_search_sad(vp8_diamond_search_sadx4);
101 
102 #ifndef vp8_search_full_search
103 #define vp8_search_full_search vp8_full_search_sad
104 #endif
105 extern prototype_full_search_sad(vp8_search_full_search);
106 
107 #ifndef vp8_search_diamond_search
108 #define vp8_search_diamond_search vp8_diamond_search_sad
109 #endif
110 extern prototype_diamond_search_sad(vp8_search_diamond_search);
111 
112 typedef struct
113 {
114     prototype_full_search_sad(*full_search);
115     prototype_diamond_search_sad(*diamond_search);
116 } vp8_search_rtcd_vtable_t;
117 
118 #if CONFIG_RUNTIME_CPU_DETECT
119 #define SEARCH_INVOKE(ctx,fn) (ctx)->fn
120 #else
121 #define SEARCH_INVOKE(ctx,fn) vp8_search_##fn
122 #endif
123 
124 #endif
125