ime.h revision a2b49e5f0574dee76f81507f288143d83a4b7c1a
1/******************************************************************************
2 *
3 * Copyright (C) 2015 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *****************************************************************************
18 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19*/
20/**
21 *******************************************************************************
22 * @file
23 *  ime.h
24 *
25 * @brief
26 *  Contains declarations of global variables for H264 encoder
27 *
28 * @author
29 *  Ittiam
30 *
31 * @remarks
32 *
33 *******************************************************************************
34 */
35
36#ifndef IME_H_
37#define IME_H_
38
39/*****************************************************************************/
40/* Constant Macros                                                           */
41/*****************************************************************************/
42
43/**
44******************************************************************************
45 *  @brief      Number of iterations before exiting during diamond search
46******************************************************************************
47 */
48#define NUM_LAYERS 16
49
50
51/*****************************************************************************/
52/* Extern Function Declarations                                              */
53/*****************************************************************************/
54
55
56/**
57*******************************************************************************
58*
59* @brief Diamond Search
60*
61* @par Description:
62*  This function computes the sad at vertices of several layers of diamond grid
63*  at a time. The number of layers of diamond grid that would be evaluated is
64*  configurable.The function computes the sad at vertices of a diamond grid. If
65*  the sad at the center of the diamond grid is lesser than the sad at any other
66*  point of the diamond grid, the function marks the candidate Mb partition as
67*  mv.
68*
69* @param[in] ps_mb_part
70*  pointer to current mb partition ctxt with respect to ME
71*
72* @param[in] ps_me_ctxt
73*  pointer to me context
74*
75* @param[in] u4_lambda
76*  lambda motion
77*
78* @param[in] u4_fast_flag
79*  enable/disable fast sad computation
80*
81* @returns  mv pair & corresponding distortion and cost
82*
83* @remarks This module cannot be part of the final product due to its lack of
84* computational feasibility. This is only for quality eval purposes.
85*
86*******************************************************************************
87*/
88extern void ime_diamond_search_16x16(me_ctxt_t *ps_me_ctxt);
89
90
91/**
92*******************************************************************************
93*
94* @brief This function computes the best motion vector among the tentative mv
95* candidates chosen.
96*
97* @par Description:
98*  This function determines the position in the search window at which the motion
99*  estimation should begin in order to minimise the number of search iterations.
100*
101* @param[in] ps_mb_part
102*  pointer to current mb partition ctxt with respect to ME
103*
104* @param[in] u4_lambda_motion
105*  lambda motion
106*
107* @param[in] u4_fast_flag
108*  enable/disable fast sad computation
109*
110* @returns  mv pair & corresponding distortion and cost
111*
112* @remarks none
113*
114*******************************************************************************
115*/
116extern void ime_evaluate_init_srchposn_16x16
117        (
118            me_ctxt_t *ps_me_ctxt
119        );
120
121/**
122*******************************************************************************
123*
124* @brief Searches for the best matching full pixel predictor within the search
125* range
126*
127* @par Description:
128*  This function begins by computing the mv predict vector for the current mb.
129*  This is used for cost computations. Further basing on the algo. chosen, it
130*  looks through a set of candidate vectors that best represent the mb a least
131*  cost and returns this information.
132*
133* @param[in] ps_proc
134*  pointer to current proc ctxt
135*
136* @param[in] ps_me_ctxt
137*  pointer to me context
138*
139* @returns  mv pair & corresponding distortion and cost
140*
141* @remarks none
142*
143*******************************************************************************
144*/
145extern void ime_full_pel_motion_estimation_16x16
146    (
147        me_ctxt_t *ps_me_ctxt
148    );
149
150/**
151*******************************************************************************
152*
153* @brief Searches for the best matching sub pixel predictor within the search
154* range
155*
156* @par Description:
157*  This function begins by searching across all sub pixel sample points
158*  around the full pel motion vector. The vector with least cost is chosen as
159*  the mv for the current mb. If the skip mode is not evaluated while analysing
160*  the initial search candidates then analyse it here and update the mv.
161*
162* @param[in] ps_proc
163*  pointer to current proc ctxt
164*
165* @param[in] ps_me_ctxt
166*  pointer to me context
167*
168* @returns none
169*
170* @remarks none
171*
172*******************************************************************************
173*/
174extern void ime_sub_pel_motion_estimation_16x16
175    (
176        me_ctxt_t *ps_me_ctxt
177    );
178
179/**
180*******************************************************************************
181*
182* @brief This function computes cost of skip macroblocks
183*
184* @par Description:
185*
186* @param[in] ps_me_ctxt
187*  pointer to me ctxt
188*
189* @param[in] ps_skip_mv
190*  pointer to skip mv
191*
192* @returns  none
193*
194* @remarks
195* NOTE: while computing the skip cost, do not enable early exit from compute
196* sad function because, a negative bias gets added later
197*
198*******************************************************************************
199*/
200extern void ime_compute_skip_cost
201    (
202        me_ctxt_t *ps_me_ctxt,
203        void *pv_skip_mv,
204        mb_part_ctxt *ps_smb_part_info,
205        UWORD32 u4_use_stat_sad
206    );
207
208
209#endif /* IME_H_ */
210