1 /*
2  * Copyright (c) 2010 The Khronos Group Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining
5  * a copy of this software and associated documentation files (the
6  * "Software"), to deal in the Software without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sublicense, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so, subject
10  * to the following conditions:
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  */
23 
24 /** OMX_VideoExt.h - OpenMax IL version 1.1.2
25  * The OMX_VideoExt header file contains extensions to the
26  * definitions used by both the application and the component to
27  * access video items.
28  */
29 
30 #ifndef OMX_VideoExt_h
31 #define OMX_VideoExt_h
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif /* __cplusplus */
36 
37 /* Each OMX header shall include all required header files to allow the
38  * header to compile without errors.  The includes below are required
39  * for this header file to compile successfully
40  */
41 #include <OMX_Core.h>
42 
43 /** NALU Formats */
44 typedef enum OMX_NALUFORMATSTYPE {
45     OMX_NaluFormatStartCodes = 1,
46     OMX_NaluFormatOneNaluPerBuffer = 2,
47     OMX_NaluFormatOneByteInterleaveLength = 4,
48     OMX_NaluFormatTwoByteInterleaveLength = 8,
49     OMX_NaluFormatFourByteInterleaveLength = 16,
50     OMX_NaluFormatCodingMax = 0x7FFFFFFF
51 } OMX_NALUFORMATSTYPE;
52 
53 /** NAL Stream Format */
54 typedef struct OMX_NALSTREAMFORMATTYPE{
55     OMX_U32 nSize;
56     OMX_VERSIONTYPE nVersion;
57     OMX_U32 nPortIndex;
58     OMX_NALUFORMATSTYPE eNaluFormat;
59 } OMX_NALSTREAMFORMATTYPE;
60 
61 /** VP8 profiles */
62 typedef enum OMX_VIDEO_VP8PROFILETYPE {
63     OMX_VIDEO_VP8ProfileMain = 0x01,
64     OMX_VIDEO_VP8ProfileUnknown = 0x6EFFFFFF,
65     OMX_VIDEO_VP8ProfileMax = 0x7FFFFFFF
66 } OMX_VIDEO_VP8PROFILETYPE;
67 
68 /** VP8 levels */
69 typedef enum OMX_VIDEO_VP8LEVELTYPE {
70     OMX_VIDEO_VP8Level_Version0 = 0x01,
71     OMX_VIDEO_VP8Level_Version1 = 0x02,
72     OMX_VIDEO_VP8Level_Version2 = 0x04,
73     OMX_VIDEO_VP8Level_Version3 = 0x08,
74     OMX_VIDEO_VP8LevelUnknown = 0x6EFFFFFF,
75     OMX_VIDEO_VP8LevelMax = 0x7FFFFFFF
76 } OMX_VIDEO_VP8LEVELTYPE;
77 
78 /** VP8 Param */
79 typedef struct OMX_VIDEO_PARAM_VP8TYPE {
80     OMX_U32 nSize;
81     OMX_VERSIONTYPE nVersion;
82     OMX_U32 nPortIndex;
83     OMX_VIDEO_VP8PROFILETYPE eProfile;
84     OMX_VIDEO_VP8LEVELTYPE eLevel;
85     OMX_U32 nDCTPartitions;
86     OMX_BOOL bErrorResilientMode;
87 } OMX_VIDEO_PARAM_VP8TYPE;
88 
89 /** Structure for configuring VP8 reference frames */
90 typedef struct OMX_VIDEO_VP8REFERENCEFRAMETYPE {
91     OMX_U32 nSize;
92     OMX_VERSIONTYPE nVersion;
93     OMX_U32 nPortIndex;
94     OMX_BOOL bPreviousFrameRefresh;
95     OMX_BOOL bGoldenFrameRefresh;
96     OMX_BOOL bAlternateFrameRefresh;
97     OMX_BOOL bUsePreviousFrame;
98     OMX_BOOL bUseGoldenFrame;
99     OMX_BOOL bUseAlternateFrame;
100 } OMX_VIDEO_VP8REFERENCEFRAMETYPE;
101 
102 /** Structure for querying VP8 reference frame type */
103 typedef struct OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE {
104     OMX_U32 nSize;
105     OMX_VERSIONTYPE nVersion;
106     OMX_U32 nPortIndex;
107     OMX_BOOL bIsIntraFrame;
108     OMX_BOOL bIsGoldenOrAlternateFrame;
109 } OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE;
110 
111 /** Maximum number of VP8 temporal layers */
112 #define OMX_VIDEO_ANDROID_MAXVP8TEMPORALLAYERS 3
113 
114 /** VP8 temporal layer patterns */
115 typedef enum OMX_VIDEO_ANDROID_VPXTEMPORALLAYERPATTERNTYPE {
116     OMX_VIDEO_VPXTemporalLayerPatternNone = 0,
117     OMX_VIDEO_VPXTemporalLayerPatternWebRTC = 1,
118     OMX_VIDEO_VPXTemporalLayerPatternMax = 0x7FFFFFFF
119 } OMX_VIDEO_ANDROID_VPXTEMPORALLAYERPATTERNTYPE;
120 
121 /**
122  * Android specific VP8 encoder params
123  *
124  * STRUCT MEMBERS:
125  *  nSize                      : Size of the structure in bytes
126  *  nVersion                   : OMX specification version information
127  *  nPortIndex                 : Port that this structure applies to
128  *  nKeyFrameInterval          : Key frame interval in frames
129  *  eTemporalPattern           : Type of temporal layer pattern
130  *  nTemporalLayerCount        : Number of temporal coding layers
131  *  nTemporalLayerBitrateRatio : Bitrate ratio allocation between temporal
132  *                               streams in percentage
133  *  nMinQuantizer              : Minimum (best quality) quantizer
134  *  nMaxQuantizer              : Maximum (worst quality) quantizer
135  */
136 typedef struct OMX_VIDEO_PARAM_ANDROID_VP8ENCODERTYPE {
137     OMX_U32 nSize;
138     OMX_VERSIONTYPE nVersion;
139     OMX_U32 nPortIndex;
140     OMX_U32 nKeyFrameInterval;
141     OMX_VIDEO_ANDROID_VPXTEMPORALLAYERPATTERNTYPE eTemporalPattern;
142     OMX_U32 nTemporalLayerCount;
143     OMX_U32 nTemporalLayerBitrateRatio[OMX_VIDEO_ANDROID_MAXVP8TEMPORALLAYERS];
144     OMX_U32 nMinQuantizer;
145     OMX_U32 nMaxQuantizer;
146 } OMX_VIDEO_PARAM_ANDROID_VP8ENCODERTYPE;
147 
148 /** HEVC Profile enum type */
149 typedef enum OMX_VIDEO_HEVCPROFILETYPE {
150     OMX_VIDEO_HEVCProfileUnknown = 0x0,
151     OMX_VIDEO_HEVCProfileMain    = 0x1,
152     OMX_VIDEO_HEVCProfileMain10  = 0x2,
153     OMX_VIDEO_HEVCProfileMax     = 0x7FFFFFFF
154 } OMX_VIDEO_HEVCPROFILETYPE;
155 
156 /** HEVC Level enum type */
157 typedef enum OMX_VIDEO_HEVCLEVELTYPE {
158     OMX_VIDEO_HEVCLevelUnknown    = 0x0,
159     OMX_VIDEO_HEVCMainTierLevel1  = 0x1,
160     OMX_VIDEO_HEVCHighTierLevel1  = 0x2,
161     OMX_VIDEO_HEVCMainTierLevel2  = 0x4,
162     OMX_VIDEO_HEVCHighTierLevel2  = 0x8,
163     OMX_VIDEO_HEVCMainTierLevel21 = 0x10,
164     OMX_VIDEO_HEVCHighTierLevel21 = 0x20,
165     OMX_VIDEO_HEVCMainTierLevel3  = 0x40,
166     OMX_VIDEO_HEVCHighTierLevel3  = 0x80,
167     OMX_VIDEO_HEVCMainTierLevel31 = 0x100,
168     OMX_VIDEO_HEVCHighTierLevel31 = 0x200,
169     OMX_VIDEO_HEVCMainTierLevel4  = 0x400,
170     OMX_VIDEO_HEVCHighTierLevel4  = 0x800,
171     OMX_VIDEO_HEVCMainTierLevel41 = 0x1000,
172     OMX_VIDEO_HEVCHighTierLevel41 = 0x2000,
173     OMX_VIDEO_HEVCMainTierLevel5  = 0x4000,
174     OMX_VIDEO_HEVCHighTierLevel5  = 0x8000,
175     OMX_VIDEO_HEVCMainTierLevel51 = 0x10000,
176     OMX_VIDEO_HEVCHighTierLevel51 = 0x20000,
177     OMX_VIDEO_HEVCMainTierLevel52 = 0x40000,
178     OMX_VIDEO_HEVCHighTierLevel52 = 0x80000,
179     OMX_VIDEO_HEVCMainTierLevel6  = 0x100000,
180     OMX_VIDEO_HEVCHighTierLevel6  = 0x200000,
181     OMX_VIDEO_HEVCMainTierLevel61 = 0x400000,
182     OMX_VIDEO_HEVCHighTierLevel61 = 0x800000,
183     OMX_VIDEO_HEVCMainTierLevel62 = 0x1000000,
184     OMX_VIDEO_HEVCHighTierLevel62 = 0x2000000,
185     OMX_VIDEO_HEVCHighTiermax     = 0x7FFFFFFF
186 } OMX_VIDEO_HEVCLEVELTYPE;
187 
188 /** Structure for controlling HEVC video encoding and decoding */
189 typedef struct OMX_VIDEO_PARAM_HEVCTYPE {
190     OMX_U32 nSize;
191     OMX_VERSIONTYPE nVersion;
192     OMX_U32 nPortIndex;
193     OMX_VIDEO_HEVCPROFILETYPE eProfile;
194     OMX_VIDEO_HEVCLEVELTYPE eLevel;
195 } OMX_VIDEO_PARAM_HEVCTYPE;
196 
197 /** Structure to define if dependent slice segments should be used */
198 typedef struct OMX_VIDEO_SLICESEGMENTSTYPE {
199     OMX_U32 nSize;
200     OMX_VERSIONTYPE nVersion;
201     OMX_U32 nPortIndex;
202     OMX_BOOL bDepedentSegments;
203     OMX_BOOL bEnableLoopFilterAcrossSlices;
204 } OMX_VIDEO_SLICESEGMENTSTYPE;
205 
206 /** Structure to return timestamps of rendered output frames for tunneled components */
207 typedef struct OMX_VIDEO_RENDEREVENTTYPE {
208     OMX_S64 nMediaTimeUs;  // timestamp of rendered video frame
209     OMX_S64 nSystemTimeNs; // system monotonic time at the time frame was rendered
210 } OMX_VIDEO_RENDEREVENTTYPE;
211 
212 #ifdef __cplusplus
213 }
214 #endif /* __cplusplus */
215 
216 #endif /* OMX_VideoExt_h */
217 /* File EOF */
218