• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 /** AVC additional profiles */
62 typedef enum OMX_VIDEO_AVCPROFILEEXTTYPE {
63     OMX_VIDEO_AVCProfileConstrainedBaseline = 0x10000,   /**< Constrained baseline profile */
64     OMX_VIDEO_AVCProfileConstrainedHigh     = 0x80000,   /**< Constrained high profile */
65 } OMX_VIDEO_AVCPROFILEEXTTYPE;
66 
67 /** VP8 profiles */
68 typedef enum OMX_VIDEO_VP8PROFILETYPE {
69     OMX_VIDEO_VP8ProfileMain = 0x01,
70     OMX_VIDEO_VP8ProfileUnknown = 0x6EFFFFFF,
71     OMX_VIDEO_VP8ProfileMax = 0x7FFFFFFF
72 } OMX_VIDEO_VP8PROFILETYPE;
73 
74 /** VP8 levels */
75 typedef enum OMX_VIDEO_VP8LEVELTYPE {
76     OMX_VIDEO_VP8Level_Version0 = 0x01,
77     OMX_VIDEO_VP8Level_Version1 = 0x02,
78     OMX_VIDEO_VP8Level_Version2 = 0x04,
79     OMX_VIDEO_VP8Level_Version3 = 0x08,
80     OMX_VIDEO_VP8LevelUnknown = 0x6EFFFFFF,
81     OMX_VIDEO_VP8LevelMax = 0x7FFFFFFF
82 } OMX_VIDEO_VP8LEVELTYPE;
83 
84 /** VP8 Param */
85 typedef struct OMX_VIDEO_PARAM_VP8TYPE {
86     OMX_U32 nSize;
87     OMX_VERSIONTYPE nVersion;
88     OMX_U32 nPortIndex;
89     OMX_VIDEO_VP8PROFILETYPE eProfile;
90     OMX_VIDEO_VP8LEVELTYPE eLevel;
91     OMX_U32 nDCTPartitions;
92     OMX_BOOL bErrorResilientMode;
93 } OMX_VIDEO_PARAM_VP8TYPE;
94 
95 /** Structure for configuring VP8 reference frames */
96 typedef struct OMX_VIDEO_VP8REFERENCEFRAMETYPE {
97     OMX_U32 nSize;
98     OMX_VERSIONTYPE nVersion;
99     OMX_U32 nPortIndex;
100     OMX_BOOL bPreviousFrameRefresh;
101     OMX_BOOL bGoldenFrameRefresh;
102     OMX_BOOL bAlternateFrameRefresh;
103     OMX_BOOL bUsePreviousFrame;
104     OMX_BOOL bUseGoldenFrame;
105     OMX_BOOL bUseAlternateFrame;
106 } OMX_VIDEO_VP8REFERENCEFRAMETYPE;
107 
108 /** Structure for querying VP8 reference frame type */
109 typedef struct OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE {
110     OMX_U32 nSize;
111     OMX_VERSIONTYPE nVersion;
112     OMX_U32 nPortIndex;
113     OMX_BOOL bIsIntraFrame;
114     OMX_BOOL bIsGoldenOrAlternateFrame;
115 } OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE;
116 
117 /** VP9 profiles */
118 typedef enum OMX_VIDEO_VP9PROFILETYPE {
119     OMX_VIDEO_VP9Profile0 = 0x1,
120     OMX_VIDEO_VP9Profile1 = 0x2,
121     OMX_VIDEO_VP9Profile2 = 0x4,
122     OMX_VIDEO_VP9Profile3 = 0x8,
123     // HDR profiles also support passing HDR metadata
124     OMX_VIDEO_VP9Profile2HDR = 0x1000,
125     OMX_VIDEO_VP9Profile3HDR = 0x2000,
126     OMX_VIDEO_VP9ProfileUnknown = 0x6EFFFFFF,
127     OMX_VIDEO_VP9ProfileMax = 0x7FFFFFFF
128 } OMX_VIDEO_VP9PROFILETYPE;
129 
130 /** VP9 levels */
131 typedef enum OMX_VIDEO_VP9LEVELTYPE {
132     OMX_VIDEO_VP9Level1  = 0x1,
133     OMX_VIDEO_VP9Level11 = 0x2,
134     OMX_VIDEO_VP9Level2  = 0x4,
135     OMX_VIDEO_VP9Level21 = 0x8,
136     OMX_VIDEO_VP9Level3  = 0x10,
137     OMX_VIDEO_VP9Level31 = 0x20,
138     OMX_VIDEO_VP9Level4  = 0x40,
139     OMX_VIDEO_VP9Level41 = 0x80,
140     OMX_VIDEO_VP9Level5  = 0x100,
141     OMX_VIDEO_VP9Level51 = 0x200,
142     OMX_VIDEO_VP9Level52 = 0x400,
143     OMX_VIDEO_VP9Level6  = 0x800,
144     OMX_VIDEO_VP9Level61 = 0x1000,
145     OMX_VIDEO_VP9Level62 = 0x2000,
146     OMX_VIDEO_VP9LevelUnknown = 0x6EFFFFFF,
147     OMX_VIDEO_VP9LevelMax = 0x7FFFFFFF
148 } OMX_VIDEO_VP9LEVELTYPE;
149 
150 /** HEVC Profiles */
151 typedef enum OMX_VIDEO_HEVCPROFILETYPE {
152     OMX_VIDEO_HEVCProfileMain         = 0x01,
153     OMX_VIDEO_HEVCProfileMain10       = 0x02,
154     OMX_VIDEO_HEVCProfileMainStill    = 0x04,
155     // Main10 profile with HDR SEI support.
156     OMX_VIDEO_HEVCProfileMain10HDR10  = 0x1000,
157     OMX_VIDEO_HEVCProfileUnknown      = 0x6EFFFFFF,
158     OMX_VIDEO_HEVCProfileMax          = 0x7FFFFFFF
159 } OMX_VIDEO_HEVCPROFILETYPE;
160 
161 /** HEVC levels */
162 typedef enum OMX_VIDEO_HEVCLEVELTYPE {
163     OMX_VIDEO_HEVCLevel_Version0  = 0x0,
164     OMX_VIDEO_HEVCMainTierLevel1  = 0x1,
165     OMX_VIDEO_HEVCHighTierLevel1  = 0x2,
166     OMX_VIDEO_HEVCMainTierLevel2  = 0x4,
167     OMX_VIDEO_HEVCHighTierLevel2  = 0x8,
168     OMX_VIDEO_HEVCMainTierLevel21 = 0x10,
169     OMX_VIDEO_HEVCHighTierLevel21 = 0x20,
170     OMX_VIDEO_HEVCMainTierLevel3  = 0x40,
171     OMX_VIDEO_HEVCHighTierLevel3  = 0x80,
172     OMX_VIDEO_HEVCMainTierLevel31 = 0x100,
173     OMX_VIDEO_HEVCHighTierLevel31 = 0x200,
174     OMX_VIDEO_HEVCMainTierLevel4  = 0x400,
175     OMX_VIDEO_HEVCHighTierLevel4  = 0x800,
176     OMX_VIDEO_HEVCMainTierLevel41 = 0x1000,
177     OMX_VIDEO_HEVCHighTierLevel41 = 0x2000,
178     OMX_VIDEO_HEVCMainTierLevel5  = 0x4000,
179     OMX_VIDEO_HEVCHighTierLevel5  = 0x8000,
180     OMX_VIDEO_HEVCMainTierLevel51 = 0x10000,
181     OMX_VIDEO_HEVCHighTierLevel51 = 0x20000,
182     OMX_VIDEO_HEVCMainTierLevel52 = 0x40000,
183     OMX_VIDEO_HEVCHighTierLevel52 = 0x80000,
184     OMX_VIDEO_HEVCMainTierLevel6  = 0x100000,
185     OMX_VIDEO_HEVCHighTierLevel6  = 0x200000,
186     OMX_VIDEO_HEVCMainTierLevel61 = 0x400000,
187     OMX_VIDEO_HEVCHighTierLevel61 = 0x800000,
188     OMX_VIDEO_HEVCMainTierLevel62 = 0x1000000,
189     OMX_VIDEO_HEVCHighTierLevel62 = 0x2000000,
190     OMX_VIDEO_HEVCLevelUnknown = 0x6EFFFFFF,
191     OMX_VIDEO_HEVCLevelMax = 0x7FFFFFFF
192 } OMX_VIDEO_HEVCLEVELTYPE;
193 
194 /** HEVC Param */
195 typedef struct OMX_VIDEO_PARAM_HEVCTYPE {
196     OMX_U32 nSize;
197     OMX_VERSIONTYPE nVersion;
198     OMX_U32 nPortIndex;
199     OMX_VIDEO_HEVCPROFILETYPE eProfile;
200     OMX_VIDEO_HEVCLEVELTYPE eLevel;
201     OMX_U32 nKeyFrameInterval;
202 } OMX_VIDEO_PARAM_HEVCTYPE;
203 
204 /**
205  * Android specific param for specifying image grid layout information for image encoding
206  * use cases, corresponding to index OMX_IndexParamVideoAndroidImageGrid.
207  *
208  * OMX_VIDEO_CodingImageHEIC encoders must handle this param type. When this param is set
209  * on the component with bEnabled set to true, nTileWidth, nTileHeight, nGridRows,
210  * nGridCols indicates the desired grid config by the client. The component can use this
211  * as a heuristic, and is free to choose any suitable grid configs. The client shall
212  * always get the actual from the component after the param is set. Encoder will receive
213  * each input image in full, and shall encode it into tiles in row-major, top-row first,
214  * left-to-right order, and send each encoded tile in a separate output buffer. All output
215  * buffers for the same input buffer shall carry the same timestamp as the input buffer.
216  * If the input buffer is marked EOS, the EOS should only appear on the last output buffer
217  * for that input buffer.
218  *
219  * OMX_VIDEO_CodingHEVC encoders might also receive this param when it's used for image
220  * encoding, although in this case the param only serves as a hint. The encoder will
221  * receive the input image tiles in row-major, top-row first, left-to-right order.
222  * The grid config can be used for quality control, or optimizations.
223  *
224  * If this param is not set, the component shall assume that grid option is disabled.
225  *
226  *  nSize                      : Size of the structure in bytes
227  *  nVersion                   : OMX specification version information
228  *  nPortIndex                 : Port that this structure applies to (output port for encoders)
229  *  bEnabled                   : Whether grid is enabled. If true, the other parameters
230  *                               specifies the grid config; otherwise they shall be ignored.
231  *  nTileWidth                 : Width of each tile.
232  *  nTileHeight                : Height of each tile.
233  *  nGridRows                  : Number of rows in the grid.
234  *  nGridCols                  : Number of cols in the grid.
235  */
236 typedef struct OMX_VIDEO_PARAM_ANDROID_IMAGEGRIDTYPE {
237     OMX_U32 nSize;
238     OMX_VERSIONTYPE nVersion;
239     OMX_U32 nPortIndex;
240     OMX_BOOL bEnabled;
241     OMX_U32 nTileWidth;
242     OMX_U32 nTileHeight;
243     OMX_U32 nGridRows;
244     OMX_U32 nGridCols;
245 } OMX_VIDEO_PARAM_ANDROID_IMAGEGRIDTYPE;
246 
247 /**
248  * Structure for configuring video compression intra refresh period
249  *
250  * STRUCT MEMBERS:
251  *  nSize               : Size of the structure in bytes
252  *  nVersion            : OMX specification version information
253  *  nPortIndex          : Port that this structure applies to
254  *  nRefreshPeriod      : Intra refreh period in frames. Value 0 means disable intra refresh
255 */
256 typedef struct OMX_VIDEO_CONFIG_ANDROID_INTRAREFRESHTYPE {
257     OMX_U32 nSize;
258     OMX_VERSIONTYPE nVersion;
259     OMX_U32 nPortIndex;
260     OMX_U32 nRefreshPeriod;
261 } OMX_VIDEO_CONFIG_ANDROID_INTRAREFRESHTYPE;
262 
263 /** Maximum number of temporal layers supported by AVC/HEVC */
264 #define OMX_VIDEO_ANDROID_MAXTEMPORALLAYERS 8
265 
266 /** temporal layer patterns */
267 typedef enum OMX_VIDEO_ANDROID_TEMPORALLAYERINGPATTERNTYPE {
268     OMX_VIDEO_AndroidTemporalLayeringPatternNone = 0,
269     // pattern as defined by WebRTC
270     OMX_VIDEO_AndroidTemporalLayeringPatternWebRTC = 1 << 0,
271     // pattern where frames in any layer other than the base layer only depend on at most the very
272     // last frame from each preceding layer (other than the base layer.)
273     OMX_VIDEO_AndroidTemporalLayeringPatternAndroid = 1 << 1,
274 } OMX_VIDEO_ANDROID_TEMPORALLAYERINGPATTERNTYPE;
275 
276 /**
277  * Android specific param for configuration of temporal layering.
278  * Android only supports temporal layering where successive layers each double the
279  * previous layer's framerate.
280  * NOTE: Reading this parameter at run-time SHALL return actual run-time values.
281  *
282  *  nSize                      : Size of the structure in bytes
283  *  nVersion                   : OMX specification version information
284  *  nPortIndex                 : Port that this structure applies to (output port for encoders)
285  *  eSupportedPatterns         : A bitmask of supported layering patterns
286  *  nLayerCountMax             : Max number of temporal coding layers supported
287  *                               by the encoder (must be at least 1, 1 meaning temporal layering
288  *                               is NOT supported)
289  *  nBLayerCountMax            : Max number of layers that can contain B frames
290  *                               (0) to (nLayerCountMax - 1)
291  *  ePattern                   : Layering pattern.
292  *  nPLayerCountActual         : Number of temporal layers to be coded with non-B frames,
293  *                               starting from and including the base-layer.
294  *                               (1 to nLayerCountMax - nBLayerCountActual)
295  *                               If nPLayerCountActual is 1 and nBLayerCountActual is 0, temporal
296  *                               layering is disabled. Otherwise, it is enabled.
297  *  nBLayerCountActual         : Number of temporal layers to be coded with B frames,
298  *                               starting after non-B layers.
299  *                               (0 to nBLayerCountMax)
300  *  bBitrateRatiosSpecified    : Flag to indicate if layer-wise bitrate
301  *                               distribution is specified.
302  *  nBitrateRatios             : Bitrate ratio (100 based) per layer (index 0 is base layer).
303  *                               Honored if bBitrateRatiosSpecified is set.
304  *                               i.e for 4 layers with desired distribution (25% 25% 25% 25%),
305  *                               nBitrateRatio = {25, 50, 75, 100, ... }
306  *                               Values in indices not less than 'the actual number of layers
307  *                               minus 1' MAY be ignored and assumed to be 100.
308  */
309 typedef struct OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE {
310     OMX_U32 nSize;
311     OMX_VERSIONTYPE nVersion;
312     OMX_U32 nPortIndex;
313     OMX_VIDEO_ANDROID_TEMPORALLAYERINGPATTERNTYPE eSupportedPatterns;
314     OMX_U32 nLayerCountMax;
315     OMX_U32 nBLayerCountMax;
316     OMX_VIDEO_ANDROID_TEMPORALLAYERINGPATTERNTYPE ePattern;
317     OMX_U32 nPLayerCountActual;
318     OMX_U32 nBLayerCountActual;
319     OMX_BOOL bBitrateRatiosSpecified;
320     OMX_U32 nBitrateRatios[OMX_VIDEO_ANDROID_MAXTEMPORALLAYERS];
321 } OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE;
322 
323 /**
324  * Android specific config for changing the temporal-layer count or
325  * bitrate-distribution at run-time.
326  *
327  *  nSize                      : Size of the structure in bytes
328  *  nVersion                   : OMX specification version information
329  *  nPortIndex                 : Port that this structure applies to (output port for encoders)
330  *  ePattern                   : Layering pattern.
331  *  nPLayerCountActual         : Number of temporal layers to be coded with non-B frames.
332  *                               (same OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE limits apply.)
333  *  nBLayerCountActual         : Number of temporal layers to be coded with B frames.
334  *                               (same OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE limits apply.)
335  *  bBitrateRatiosSpecified    : Flag to indicate if layer-wise bitrate
336  *                               distribution is specified.
337  *  nBitrateRatios             : Bitrate ratio (100 based, Q16 values) per layer (0 is base layer).
338  *                               Honored if bBitrateRatiosSpecified is set.
339  *                               (same OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE limits apply.)
340  */
341 typedef struct OMX_VIDEO_CONFIG_ANDROID_TEMPORALLAYERINGTYPE {
342     OMX_U32 nSize;
343     OMX_VERSIONTYPE nVersion;
344     OMX_U32 nPortIndex;
345     OMX_VIDEO_ANDROID_TEMPORALLAYERINGPATTERNTYPE ePattern;
346     OMX_U32 nPLayerCountActual;
347     OMX_U32 nBLayerCountActual;
348     OMX_BOOL bBitrateRatiosSpecified;
349     OMX_U32 nBitrateRatios[OMX_VIDEO_ANDROID_MAXTEMPORALLAYERS];
350 } OMX_VIDEO_CONFIG_ANDROID_TEMPORALLAYERINGTYPE;
351 
352 #ifdef __cplusplus
353 }
354 #endif /* __cplusplus */
355 
356 #endif /* OMX_VideoExt_h */
357 /* File EOF */
358