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 VP8_ENCODER_MCOMP_H_
13#define VP8_ENCODER_MCOMP_H_
14
15#include "block.h"
16#include "vp8/common/variance.h"
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22#ifdef VP8_ENTROPY_STATS
23extern void init_mv_ref_counts();
24extern void accum_mv_refs(MB_PREDICTION_MODE, const int near_mv_ref_cts[4]);
25#endif
26
27
28/* The maximum number of steps in a step search given the largest allowed
29 * initial step
30 */
31#define MAX_MVSEARCH_STEPS 8
32
33/* Max full pel mv specified in 1 pel units */
34#define MAX_FULL_PEL_VAL ((1 << (MAX_MVSEARCH_STEPS)) - 1)
35
36/* Maximum size of the first step in full pel units */
37#define MAX_FIRST_STEP (1 << (MAX_MVSEARCH_STEPS-1))
38
39extern void print_mode_context(void);
40extern int vp8_mv_bit_cost(int_mv *mv, int_mv *ref, int *mvcost[2], int Weight);
41extern void vp8_init_dsmotion_compensation(MACROBLOCK *x, int stride);
42extern void vp8_init3smotion_compensation(MACROBLOCK *x,  int stride);
43
44
45extern int vp8_hex_search
46(
47    MACROBLOCK *x,
48    BLOCK *b,
49    BLOCKD *d,
50    int_mv *ref_mv,
51    int_mv *best_mv,
52    int search_param,
53    int error_per_bit,
54    const vp8_variance_fn_ptr_t *vf,
55    int *mvsadcost[2],
56    int *mvcost[2],
57    int_mv *center_mv
58);
59
60typedef int (fractional_mv_step_fp)
61    (MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *bestmv, int_mv *ref_mv,
62     int error_per_bit, const vp8_variance_fn_ptr_t *vfp, int *mvcost[2],
63     int *distortion, unsigned int *sse);
64
65extern fractional_mv_step_fp vp8_find_best_sub_pixel_step_iteratively;
66extern fractional_mv_step_fp vp8_find_best_sub_pixel_step;
67extern fractional_mv_step_fp vp8_find_best_half_pixel_step;
68extern fractional_mv_step_fp vp8_skip_fractional_mv_step;
69
70typedef int (*vp8_full_search_fn_t)
71    (
72     MACROBLOCK *x,
73     BLOCK *b,
74     BLOCKD *d,
75     int_mv *ref_mv,
76     int sad_per_bit,
77     int distance,
78     vp8_variance_fn_ptr_t *fn_ptr,
79     int *mvcost[2],
80     int_mv *center_mv
81    );
82
83typedef int (*vp8_refining_search_fn_t)
84    (
85     MACROBLOCK *x,
86     BLOCK *b,
87     BLOCKD *d,
88     int_mv *ref_mv,
89     int sad_per_bit,
90     int distance,
91     vp8_variance_fn_ptr_t *fn_ptr,
92     int *mvcost[2],
93     int_mv *center_mv
94    );
95
96typedef int (*vp8_diamond_search_fn_t)
97    (
98     MACROBLOCK *x,
99     BLOCK *b,
100     BLOCKD *d,
101     int_mv *ref_mv,
102     int_mv *best_mv,
103     int search_param,
104     int sad_per_bit,
105     int *num00,
106     vp8_variance_fn_ptr_t *fn_ptr,
107     int *mvcost[2],
108     int_mv *center_mv
109    );
110
111#ifdef __cplusplus
112}  // extern "C"
113#endif
114
115#endif  // VP8_ENCODER_MCOMP_H_
116