xref: /OK3568_Linux_fs/external/mpp/mpp/codec/inc/rc_data.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright 2016 Rockchip Electronics Co. LTD
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __RC_DATA_H__
18 #define __RC_DATA_H__
19 
20 #include "mpp_rc_defs.h"
21 #include "rc_hal.h"
22 
23 typedef enum RcDataIndexType_e {
24     RC_DATA_SEQ_ID,
25     RC_DATA_FRM_TYPE,
26     RC_DATA_TID,
27     RC_DATA_INDEX_BUTT,
28 } RcDataIndexType;
29 
30 #define RC_FRM_TYPE_I           0
31 #define RC_FRM_TYPE_P           1
32 
33 /*
34  * base_cnt  - rate control base data storage number
35  * extra_cnt - rate control extra data storage number
36  */
37 typedef struct DataGroupCfg_t {
38     RK_S32          base_cnt;
39     RK_S32          extra_cnt;
40 } DataGroupCfg;
41 
42 typedef void* DataGroup;
43 typedef void* RcData;
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 /* rc data group API */
50 MPP_RET rc_data_init(DataGroup *grp, DataGroupCfg *cfg);
51 MPP_RET rc_data_deinit(DataGroup grp);
52 MPP_RET rc_data_reset(DataGroup grp);
53 
54 RcData rc_data_get(DataGroup grp, RK_S32 seq_id);
55 RcData rc_data_index_type(DataGroup grp, RK_S32 type, RK_S32 whence, RK_S32 offset);
56 RcData rc_data_index_tid(DataGroup grp, RK_S32 tid, RK_S32 whence, RK_S32 offset);
57 
58 RcData rc_data_next(RcData data, RcDataIndexType type);
59 RcData rc_data_prev(RcData data, RcDataIndexType type);
60 
61 /* use const to ensure user will NOT change the data in RcData */
62 const RK_S32 *rc_data_get_seq_id(RcData data);
63 const RK_S32 *rc_data_get_qp_sum(RcData data);
64 const RK_S32 *rc_data_get_strm_size(RcData data);
65 const EncFrmStatus *rc_data_get_frm_status(RcData data);
66 const RcHalSet *rc_data_get_hal_set(RcData data);
67 const RcHalRet *rc_data_get_hal_ret(RcData data);
68 
69 #ifdef __cplusplus
70 }
71 #endif
72 
73 #endif /* __RC_DATA_H__ */
74