xref: /OK3568_Linux_fs/external/mpp/mpp/common/h264e_syntax.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright 2015 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 __H264E_SYNTAX_H__
18 #define __H264E_SYNTAX_H__
19 
20 #include "mpp_rc_api.h"
21 #include "h264_syntax.h"
22 
23 typedef enum H264eSyntaxType_e {
24     H264E_SYN_CFG,
25     H264E_SYN_SPS,
26     H264E_SYN_PPS,
27     H264E_SYN_DPB,
28     H264E_SYN_SLICE,
29     H264E_SYN_FRAME,
30     H264E_SYN_PREFIX,
31     H264E_SYN_RC_RET,
32     H264E_SYN_BUTT,
33 } H264eSyntaxType;
34 
35 #define SYN_TYPE_FLAG(type)         (1 << (type))
36 
37 typedef struct H264eSyntaxDesc_t {
38     H264eSyntaxType     type;
39     void                *p;
40 } H264eSyntaxDesc;
41 
42 typedef struct H264ePrefixNal_t {
43     RK_S32      nal_ref_idc;
44 
45     /* svc extension header */
46     RK_S32      idr_flag;
47     RK_S32      priority_id;
48     RK_S32      no_inter_layer_pred_flag;
49     RK_S32      dependency_id;
50     RK_S32      quality_id;
51     RK_S32      temporal_id;
52     RK_S32      use_ref_base_pic_flag;
53     RK_S32      discardable_flag;
54     RK_S32      output_flag;
55 } H264ePrefixNal;
56 
57 typedef struct H264eReorderInfo_t   H264eReorderInfo;
58 typedef struct H264eMarkingInfo_t   H264eMarkingInfo;
59 typedef struct H264eDpbFrm_t        H264eDpbFrm;
60 
61 /*
62  * Split reference frame configure to two parts
63  * The first part is slice depended info like poc / frame_num, and frame
64  * type and flags.
65  * The other part is gop structure depended info like gop index, ref_status
66  * and ref_frm_index. This part is inited from dpb gop hierarchy info.
67  */
68 typedef struct H264eFrmInfo_s {
69     RK_S32      seq_idx;
70 
71     RK_S32      curr_idx;
72     RK_S32      refr_idx;
73 
74     RK_S32      usage[H264E_MAX_REFS_CNT + 1];
75 } H264eFrmInfo;
76 
77 /* macro to add syntax to description array */
78 #define H264E_ADD_SYNTAX(desc, number, syn_type, syn_ptr) \
79     do { \
80         desc[number].type  = syn_type; \
81         desc[number].p     = syn_ptr; \
82         number++; \
83     } while (0)
84 
85 #endif /* __H264E_SYNTAX_H__ */
86