xref: /OK3568_Linux_fs/external/mpp/mpp/common/h264_syntax.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2 *
3 * Copyright 2015 Rockchip Electronics Co. LTD
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 
19 #ifndef __H264_SYNTAX_H__
20 #define __H264_SYNTAX_H__
21 
22 /* H.264/AVC-specific definition */
23 
24 //!< define
25 #define MAXSPS                      32
26 #define MAXPPS                      256
27 
28 //!< aspect ratio explicitly specified as width:height
29 #define H264_EXTENDED_SAR           255
30 
31 //!< values for nal_ref_idc
32 typedef enum H264NalRefIdcType_e {
33     H264_NALU_PRIORITY_DISPOSABLE   = 0,
34     H264_NALU_PRIORITY_LOW          = 1,
35     H264_NALU_PRIORITY_HIGH         = 2,
36     H264_NALU_PRIORITY_HIGHEST      = 3
37 } H264NalRefIdcType;
38 
39 //!< AVC Profile IDC definitions
40 typedef enum h264e_profile_t {
41     H264_PROFILE_FREXT_CAVLC444     = 44,   //!< YUV 4:4:4/14 "CAVLC 4:4:4"
42     H264_PROFILE_BASELINE           = 66,   //!< YUV 4:2:0/8  "Baseline"
43     H264_PROFILE_MAIN               = 77,   //!< YUV 4:2:0/8  "Main"
44     H264_PROFILE_EXTENDED           = 88,   //!< YUV 4:2:0/8  "Extended"
45     H264_PROFILE_HIGH               = 100,  //!< YUV 4:2:0/8  "High"
46     H264_PROFILE_HIGH10             = 110,  //!< YUV 4:2:0/10 "High 10"
47     H264_PROFILE_HIGH422            = 122,  //!< YUV 4:2:2/10 "High 4:2:2"
48     H264_PROFILE_HIGH444            = 244,  //!< YUV 4:4:4/14 "High 4:4:4"
49     H264_PROFILE_MVC_HIGH           = 118,  //!< YUV 4:2:0/8  "Multiview High"
50     H264_PROFILE_STEREO_HIGH        = 128   //!< YUV 4:2:0/8  "Stereo High"
51 } H264Profile;
52 
53 //!< AVC Level IDC definitions
54 typedef enum {
55     H264_LEVEL_1_0                  = 10,   //!< qcif@15fps
56     H264_LEVEL_1_b                  = 99,   //!< qcif@15fps
57     H264_LEVEL_1_1                  = 11,   //!< cif@7.5fps
58     H264_LEVEL_1_2                  = 12,   //!< cif@15fps
59     H264_LEVEL_1_3                  = 13,   //!< cif@30fps
60     H264_LEVEL_2_0                  = 20,   //!< cif@30fps
61     H264_LEVEL_2_1                  = 21,   //!< half-D1@@25fps
62     H264_LEVEL_2_2                  = 22,   //!< D1@12.5fps
63     H264_LEVEL_3_0                  = 30,   //!< D1@25fps
64     H264_LEVEL_3_1                  = 31,   //!< 720p@30fps
65     H264_LEVEL_3_2                  = 32,   //!< 720p@60fps
66     H264_LEVEL_4_0                  = 40,   //!< 1080p@30fps
67     H264_LEVEL_4_1                  = 41,   //!< 1080p@30fps
68     H264_LEVEL_4_2                  = 42,   //!< 1080p@60fps
69     H264_LEVEL_5_0                  = 50,   //!< 3K@30fps
70     H264_LEVEL_5_1                  = 51,   //!< 4K@30fps
71     H264_LEVEL_5_2                  = 52,   //!< 4K@60fps
72     H264_LEVEL_6_0                  = 60,   //!< 8K@30fps
73     H264_LEVEL_6_1                  = 61,   //!< 8K@60fps
74     H264_LEVEL_6_2                  = 62,   //!< 8K@120fps
75 } H264Level;
76 
77 //!< values for nalu_type
78 typedef enum H264NaluType_e {
79     H264_NALU_TYPE_NULL             = 0,
80     H264_NALU_TYPE_SLICE            = 1,
81     H264_NALU_TYPE_DPA              = 2,
82     H264_NALU_TYPE_DPB              = 3,
83     H264_NALU_TYPE_DPC              = 4,
84     H264_NALU_TYPE_IDR              = 5,
85     H264_NALU_TYPE_SEI              = 6,
86     H264_NALU_TYPE_SPS              = 7,
87     H264_NALU_TYPE_PPS              = 8,
88     H264_NALU_TYPE_AUD              = 9,    // Access Unit Delimiter
89     H264_NALU_TYPE_EOSEQ            = 10,   // end of sequence
90     H264_NALU_TYPE_EOSTREAM         = 11,   // end of stream
91     H264_NALU_TYPE_FILL             = 12,
92     H264_NALU_TYPE_SPSEXT           = 13,
93     H264_NALU_TYPE_PREFIX           = 14,   // prefix
94     H264_NALU_TYPE_SUB_SPS          = 15,
95     H264_NALU_TYPE_SLICE_AUX        = 19,
96     H264_NALU_TYPE_SLC_EXT          = 20,   // slice extensive
97     H264_NALU_TYPE_VDRD             = 24    // View and Dependency Representation Delimiter NAL Unit
98 } H264NaluType;
99 
100 typedef enum H264ChromaFmt_e {
101     H264_CHROMA_400                 = 0,    //!< Monochrome
102     H264_CHROMA_420                 = 1,    //!< 4:2:0
103     H264_CHROMA_422                 = 2,    //!< 4:2:2
104     H264_CHROMA_444                 = 3     //!< 4:4:4
105 } H264ChromaFmt;
106 
107 typedef enum H264SliceType_e {
108     H264_P_SLICE                    = 0,
109     H264_B_SLICE                    = 1,
110     H264_I_SLICE                    = 2,
111     H264_SP_SLICE                   = 3,
112     H264_SI_SLICE                   = 4,
113     H264_NUM_SLICE_TYPES            = 5
114 } H264SliceType;
115 
116 //!< SEI
117 typedef enum H264SeiType_e {
118     H264_SEI_BUFFERING_PERIOD       = 0,
119     H264_SEI_PIC_TIMING,
120     H264_SEI_PAN_SCAN_RECT,
121     H264_SEI_FILLER_PAYLOAD,
122     H264_SEI_USER_DATA_REGISTERED_ITU_T_T35,
123     H264_SEI_USER_DATA_UNREGISTERED,
124     H264_SEI_RECOVERY_POINT,
125     H264_SEI_DEC_REF_PIC_MARKING_REPETITION,
126     H264_SEI_SPARE_PIC,
127     H264_SEI_SCENE_INFO,
128     H264_SEI_SUB_SEQ_INFO,
129     H264_SEI_SUB_SEQ_LAYER_CHARACTERISTICS,
130     H264_SEI_SUB_SEQ_CHARACTERISTICS,
131     H264_SEI_FULL_FRAME_FREEZE,
132     H264_SEI_FULL_FRAME_FREEZE_RELEASE,
133     H264_SEI_FULL_FRAME_SNAPSHOT,
134     H264_SEI_PROGRESSIVE_REFINEMENT_SEGMENT_START,
135     H264_SEI_PROGRESSIVE_REFINEMENT_SEGMENT_END,
136     H264_SEI_MOTION_CONSTRAINED_SLICE_GROUP_SET,
137     H264_SEI_FILM_GRAIN_CHARACTERISTICS,
138     H264_SEI_DEBLOCKING_FILTER_DISPLAY_PREFERENCE,
139     H264_SEI_STEREO_VIDEO_INFO,
140     H264_SEI_POST_FILTER_HINTS,
141     H264_SEI_TONE_MAPPING,
142     H264_SEI_SCALABILITY_INFO,
143     H264_SEI_SUB_PIC_SCALABLE_LAYER,
144     H264_SEI_NON_REQUIRED_LAYER_REP,
145     H264_SEI_PRIORITY_LAYER_INFO,
146     H264_SEI_LAYERS_NOT_PRESENT,
147     H264_SEI_LAYER_DEPENDENCY_CHANGE,
148     H264_SEI_SCALABLE_NESTING,
149     H264_SEI_BASE_LAYER_TEMPORAL_HRD,
150     H264_SEI_QUALITY_LAYER_INTEGRITY_CHECK,
151     H264_SEI_REDUNDANT_PIC_PROPERTY,
152     H264_SEI_TL0_DEP_REP_INDEX,
153     H264_SEI_TL_SWITCHING_POINT,
154     H264_SEI_PARALLEL_DECODING_INFO,
155     H264_SEI_MVC_SCALABLE_NESTING,
156     H264_SEI_VIEW_SCALABILITY_INFO,
157     H264_SEI_MULTIVIEW_SCENE_INFO,
158     H264_SEI_MULTIVIEW_ACQUISITION_INFO,
159     H264_SEI_NON_REQUIRED_VIEW_COMPONENT,
160     H264_SEI_VIEW_DEPENDENCY_CHANGE,
161     H264_SEI_OPERATION_POINTS_NOT_PRESENT,
162     H264_SEI_BASE_VIEW_TEMPORAL_HRD,
163     H264_SEI_FRAME_PACKING_ARRANGEMENT,
164 
165     H264_SEI_MAX_ELEMENTS  //!< number of maximum syntax elements
166 } H264SeiType;
167 
168 typedef enum H264ScalingListType_e {
169     H264_INTRA_4x4_Y,
170     H264_INTRA_4x4_U,
171     H264_INTRA_4x4_V,
172     H264_INTER_4x4_Y,
173     H264_INTER_4x4_U,
174     H264_INTER_4x4_V,
175     H264_INTRA_8x8_Y,
176     H264_INTER_8x8_Y,
177     H264_SCALING_MATRIX_TYPE_BUTT,
178 } H264ScalingMatrixType;
179 
180 #define H264E_MAX_REFS_CNT          16
181 
182 #endif /*__H264_SYNTAX_H__*/
183