blob: 1694af819ebe5771b5cc3c8e02ede574bd4dc799 [file] [log] [blame]
John Koleszar0ea50ce2010-05-18 11:58:33 -04001/*
John Koleszarc2140b82010-09-09 08:16:39 -04002 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
John Koleszar0ea50ce2010-05-18 11:58:33 -04003 *
John Koleszar94c52e42010-06-18 12:39:21 -04004 * Use of this source code is governed by a BSD-style license
John Koleszar09202d82010-06-04 16:19:40 -04005 * 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
John Koleszar94c52e42010-06-18 12:39:21 -04007 * in the file PATENTS. All contributing project authors may
John Koleszar09202d82010-06-04 16:19:40 -04008 * be found in the AUTHORS file in the root of the source tree.
John Koleszar0ea50ce2010-05-18 11:58:33 -04009 */
10
11
James Zernbb285202013-12-15 18:25:05 -080012#ifndef VP8_ENCODER_MCOMP_H_
13#define VP8_ENCODER_MCOMP_H_
John Koleszar0ea50ce2010-05-18 11:58:33 -040014
15#include "block.h"
Johann6a82f0d2015-06-05 09:54:19 -070016#include "vpx_dsp/variance.h"
John Koleszar0ea50ce2010-05-18 11:58:33 -040017
James Zern513fae32014-01-18 12:16:11 -080018#ifdef __cplusplus
19extern "C" {
20#endif
21
Ronald S. Bultje65d22822013-03-18 15:28:51 -070022#ifdef VP8_ENTROPY_STATS
John Koleszar0ea50ce2010-05-18 11:58:33 -040023extern void init_mv_ref_counts();
24extern void accum_mv_refs(MB_PREDICTION_MODE, const int near_mv_ref_cts[4]);
25#endif
26
27
John Koleszar0164a1c2012-05-21 14:30:56 -070028/* 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))
John Koleszar0ea50ce2010-05-18 11:58:33 -040038
39extern void print_mode_context(void);
Scott LaVarnway6b255012011-05-12 10:50:16 -040040extern int vp8_mv_bit_cost(int_mv *mv, int_mv *ref, int *mvcost[2], int Weight);
John Koleszar0ea50ce2010-05-18 11:58:33 -040041extern 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,
Scott LaVarnway6b255012011-05-12 10:50:16 -040050 int_mv *ref_mv,
51 int_mv *best_mv,
John Koleszar0ea50ce2010-05-18 11:58:33 -040052 int search_param,
53 int error_per_bit,
John Koleszar209d82a2010-10-26 15:34:16 -040054 const vp8_variance_fn_ptr_t *vf,
John Koleszar0ea50ce2010-05-18 11:58:33 -040055 int *mvsadcost[2],
Yunqing Wang41e6ece2011-02-07 19:16:15 -050056 int *mvcost[2],
Scott LaVarnway6b255012011-05-12 10:50:16 -040057 int_mv *center_mv
John Koleszar0ea50ce2010-05-18 11:58:33 -040058);
59
John Koleszar209d82a2010-10-26 15:34:16 -040060typedef int (fractional_mv_step_fp)
Scott LaVarnway6b255012011-05-12 10:50:16 -040061 (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);
John Koleszar0b0bc8d2012-01-12 16:55:44 -080064
John Koleszar0ea50ce2010-05-18 11:58:33 -040065extern 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
John Koleszar0b0bc8d2012-01-12 16:55:44 -080070typedef 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 );
John Koleszar0ea50ce2010-05-18 11:58:33 -040082
John Koleszar0b0bc8d2012-01-12 16:55:44 -080083typedef 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 );
Yunqing Wangcb7b1fb2011-05-06 12:51:31 -040095
John Koleszar0b0bc8d2012-01-12 16:55:44 -080096typedef 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 );
John Koleszar0ea50ce2010-05-18 11:58:33 -0400110
James Zern513fae32014-01-18 12:16:11 -0800111#ifdef __cplusplus
112} // extern "C"
113#endif
114
James Zernbb285202013-12-15 18:25:05 -0800115#endif // VP8_ENCODER_MCOMP_H_