xref: /aosp_15_r20/external/libavc/encoder/ih264e_me.h (revision 495ae853bb871d1e5a258cb02c2cc13cde8ddb9a)
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  *******************************************************************************
23  * @file
24  *  ih264e_me.h
25  *
26  * @brief
27  *  Contains declarations of h264 me
28  *
29  * @author
30  *  ittiam
31  *
32  * @remarks
33  *
34  *******************************************************************************
35  */
36 
37 #ifndef _IH264E_ME_H_
38 #define _IH264E_ME_H_
39 
40 
41 /*****************************************************************************/
42 /* Constant Macros                                                           */
43 /*****************************************************************************/
44 
45 /**
46 ******************************************************************************
47  *  @brief     Skip Bias value for P slice
48 ******************************************************************************
49  */
50 #define SKIP_BIAS_P 0
51 
52 /**
53 ******************************************************************************
54  *  @brief     Skip Bias value for B slice
55 ******************************************************************************
56  */
57 #define SKIP_BIAS_B 0
58 
59 
60 /*****************************************************************************/
61 /* Function Macros                                                           */
62 /*****************************************************************************/
63 
64 /**
65  ******************************************************************************
66  *  @brief      compute median of 3 elements (a, b, c) and store the output
67  *  in to result. This is used for mv prediction
68  ******************************************************************************
69  */
70 #define MEDIAN(a, b, c, result) if (a > b){\
71                                     if (b > c)\
72                                         result = b;\
73                                     else {\
74                                         if (a > c)\
75                                             result = c;\
76                                         else \
77                                             result = a;\
78                                     }\
79                                 }\
80                                 else {\
81                                     if (c > b)\
82                                         result = b;\
83                                     else {\
84                                         if (c > a)\
85                                             result = c;\
86                                         else \
87                                             result = a;\
88                                     }\
89                                 }
90 
91 /*****************************************************************************/
92 /* Function Declarations                                                     */
93 /*****************************************************************************/
94 
95 void ih264e_init_mv_bits(me_ctxt_t *ps_me);
96 
97 ih264e_skip_params_ft  ih264e_find_pskip_params;
98 
99 ih264e_skip_params_ft  ih264e_find_pskip_params_me;
100 
101 ih264e_skip_params_ft  ih264e_find_bskip_params;
102 
103 ih264e_skip_params_ft  ih264e_find_bskip_params_me;
104 
105 void ih264e_get_mv_predictor(enc_pu_t *ps_left_mb_pu, enc_pu_t *ps_top_row_pu,
106                              enc_pu_mv_t *ps_pred_mv, WORD32 i4_ref_list);
107 
108 ih264e_compute_me_ft  ih264e_compute_me_multi_reflist;
109 
110 ih264e_compute_me_ft  ih264e_compute_me_single_reflist;
111 
112 void ih264e_init_me(process_ctxt_t *ps_proc);
113 
114 void ih264e_compute_me_nmb(process_ctxt_t *ps_proc, UWORD32 u4_nmb_count);
115 
116 void ih264e_mv_pred(process_ctxt_t *ps_proc, WORD32 i4_reflist);
117 
118 void ih264e_mv_pred_me(process_ctxt_t *ps_proc, WORD32 i4_ref_list);
119 
120 #endif /* _IH264E_ME_H_ */
121