1 /******************************************************************************
2  *
3  * Copyright (C) 2018 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 ihevce_mv_pred_merge.h
23 *
24 * \brief
25 *    This file contains function prototypes of MV Merge candidates list
26 *    derivation functions and corresponding structure and macrso definations
27 *
28 * \date
29 *    18/09/2012
30 *
31 * \author
32 *    Ittiam
33 *
34 ******************************************************************************
35 */
36 
37 #ifndef _IHEVCE_MV_PRED_MERGE_H_
38 #define _IHEVCE_MV_PRED_MERGE_H_
39 
40 /*****************************************************************************/
41 /* Constant Macros                                                           */
42 /*****************************************************************************/
43 #define MAX_NUM_MERGE_CAND MAX_MERGE_CANDIDATES
44 #define MAX_NUM_MV_NBR 5
45 
46 /*****************************************************************************/
47 /* Function Macros                                                           */
48 /*****************************************************************************/
49 
50 /*****************************************************************************/
51 /* Typedefs                                                                  */
52 /*****************************************************************************/
53 
54 /*****************************************************************************/
55 /* Enums                                                                     */
56 /*****************************************************************************/
57 typedef enum
58 {
59     NBR_A0 = 0,
60     NBR_A1 = 1,
61     NBR_B0 = 2,
62     NBR_B1 = 3,
63     NBR_B2 = 4,
64 
65     /* should be last */
66     MAX_NUM_NBRS
67 } MV_MERGE_NBRS_T;
68 
69 /*****************************************************************************/
70 /* Structure                                                                 */
71 /*****************************************************************************/
72 
73 typedef struct
74 {
75     /* Merge candidate motion vectors and refernce idx */
76     pu_mv_t mv;
77 
78     /* Pred_l0 mode for the candidate */
79     UWORD8 u1_pred_flag_l0;
80 
81     /* Pred_l1 mode for the candidate */
82     UWORD8 u1_pred_flag_l1;
83 
84 } merge_cand_list_t;
85 
86 /*****************************************************************************/
87 /* Extern Variable Declarations                                              */
88 /*****************************************************************************/
89 
90 /*****************************************************************************/
91 /* Extern Function Declarations                                              */
92 /*****************************************************************************/
93 
94 void ihevce_collocated_mvp(
95     mv_pred_ctxt_t *ps_mv_ctxt,
96     pu_t *ps_pu,
97     mv_t *ps_mv_col,
98     WORD32 *pu4_avail_col_flag,
99     WORD32 use_pu_ref_idx,
100     WORD32 x_col,
101     WORD32 y_col);
102 
103 WORD32 ihevce_mv_pred_merge(
104     mv_pred_ctxt_t *ps_ctxt,
105     nbr_4x4_t *ps_top_nbr_4x4,
106     nbr_4x4_t *ps_left_nbr_4x4,
107     nbr_4x4_t *ps_top_left_nbr_4x4,
108     WORD32 left_nbr_4x4_strd,
109     nbr_avail_flags_t *ps_avail_flags,
110     pu_mv_t *ps_col_mv,
111     pu_t *ps_pu,
112     PART_SIZE_E part_mode,
113     WORD32 part_idx,
114     WORD32 single_mcl_flag,
115     merge_cand_list_t *ps_merge_cand_list,
116     UWORD8 *pu1_is_top_used);
117 
118 #endif /* _IHEVCE_MV_PRED_MERGE_H_ */
119