aboutsummaryrefslogtreecommitdiff
path: root/encoder/ihevce_dep_mngr_interface.h
blob: 28d22b773a3842fb1543b0659afd03e369e9e0ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
/******************************************************************************
 *
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 *****************************************************************************
 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
/*!
******************************************************************************
* \file ihevce_dep_mngr_interface.h
*
* \brief
*    This file contains infertace prototypes of Sync manager functions
*
* \date
*    13/12/2013
*
* \author
*    Ittiam
*
******************************************************************************
*/

#ifndef _IHEVCE_DEPENDENCY_MANAGER_INTERFACE_H_
#define _IHEVCE_DEPENDENCY_MANAGER_INTERFACE_H_

/*****************************************************************************/
/* Constant Macros                                                           */
/*****************************************************************************/

/*****************************************************************************/
/* Function Macros                                                           */
/*****************************************************************************/

/*****************************************************************************/
/* Typedefs                                                                  */
/*****************************************************************************/

/*****************************************************************************/
/* Enums                                                                     */
/*****************************************************************************/

typedef enum
{
    DEP_MNGR_FRM_FRM_SYNC = 0, /*!< To be used for multi threads Frame-
                                      Frame level sync, where threads entering
                                      a particular frame processing stage at
                                      a particular index waits for all the threads
                                      to complete the that stage at the same index
                                      in the previous  iteration
                                      Ex: Wait for Encloop at Index i frame
                                      to complete before starting encloop of
                                      MAX_NUM_ENCLOOP + i frame at Index i
                                      (FRAME LEVEl SYNCS)*/

    DEP_MNGR_ROW_FRM_SYNC, /*!< To be used for multi threads Row-
                                      Frame level sync, where multiple threads
                                      entering a particular frame processing stage at
                                      a particular index waits for corresponding
                                      row to be completely processed in the
                                      dependent stage
                                      Ex: Multiple threads Wait in ME at a
                                      particular row X (of Frame I)
                                      until encloop of row X in Frame I
                                      is completed
                                      (REVERSE ME DEPENDENCY SYNC)*/

    DEP_MNGR_ROW_ROW_SYNC, /*!< To be used for multi threads Row-
                                      Row level sync, where a thread
                                      entering a particular frame processing stage at
                                      a particular index waits for corresponding
                                      row to be processed til dependent position
                                      in the dependent stage
                                      Ex: (ENC LOOP to ME FORWARD Sync)
                                          ( TOP RIGHT SYNC) */

    DEP_MNGR_MAP_SYNC

} DEP_MNGR_MODE_T;

typedef enum
{
    MAP_CTB_INIT = 0,
    MAP_CTB_RECON_DONE = 1,
    MAP_CTB_COMPLETE = 2,  //after hpel plane creation

} DEP_MNGR_MAP_CTB_STATUS_T;

/*****************************************************************************/
/* Structure                                                                 */
/*****************************************************************************/

/*****************************************************************************/
/* Extern Variable Declarations                                              */
/*****************************************************************************/

/*****************************************************************************/
/* Extern Function Declarations                                              */
/*****************************************************************************/

/* Create APIs */
WORD32 ihevce_dmgr_get_num_mem_recs(void);

WORD32 ihevce_dmgr_get_mem_recs(
    iv_mem_rec_t *ps_mem_tab,
    WORD32 dep_mngr_mode, /* should be part of DEP_MNGR_MODE_T*/
    WORD32 max_num_vert_units,
    WORD32 num_tile_cols,
    WORD32 num_threads,
    WORD32 i4_mem_space);

WORD32 ihevce_dmgr_map_get_mem_recs(
    iv_mem_rec_t *ps_mem_tab, WORD32 num_units, WORD32 num_threads, WORD32 i4_mem_space);

void *ihevce_dmgr_init(
    iv_mem_rec_t *ps_mem_tab,
    void *pv_osal_handle,
    WORD32 dep_mngr_mode, /* should be part of DEP_MNGR_MODE_T*/
    WORD32 max_num_vert_units,
    WORD32 max_num_horz_units,
    WORD32 num_tile_cols,
    WORD32 num_threads,
    WORD32 sem_enable);

void *ihevce_dmgr_map_init(
    iv_mem_rec_t *ps_mem_tab,
    WORD32 max_num_vert_units,
    WORD32 max_num_horz_units,
    WORD32 sem_enable,
    WORD32 num_threads,
    WORD32 ai4_tile_xtra_ctb[4]);

void ihevce_dmgr_reg_sem_hdls(
    void *pv_dep_mngr_state, void **ppv_thread_sem_hdl, WORD32 num_threads);

/* Row-Row sync Process APIs*/
void ihevce_dmgr_rst_row_row_sync(void *pv_dep_mngr_state);

WORD32 ihevce_dmgr_chk_row_row_sync(
    void *pv_dep_mngr_state,
    WORD32 cur_offset,
    WORD32 dep_offset,
    WORD32 dep_row,
    WORD32 cur_tile_col,
    WORD32 thrd_id);

WORD32 ihevce_dmgr_set_row_row_sync(
    void *pv_dep_mngr_state, WORD32 cur_offset, WORD32 cur_row, WORD32 cur_tile_col);

/* Row-Frame sync Process APIs*/
void ihevce_dmgr_rst_row_frm_sync(void *pv_dep_mngr_state);

/* Frame-Frame sync Process APIs*/
void ihevce_dmgr_set_done_frm_frm_sync(void *pv_dep_mngr_state);

void ihevce_dmgr_set_prev_done_frm_frm_sync(void *pv_dep_mngr_state);

WORD32 ihevce_dmgr_chk_frm_frm_sync(void *pv_dep_mngr_state, WORD32 thrd_id);

WORD32 ihevce_dmgr_update_frm_frm_sync(void *pv_dep_mngr_state);

/* Map sync Process APIs*/
void ihevce_dmgr_map_rst_sync(void *pv_dep_mngr_state);

WORD32 ihevce_dmgr_map_chk_sync(
    void *pv_dep_mngr_state,
    WORD32 thrd_id,
    WORD32 offset_x,
    WORD32 offset_y,
    WORD32 i4_sr_ctb_x,
    WORD32 i4_sr_ctb_y);

WORD32 ihevce_dmgr_map_set_sync(
    void *pv_dep_mngr_state, WORD32 offset_x, WORD32 offset_y, WORD32 e_map_value);

/* Delete APIs */
void ihevce_dmgr_del(void *pv_dep_mngr_state);

#endif /* _IHEVCE_DEPENDENCY_MANAGER_INTERFACE_H_ */