1 /*--------------------------------------------------------------------------
2 Copyright (c) 2009-2017, 2019, The Linux Foundation. All rights reserved.
3 
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions are met:
6     * Redistributions of source code must retain the above copyright
7       notice, this list of conditions and the following disclaimer.
8     * Redistributions in binary form must reproduce the above copyright
9       notice, this list of conditions and the following disclaimer in the
10       documentation and/or other materials provided with the distribution.
11     * Neither the name of The Linux Foundation nor
12       the names of its contributors may be used to endorse or promote
13       products derived from this software without specific prior written
14       permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23 OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 --------------------------------------------------------------------------*/
28 #ifndef __OMX_QCOM_EXTENSIONS_H__
29 #define __OMX_QCOM_EXTENSIONS_H__
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif /* __cplusplus */
34 
35 /*============================================================================
36 *//** @file OMX_QCOMExtns.h
37   This header contains constants and type definitions that specify the
38   extensions added to the OpenMAX Vendor specific APIs.
39 
40 *//*========================================================================*/
41 
42 
43 ///////////////////////////////////////////////////////////////////////////////
44 //                             Include Files
45 ///////////////////////////////////////////////////////////////////////////////
46 #include "OMX_Core.h"
47 #include "OMX_Video.h"
48 #include "string.h"
49 #include "OMX_VideoExt.h"
50 
51 #define OMX_VIDEO_MAX_HP_LAYERS 6
52 
53 /**
54  * These MACROS used by Camera and Video to decide buffer count.
55  * This is to avoid mismatch of buffer count between Camera and Video.
56  * In Meta mode, read this count as buffer count in Camera and Header
57  * count in Video.
58  * 1) Number of buffers in Non-DCVS mode.
59  * 2) DCVS resolution.
60  * 3) Buffer count when Current resolution is greater than DCVS resolution
61  * defined in 2)
62  */
63 
64 #define OMX_VIDEO_MIN_CAMERA_BUFFERS 9
65 #define OMX_VIDEO_ENC_DCVS_RESOLUTION 3840 * 2160
66 #define OMX_VIDEO_MIN_CAMERA_BUFFERS_DCVS 11
67 
68 /**
69  * This count indicates the number of Ints in the legacy Camera payload
70  * used for HAL1
71  */
72 
73 #define VIDEO_METADATA_NUM_COMMON_INTS 1
74 
75 /**
76  * This extension is used to register mapping of a virtual
77  * address to a physical address. This extension is a parameter
78  * which can be set using the OMX_SetParameter macro. The data
79  * pointer corresponding to this extension is
80  * OMX_QCOM_MemMapEntry. This parameter is a 'write only'
81  * parameter (Current value cannot be queried using
82  * OMX_GetParameter macro).
83  */
84 #define OMX_QCOM_EXTN_REGISTER_MMAP     "OMX.QCOM.index.param.register_mmap"
85 
86 /**
87  * This structure describes the data pointer corresponding to
88  * the OMX_QCOM_MMAP_REGISTER_EXTN extension. This parameter
89  * must be set only 'after' populating a port with a buffer
90  * using OMX_UseBuffer, wherein the data pointer of the buffer
91  * corresponds to the virtual address as specified in this
92  * structure.
93  */
94 struct OMX_QCOM_PARAM_MEMMAPENTRYTYPE
95 {
96     OMX_U32 nSize;              /** Size of the structure in bytes */
97     OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
98     OMX_U32 nPortIndex;         /**< Port number the structure applies to */
99 
100     /**
101      * The virtual address of memory block
102      */
103     OMX_U64 nVirtualAddress;
104 
105     /**
106      * The physical address corresponding to the virtual address. The physical
107      * address is contiguous for the entire valid range of the virtual
108      * address.
109      */
110     OMX_U64 nPhysicalAddress;
111 };
112 
113 #define QOMX_VIDEO_IntraRefreshRandom (OMX_VIDEO_IntraRefreshVendorStartUnused + 0)
114 
115 /* This error event is used for H.264 long-term reference (LTR) encoding.
116  * When IL client specifies an LTR frame with its identifier via
117  * OMX_QCOM_INDEX_CONFIG_VIDEO_LTRUSE to the encoder, if the specified
118  * LTR frame can not be located by the encoder in its LTR list, the encoder
119  * issues this error event to IL client to notify the failure of LTRUse config.
120  */
121 #define QOMX_ErrorLTRUseFailed        (OMX_ErrorVendorStartUnused + 1)
122 
123 /*
124  * This rate control will be used for low bitrate applications to get better
125  * video quality for a given bitrate.
126  */
127 #define QOMX_Video_ControlRateMaxBitrate (OMX_Video_ControlRateVendorStartUnused + 1)
128 
129 #define QOMX_Video_ControlRateMaxBitrateSkipFrames (OMX_Video_ControlRateVendorStartUnused + 2)
130 
131 #define QOMX_VIDEO_BUFFERFLAG_BFRAME 0x00100000
132 
133 #define QOMX_VIDEO_BUFFERFLAG_EOSEQ  0x00200000
134 
135 #define QOMX_VIDEO_BUFFERFLAG_MBAFF  0x00400000
136 
137 #define QOMX_VIDEO_BUFFERFLAG_CANCEL 0x00800000
138 
139 #define OMX_QCOM_PORTDEFN_EXTN   "OMX.QCOM.index.param.portdefn"
140 /* Allowed APIs on the above Index: OMX_GetParameter() and OMX_SetParameter() */
141 
142 /*
143  * VT Driver Version Number definition
144  * Hexa Decimal: 0xPPPPYYMM
145  *               PPPP [2 Bytes] - Product ID
146  *               YY   [1 Byte ] - Year (last two digits of year {00..99})
147  *               MM   [1 Byte ] - Month (01..12)
148  */
149 #define VT_DRIVER_VERSION 0x1FD6120A
150 
151 typedef enum OMX_QCOMMemoryRegion
152 {
153     OMX_QCOM_MemRegionInvalid,
154     OMX_QCOM_MemRegionEBI1,
155     OMX_QCOM_MemRegionSMI,
156     OMX_QCOM_MemRegionMax = 0X7FFFFFFF
157 } OMX_QCOMMemoryRegion;
158 
159 typedef enum OMX_QCOMCacheAttr
160 {
161     OMX_QCOM_CacheAttrNone,
162     OMX_QCOM_CacheAttrWriteBack,
163     OMX_QCOM_CacheAttrWriteThrough,
164     OMX_QCOM_CacheAttrMAX = 0X7FFFFFFF
165 } OMX_QCOMCacheAttr;
166 
167 typedef struct OMX_QCOMRectangle
168 {
169    OMX_S32 x;
170    OMX_S32 y;
171    OMX_S32 dx;
172    OMX_S32 dy;
173 } OMX_QCOMRectangle;
174 
175 /** OMX_QCOMFramePackingFormat
176   * Input or output buffer format
177   */
178 typedef enum OMX_QCOMFramePackingFormat
179 {
180   /* 0 - unspecified
181    */
182   OMX_QCOM_FramePacking_Unspecified,
183 
184   /*  1 - Partial frames may be present OMX IL 1.1.1 Figure 2-10:
185    *  Case 1??Each Buffer Filled In Whole or In Part
186    */
187   OMX_QCOM_FramePacking_Arbitrary,
188 
189   /*  2 - Multiple complete frames per buffer (integer number)
190    *  OMX IL 1.1.1 Figure 2-11: Case 2-Each Buffer Filled with
191    *  Only Complete Frames of Data
192    */
193   OMX_QCOM_FramePacking_CompleteFrames,
194 
195   /*  3 - Only one complete frame per buffer, no partial frame
196    *  OMX IL 1.1.1 Figure 2-12: Case 3-Each Buffer Filled with
197    *  Only One Frame of Compressed Data. Usually at least one
198    *  complete unit of data will be delivered in a buffer for
199    *  uncompressed data formats.
200    */
201   OMX_QCOM_FramePacking_OnlyOneCompleteFrame,
202 
203   /*  4 - Only one complete subframe per buffer, no partial subframe
204    *  Example: In H264, one complete NAL per buffer, where one frame
205    *  can contatin multiple NAL
206    */
207   OMX_QCOM_FramePacking_OnlyOneCompleteSubFrame,
208 
209   OMX_QCOM_FramePacking_MAX = 0X7FFFFFFF
210 } OMX_QCOMFramePackingFormat;
211 
212 typedef struct OMX_QCOM_PARAM_PORTDEFINITIONTYPE {
213  OMX_U32 nSize;           /** Size of the structure in bytes */
214  OMX_VERSIONTYPE nVersion;/** OMX specification version information */
215  OMX_U32 nPortIndex;    /** Portindex which is extended by this structure */
216 
217  /** Platform specific memory region EBI1, SMI, etc.,*/
218  OMX_QCOMMemoryRegion nMemRegion;
219 
220  OMX_QCOMCacheAttr nCacheAttr; /** Cache attributes */
221 
222  /** Input or output buffer format */
223  OMX_U32 nFramePackingFormat;
224 
225 } OMX_QCOM_PARAM_PORTDEFINITIONTYPE;
226 
227 typedef struct OMX_QCOM_VIDEO_CONFIG_QP {
228     OMX_U32 nSize;
229     OMX_VERSIONTYPE nVersion;
230     OMX_U32 nPortIndex;
231     OMX_U32 nQP;
232 } OMX_QCOM_VIDEO_CONFIG_QP;
233 
234 typedef struct OMX_QCOM_VIDEO_PARAM_IPB_QPRANGETYPE {
235     OMX_U32 nSize;
236     OMX_VERSIONTYPE nVersion;
237     OMX_U32 nPortIndex;
238     OMX_U32 minIQP;
239     OMX_U32 maxIQP;
240     OMX_U32 minPQP;
241     OMX_U32 maxPQP;
242     OMX_U32 minBQP;
243     OMX_U32 maxBQP;
244 } OMX_QCOM_VIDEO_PARAM_IPB_QPRANGETYPE;
245 
246 #define OMX_QCOM_PLATFORMPVT_EXTN   "OMX.QCOM.index.param.platformprivate"
247 /** Allowed APIs on the above Index: OMX_SetParameter() */
248 
249 typedef enum OMX_QCOM_PLATFORM_PRIVATE_ENTRY_TYPE
250 {
251     /** Enum for PMEM information */
252     OMX_QCOM_PLATFORM_PRIVATE_PMEM = 0x1
253 } OMX_QCOM_PLATFORM_PRIVATE_ENTRY_TYPE;
254 
255 /** IL client will set the following structure. A failure
256  *  code will be returned if component does not support the
257  *  value provided for 'type'.
258  */
259 struct OMX_QCOM_PLATFORMPRIVATE_EXTN
260 {
261     OMX_U32 nSize;        /** Size of the structure in bytes */
262     OMX_VERSIONTYPE nVersion; /** OMX spec version information */
263     OMX_U32 nPortIndex;  /** Port number on which usebuffer extn is applied */
264 
265     /** Type of extensions should match an entry from
266      OMX_QCOM_PLATFORM_PRIVATE_ENTRY_TYPE
267     */
268     OMX_QCOM_PLATFORM_PRIVATE_ENTRY_TYPE type;
269 };
270 
271 typedef struct OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO
272 {
273     /** pmem file descriptor */
274     unsigned long pmem_fd;
275 #ifdef USE_GBM
276     unsigned long pmeta_fd;
277 #endif
278     /** Offset from pmem device base address */
279     OMX_U32 offset;
280     OMX_U32 size;
281     OMX_U32 mapped_size;
282     OMX_PTR buffer;
283 }OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO;
284 
285 typedef struct OMX_QCOM_PLATFORM_PRIVATE_ENTRY
286 {
287     /** Entry type */
288     OMX_QCOM_PLATFORM_PRIVATE_ENTRY_TYPE type;
289 
290     /** Pointer to platform specific entry */
291     OMX_PTR entry;
292 }OMX_QCOM_PLATFORM_PRIVATE_ENTRY;
293 
294 typedef struct OMX_QCOM_PLATFORM_PRIVATE_LIST
295 {
296     /** Number of entries */
297     OMX_U32 nEntries;
298 
299     /** Pointer to array of platform specific entries *
300      * Contiguous block of OMX_QCOM_PLATFORM_PRIVATE_ENTRY element
301     */
302     OMX_QCOM_PLATFORM_PRIVATE_ENTRY* entryList;
303 }OMX_QCOM_PLATFORM_PRIVATE_LIST;
304 
305 #define OMX_QCOM_FRAME_PACKING_FORMAT   "OMX.QCOM.index.param.framepackfmt"
306 /* Allowed API call: OMX_GetParameter() */
307 /* IL client can use this index to rerieve the list of frame formats *
308  * supported by the component */
309 
310 typedef struct OMX_QCOM_FRAME_PACKINGFORMAT_TYPE {
311     OMX_U32 nSize;
312     OMX_VERSIONTYPE nVersion;
313     OMX_U32 nPortIndex;
314     OMX_U32 nIndex;
315     OMX_QCOMFramePackingFormat eframePackingFormat;
316 } OMX_QCOM_FRAME_PACKINGFORMAT_TYPE;
317 
318 
319 /**
320  * Following is the enum for color formats supported on Qualcomm
321  * MSMs YVU420SemiPlanar color format is not defined in OpenMAX
322  * 1.1.1 and prior versions of OpenMAX specification.
323  */
324 
325 enum OMX_QCOM_COLOR_FORMATTYPE
326 {
327 
328 /** YVU420SemiPlanar: YVU planar format, organized with a first
329  *  plane containing Y pixels, and a second plane containing
330  *  interleaved V and U pixels. V and U pixels are sub-sampled
331  *  by a factor of two both horizontally and vertically.
332  */
333     QOMX_COLOR_FormatYVU420SemiPlanar = 0x7FA30C00,
334     QOMX_COLOR_FormatYVU420PackedSemiPlanar32m4ka,
335     QOMX_COLOR_FormatYUV420PackedSemiPlanar16m2ka,
336     QOMX_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka,
337     QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m,
338     QOMX_COLOR_FORMATYUV420PackedSemiPlanar32mMultiView,
339     QOMX_COLOR_FORMATYUV420PackedSemiPlanar32mCompressed,
340     QOMX_COLOR_Format32bitRGBA8888,
341     QOMX_COLOR_Format32bitRGBA8888Compressed,
342     QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m10bitCompressed,
343     QOMX_COLOR_FORMATYUV420SemiPlanarP010Venus,
344     QOMX_COLOR_FormatAndroidOpaque = (OMX_COLOR_FORMATTYPE) OMX_COLOR_FormatVendorStartUnused  + 0x789,
345 };
346 
347 enum OMX_QCOM_VIDEO_CODINGTYPE
348 {
349 /** Codecs support by qualcomm which are not listed in OMX 1.1.x
350  *  spec
351  *   */
352     OMX_QCOM_VIDEO_CodingVC1  = 0x7FA30C00 ,
353     OMX_QCOM_VIDEO_CodingWMV9 = 0x7FA30C01,
354     QOMX_VIDEO_CodingDivx = 0x7FA30C02,     /**< Value when coding is Divx */
355     QOMX_VIDEO_CodingSpark = 0x7FA30C03,     /**< Value when coding is Sorenson Spark */
356     QOMX_VIDEO_CodingVp = 0x7FA30C04,
357     QOMX_VIDEO_CodingVp8 = OMX_VIDEO_CodingVP8,   /**< keeping old enum for backwards compatibility*/
358     QOMX_VIDEO_CodingHevc = OMX_VIDEO_CodingHEVC, /**< keeping old enum for backwards compatibility*/
359     QOMX_VIDEO_CodingMVC = 0x7FA30C07,
360     QOMX_VIDEO_CodingVp9 = OMX_VIDEO_CodingVP9,   /**< keeping old enum for backwards compatibility*/
361     QOMX_VIDEO_CodingTME = 0x7FA30C09,
362     QOMX_VIDEO_CodingImageHeic = OMX_VIDEO_CodingImageHEIC,
363 };
364 
365 enum OMX_QCOM_EXTN_INDEXTYPE
366 {
367     /** Qcom proprietary extension index list */
368 
369     /* "OMX.QCOM.index.param.register_mmap" */
370     OMX_QcomIndexRegmmap = 0x7F000000,
371 
372     /* "OMX.QCOM.index.param.platformprivate" */
373     OMX_QcomIndexPlatformPvt = 0x7F000001,
374 
375     /* "OMX.QCOM.index.param.portdefn" */
376     OMX_QcomIndexPortDefn = 0x7F000002,
377 
378     /* "OMX.QCOM.index.param.framepackingformat" */
379     OMX_QcomIndexPortFramePackFmt = 0x7F000003,
380 
381     /*"OMX.QCOM.index.param.Interlaced */
382     OMX_QcomIndexParamInterlaced = 0x7F000004,
383 
384     /*"OMX.QCOM.index.config.interlaceformat */
385     OMX_QcomIndexConfigInterlaced = 0x7F000005,
386 
387     /*"OMX.QCOM.index.param.syntaxhdr" */
388     QOMX_IndexParamVideoSyntaxHdr = 0x7F000006,
389 
390     /*"OMX.QCOM.index.config.intraperiod" */
391     QOMX_IndexConfigVideoIntraperiod = 0x7F000007,
392 
393     /*"OMX.QCOM.index.config.randomIntrarefresh" */
394     QOMX_IndexConfigVideoIntraRefresh = 0x7F000008,
395 
396     /*"OMX.QCOM.index.config.video.TemporalSpatialTradeOff" */
397     QOMX_IndexConfigVideoTemporalSpatialTradeOff = 0x7F000009,
398 
399     /*"OMX.QCOM.index.param.video.EncoderMode" */
400     QOMX_IndexParamVideoEncoderMode = 0x7F00000A,
401 
402     /*"OMX.QCOM.index.param.Divxtype */
403     OMX_QcomIndexParamVideoDivx = 0x7F00000B,
404 
405     /*"OMX.QCOM.index.param.Sparktype */
406     OMX_QcomIndexParamVideoSpark = 0x7F00000C,
407 
408     /*"OMX.QCOM.index.param.Vptype */
409     OMX_QcomIndexParamVideoVp = 0x7F00000D,
410 
411     OMX_QcomIndexQueryNumberOfVideoDecInstance = 0x7F00000E,
412 
413     OMX_QcomIndexParamVideoSyncFrameDecodingMode = 0x7F00000F,
414 
415     OMX_QcomIndexParamVideoDecoderPictureOrder = 0x7F000010,
416 
417     /* "OMX.QCOM.index.config.video.FramePackingInfo" */
418     OMX_QcomIndexConfigVideoFramePackingArrangement = 0x7F000011,
419 
420     OMX_QcomIndexParamConcealMBMapExtraData = 0x7F000012,
421 
422     OMX_QcomIndexParamFrameInfoExtraData = 0x7F000013,
423 
424     OMX_QcomIndexParamInterlaceExtraData = 0x7F000014,
425 
426     OMX_QcomIndexParamH264TimeInfo = 0x7F000015,
427 
428     OMX_QcomIndexParamIndexExtraDataType = 0x7F000016,
429 
430     OMX_GoogleAndroidIndexEnableAndroidNativeBuffers = 0x7F000017,
431 
432     OMX_GoogleAndroidIndexUseAndroidNativeBuffer = 0x7F000018,
433 
434     OMX_GoogleAndroidIndexGetAndroidNativeBufferUsage = 0x7F000019,
435 
436     /*"OMX.QCOM.index.param.EnableTimeStampReoder"*/
437     OMX_QcomIndexParamEnableTimeStampReorder = 0x7F00001B,
438 
439     /*"OMX.google.android.index.storeMetaDataInBuffers"*/
440     OMX_QcomIndexParamVideoMetaBufferMode = 0x7F00001C,
441 
442     /*"OMX.google.android.index.useAndroidNativeBuffer2"*/
443     OMX_GoogleAndroidIndexUseAndroidNativeBuffer2 = 0x7F00001D,
444 
445     /*"OMX.QCOM.index.param.VideoMaxAllowedBitrateCheck"*/
446     OMX_QcomIndexParamVideoMaxAllowedBitrateCheck = 0x7F00001E,
447 
448     /* "OMX.QCOM.index.param.video.ExtnUserExtraData" */
449     OMX_QcomIndexEnableExtnUserData = 0x7F000020,
450 
451     /*"OMX.QCOM.index.param.video.EnableSmoothStreaming"*/
452     OMX_QcomIndexParamEnableSmoothStreaming = 0x7F000021,
453 
454     OMX_QcomIndexEnableH263PlusPType = 0x7F000023,
455 
456     /*"OMX.QCOM.index.param.video.LTRCount"*/
457     QOMX_IndexParamVideoLTRCount = 0x7F000026,
458 
459     /*"OMX.QCOM.index.config.video.LTRUse"*/
460     QOMX_IndexConfigVideoLTRUse = 0x7F000028,
461 
462     /*"OMX.QCOM.index.config.video.LTRMark"*/
463     QOMX_IndexConfigVideoLTRMark = 0x7F000029,
464 
465     /* OMX.google.android.index.prependSPSPPSToIDRFrames */
466     OMX_QcomIndexParamSequenceHeaderWithIDR = 0x7F00002A,
467 
468     OMX_QcomIndexParamAUDelimiter = 0x7F00002B,
469 
470     OMX_QcomIndexParamVideoDownScalar = 0x7F00002C,
471 
472     /* "OMX.QCOM.index.param.video.FramePackingExtradata" */
473     OMX_QcomIndexParamVideoFramePackingExtradata = 0x7F00002D,
474 
475     /* "OMX.QCOM.index.config.activeregiondetection" */
476     OMX_QcomIndexConfigActiveRegionDetection = 0x7F00002E,
477 
478     /* "OMX.QCOM.index.config.activeregiondetectionstatus" */
479     OMX_QcomIndexConfigActiveRegionDetectionStatus = 0x7F00002F,
480 
481     /* "OMX.QCOM.index.config.scalingmode" */
482     OMX_QcomIndexConfigScalingMode = 0x7F000030,
483 
484     /* "OMX.QCOM.index.config.noisereduction" */
485     OMX_QcomIndexConfigNoiseReduction = 0x7F000031,
486 
487     /* "OMX.QCOM.index.config.imageenhancement" */
488     OMX_QcomIndexConfigImageEnhancement = 0x7F000032,
489 
490     /* google smooth-streaming support */
491     OMX_QcomIndexParamVideoAdaptivePlaybackMode = 0x7F000033,
492 
493     /* H.264 MVC codec index */
494     QOMX_IndexParamVideoMvc = 0x7F000034,
495 
496     /* "OMX.QCOM.index.param.video.QPExtradata" */
497     OMX_QcomIndexParamVideoQPExtraData = 0x7F000035,
498 
499     /* "OMX.QCOM.index.param.video.InputBitsInfoExtradata" */
500     OMX_QcomIndexParamVideoInputBitsInfoExtraData = 0x7F000036,
501 
502     /* VP8 Hierarchical P support */
503     OMX_QcomIndexHierarchicalStructure = 0x7F000037,
504 
505     OMX_QcomIndexParamH264VUITimingInfo = 0x7F000039,
506 
507     OMX_QcomIndexParamPeakBitrate = 0x7F00003A,
508 
509     /* Enable InitialQP : QOMX_EXTNINDEX_VIDEO_INITIALQP */
510     QOMX_IndexParamVideoInitialQp = 0x7F00003B,
511 
512     OMX_QcomIndexParamSetMVSearchrange = 0x7F00003C,
513 
514     /* Note: This will get deprecated */
515     OMX_QcomIndexConfigPerfLevel = 0x7F00003D,
516 
517     /*"OMX.QCOM.index.param.video.LTRCount"*/
518     OMX_QcomIndexParamVideoLTRCount = QOMX_IndexParamVideoLTRCount,
519 
520     /*"OMX.QCOM.index.config.video.LTRUse"*/
521     OMX_QcomIndexConfigVideoLTRUse = QOMX_IndexConfigVideoLTRUse,
522 
523     /*"OMX.QCOM.index.config.video.LTRMark"*/
524     OMX_QcomIndexConfigVideoLTRMark = QOMX_IndexConfigVideoLTRMark,
525 
526     /*"OMX.QCOM.index.param.video.CustomBufferSize"*/
527     OMX_QcomIndexParamVideoCustomBufferSize = 0x7F00003E,
528 
529     /* Max Hierarchical P layers */
530     OMX_QcomIndexMaxHierarchicallayers = 0x7F000041,
531 
532     OMX_QcomIndexFlexibleYUVDescription = 0x7F000044,
533 
534     /* Vpp Hqv Control Type */
535     OMX_QcomIndexParamVppHqvControl = 0x7F000045,
536 
537     /* Enable VPP */
538     OMX_QcomIndexParamEnableVpp = 0x7F000046,
539 
540     /* MBI statistics mode */
541     OMX_QcomIndexParamMBIStatisticsMode = 0x7F000047,
542 
543     /* Set PictureTypeDecode */
544     OMX_QcomIndexConfigPictureTypeDecode = 0x7F000048,
545 
546     OMX_QcomIndexConfigH264EntropyCodingCabac = 0x7F000049,
547 
548     /* "OMX.QCOM.index.param.video.InputBatch" */
549     OMX_QcomIndexParamBatchSize = 0x7F00004A,
550 
551     OMX_QcomIndexConfigNumHierPLayers = 0x7F00004B,
552 
553     OMX_QcomIndexConfigRectType = 0x7F00004C,
554 
555     OMX_QcomIndexConfigBaseLayerId = 0x7F00004E,
556 
557     OMX_QcomIndexParamDriverVersion = 0x7F00004F,
558 
559     /* Reference : OMX_QCOM_VIDEO_CONFIG_QP */
560     OMX_QcomIndexConfigQp = 0x7F000050,
561 
562     OMX_QcomIndexParamVencAspectRatio = 0x7F000051,
563 
564     OMX_QTIIndexParamPassInputBufferFd = 0x7F000054,
565 
566     /* Set Prefer-adaptive playback*/
567     /* "OMX.QTI.index.param.video.PreferAdaptivePlayback" */
568     OMX_QTIIndexParamVideoPreferAdaptivePlayback = 0x7F000055,
569 
570     /* Set time params */
571     OMX_QTIIndexConfigSetTimeData = 0x7F000056,
572     /* Force Compressed format for DPB when resolution <=1080p
573      * and OPB is cpu_access */
574     /* OMX.QTI.index.param.video.ForceCompressedForDPB */
575     OMX_QTIIndexParamForceCompressedForDPB = 0x7F000057,
576 
577     /* Enable ROI info */
578     OMX_QTIIndexParamVideoEnableRoiInfo = 0x7F000058,
579 
580     /* Configure ROI info */
581     OMX_QTIIndexConfigVideoRoiInfo = 0x7F000059,
582 
583     /* Set Low Latency Mode */
584     OMX_QTIIndexParamLowLatencyMode = 0x7F00005B,
585 
586     /* Force OPB to UnCompressed mode */
587     OMX_QTIIndexParamForceUnCompressedForOPB = 0x7F00005C,
588 
589     /* OMX.google.android.index.allocateNativeHandle */
590     OMX_GoogleAndroidIndexAllocateNativeHandle = 0x7F00005D,
591 
592     /* Configure BLUR resolution for encode */
593     OMX_QTIIndexConfigVideoBlurResolution = 0x7F00005E,
594 
595     /* QP range for I/P/B frames : OMX_QCOM_VIDEO_PARAM_IPB_QPRANGETYPE */
596     OMX_QcomIndexParamVideoIPBQPRange = 0x7F00005F,
597 
598     /* Enable client extradata */
599     OMX_QTIIndexParamVideoClientExtradata = 0x7F000060,
600 
601     /* H264 transform 8x8 mode */
602     OMX_QcomIndexConfigH264Transform8x8 = 0x7F000061,
603 
604     /*"OMX.google.android.index.describeColorAspects"*/
605     OMX_QTIIndexConfigDescribeColorAspects = 0x7F000062,
606 
607     OMX_QTIIndexParamVUIExtraDataExtraData = 0x7F000063,
608 
609     OMX_QTIIndexParamMPEG2SeqDispExtraData = 0x7F000064,
610 
611     OMX_QTIIndexParamVC1SeqDispExtraData = 0x7F000065,
612 
613     OMX_QTIIndexParamVPXColorSpaceExtraData = 0x7F000066,
614 
615     /*"OMX.google.android.index.describeHDRStaticInfo"*/
616     OMX_QTIIndexConfigDescribeHDRColorInfo = 0x7F000067,
617 
618     /* Configure to disable PQ*/
619     OMX_QTIIndexParamDisablePQ = 0x7F000068,
620 
621     /* Dither control for 10bit */
622     OMX_QTIIndexParamDitherControl = 0x7F000069,
623 
624     /* use av-timer ticks as timestamp (used by VT-client) */
625     OMX_QTIIndexParamEnableAVTimerTimestamps = 0x7F000071,
626 
627     /* Output Crop extradata (includes MISR) */
628     OMX_QcomIndexParamOutputCropExtraData = 0x7F000072,
629 
630     /* Controlled Input queue mode for frame accurate configuration */
631     OMX_QcomIndexParamVencControlInputQueue = 0x7F000073,
632 
633     /**
634     *  Configure Slice Header Spacing
635     *  This index will be used to configure both byte based
636     *  and MB based slice header spacing. This is the preferred
637     *  alternative to OMX_IndexParamVideoAvc (for MB based)
638     *  and OMX_IndexParamVideoErrorCorrection (for byte based)
639     */
640     OMX_QcomIndexParamVideoSliceSpacing = 0x7F000074,
641 
642     /* OMX.QTI.index.config.video.getdsmode */
643     OMX_QTIIndexConfigGetDSMode = 0x7F000075,
644 
645     /*
646      * Client configured profile and level for sufficiency
647      * This index will be set by the OMX client which will
648      * specify profile and level of the clip upto which
649      * buffer sufficiency should be considered. if the profile
650      * or level of the clip exceeds the client specified
651      * profile and level via this index, sufficient buffer
652      * events will be converted to insufficient.
653      * Structure to be used for this extension is:
654      * typedef struct OMX_VIDEO_PARAM_PROFILELEVELTYPE {
655      * OMX_U32 nSize;
656      * OMX_VERSIONTYPE nVersion;
657      * OMX_U32 nPortIndex;
658      * OMX_U32 eProfile;
659      * OMX_U32 eLevel;
660      * OMX_U32 nProfileIndex; // index not needed
661      * } OMX_VIDEO_PARAM_PROFILELEVELTYPE;
662      */
663     OMX_QTIIndexParamClientConfiguredProfileLevelForSufficiency = 0x7F000076,
664 
665     /* TME configuration */
666     OMX_IndexParamVideoTme = 0x7F000077,
667 
668     /* Set Color Space Conversion */
669     OMX_QTIIndexParamColorSpaceConversion = 0x7F000078,
670 
671     /* Enable linear color format */
672     OMX_QTIIndexParamEnableLinearColorFormat = 0x7F000079,
673 
674     /* Enable Blur */
675     OMX_QTIIndexParamVideoEnableBlur = 0x7F00007A,
676 
677     /* Vbv Delay*/
678     OMX_QTIIndexParamVbvDelay = 0x7F00007B,
679 
680     /* Capabilities */
681     OMX_QTIIndexParamCapabilitiesVTDriverVersion = 0x7F100000,
682 
683     OMX_QTIIndexParamCapabilitiesMaxTemporalLayers = 0x7F100001,
684 
685     OMX_QTIIndexParamCapabilitiesMaxLTR = 0x7F100002,
686 
687     OMX_QTIIndexParamCapabilitiesMaxDownScaleRatio = 0x7F100003,
688 
689     OMX_QTIIndexParamCapabilitiesRotationSupport = 0x7F100004,
690 
691     OMX_QTIIndexParamNativeRecorder = 0x7F100005,
692     OMX_QTIIndexParamVideoDecoderOutputFrameRate = 0x7F100006,
693 
694     /* Configure Rectangle Region based ROI info */
695     OMX_QTIIndexConfigVideoRoiRectRegionInfo = 0x7F100007,
696 
697     /*"OMX.google.android.index.describeHDR10PlusInfo"*/
698     OMX_QTIIndexConfigDescribeHDR10PlusInfo = 0x7F100008,
699 
700     /* Configure Bitrate Savings (CAC) */
701     OMX_QTIIndexConfigContentAdaptiveCoding = 0x7F100009,
702 };
703 
704 /**
705 * This is custom extension to configure Low Latency Mode.
706 *
707 * STRUCT MEMBERS
708 *
709 * nSize         : Size of Structure in bytes
710 * nVersion      : OpenMAX IL specification version information
711 * bEnableLowLatencyMode   : Enable/Disable Low Latency mode
712 * nNumFrames    : Latency in terms of num of frames
713 *                 0: Minimum possible latency,
714 *                 n: n-frame latency
715 *                 Valid when bEnableLowLatencyMode is TRUE
716 */
717 
718 typedef struct QOMX_EXTNINDEX_VIDEO_LOW_LATENCY_MODE
719 {
720    OMX_U32 nSize;
721    OMX_VERSIONTYPE nVersion;
722    OMX_BOOL bEnableLowLatencyMode;
723    OMX_U32  nNumFrames;
724 } QOMX_EXTNINDEX_VIDEO_LOW_LATENCY_MODE;
725 
726 /**
727 * This is custom extension to configure Encoder Aspect Ratio.
728 *
729 * STRUCT MEMBERS
730 *
731 * nSize         : Size of Structure in bytes
732 * nVersion      : OpenMAX IL specification version information
733 * nSARWidth     : Horizontal aspect size
734 * nSARHeight    : Vertical aspect size
735 */
736 
737 typedef struct QOMX_EXTNINDEX_VIDEO_VENC_SAR
738 {
739    OMX_U32 nSize;
740    OMX_VERSIONTYPE nVersion;
741    OMX_U32 nSARWidth;
742    OMX_U32 nSARHeight;
743 } QOMX_EXTNINDEX_VIDEO_VENC_SAR;
744 
745 /**
746 * This is custom extension to configure Hier-p layers.
747 * This mode configures Hier-p layers dynamically.
748 *
749 * STRUCT MEMBERS
750 *
751 * nSize         : Size of Structure in bytes
752 * nVersion      : OpenMAX IL specification version information
753 * nNumHierLayers: Set the number of Hier-p layers for the session
754 *                  - This should be less than the MAX Hier-P
755 *                    layers set for the session.
756 */
757 
758 typedef struct QOMX_EXTNINDEX_VIDEO_HIER_P_LAYERS {
759    OMX_U32 nSize;
760    OMX_VERSIONTYPE nVersion;
761    OMX_U32 nNumHierLayers;
762 } QOMX_EXTNINDEX_VIDEO_HIER_P_LAYERS;
763 
764 /**
765  * Initial QP parameter.  This structure is used to enable
766  * vendor specific extension to let client enable setting
767  * initial QP values to I P B Frames
768  *
769  * STRUCT MEMBERS:
770  *  nSize              : Size of Structure in bytes
771  *  nVersion           : OpenMAX IL specification version information
772  *  nPortIndex         : Index of the port to which this structure applies
773  *  OMX_U32 nQpI       : First Iframe QP
774  *  OMX_U32 nQpP       : First Pframe QP
775  *  OMX_U32 nQpB       : First Bframe QP
776  *  OMX_U32 bEnableInitQp : Bit field indicating which frame type(s) shall
777  *                             use the specified initial QP.
778  *                          Bit 0: Enable initial QP for I/IDR
779  *                                 and use value specified in nInitQpI
780  *                          Bit 1: Enable initial QP for
781  *                                 and use value specified in nInitQpP
782  *                          Bit 2: Enable initial QP for B
783  *                                 and use value specified in nInitQpB
784  */
785 typedef struct QOMX_EXTNINDEX_VIDEO_INITIALQP {
786     OMX_U32 nSize;
787     OMX_VERSIONTYPE nVersion;
788     OMX_U32 nPortIndex;
789     OMX_U32 nQpI;
790     OMX_U32 nQpP;
791     OMX_U32 nQpB;
792     OMX_U32 bEnableInitQp;
793 } QOMX_EXTNINDEX_VIDEO_INITIALQP;
794 
795 /**
796  * Extension index parameter.  This structure is used to enable
797  * vendor specific extension on input/output port and
798  * to pass the required flags and data, if any.
799  * The format of flags and data being passed is known to
800  * the client and component apriori.
801  *
802  * STRUCT MEMBERS:
803  *  nSize              : Size of Structure plus pData size
804  *  nVersion           : OMX specification version information
805  *  nPortIndex         : Indicates which port to set
806  *  bEnable            : Extension index enable (1) or disable (0)
807  *  nFlags             : Extension index flags, if any
808  *  nDataSize          : Size of the extension index data to follow
809  *  pData              : Extension index data, if present.
810  */
811 typedef struct QOMX_EXTNINDEX_PARAMTYPE {
812     OMX_U32 nSize;
813     OMX_VERSIONTYPE nVersion;
814     OMX_U32 nPortIndex;
815     OMX_BOOL bEnable;
816     OMX_U32 nFlags;
817     OMX_U32 nDataSize;
818     OMX_PTR pData;
819 } QOMX_EXTNINDEX_PARAMTYPE;
820 
821 /**
822  * Range index parameter.  This structure is used to enable
823  * vendor specific extension on input/output port and
824  * to pass the required minimum and maximum values
825  *
826  * STRUCT MEMBERS:
827  *  nSize              : Size of Structure in bytes
828  *  nVersion           : OpenMAX IL specification version information
829  *  nPortIndex         : Index of the port to which this structure applies
830  *  nMin               : Minimum value
831  *  nMax               : Maximum value
832  *  nSteSize           : Step size
833  */
834 typedef struct QOMX_EXTNINDEX_RANGETYPE {
835     OMX_U32 nSize;
836     OMX_VERSIONTYPE nVersion;
837     OMX_U32 nPortIndex;
838     OMX_S32 nMin;
839     OMX_S32 nMax;
840     OMX_S32 nStepSize;
841 } QOMX_EXTNINDEX_RANGETYPE;
842 
843 /**
844  * LTR count index parameter.  This structure is used
845  * to enable vendor specific extension on output port
846  * to pass the LTR count information.
847  *
848  * STRUCT MEMBERS:
849  *  nSize              : Size of Structure in bytes
850  *  nVersion           : OpenMAX IL specification version information
851  *  nPortIndex         : Index of the port to which this structure applies
852  *  nCount             : Specifies the number of LTR frames stored in the
853  *                       encoder component
854  */
855 typedef struct QOMX_VIDEO_PARAM_LTRCOUNT_TYPE {
856     OMX_U32 nSize;
857     OMX_VERSIONTYPE nVersion;
858     OMX_U32 nPortIndex;
859     OMX_U32 nCount;
860 } QOMX_VIDEO_PARAM_LTRCOUNT_TYPE;
861 
862 
863 /**
864  * This should be used with OMX_QcomIndexParamVideoLTRCount extension.
865  */
866 typedef QOMX_VIDEO_PARAM_LTRCOUNT_TYPE OMX_QCOM_VIDEO_PARAM_LTRCOUNT_TYPE;
867 
868 /**
869  * Marks the next encoded frame as an LTR frame.
870  * STRUCT MEMBERS:
871  *  nSize              : Size of Structure in bytes
872  *  nVersion           : OpenMAX IL specification version information
873  *  nPortIndex         : Index of the port to which this structure applies
874  *  nID                : Specifies the identifier of the LTR frame to be marked
875  *                       as reference frame for encoding subsequent frames.
876  */
877 typedef struct QOMX_VIDEO_CONFIG_LTRMARK_TYPE {
878     OMX_U32 nSize;
879     OMX_VERSIONTYPE nVersion;
880     OMX_U32 nPortIndex;
881     OMX_U32 nID;
882 } QOMX_VIDEO_CONFIG_LTRMARK_TYPE;
883 
884 /**
885  * This should be used with OMX_QcomIndexConfigVideoLTRMark extension.
886  */
887 typedef QOMX_VIDEO_CONFIG_LTRMARK_TYPE OMX_QCOM_VIDEO_CONFIG_LTRMARK_TYPE;
888 
889 /**
890  * Specifies an LTR frame to encode subsequent frames.
891  * STRUCT MEMBERS:
892  *  nSize              : Size of Structure in bytes
893  *  nVersion           : OpenMAX IL specification version information
894  *  nPortIndex         : Index of the port to which this structure applies
895  *  nID                : Specifies the identifier of the LTR frame to be used
896                          as reference frame for encoding subsequent frames.
897  *  nFrames            : Specifies the number of subsequent frames to be
898                          encoded using the LTR frame with its identifier
899                          nID as reference frame. Short-term reference frames
900                          will be used thereafter. The value of 0xFFFFFFFF
901                          indicates that all subsequent frames will be
902                          encodedusing this LTR frame as reference frame.
903  */
904 typedef struct QOMX_VIDEO_CONFIG_LTRUSE_TYPE {
905     OMX_U32 nSize;
906     OMX_VERSIONTYPE nVersion;
907     OMX_U32 nPortIndex;
908     OMX_U32 nID;
909     OMX_U32 nFrames;
910 } QOMX_VIDEO_CONFIG_LTRUSE_TYPE;
911 
912 /**
913  * This should be used with OMX_QcomIndexConfigVideoLTRUse extension.
914  */
915 typedef QOMX_VIDEO_CONFIG_LTRUSE_TYPE OMX_QCOM_VIDEO_CONFIG_LTRUSE_TYPE;
916 
917 /**
918  * Enumeration used to define the video encoder modes
919  *
920  * ENUMS:
921  *  EncoderModeDefault : Default video recording mode.
922  *                       All encoder settings made through
923  *                       OMX_SetParameter/OMX_SetConfig are applied. No
924  *                       parameter is overridden.
925  *  EncoderModeMMS : Video recording mode for MMS (Multimedia Messaging
926  *                   Service). This mode is similar to EncoderModeDefault
927  *                   except that here the Rate control mode is overridden
928  *                   internally and set as a variant of variable bitrate with
929  *                   variable frame rate. After this mode is set if the IL
930  *                   client tries to set OMX_VIDEO_CONTROLRATETYPE via
931  *                   OMX_IndexParamVideoBitrate that would be rejected. For
932  *                   this, client should set mode back to EncoderModeDefault
933  *                   first and then change OMX_VIDEO_CONTROLRATETYPE.
934  */
935 typedef enum QOMX_VIDEO_ENCODERMODETYPE
936 {
937     QOMX_VIDEO_EncoderModeDefault        = 0x00,
938     QOMX_VIDEO_EncoderModeMMS            = 0x01,
939     QOMX_VIDEO_EncoderModeMax            = 0x7FFFFFFF
940 } QOMX_VIDEO_ENCODERMODETYPE;
941 
942 /**
943  * This structure is used to set the video encoder mode.
944  *
945  * STRUCT MEMBERS:
946  *  nSize      : Size of the structure in bytes
947  *  nVersion   : OMX specification version info
948  *  nPortIndex : Port that this structure applies to
949  *  nMode : defines the video encoder mode
950  */
951 typedef struct QOMX_VIDEO_PARAM_ENCODERMODETYPE {
952     OMX_U32 nSize;
953     OMX_VERSIONTYPE nVersion;
954     OMX_U32 nPortIndex;
955     QOMX_VIDEO_ENCODERMODETYPE nMode;
956 } QOMX_VIDEO_PARAM_ENCODERMODETYPE;
957 
958 /**
959  * This structure describes the parameters corresponding to the
960  * QOMX_VIDEO_SYNTAXHDRTYPE extension. This parameter can be queried
961  * during the loaded state.
962  */
963 
964 typedef struct QOMX_VIDEO_SYNTAXHDRTYPE
965 {
966    OMX_U32 nSize;           /** Size of the structure in bytes */
967    OMX_VERSIONTYPE nVersion;/** OMX specification version information */
968    OMX_U32 nPortIndex;      /** Portindex which is extended by this structure */
969    OMX_U32 nBytes;          /** The number of bytes filled in to the buffer */
970    OMX_U8 data[1];          /** Buffer to store the header information */
971 } QOMX_VIDEO_SYNTAXHDRTYPE;
972 
973 /**
974  * This structure describes the parameters corresponding to the
975  * QOMX_VIDEO_TEMPORALSPATIALTYPE extension. This parameter can be set
976  * dynamically during any state except the state invalid.  This is primarily
977  * used for setting MaxQP from the application.  This is set on the out port.
978  */
979 
980 typedef struct QOMX_VIDEO_TEMPORALSPATIALTYPE
981 {
982    OMX_U32 nSize;           /** Size of the structure in bytes */
983    OMX_VERSIONTYPE nVersion;/** OMX specification version information */
984    OMX_U32 nPortIndex;      /** Portindex which is extended by this structure */
985    OMX_U32 nTSFactor;       /** Temoral spatial tradeoff factor value in 0-100 */
986 } QOMX_VIDEO_TEMPORALSPATIALTYPE;
987 
988 /**
989  * This structure describes the parameters corresponding to the
990  * OMX_QCOM_VIDEO_CONFIG_INTRAPERIODTYPE extension. This parameter can be set
991  * dynamically during any state except the state invalid.  This is set on the out port.
992  */
993 
994 typedef struct QOMX_VIDEO_INTRAPERIODTYPE
995 {
996    OMX_U32 nSize;           /** Size of the structure in bytes */
997    OMX_VERSIONTYPE nVersion;/** OMX specification version information */
998    OMX_U32 nPortIndex;      /** Portindex which is extended by this structure */
999    OMX_U32 nIDRPeriod;      /** This specifies coding a frame as IDR after every nPFrames
1000                                 of intra frames. If this parameter is set to 0, only the
1001                                 first frame of the encode session is an IDR frame. This
1002                                 field is ignored for non-AVC codecs and is used only for
1003                                 codecs that support IDR Period */
1004    OMX_U32 nPFrames;         /** The number of "P" frames between two "I" frames */
1005    OMX_U32 nBFrames;         /** The number of "B" frames between two "I" frames */
1006 } QOMX_VIDEO_INTRAPERIODTYPE;
1007 
1008 /**
1009  * This structure describes the parameters corresponding to the
1010  * OMX_QCOM_VIDEO_CONFIG_ULBUFFEROCCUPANCYTYPE extension. This parameter can be set
1011  * dynamically during any state except the state invalid. This is used for the buffer negotiation
1012  * with other clients.  This is set on the out port.
1013  */
1014 typedef struct OMX_QCOM_VIDEO_CONFIG_ULBUFFEROCCUPANCYTYPE
1015 {
1016    OMX_U32 nSize;            /** Size of the structure in bytes */
1017    OMX_VERSIONTYPE nVersion; /** OMX specification version information */
1018    OMX_U32 nPortIndex;       /** Portindex which is extended by this structure */
1019    OMX_U32 nBufferOccupancy; /** The number of bytes to be set for the buffer occupancy */
1020 } OMX_QCOM_VIDEO_CONFIG_ULBUFFEROCCUPANCYTYPE;
1021 
1022 /**
1023  * This structure describes the parameters corresponding to the
1024  * OMX_QCOM_VIDEO_CONFIG_RANDOMINTRAREFRESHTYPE extension. This parameter can be set
1025  * dynamically during any state except the state invalid. This is primarily used for the dynamic/random
1026  * intrarefresh.  This is set on the out port.
1027  */
1028 typedef struct OMX_QCOM_VIDEO_CONFIG_RANDOMINTRAREFRESHTYPE
1029 {
1030    OMX_U32 nSize;           /** Size of the structure in bytes */
1031    OMX_VERSIONTYPE nVersion;/** OMX specification version information */
1032    OMX_U32 nPortIndex;      /** Portindex which is extended by this structure */
1033    OMX_U32 nRirMBs;         /** The number of MBs to be set for intrarefresh */
1034 } OMX_QCOM_VIDEO_CONFIG_RANDOMINTRAREFRESHTYPE;
1035 
1036 /**
1037  * This structure describes the parameters for the
1038  * OMX_QcomIndexParamAUDelimiter extension. It enables/disables
1039  * the AU delimiters in H264/HEVC stream.
1040  */
1041 typedef struct OMX_QCOM_VIDEO_CONFIG_AUD
1042 {
1043     OMX_U32 nSize;           /** Size of the structure in bytes */
1044     OMX_VERSIONTYPE nVersion;/** OMX specification version information */
1045     OMX_BOOL bEnable;        /** Enable/disable the setting */
1046 } OMX_QCOM_VIDEO_CONFIG_AUD;
1047 
1048 #define QOMX_VIDEO_HIGH_PERF_OPERATING_MODE    (0x7FFFFFFF)
1049 
1050 /**
1051  * Note: This will get deprecated
1052  */
1053 typedef enum QOMX_VIDEO_PERF_LEVEL
1054 {
1055     OMX_QCOM_PerfLevelNominal,
1056     OMX_QCOM_PerfLevelTurbo
1057 } QOMX_VIDEO_PERF_LEVEL;
1058 
1059 /**
1060   * This structure describes the parameters corresponding
1061   * to OMX_QcomIndexParamPerfLevel extension. It will set
1062   * the performance mode specified as QOMX_VIDEO_PERF_LEVEL.
1063   * Note: This will get deprecated
1064   */
1065 typedef struct OMX_QCOM_VIDEO_PARAM_PERF_LEVEL {
1066     OMX_U32 nSize;                      /** Size of the structure in bytes */
1067     OMX_VERSIONTYPE nVersion;           /** OMX specification version information */
1068     QOMX_VIDEO_PERF_LEVEL ePerfLevel;   /** Performance level */
1069 } OMX_QCOM_VIDEO_PARAM_PERF_LEVEL;
1070 
1071 /**
1072  * This structure describes the parameters corresponding
1073  * to OMX_QcomIndexConfigPerfLevel extension. It will set
1074  * the performance mode specified as QOMX_VIDEO_PERF_LEVEL.
1075  * Note: This will get deprecated
1076  */
1077 typedef struct OMX_QCOM_VIDEO_CONFIG_PERF_LEVEL {
1078     OMX_U32 nSize;                      /** Size of the structure in bytes */
1079     OMX_VERSIONTYPE nVersion;           /** OMX specification version information */
1080     QOMX_VIDEO_PERF_LEVEL ePerfLevel;   /** Performance level */
1081 } OMX_QCOM_VIDEO_CONFIG_PERF_LEVEL;
1082 
1083 typedef enum QOMX_VIDEO_PICTURE_TYPE_DECODE
1084 {
1085     OMX_QCOM_PictypeDecode_IPB,
1086     OMX_QCOM_PictypeDecode_I
1087 } QOMX_VIDEO_PICTURE_TYPE_DECODE;
1088 
1089 /**
1090  * This structure describes the parameters corresponding
1091  * to OMX_QcomIndexConfigPictureTypeDecode extension. It
1092  * will set the picture type decode specified by eDecodeType.
1093  */
1094 typedef struct OMX_QCOM_VIDEO_CONFIG_PICTURE_TYPE_DECODE {
1095     OMX_U32 nSize;                      /** Size of the structure in bytes */
1096     OMX_VERSIONTYPE nVersion;           /** OMX specification version information */
1097     QOMX_VIDEO_PICTURE_TYPE_DECODE eDecodeType;   /** Decode type */
1098 } OMX_QCOM_VIDEO_CONFIG_PICTURE_TYPE_DECODE;
1099 
1100 /**
1101  * This structure describes the parameters corresponding
1102  * to OMX_QcomIndexParamH264VUITimingInfo extension. It
1103  * will enable/disable the VUI timing info.
1104  */
1105 typedef struct OMX_QCOM_VIDEO_PARAM_VUI_TIMING_INFO {
1106     OMX_U32 nSize;              /** Size of the structure in bytes */
1107     OMX_VERSIONTYPE nVersion;   /** OMX specification version information */
1108     OMX_BOOL bEnable;           /** Enable/disable the setting */
1109 } OMX_QCOM_VIDEO_PARAM_VUI_TIMING_INFO;
1110 
1111 /**
1112  * This structure describes the parameters corresponding
1113  * to OMX_QcomIndexParamPeakBitrate extension. It will
1114  * set the peak bitrate specified by nPeakBitrate.
1115  */
1116 typedef struct OMX_QCOM_VIDEO_PARAM_PEAK_BITRATE {
1117     OMX_U32 nSize;              /** Size of the structure in bytes */
1118     OMX_VERSIONTYPE nVersion;   /** OMX specification version information */
1119     OMX_U32 nPeakBitrate;       /** Peak bitrate value */
1120 } OMX_QCOM_VIDEO_PARAM_PEAK_BITRATE;
1121 
1122 /**
1123  * This structure describes the parameters corresponding
1124  * to OMX_QTIIndexParamForceCompressedForDPB extension. Enabling
1125  * this extension will force the split mode DPB(compressed)/OPB(Linear)
1126  * for all resolutions.On some chipsets preferred mode would be combined
1127  * Linear for both DPB/OPB to save memory. For example on 8996 preferred mode
1128  * would be combined linear for resolutions <= 1080p .
1129  * Enabling this might save power but with the cost
1130  * of increased memory i.e almost double the number on output YUV buffers.
1131  */
1132 typedef struct OMX_QTI_VIDEO_PARAM_FORCE_COMPRESSED_FOR_DPB_TYPE {
1133     OMX_U32 nSize;              /** Size of the structure in bytes */
1134     OMX_VERSIONTYPE nVersion;   /** OMX specification version information */
1135     OMX_BOOL bEnable;           /** Enable/disable the setting */
1136 } OMX_QTI_VIDEO_PARAM_FORCE_COMPRESSED_FOR_DPB_TYPE;
1137 
1138 /**
1139  * This structure describes the parameters corresponding
1140  * to OMX_QTIIndexParamForceUnCompressedForOPB extension. Enabling this
1141  * extension will force the OPB to be linear for the current video session.
1142  * If this property is not set, then the OPB will be set to linear or compressed
1143  * based on resolution selected and/or if cpu access is requested on the
1144  * OPB buffer.
1145  */
1146 typedef struct OMX_QTI_VIDEO_PARAM_FORCE_UNCOMPRESSED_FOR_OPB_TYPE {
1147     OMX_U32 nSize;              /** Sizeo f the structure in bytes */
1148     OMX_VERSIONTYPE nVersion;   /** OMX specification version information */
1149     OMX_BOOL bEnable;           /** Enable/disable the setting */
1150 } OMX_QTI_VIDEO_PARAM_FORCE_UNCOMPRESSED_FOR_OPB_TYPE;
1151 
1152 typedef struct OMX_VENDOR_EXTRADATATYPE  {
1153     OMX_U32 nPortIndex;
1154     OMX_U32 nDataSize;
1155     OMX_U8  *pData;     // cdata (codec_data/extradata)
1156 } OMX_VENDOR_EXTRADATATYPE;
1157 
1158 /**
1159  * This structure describes the parameters corresponding to the
1160  * OMX_VENDOR_VIDEOFRAMERATE extension. This parameter can be set
1161  * dynamically during any state except the state invalid. This is
1162  * used for frame rate to be set from the application. This
1163  * is set on the in port.
1164  */
1165 typedef struct OMX_VENDOR_VIDEOFRAMERATE  {
1166    OMX_U32 nSize;           /** Size of the structure in bytes */
1167    OMX_VERSIONTYPE nVersion;/** OMX specification version information */
1168    OMX_U32 nPortIndex;      /** Portindex which is extended by this structure */
1169    OMX_U32 nFps;            /** Frame rate value */
1170    OMX_BOOL bEnabled;       /** Flag to enable or disable client's frame rate value */
1171 } OMX_VENDOR_VIDEOFRAMERATE;
1172 
1173 typedef enum OMX_INDEXVENDORTYPE {
1174     OMX_IndexVendorFileReadInputFilename = 0xFF000001,
1175     OMX_IndexVendorParser3gpInputFilename = 0xFF000002,
1176     OMX_IndexVendorVideoExtraData = 0xFF000003,
1177     OMX_IndexVendorAudioExtraData = 0xFF000004,
1178     OMX_IndexVendorVideoFrameRate = 0xFF000005,
1179 } OMX_INDEXVENDORTYPE;
1180 
1181 typedef enum OMX_QCOM_VC1RESOLUTIONTYPE
1182 {
1183    OMX_QCOM_VC1_PICTURE_RES_1x1,
1184    OMX_QCOM_VC1_PICTURE_RES_2x1,
1185    OMX_QCOM_VC1_PICTURE_RES_1x2,
1186    OMX_QCOM_VC1_PICTURE_RES_2x2
1187 } OMX_QCOM_VC1RESOLUTIONTYPE;
1188 
1189 typedef enum OMX_QCOM_INTERLACETYPE
1190 {
1191     OMX_QCOM_InterlaceFrameProgressive,
1192     OMX_QCOM_InterlaceInterleaveFrameTopFieldFirst,
1193     OMX_QCOM_InterlaceInterleaveFrameBottomFieldFirst,
1194     OMX_QCOM_InterlaceFrameTopFieldFirst,
1195     OMX_QCOM_InterlaceFrameBottomFieldFirst,
1196     OMX_QCOM_InterlaceFieldTop,
1197     OMX_QCOM_InterlaceFieldBottom
1198 }OMX_QCOM_INTERLACETYPE;
1199 
1200 typedef struct OMX_QCOM_PARAM_VIDEO_INTERLACETYPE
1201 {
1202     OMX_U32 nSize;           /** Size of the structure in bytes */
1203     OMX_VERSIONTYPE nVersion;/** OMX specification version information */
1204     OMX_U32 nPortIndex;    /** Portindex which is extended by this structure */
1205     OMX_BOOL bInterlace;  /** Interlace content **/
1206 }OMX_QCOM_PARAM_VIDEO_INTERLACETYPE;
1207 
1208 typedef struct OMX_QCOM_CONFIG_INTERLACETYPE
1209 {
1210     OMX_U32 nSize;
1211     OMX_VERSIONTYPE nVersion;
1212     OMX_U32 nPortIndex;
1213     OMX_U32 nIndex;
1214     OMX_QCOM_INTERLACETYPE eInterlaceType;
1215 }OMX_QCOM_CONFIG_INTERLACETYPE;
1216 
1217 #define MAX_PAN_SCAN_WINDOWS 4
1218 
1219 typedef struct OMX_QCOM_MISR_INFO {
1220 	unsigned int misr_set;
1221 	unsigned int misr_dpb_luma[8];
1222 	unsigned int misr_dpb_chroma[8];
1223 	unsigned int misr_opb_luma[8];
1224 	unsigned int misr_opb_chroma[8];
1225 } OMX_QCOM_MISR_INFO;
1226 
1227 typedef struct OMX_QCOM_OUTPUT_CROP {
1228     OMX_U32 size;
1229     OMX_U32 version;
1230     OMX_U32 port_index;
1231     OMX_U32 left;
1232     OMX_U32 top;
1233     OMX_U32 display_width;
1234     OMX_U32 display_height;
1235     OMX_U32 width;
1236     OMX_U32 height;
1237     OMX_U32 frame_num;
1238     OMX_U32 bit_depth_y;
1239     OMX_U32 bit_depth_c;
1240     OMX_QCOM_MISR_INFO misr_info[2];
1241 } OMX_QCOM_OUTPUT_CROP;
1242 
1243 typedef struct OMX_QCOM_PANSCAN
1244 {
1245    OMX_U32 numWindows;
1246    OMX_QCOMRectangle window[MAX_PAN_SCAN_WINDOWS];
1247 } OMX_QCOM_PANSCAN;
1248 
1249 typedef struct OMX_QCOM_ASPECT_RATIO
1250 {
1251    OMX_U32 aspectRatioX;
1252    OMX_U32 aspectRatioY;
1253 } OMX_QCOM_ASPECT_RATIO;
1254 
1255 typedef struct OMX_QCOM_DISPLAY_ASPECT_RATIO
1256 {
1257    OMX_U32 displayVerticalSize;
1258    OMX_U32 displayHorizontalSize;
1259 } OMX_QCOM_DISPLAY_ASPECT_RATIO;
1260 
1261 typedef struct OMX_QCOM_FRAME_PACK_ARRANGEMENT
1262 {
1263   OMX_U32 nSize;
1264   OMX_VERSIONTYPE nVersion;
1265   OMX_U32 nPortIndex;
1266   OMX_U32 id;
1267   OMX_U32 cancel_flag;
1268   OMX_U32 type;
1269   OMX_U32 quincunx_sampling_flag;
1270   OMX_U32 content_interpretation_type;
1271   OMX_U32 spatial_flipping_flag;
1272   OMX_U32 frame0_flipped_flag;
1273   OMX_U32 field_views_flag;
1274   OMX_U32 current_frame_is_frame0_flag;
1275   OMX_U32 frame0_self_contained_flag;
1276   OMX_U32 frame1_self_contained_flag;
1277   OMX_U32 frame0_grid_position_x;
1278   OMX_U32 frame0_grid_position_y;
1279   OMX_U32 frame1_grid_position_x;
1280   OMX_U32 frame1_grid_position_y;
1281   OMX_U32 reserved_byte;
1282   OMX_U32 repetition_period;
1283   OMX_U32 extension_flag;
1284 } OMX_QCOM_FRAME_PACK_ARRANGEMENT;
1285 
1286 typedef struct OMX_QCOM_EXTRADATA_QP
1287 {
1288    OMX_U32        nQP;
1289    OMX_U32        nQPSum;           /* Decode Only */
1290    OMX_U32        nSkipQPSum;       /* Decode Only */
1291    OMX_U32        nSkipNumBlocks;   /* Decode Only */
1292    OMX_U32        nTotalNumBlocks;  /* Decode Only */
1293 } OMX_QCOM_EXTRADATA_QP;
1294 
1295 typedef struct OMX_QCOM_EXTRADATA_BITS_INFO
1296 {
1297    OMX_U32 header_bits;
1298    OMX_U32 frame_bits;
1299 } OMX_QCOM_EXTRADATA_BITS_INFO;
1300 
1301 typedef struct OMX_QCOM_EXTRADATA_USERDATA {
1302    OMX_U32 type;
1303    OMX_U32 data[1];
1304 } OMX_QCOM_EXTRADATA_USERDATA;
1305 
1306 typedef struct OMX_QCOM_EXTRADATA_FRAMEINFO
1307 {
1308    // common frame meta data. interlace related info removed
1309    OMX_VIDEO_PICTURETYPE  ePicType;
1310    OMX_QCOM_INTERLACETYPE interlaceType;
1311    OMX_QCOM_PANSCAN       panScan;
1312    OMX_QCOM_ASPECT_RATIO  aspectRatio;
1313    OMX_QCOM_DISPLAY_ASPECT_RATIO displayAspectRatio;
1314    OMX_U32                nConcealedMacroblocks;
1315    OMX_U32                nRecoverySeiFlag;
1316    OMX_U32                nFrameRate;
1317    OMX_TICKS              nTimeStamp;
1318 } OMX_QCOM_EXTRADATA_FRAMEINFO;
1319 
1320 typedef struct OMX_QCOM_EXTRADATA_FRAMEDIMENSION
1321 {
1322    /** Frame Dimensions added to each YUV buffer */
1323    OMX_U32   nDecWidth;  /** Width  rounded to multiple of 16 */
1324    OMX_U32   nDecHeight; /** Height rounded to multiple of 16 */
1325    OMX_U32   nActualWidth; /** Actual Frame Width */
1326    OMX_U32   nActualHeight; /** Actual Frame Height */
1327 
1328 } OMX_QCOM_EXTRADATA_FRAMEDIMENSION;
1329 
1330 typedef struct OMX_QCOM_H264EXTRADATA
1331 {
1332    OMX_U64 seiTimeStamp;
1333 } OMX_QCOM_H264EXTRADATA;
1334 
1335 typedef struct OMX_QCOM_VC1EXTRADATA
1336 {
1337    OMX_U32                     nVC1RangeY;
1338    OMX_U32                     nVC1RangeUV;
1339    OMX_QCOM_VC1RESOLUTIONTYPE eVC1PicResolution;
1340 } OMX_QCOM_VC1EXTRADATA;
1341 
1342 typedef union OMX_QCOM_EXTRADATA_CODEC_DATA
1343 {
1344    OMX_QCOM_H264EXTRADATA h264ExtraData;
1345    OMX_QCOM_VC1EXTRADATA vc1ExtraData;
1346 } OMX_QCOM_EXTRADATA_CODEC_DATA;
1347 
1348 typedef struct OMX_QCOM_EXTRADATA_MBINFO
1349 {
1350    OMX_U32 nFormat;
1351    OMX_U32 nDataSize;
1352    OMX_U8  data[0];
1353 } OMX_QCOM_EXTRADATA_MBINFO;
1354 
1355 typedef struct OMX_QTI_VIDEO_PARAM_ENABLE_ROIINFO {
1356     OMX_U32         nSize;
1357     OMX_VERSIONTYPE nVersion;
1358     OMX_U32         nPortIndex;
1359     OMX_BOOL        bEnableRoiInfo;
1360 } OMX_QTI_VIDEO_PARAM_ENABLE_ROIINFO;
1361 
1362 #define MAX_ROI_MBINFO_SIZE 36864 /* 4096*2304/256 */
1363 
1364 /**
1365  * Specifies ROI deltaQP information for a frame. This information must be provided
1366  * via SetConfig before ETB. If client sends it after the ETB, it will be ignored.
1367  * STRUCT MEMBERS:
1368  *  nSize              : Size of Structure in bytes
1369  *  nVersion           : OpenMAX IL specification version information
1370  *  nPortIndex         : Index of the port to which this structure applies
1371  *  nTimeStamp         : TimeStamp of the ETB, to which the ROI data will be applied.
1372  *  nRoiMBInfoCount    : Total deltaQP values provided by the Client.
1373  *                       Total MB/LCU = (MB/LCU)_Width * (MB/LCU)_Height
1374  *                       for H264:
1375  *                           MB_Width  = (frame_width +15) >>4;
1376  *                           MB_Height = (frame_height +15) >>4;
1377  *                       for H265:
1378  *                           LCU_Width  = (frame_width + 31) >>5;
1379  *                           LCU_Height = (frame_height +31) >>5;
1380  *  pRoiMBInfo[]       : Array containing the deltaQP(1 per MacroBlock) values of a frame.
1381  */
1382 typedef struct OMX_QTI_VIDEO_CONFIG_ROIINFO {
1383     OMX_U32         nSize;
1384     OMX_VERSIONTYPE nVersion;
1385     OMX_U32         nPortIndex;
1386     OMX_BOOL        bUseRoiInfo;
1387     OMX_TICKS       nTimeStamp;
1388     OMX_S32         nRoiMBInfoCount;
1389     OMX_S8          pRoiMBInfo[MAX_ROI_MBINFO_SIZE];
1390 } OMX_QTI_VIDEO_CONFIG_ROIINFO;
1391 
1392 typedef struct QOMX_VIDEO_RECT_REGION_DELTAQP {
1393     OMX_U32 nLeft;
1394     OMX_U32 nTop;
1395     OMX_U32 nRight;
1396     OMX_U32 nBottom;
1397     OMX_S8  nDeltaQP;
1398 } QOMX_VIDEO_RECT_REGION_DELTAQP;
1399 
1400 #define MAX_RECT_ROI_NUM 10
1401 /* *
1402  *  Specifies the region based ROI deltaQP information for each frame to support
1403  *  MediaCodec VendorExtension usage. The client should send it before ETB.
1404  *  STRUCT MEMBERS:
1405  *  nSize                 : Size of Structure in bytes.
1406  *  nVersion              : OpenMAX IL spcification version information.
1407  *  nPortIndex            : Index of the port to which this structure applies.
1408  *  nTimeStamp            : TimeStamp of the ETB, to which the ROI data will be applied.
1409  *  nRegionNum            : The numbers of the roi regions, the maximum number is 10 which
1410  *                          is aligned with vender extension's maximum numbers.
1411  *  nRegions              : The array of rectangle region's area and delta qp value.
1412  */
1413 typedef struct OMX_QTI_VIDEO_CONFIG_ROI_RECT_REGION_INFO {
1414     OMX_U32         nSize;
1415     OMX_VERSIONTYPE nVersion;
1416     OMX_U32         nPortIndex;
1417     OMX_TICKS       nTimeStamp;
1418     OMX_U32         nRegionNum;
1419     QOMX_VIDEO_RECT_REGION_DELTAQP  nRegions[MAX_RECT_ROI_NUM];
1420 } OMX_QTI_VIDEO_CONFIG_ROI_RECT_REGION_INFO;
1421 
1422 /**
1423  * Specifies the Blur resolution or Enable/Disable config.
1424  * When enabled, a filter will be applied to the input YUV, to
1425  * achieve an effect similar to downscaling to the BLUR
1426  * resolution specified in nBlurInfo. Blur effect is applied
1427  * starting from the next IDR frame.
1428  *
1429  *  nSize              : Size of Structure in bytes
1430  *  nVersion           : OpenMAX IL specification version information
1431  *  nPortIndex         : Index of the port.
1432  *  nBlurInfo        0 : Disable Blur. If set before start, blur
1433  *                       is disabled throughout the session.
1434  *                   1 : Enable Blur. Must be set before start.
1435  *                       Blur is applied when valid resolution
1436  *                       is set.
1437  *                   n : Custom resolution, bit[31:16] for width
1438  *                       bit[15:0] for height.
1439 */
1440 
1441 typedef struct OMX_QTI_VIDEO_CONFIG_BLURINFO {
1442     OMX_U32         nSize;
1443     OMX_VERSIONTYPE nVersion;
1444     OMX_U32         nPortIndex;
1445     OMX_U32         nBlurInfo;
1446 } OMX_QTI_VIDEO_CONFIG_BLURINFO;
1447 
1448 typedef enum OMX_QCOM_EXTRADATATYPE
1449 {
1450     OMX_ExtraDataFrameInfo =               0x7F000001,
1451     OMX_ExtraDataH264 =                    0x7F000002,
1452     OMX_ExtraDataVC1 =                     0x7F000003,
1453     OMX_ExtraDataFrameDimension =          0x7F000004,
1454     OMX_ExtraDataVideoEncoderSliceInfo =   0x7F000005,
1455     OMX_ExtraDataConcealMB =               0x7F000006,
1456     OMX_ExtraDataInterlaceFormat =         0x7F000007,
1457     OMX_ExtraDataPortDef =                 0x7F000008,
1458     OMX_ExtraDataMP2ExtnData =             0x7F000009,
1459     OMX_ExtraDataMP2UserData =             0x7F00000a,
1460     OMX_ExtraDataVideoLTRInfo =            0x7F00000b,
1461     OMX_ExtraDataFramePackingArrangement = 0x7F00000c,
1462     OMX_ExtraDataQP =                      0x7F00000d,
1463     OMX_ExtraDataInputBitsInfo =           0x7F00000e,
1464     OMX_ExtraDataVideoEncoderMBInfo =      0x7F00000f,
1465     OMX_ExtraDataDisplayColourSEI =        0x7F000011,
1466     OMX_ExtraDataLightLevelSEI =           0x7F000012,
1467     OMX_ExtraDataOutputCropInfo =          0x7F000014,
1468     OMX_ExtraDataInputROIInfo =            0x7F000058,
1469 } OMX_QCOM_EXTRADATATYPE;
1470 
1471 /**
1472  * Basic extradata includes:
1473  *     decoder: output_crop, num_concealed_mb, interlaced_format,
1474                 vui_display_info, vpx_color, mpeg2_seqdisp, MLL, CLL
1475        encoder: none
1476    Others are advanced extradata, except encoder ROI
1477  */
1478 typedef enum OMX_QTI_EXTRADATACATEGORY {
1479     OMX_QTI_ExtraDataCategory_Basic =       1,
1480     OMX_QTI_ExtraDataCategory_Advanced =    2,
1481     OMX_QTI_ExtraDataCategory_Enc_ROI =     4,
1482 } OMX_QTI_EXTRADATA_ENABLE_TYPE;
1483 
1484 /**
1485  * Below enums are used to indicate the type of each
1486  * extradata packet in the extradata buffer.
1487  */
1488 typedef enum OMX_QTI_VIDC_EXTRADATATYPE
1489 {
1490     OMX_QTI_VIDC_ExtraData_None =                       0x00000000,
1491     OMX_QTI_VIDC_ExtraData_InterlaceFormat =            0x00000002,
1492     OMX_QTI_VIDC_ExtraData_Timestamp =                  0x00000005,
1493     OMX_QTI_VIDC_ExtraData_FramePacking =               0x00000006,
1494     OMX_QTI_VIDC_ExtraData_FrameRate =                  0x00000007,
1495     OMX_QTI_VIDC_ExtraData_PanscanWindow =              0x00000008,
1496     OMX_QTI_VIDC_ExtraData_RecoveryPointSEI =           0x00000009,
1497     OMX_QTI_VIDC_ExtraData_Mpeg2SeqDisp =               0x0000000D,
1498     OMX_QTI_VIDC_ExtraData_StreamUserData =             0x0000000E,
1499     OMX_QTI_VIDC_ExtraData_FrameQP =                    0x0000000F,
1500     OMX_QTI_VIDC_ExtraData_FrameBitsInfo =              0x00000010,
1501     OMX_QTI_VIDC_ExtraData_VPXColorSpaceInfo =          0x00000014,
1502     OMX_QTI_VIDC_ExtraData_MasteringDisplayColourSEI =  0x00000015,
1503     OMX_QTI_VIDC_ExtraData_ContentLightLevelSEI =       0x00000016,
1504     OMX_QTI_VIDC_ExtraData_UBWCStatInfo =               0x00000019,
1505     OMX_QTI_VIDC_ExtraData_OutputCropInfo =             0x0700000F,
1506     OMX_QTI_VIDC_ExtraData_ROIInfo =                    0x7F000058,
1507     OMX_QTI_VIDC_ExtraData_NumConcealedMB =             0x7F100001,
1508     OMX_QTI_VIDC_ExtraData_Index =                      0x7F100002,
1509     OMX_QTI_VIDC_ExtraData_AspectRatio =                0x7F100003,
1510     OMX_QTI_VIDC_ExtraData_LTRInfo =                    0x7F100004,
1511     OMX_QTI_VIDC_ExtraData_VUIDisplayInfo =             0x7F100006,
1512     OMX_QTI_VIDC_ExtraData_HDR10HIST =                  0x7F100008,
1513 } OMX_QTI_VIDC_EXTRADATATYPE;
1514 
1515 struct ExtraDataMap {
1516         const char *type;
1517         OMX_QTI_VIDC_EXTRADATATYPE index;
1518 };
1519 static const struct ExtraDataMap kExtradataMap[] = {
1520         { "outputcropinfo", OMX_QTI_VIDC_ExtraData_OutputCropInfo },
1521         { "ltrinfo", OMX_QTI_VIDC_ExtraData_LTRInfo },
1522         { "concealmbinfo", OMX_QTI_VIDC_ExtraData_NumConcealedMB },
1523 };
1524 
getIndexForExtradataType(char * type)1525 static inline OMX_S32 getIndexForExtradataType(char * type) {
1526     if(type == NULL) return -1;
1527     for(int i = 0; i< (int)(sizeof(kExtradataMap)/ sizeof(struct ExtraDataMap)); i++){
1528         if(!strcmp(kExtradataMap[i].type,type)){
1529             return kExtradataMap[i].index;
1530         }
1531     }
1532     return -1;
1533 }
1534 
getStringForExtradataType(int64_t index)1535 static inline const char * getStringForExtradataType(int64_t index) {
1536     for(int i = 0; i< (int)(sizeof(kExtradataMap)/sizeof(struct ExtraDataMap)); i++){
1537         if(kExtradataMap[i].index == index){
1538             return kExtradataMap[i].type;
1539         }
1540     }
1541     return NULL;
1542 }
1543 
1544 /* Start of definitions are extradata payload structures for OMX_QTI_VIDC_EXTRADATATYPE */
1545 
1546 /* Below extradata types payload structure are currently not exposed
1547  *  OMX_QTI_VIDC_ExtraData_Mpeg2SeqDisp
1548  *  OMX_QTI_VIDC_ExtraData_VPXColorSpaceInfo
1549  *  OMX_QTI_VIDC_ExtraData_VUIDisplayInfo
1550  *  OMX_QTI_VIDC_ExtraData_MasteringDisplayColourSEI
1551  *  OMX_QTI_VIDC_ExtraData_ContentLightLevelSEI
1552  *  OMX_QTI_VIDC_ExtraData_UBWCStatInfo
1553  *  OMX_QTI_VIDC_ExtraData_HDR10HIST
1554  */
1555 
1556 typedef enum OMX_QTI_VIDC_INTERLACE_FORMATTYPE {
1557     OMX_QTI_VIDC_InterlaceFrameProgressive =                   0x1,
1558     OMX_QTI_VIDC_InterlaceInterleaveFrameTopFieldFirst =       0x2,
1559     OMX_QTI_VIDC_InterlaceInterleaveFrameBottomFieldFirst =    0x4,
1560     OMX_QTI_VIDC_InterlaceFrameTopFieldFirst =                 0x8,
1561     OMX_QTI_VIDC_InterlaceFrameBottomFieldFirst =              0x10,
1562     OMX_QTI_VIDC_InterlaceMBAFF =                              0x20,
1563 } OMX_QTI_VIDC_INTERLACE_FORMATTYPE;
1564 
1565 typedef struct OMX_QTI_VIDC_EXTRADATA_INTERFACE_TYPE {
1566     OMX_QTI_VIDC_INTERLACE_FORMATTYPE eInterlaceFormat;
1567     OMX_U32 eColorFormat;
1568 } OMX_QTI_VIDC_EXTRADATA_INTERFACE_TYPE;
1569 
1570 typedef struct OMX_QTI_VIDC_EXTRADATA_TIMESTAMP_TYPE {
1571     OMX_U32 nTimeStampLow;    /**< Lower 32 bit value of the time stamp */
1572     OMX_U32 nTimeStampHigh;   /**< Higher 32 bit value of the time stamp */
1573 } OMX_QTI_VIDC_EXTRADATA_TIMESTAMP_TYPE;
1574 
1575 typedef struct OMX_QTI_VIDC_EXTRADATA_FRAMEPACKING_TYPE {
1576     OMX_U32 id;
1577     OMX_U32 cancel_flag;
1578     OMX_U32 type;
1579     OMX_U32 quincunx_sampling_flag;
1580     OMX_U32 content_interpretation_type;
1581     OMX_U32 spatial_flipping_flag;
1582     OMX_U32 frame0_flipped_flag;
1583     OMX_U32 field_views_flag;
1584     OMX_U32 current_frame_is_frame0_flag;
1585     OMX_U32 frame0_self_contained_flag;
1586     OMX_U32 frame1_self_contained_flag;
1587     OMX_U32 frame0_grid_position_x;
1588     OMX_U32 frame0_grid_position_y;
1589     OMX_U32 frame1_grid_position_x;
1590     OMX_U32 frame1_grid_position_y;
1591     OMX_U32 reserved_byte;
1592     OMX_U32 repetition_period;
1593     OMX_U32 extension_flag;
1594 } OMX_QTI_VIDC_EXTRADATA_FRAMEPACKING_TYPE;
1595 
1596 typedef struct OMX_QTI_VIDC_EXTRADATA_FRAMERATE_TYPE {
1597     OMX_U32 xFrameRate;     /* In Q16 format */
1598 } OMX_QTI_VIDC_EXTRADATA_FRAMERATE_TYPE;
1599 
1600 typedef struct OMX_QTI_VIDC_WINDOW
1601 {
1602     OMX_S32 dx;
1603     OMX_S32 dy;
1604     OMX_S32 x;
1605     OMX_S32 y;
1606 } OMX_QTI_VIDC_WINDOW;
1607 
1608 typedef struct OMX_QTI_VIDC_EXTRADATA_PANSCAN_TYPE
1609 {
1610     OMX_U32 numWindows;
1611     OMX_QTI_VIDC_WINDOW window[MAX_PAN_SCAN_WINDOWS];
1612 } OMX_QTI_VIDC_EXTRADATA_PANSCAN_TYPE;
1613 
1614 typedef struct OMX_QTI_VIDC_EXTRADATA_RECOVERYSEI_TYPE {
1615     OMX_U32 nFlag;     /* QOMX_VIDEO_RECOVERYSEITYPE */
1616 } OMX_QTI_VIDC_EXTRADATA_RECOVERYSEI_TYPE;
1617 
1618 typedef struct OMX_QTI_VIDC_EXTRADATA_CONCEALMB_TYPE {
1619     OMX_U32 nNumMBConcealed;
1620 } OMX_QTI_VIDC_EXTRADATA_CONCEALMB_TYPE;
1621 
1622 typedef struct OMX_QTI_VIDC_EXTRADATA_LTRINFO_TYPE {
1623     OMX_U32 nLTRInfo;
1624 } OMX_QTI_VIDC_EXTRADATA_LTRINFO_TYPE;
1625 
1626 typedef struct OMX_QCOM_EXTRADATA_USERDATA OMX_QTI_VIDC_EXTRADATA_USERDATA_TYPE;
1627 
1628 typedef struct OMX_QCOM_EXTRADATA_QP OMX_QTI_VIDC_EXTRADATA_FRAMEQP_TYPE;
1629 
1630 typedef struct OMX_QCOM_EXTRADATA_BITS_INFO OMX_QTI_VIDC_EXTRADATA_FRAMEBITS_TYPE;
1631 
1632 typedef struct OMX_QCOM_OUTPUT_CROP OMX_QTI_VIDC_EXTRADATA_OUTPUTCROP_TYPE;
1633 
1634 typedef struct OMX_QTI_VIDC_EXTRADATA_ASPECTRATIO_TYPE
1635 {
1636     OMX_U32 nSize;
1637     OMX_U32 nVersion;
1638     OMX_U32 nPortIndex;
1639     OMX_U32 aspectRatioX;
1640     OMX_U32 aspectRatioY;
1641 } OMX_QTI_VIDC_EXTRADATA_ASPECTRATIO_TYPE;
1642 
1643 /* End of definitions for extradata payload structures for OMX_QTI_VIDC_EXTRADATATYPE */
1644 
1645 typedef struct  OMX_STREAMINTERLACEFORMATTYPE {
1646     OMX_U32 nSize;
1647     OMX_VERSIONTYPE nVersion;
1648     OMX_U32 nPortIndex;
1649     OMX_BOOL bInterlaceFormat;
1650     OMX_U32 nInterlaceFormats;
1651 } OMX_STREAMINTERLACEFORMAT;
1652 
1653 typedef enum OMX_INTERLACETYPE
1654 {
1655    OMX_InterlaceFrameProgressive,
1656    OMX_InterlaceInterleaveFrameTopFieldFirst,
1657    OMX_InterlaceInterleaveFrameBottomFieldFirst,
1658    OMX_InterlaceFrameTopFieldFirst,
1659    OMX_InterlaceFrameBottomFieldFirst
1660 } OMX_INTERLACES;
1661 
1662 typedef enum QOMX_VIDEO_RECOVERYSEITYPE {
1663 /*
1664  * 0: Frame reconstruction is incorrect
1665  *   a) Open Gop, frames before recovery point SEI
1666  * 1: Frame reconstruction is correct.
1667  *   a) Closed Gop, When decoding starts from the top of closed GOP at IDR
1668  *   b) Open Gop, Output at and subsequent to recovery point SEI with
1669  *      exact_match_flag = true
1670  * 2: Frame reconstruction is approximately correct:
1671  *   a) Closed Gop, When decoding starts from a P/B/I frames wihtout
1672  *      any recovery point SEI information
1673  *   b) Open Gop, Output at and subsequent to recovery point SEI with
1674  *      exact_match_flag = false
1675  * In case flag is set to 0 or 2, DATACORRUPT shall be enabled
1676  * for buffer (nFlags) in FILL_BUFFER_DONE
1677  */
1678     OMX_FRAME_RECONSTRUCTION_INCORRECT = 0,
1679     OMX_FRAME_RECONSTRUCTION_CORRECT = 1,
1680     OMX_FRAME_RECONSTRUCTION_APPROXIMATELY_CORRECT = 2
1681 } QOMX_VIDEO_RECOVERYSEI;
1682 
1683 #define OMX_EXTRADATA_HEADER_SIZE 20
1684 
1685 /**
1686  * AVC profile types, each profile indicates support for various
1687  * performance bounds and different annexes.
1688  */
1689 typedef enum QOMX_VIDEO_AVCPROFILETYPE {
1690     QOMX_VIDEO_AVCProfileBaseline      = OMX_VIDEO_AVCProfileBaseline,
1691     QOMX_VIDEO_AVCProfileMain          = OMX_VIDEO_AVCProfileMain,
1692     QOMX_VIDEO_AVCProfileExtended      = OMX_VIDEO_AVCProfileExtended,
1693     QOMX_VIDEO_AVCProfileHigh          = OMX_VIDEO_AVCProfileHigh,
1694     QOMX_VIDEO_AVCProfileHigh10        = OMX_VIDEO_AVCProfileHigh10,
1695     QOMX_VIDEO_AVCProfileHigh422       = OMX_VIDEO_AVCProfileHigh422,
1696     QOMX_VIDEO_AVCProfileHigh444       = OMX_VIDEO_AVCProfileHigh444,
1697     QOMX_VIDEO_AVCProfileConstrainedBaseline = OMX_VIDEO_AVCProfileConstrainedBaseline,
1698     QOMX_VIDEO_AVCProfileConstrainedHigh     = OMX_VIDEO_AVCProfileConstrainedHigh,
1699     /* QCom specific profile indexes */
1700     QOMX_VIDEO_AVCProfileConstrained         = OMX_VIDEO_AVCProfileVendorStartUnused
1701 } QOMX_VIDEO_AVCPROFILETYPE;
1702 
1703 
1704 /**
1705  * H.264 MVC Profiles
1706   */
1707 typedef enum QOMX_VIDEO_MVCPROFILETYPE {
1708     QOMX_VIDEO_MVCProfileStereoHigh = 0x1,
1709     QOMX_VIDEO_MVCProfileMultiViewHigh = 0x2,
1710     QOMX_VIDEO_MVCProfileKhronosExtensions = 0x6F000000,
1711     QOMX_VIDEO_MVCProfileVendorStartUnused = 0x7F000000,
1712     QOMX_VIDEO_MVCProfileMax = 0x7FFFFFFF
1713 } QOMX_VIDEO_MVCPROFILETYPE;
1714 
1715 /**
1716  * H.264 MVC Levels
1717   */
1718 typedef enum QOMX_VIDEO_MVCLEVELTYPE {
1719     QOMX_VIDEO_MVCLevel1   = 0x01,     /**< Level 1 */
1720     QOMX_VIDEO_MVCLevel1b  = 0x02,     /**< Level 1b */
1721     QOMX_VIDEO_MVCLevel11  = 0x04,     /**< Level 1.1 */
1722     QOMX_VIDEO_MVCLevel12  = 0x08,     /**< Level 1.2 */
1723     QOMX_VIDEO_MVCLevel13  = 0x10,     /**< Level 1.3 */
1724     QOMX_VIDEO_MVCLevel2   = 0x20,     /**< Level 2 */
1725     QOMX_VIDEO_MVCLevel21  = 0x40,     /**< Level 2.1 */
1726     QOMX_VIDEO_MVCLevel22  = 0x80,     /**< Level 2.2 */
1727     QOMX_VIDEO_MVCLevel3   = 0x100,    /**< Level 3 */
1728     QOMX_VIDEO_MVCLevel31  = 0x200,    /**< Level 3.1 */
1729     QOMX_VIDEO_MVCLevel32  = 0x400,    /**< Level 3.2 */
1730     QOMX_VIDEO_MVCLevel4   = 0x800,    /**< Level 4 */
1731     QOMX_VIDEO_MVCLevel41  = 0x1000,   /**< Level 4.1 */
1732     QOMX_VIDEO_MVCLevel42  = 0x2000,   /**< Level 4.2 */
1733     QOMX_VIDEO_MVCLevel5   = 0x4000,   /**< Level 5 */
1734     QOMX_VIDEO_MVCLevel51  = 0x8000,   /**< Level 5.1 */
1735     QOMX_VIDEO_MVCLevelKhronosExtensions = 0x6F000000,
1736     QOMX_VIDEO_MVCLevelVendorStartUnused = 0x7F000000,
1737     QOMX_VIDEO_MVCLevelMax = 0x7FFFFFFF
1738 } QOMX_VIDEO_MVCLEVELTYPE;
1739 
1740 /**
1741  * DivX Versions
1742  */
1743 typedef enum  QOMX_VIDEO_DIVXFORMATTYPE {
1744     QOMX_VIDEO_DIVXFormatUnused = 0x01, /**< Format unused or unknown */
1745     QOMX_VIDEO_DIVXFormat311    = 0x02, /**< DivX 3.11 */
1746     QOMX_VIDEO_DIVXFormat4      = 0x04, /**< DivX 4 */
1747     QOMX_VIDEO_DIVXFormat5      = 0x08, /**< DivX 5 */
1748     QOMX_VIDEO_DIVXFormat6      = 0x10, /**< DivX 6 */
1749     QOMX_VIDEO_DIVXFormatKhronosExtensions = 0x6F000000,
1750     QOMX_VIDEO_DIVXFormatVendorStartUnused = 0x7F000000,
1751     QOMX_VIDEO_DIVXFormatMax = 0x7FFFFFFF
1752 } QOMX_VIDEO_DIVXFORMATTYPE;
1753 
1754 /**
1755  * DivX profile types, each profile indicates support for
1756  * various performance bounds.
1757  */
1758 typedef enum QOMX_VIDEO_DIVXPROFILETYPE {
1759     QOMX_VIDEO_DivXProfileqMobile = 0x01, /**< qMobile Profile */
1760     QOMX_VIDEO_DivXProfileMobile  = 0x02, /**< Mobile Profile */
1761     QOMX_VIDEO_DivXProfileMT      = 0x04, /**< Mobile Theatre Profile */
1762     QOMX_VIDEO_DivXProfileHT      = 0x08, /**< Home Theatre Profile */
1763     QOMX_VIDEO_DivXProfileHD      = 0x10, /**< High Definition Profile */
1764     QOMX_VIDEO_DIVXProfileKhronosExtensions = 0x6F000000,
1765     QOMX_VIDEO_DIVXProfileVendorStartUnused = 0x7F000000,
1766     QOMX_VIDEO_DIVXProfileMax = 0x7FFFFFFF
1767 } QOMX_VIDEO_DIVXPROFILETYPE;
1768 
1769 /**
1770  * DivX Video Params
1771  *
1772  *  STRUCT MEMBERS:
1773  *  nSize      : Size of the structure in bytes
1774  *  nVersion   : OMX specification version information
1775  *  nPortIndex : Port that this structure applies to
1776  *  eFormat    : Version of DivX stream / data
1777  *  eProfile   : Profile of DivX stream / data
1778  */
1779 typedef struct QOMX_VIDEO_PARAM_DIVXTYPE {
1780     OMX_U32 nSize;
1781     OMX_VERSIONTYPE nVersion;
1782     OMX_U32 nPortIndex;
1783     QOMX_VIDEO_DIVXFORMATTYPE eFormat;
1784     QOMX_VIDEO_DIVXPROFILETYPE eProfile;
1785 } QOMX_VIDEO_PARAM_DIVXTYPE;
1786 
1787 
1788 
1789 /**
1790  *  VP Versions
1791  */
1792 typedef enum QOMX_VIDEO_VPFORMATTYPE {
1793     QOMX_VIDEO_VPFormatUnused = 0x01, /**< Format unused or unknown */
1794     QOMX_VIDEO_VPFormat6      = 0x02, /**< VP6 Video Format */
1795     QOMX_VIDEO_VPFormat7      = 0x04, /**< VP7 Video Format */
1796     QOMX_VIDEO_VPFormat8      = 0x08, /**< VP8 Video Format */
1797     QOMX_VIDEO_VPFormat9      = 0x10, /**< VP9 Video Format */
1798     QOMX_VIDEO_VPFormatKhronosExtensions = 0x6F000000,
1799     QOMX_VIDEO_VPFormatVendorStartUnused = 0x7F000000,
1800     QOMX_VIDEO_VPFormatMax = 0x7FFFFFFF
1801 } QOMX_VIDEO_VPFORMATTYPE;
1802 
1803 /**
1804  * VP profile types, each profile indicates support for various
1805  * encoding tools.
1806  */
1807 typedef enum QOMX_VIDEO_VPPROFILETYPE {
1808     QOMX_VIDEO_VPProfileSimple   = 0x01, /**< Simple Profile, applies to VP6 only */
1809     QOMX_VIDEO_VPProfileAdvanced = 0x02, /**< Advanced Profile, applies to VP6 only */
1810     QOMX_VIDEO_VPProfileVersion0 = 0x04, /**< Version 0, applies to VP7 and VP8 */
1811     QOMX_VIDEO_VPProfileVersion1 = 0x08, /**< Version 1, applies to VP7 and VP8 */
1812     QOMX_VIDEO_VPProfileVersion2 = 0x10, /**< Version 2, applies to VP8 only */
1813     QOMX_VIDEO_VPProfileVersion3 = 0x20, /**< Version 3, applies to VP8 only */
1814     QOMX_VIDEO_VPProfileKhronosExtensions = 0x6F000000,
1815     QOMX_VIDEO_VPProfileVendorStartUnused = 0x7F000000,
1816     QOMX_VIDEO_VPProfileMax = 0x7FFFFFFF
1817 } QOMX_VIDEO_VPPROFILETYPE;
1818 
1819 /**
1820  * VP Video Params
1821  *
1822  *  STRUCT MEMBERS:
1823  *  nSize      : Size of the structure in bytes
1824  *  nVersion   : OMX specification version information
1825  *  nPortIndex : Port that this structure applies to
1826  *  eFormat    : Format of VP stream / data
1827  *  eProfile   : Profile or Version of VP stream / data
1828  */
1829 typedef struct QOMX_VIDEO_PARAM_VPTYPE {
1830     OMX_U32 nSize;
1831     OMX_VERSIONTYPE nVersion;
1832     OMX_U32 nPortIndex;
1833     QOMX_VIDEO_VPFORMATTYPE eFormat;
1834     QOMX_VIDEO_VPPROFILETYPE eProfile;
1835 } QOMX_VIDEO_PARAM_VPTYPE;
1836 
1837 /**
1838  * Spark Versions
1839  */
1840 typedef enum QOMX_VIDEO_SPARKFORMATTYPE {
1841     QOMX_VIDEO_SparkFormatUnused = 0x01, /**< Format unused or unknown */
1842     QOMX_VIDEO_SparkFormat0      = 0x02, /**< Video Format Version 0 */
1843     QOMX_VIDEO_SparkFormat1      = 0x04, /**< Video Format Version 1 */
1844     QOMX_VIDEO_SparkFormatKhronosExtensions = 0x6F000000,
1845     QOMX_VIDEO_SparkFormatVendorStartUnused = 0x7F000000,
1846     QOMX_VIDEO_SparkFormatMax = 0x7FFFFFFF
1847 } QOMX_VIDEO_SPARKFORMATTYPE;
1848 
1849 /**
1850  * Spark Video Params
1851  *
1852  *  STRUCT MEMBERS:
1853  *  nSize      : Size of the structure in bytes
1854  *  nVersion   : OMX specification version information
1855  *  nPortIndex : Port that this structure applies to
1856  *  eFormat    : Version of Spark stream / data
1857  */
1858 typedef struct QOMX_VIDEO_PARAM_SPARKTYPE {
1859     OMX_U32 nSize;
1860     OMX_VERSIONTYPE nVersion;
1861     OMX_U32 nPortIndex;
1862     QOMX_VIDEO_SPARKFORMATTYPE eFormat;
1863 } QOMX_VIDEO_PARAM_SPARKTYPE;
1864 
1865 typedef enum QOMX_VIDEO_TMEPROFILETYPE {
1866     QOMX_VIDEO_TMEProfile0  = 0x1,
1867     QOMX_VIDEO_TMEProfile1  = 0x2,
1868     QOMX_VIDEO_TMEProfile2  = 0x4,
1869     QOMX_VIDEO_TMEProfile3  = 0x8,
1870 } QOMX_VIDEO_TMEPROFILETYPE;
1871 
1872 typedef enum QOMX_VIDEO_TMELEVELTYPE {
1873     QOMX_VIDEO_TMELevelInteger  = 0x1,
1874 } QOMX_VIDEO_TMELEVELTYPE;
1875 
1876 typedef struct QOMX_VIDEO_PARAM_TMETYPE {
1877     OMX_U32 nSize;
1878     OMX_VERSIONTYPE nVersion;
1879     OMX_U32 nPortIndex;
1880     QOMX_VIDEO_TMEPROFILETYPE eProfile;
1881     QOMX_VIDEO_TMELEVELTYPE eLevel;
1882     OMX_U32 ePayloadVersion;
1883 } QOMX_VIDEO_PARAM_TMETYPE;
1884 
1885 typedef struct QOMX_VIDEO_QUERY_DECODER_INSTANCES {
1886     OMX_U32 nSize;
1887     OMX_VERSIONTYPE nVersion;
1888     OMX_U32 nPortIndex;
1889     OMX_U32 nNumOfInstances;
1890 } QOMX_VIDEO_QUERY_DECODER_INSTANCES;
1891 
1892 typedef struct QOMX_ENABLETYPE {
1893     OMX_U32 nSize;
1894     OMX_VERSIONTYPE nVersion;
1895     OMX_BOOL bEnable;
1896 } QOMX_ENABLETYPE;
1897 
1898 typedef struct QOMX_DISABLETYPE {
1899     OMX_U32 nSize;
1900     OMX_VERSIONTYPE nVersion;
1901     OMX_BOOL bDisable;
1902 } QOMX_DISABLETYPE;
1903 
1904 typedef enum QOMX_VIDEO_EVENTS {
1905     OMX_EventIndexsettingChanged = OMX_EventVendorStartUnused
1906 } QOMX_VIDEO_EVENTS;
1907 
1908 typedef enum QOMX_VIDEO_PICTURE_ORDER {
1909     QOMX_VIDEO_DISPLAY_ORDER = 0x1,
1910     QOMX_VIDEO_DECODE_ORDER = 0x2
1911 } QOMX_VIDEO_PICTURE_ORDER;
1912 
1913 typedef struct QOMX_VIDEO_DECODER_PICTURE_ORDER {
1914     OMX_U32 nSize;
1915     OMX_VERSIONTYPE nVersion;
1916     OMX_U32 nPortIndex;
1917     QOMX_VIDEO_PICTURE_ORDER eOutputPictureOrder;
1918 } QOMX_VIDEO_DECODER_PICTURE_ORDER;
1919 
1920 typedef struct QOMX_INDEXEXTRADATATYPE {
1921     OMX_U32 nSize;
1922     OMX_VERSIONTYPE nVersion;
1923     OMX_U32 nPortIndex;
1924     OMX_BOOL bEnabled;
1925     OMX_INDEXTYPE nIndex;
1926 } QOMX_INDEXEXTRADATATYPE;
1927 
1928 typedef struct QOMX_INDEXTIMESTAMPREORDER {
1929     OMX_U32 nSize;
1930     OMX_VERSIONTYPE nVersion;
1931     OMX_U32 nPortIndex;
1932     OMX_BOOL bEnable;
1933 } QOMX_INDEXTIMESTAMPREORDER;
1934 
1935 typedef struct QOMX_INDEXDOWNSCALAR {
1936     OMX_U32 nSize;
1937     OMX_VERSIONTYPE nVersion;
1938     OMX_U32 nPortIndex;
1939     OMX_BOOL bEnable;
1940     OMX_U32 nOutputWidth;
1941     OMX_U32 nOutputHeight;
1942 } QOMX_INDEXDOWNSCALAR;
1943 
1944 typedef struct QOMX_VIDEO_CUSTOM_BUFFERSIZE {
1945         OMX_U32 nSize;
1946         OMX_VERSIONTYPE nVersion;
1947         OMX_U32 nPortIndex;
1948         OMX_U32 nBufferSize;
1949 } QOMX_VIDEO_CUSTOM_BUFFERSIZE;
1950 
1951 typedef struct QOMX_VIDEO_OUTPUT_FRAME_RATE {
1952     OMX_U32 nSize;
1953     OMX_VERSIONTYPE nVersion;
1954     OMX_U32 fps;
1955 } QOMX_VIDEO_OUTPUT_FRAME_RATE;
1956 
1957 #define OMX_QCOM_INDEX_PARAM_VIDEO_SYNCFRAMEDECODINGMODE "OMX.QCOM.index.param.video.SyncFrameDecodingMode"
1958 #define OMX_QCOM_INDEX_PARAM_INDEXEXTRADATA "OMX.QCOM.index.param.IndexExtraData"
1959 
1960 #define OMX_QCOM_INDEX_PARAM_VIDEO_HIERSTRUCTURE "OMX.QCOM.index.param.video.HierStructure"
1961 #define OMX_QCOM_INDEX_PARAM_VIDEO_LTRCOUNT "OMX.QCOM.index.param.video.LTRCount"
1962 #define OMX_QCOM_INDEX_PARAM_VIDEO_LTRPERIOD "OMX.QCOM.index.param.video.LTRPeriod"
1963 #define OMX_QCOM_INDEX_CONFIG_VIDEO_LTRUSE "OMX.QCOM.index.config.video.LTRUse"
1964 #define OMX_QCOM_INDEX_CONFIG_VIDEO_LTRMARK "OMX.QCOM.index.config.video.LTRMark"
1965 #define OMX_QCOM_INDEX_CONFIG_VIDEO_HIER_P_LAYERS "OMX.QCOM.index.config.video.hierplayers"
1966 #define OMX_QCOM_INDEX_CONFIG_RECTANGLE_TYPE "OMX.QCOM.index.config.video.rectangle"
1967 #define OMX_QCOM_INDEX_PARAM_VIDEO_BASE_LAYER_ID "OMX.QCOM.index.param.video.baselayerid"
1968 #define OMX_QCOM_INDEX_CONFIG_VIDEO_QP "OMX.QCOM.index.config.video.qp"
1969 #define OMX_QCOM_INDEX_PARAM_VIDEO_SAR "OMX.QCOM.index.param.video.sar"
1970 #define OMX_QTI_INDEX_PARAM_VIDEO_LOW_LATENCY "OMX.QTI.index.param.video.LowLatency"
1971 
1972 #define OMX_QCOM_INDEX_PARAM_VIDEO_PASSINPUTBUFFERFD "OMX.QCOM.index.param.video.PassInputBufferFd"
1973 #define OMX_QTI_INDEX_PARAM_VIDEO_PREFER_ADAPTIVE_PLAYBACK "OMX.QTI.index.param.video.PreferAdaptivePlayback"
1974 #define OMX_QTI_INDEX_CONFIG_VIDEO_SETTIMEDATA "OMX.QTI.index.config.video.settimedata"
1975 #define OMX_QTI_INDEX_PARAM_VIDEO_FORCE_COMPRESSED_FOR_DPB "OMX.QTI.index.param.video.ForceCompressedForDPB"
1976 #define OMX_QTI_INDEX_PARAM_VIDEO_ENABLE_ROIINFO "OMX.QTI.index.param.enableRoiInfo"
1977 #define OMX_QTI_INDEX_CONFIG_VIDEO_ROIINFO "OMX.QTI.index.config.RoiInfo"
1978 #define OMX_QTI_INDEX_CONFIG_VIDEO_BLURINFO "OMX.QTI.index.config.BlurInfo"
1979 #define OMX_QTI_INDEX_PARAM_VIDEO_CLIENT_EXTRADATA "OMX.QTI.index.param.client.extradata"
1980 #define OMX_QTI_INDEX_CONFIG_COLOR_ASPECTS "OMX.google.android.index.describeColorAspects"
1981 #define OMX_QTI_INDEX_CONFIG_VIDEO_GETDSMODE "OMX.QTI.index.config.video.getdsmode"
1982 #define OMX_QTI_INDEX_PARAM_TME "OMX.QTI.index.param.tme"
1983 #define OMX_QTI_INDEX_PARAM_NATIVE_RECORDER "OMX.QTI.index.param.nativeRecorder"
1984 
1985 typedef enum {
1986     QOMX_VIDEO_FRAME_PACKING_CHECKERBOARD = 0,
1987     QOMX_VIDEO_FRAME_PACKING_COLUMN_INTERLEAVE = 1,
1988     QOMX_VIDEO_FRAME_PACKING_ROW_INTERLEAVE = 2,
1989     QOMX_VIDEO_FRAME_PACKING_SIDE_BY_SIDE = 3,
1990     QOMX_VIDEO_FRAME_PACKING_TOP_BOTTOM = 4,
1991     QOMX_VIDEO_FRAME_PACKING_TEMPORAL = 5,
1992 } QOMX_VIDEO_FRAME_PACKING_ARRANGEMENT;
1993 
1994 typedef enum {
1995     QOMX_VIDEO_CONTENT_UNSPECIFIED = 0,
1996     QOMX_VIDEO_CONTENT_LR_VIEW = 1,
1997     QOMX_VIDEO_CONTENT_RL_VIEW = 2,
1998 } QOMX_VIDEO_CONTENT_INTERPRETATION;
1999 
2000 /**
2001  * Specifies the extended picture types. These values should be
2002  * OR'd along with the types defined in OMX_VIDEO_PICTURETYPE to
2003  * signal all pictures types which are allowed.
2004  *
2005  * ENUMS:
2006  *  H.264 Specific Picture Types:   IDR
2007  */
2008 typedef enum QOMX_VIDEO_PICTURETYPE {
2009     QOMX_VIDEO_PictureTypeIDR = OMX_VIDEO_PictureTypeVendorStartUnused + 0x1000
2010 } QOMX_VIDEO_PICTURETYPE;
2011 
2012 #define OMX_QCOM_INDEX_CONFIG_ACTIVE_REGION_DETECTION           "OMX.QCOM.index.config.activeregiondetection"
2013 #define OMX_QCOM_INDEX_CONFIG_ACTIVE_REGION_DETECTION_STATUS    "OMX.QCOM.index.config.activeregiondetectionstatus"
2014 #define OMX_QCOM_INDEX_CONFIG_SCALING_MODE                      "OMX.QCOM.index.config.scalingmode"
2015 #define OMX_QCOM_INDEX_CONFIG_NOISEREDUCTION                    "OMX.QCOM.index.config.noisereduction"
2016 #define OMX_QCOM_INDEX_CONFIG_IMAGEENHANCEMENT                  "OMX.QCOM.index.config.imageenhancement"
2017 #define OMX_QCOM_INDEX_PARAM_HELDBUFFERCOUNT                    "OMX.QCOM.index.param.HeldBufferCount" /**< reference: QOMX_HELDBUFFERCOUNTTYPE */
2018 
2019 
2020 typedef struct QOMX_RECTTYPE {
2021     OMX_U32 nSize;
2022     OMX_VERSIONTYPE nVersion;
2023     OMX_S32 nLeft;
2024     OMX_S32 nTop;
2025     OMX_U32 nWidth;
2026     OMX_U32 nHeight;
2027 } QOMX_RECTTYPE;
2028 
2029 typedef struct QOMX_ACTIVEREGIONDETECTIONTYPE {
2030     OMX_U32 nSize;
2031     OMX_VERSIONTYPE nVersion;
2032     OMX_U32 nPortIndex;
2033     OMX_BOOL bEnable;
2034     QOMX_RECTTYPE sROI;
2035     OMX_U32 nNumExclusionRegions;
2036     QOMX_RECTTYPE sExclusionRegions[1];
2037 } QOMX_ACTIVEREGIONDETECTIONTYPE;
2038 
2039 typedef struct QOMX_ACTIVEREGIONDETECTION_STATUSTYPE {
2040     OMX_U32 nSize;
2041     OMX_VERSIONTYPE nVersion;
2042     OMX_U32 nPortIndex;
2043     OMX_BOOL bDetected;
2044     QOMX_RECTTYPE sDetectedRegion;
2045 } QOMX_ACTIVEREGIONDETECTION_STATUSTYPE;
2046 
2047 typedef enum QOMX_SCALE_MODETYPE {
2048     QOMX_SCALE_MODE_Normal,
2049     QOMX_SCALE_MODE_Anamorphic,
2050     QOMX_SCALE_MODE_Max = 0x7FFFFFFF
2051 } QOMX_SCALE_MODETYPE;
2052 
2053 typedef struct QOMX_SCALINGMODETYPE {
2054     OMX_U32 nSize;
2055     OMX_VERSIONTYPE nVersion;
2056     QOMX_SCALE_MODETYPE  eScaleMode;
2057 } QOMX_SCALINGMODETYPE;
2058 
2059 typedef struct QOMX_NOISEREDUCTIONTYPE {
2060     OMX_U32 nSize;
2061     OMX_VERSIONTYPE nVersion;
2062     OMX_U32 nPortIndex;
2063     OMX_BOOL bEnable;
2064     OMX_BOOL bAutoMode;
2065     OMX_S32 nNoiseReduction;
2066 } QOMX_NOISEREDUCTIONTYPE;
2067 
2068 typedef struct QOMX_IMAGEENHANCEMENTTYPE {
2069     OMX_U32 nSize;
2070     OMX_VERSIONTYPE nVersion;
2071     OMX_U32 nPortIndex;
2072     OMX_BOOL bEnable;
2073     OMX_BOOL bAutoMode;
2074     OMX_S32 nImageEnhancement;
2075 } QOMX_IMAGEENHANCEMENTTYPE;
2076 
2077 /*
2078  * these are part of OMX1.2 but JB MR2 branch doesn't have them defined
2079  * OMX_IndexParamInterlaceFormat
2080  * OMX_INTERLACEFORMATTYPE
2081  */
2082 #ifndef OMX_IndexParamInterlaceFormat
2083 #define OMX_IndexParamInterlaceFormat (0x7FF00000)
2084 typedef struct OMX_INTERLACEFORMATTYPE {
2085     OMX_U32 nSize;
2086     OMX_VERSIONTYPE nVersion;
2087     OMX_U32 nPortIndex;
2088     OMX_U32 nFormat;
2089     OMX_TICKS nTimeStamp;
2090 } OMX_INTERLACEFORMATTYPE;
2091 #endif
2092 
2093 /**
2094  * This structure is used to indicate the maximum number of buffers
2095  * that a port will hold during data flow.
2096  *
2097  * STRUCT MEMBERS:
2098  *  nSize              : Size of the structure in bytes
2099  *  nVersion           : OMX specification version info
2100  *  nPortIndex         : Port that this structure applies to
2101  *  nHeldBufferCount   : Read-only, maximum number of buffers that will be held
2102  */
2103 typedef struct QOMX_HELDBUFFERCOUNTTYPE {
2104     OMX_U32 nSize;
2105     OMX_VERSIONTYPE nVersion;
2106     OMX_U32 nPortIndex;
2107     OMX_U32 nHeldBufferCount;
2108 } QOMX_HELDBUFFERCOUNTTYPE;
2109 
2110 typedef enum QOMX_VIDEO_HIERARCHICALCODINGTYPE {
2111     QOMX_HIERARCHICALCODING_P = 0x01,
2112     QOMX_HIERARCHICALCODING_B = 0x02,
2113 } QOMX_VIDEO_HIERARCHICALCODINGTYPE;
2114 
2115 typedef struct QOMX_VIDEO_HIERARCHICALLAYERS {
2116     OMX_U32 nSize;
2117     OMX_VERSIONTYPE nVersion;
2118     OMX_U32 nPortIndex;
2119     OMX_U32 nNumLayers;
2120     QOMX_VIDEO_HIERARCHICALCODINGTYPE eHierarchicalCodingType;
2121 } QOMX_VIDEO_HIERARCHICALLAYERS;
2122 
2123 typedef struct QOMX_VIDEO_H264ENTROPYCODINGTYPE {
2124    OMX_U32 nSize;
2125    OMX_VERSIONTYPE nVersion;
2126    OMX_BOOL bCabac;
2127    OMX_U32 nCabacInitIdc;
2128 } QOMX_VIDEO_H264ENTROPYCODINGTYPE;
2129 
2130 typedef enum QOMX_VIDEO_IFRAMESIZE_TYPE {
2131     QOMX_IFRAMESIZE_DEFAULT,
2132     QOMX_IFRAMESIZE_MEDIUM,
2133     QOMX_IFRAMESIZE_HUGE,
2134     QOMX_IFRAMESIZE_UNLIMITED,
2135 } QOMX_VIDEO_IFRAMESIZE_TYPE;
2136 
2137 typedef struct QOMX_VIDEO_IFRAMESIZE {
2138    OMX_U32 nSize;
2139    OMX_VERSIONTYPE nVersion;
2140    QOMX_VIDEO_IFRAMESIZE_TYPE eType;
2141 } QOMX_VIDEO_IFRAMESIZE;
2142 
2143 typedef struct OMX_EXTNINDEX_VIDEO_VBV_DELAY {
2144     OMX_U32 nSize;
2145     OMX_VERSIONTYPE nVersion;
2146     OMX_U32 nPortIndex;
2147     OMX_U32 nVbvDelay;
2148  } OMX_EXTNINDEX_VIDEO_VBV_DELAY;
2149 
2150 /* VIDEO POSTPROCESSING CTRLS AND ENUMS */
2151 /* MUST KEEP SAME AS IN vpp.h */
2152 #define QOMX_VPP_HQV_CUSTOMPAYLOAD_SZ 256
2153 #define VPP_HQV_CONTROL_GLOBAL_START (VPP_HQV_CONTROL_CUST + 1)
2154 
2155 typedef enum QOMX_VPP_HQV_MODE {
2156     VPP_HQV_MODE_OFF,
2157     VPP_HQV_MODE_AUTO,
2158     VPP_HQV_MODE_MANUAL,
2159     VPP_HQV_MODE_MAX
2160 } QOMX_VPP_HQV_MODE;
2161 
2162 typedef enum QOMX_VPP_HQVCONTROLTYPE {
2163     VPP_HQV_CONTROL_CADE = 0x1,
2164     VPP_HQV_CONTROL_DI = 0x02,
2165     VPP_HQV_CONTROL_CNR = 0x04,
2166     VPP_HQV_CONTROL_AIE = 0x05,
2167     VPP_HQV_CONTROL_FRC = 0x06,
2168     VPP_HQV_CONTROL_CUST = 0x07,
2169     VPP_HQV_CONTROL_GLOBAL_DEMO = VPP_HQV_CONTROL_GLOBAL_START,
2170     VPP_HQV_CONTROL_MAX,
2171 } QOMX_VPP_HQVCONTROLTYPE;
2172 
2173 typedef enum QOMX_VPP_HQV_DI_MODE {
2174     VPP_HQV_DI_MODE_OFF,
2175     VPP_HQV_DI_MODE_VIDEO_1F,
2176     VPP_HQV_DI_MODE_VIDEO_3F,
2177     VPP_HQV_DI_MODE_AUTO,
2178     VPP_HQV_DI_MODE_MAX,
2179 } QOMX_VPP_HQV_DI_MODE;
2180 
2181 typedef enum QOMX_VPP_HQV_HUE_MODE {
2182     VPP_HQV_HUE_MODE_OFF,
2183     VPP_HQV_HUE_MODE_ON,
2184     VPP_HQV_HUE_MODE_MAX,
2185 } QOMX_VPP_HQV_HUE_MODE;
2186 
2187 typedef enum QOMX_VPP_SPLIT_DIRECTION {
2188     VPP_HQV_SPLIT_LEFT_TO_RIGHT,
2189     VPP_HQV_SPLIT_RIGHT_TO_LEFT,
2190     VPP_HQV_SPLIT_TOP_TO_BOTTOM,
2191     VPP_HQV_SPLIT_BOTTOM_TO_TOP,
2192     VPP_HQV_SPLIT_MAX,
2193 } QOMX_VPP_SPLIT_DIRECTION;
2194 
2195 typedef enum QOMX_VPP_HQV_FRC_MODE {
2196    VPP_HQV_FRC_MODE_OFF,
2197    VPP_HQV_FRC_MODE_LOW,
2198    VPP_HQV_FRC_MODE_MED,
2199    VPP_HQV_FRC_MODE_HIGH,
2200    VPP_HQV_FRC_MODE_MAX,
2201 } QOMX_VPP_HQV_FRC_MODE;
2202 
2203 
2204 typedef struct QOMX_VPP_HQVCTRL_CADE {
2205     QOMX_VPP_HQV_MODE mode;
2206     OMX_U32 level;
2207     OMX_S32 contrast;
2208     OMX_S32 saturation;
2209 } QOMX_VPP_HQVCTRL_CADE;
2210 
2211 typedef struct QOMX_VPP_HQVCTRL_DI {
2212     QOMX_VPP_HQV_DI_MODE mode;
2213 } QOMX_VPP_HQVCTRL_DI;
2214 
2215 typedef struct QOMX_VPP_HQVCTRL_CNR {
2216     QOMX_VPP_HQV_MODE mode;
2217     OMX_U32 level;
2218 } QOMX_VPP_HQVCTRL_CNR;
2219 
2220 typedef struct QOMX_VPP_HQVCTRL_AIE {
2221     QOMX_VPP_HQV_MODE mode;
2222     QOMX_VPP_HQV_HUE_MODE hue_mode;
2223     OMX_U32 cade_level;
2224     OMX_U32 ltm_level;
2225 } QOMX_VPP_HQVCTRL_AIE;
2226 
2227 typedef struct QOMX_VPP_HQVCTRL_CUSTOM {
2228     OMX_U32 id;
2229     OMX_U32 len;
2230     OMX_U8 data[QOMX_VPP_HQV_CUSTOMPAYLOAD_SZ];
2231 } QOMX_VPP_HQVCTRL_CUSTOM;
2232 
2233 typedef struct QOMX_VPP_HQVCTRL_GLOBAL_DEMO {
2234     OMX_U32 process_percent;
2235     QOMX_VPP_SPLIT_DIRECTION process_direction;
2236 } QOMX_VPP_HQVCTRL_GLOBAL_DEMO;
2237 
2238 typedef struct QOMX_VPP_HQVCTRL_FRC {
2239     QOMX_VPP_HQV_FRC_MODE mode;
2240 } QOMX_VPP_HQVCTRL_FRC;
2241 
2242 /* VIDEO POSTPROCESSING OMX CTRLS */
2243 typedef struct QOMX_VPP_HQVCONTROL {
2244     OMX_U32 nSize;
2245     OMX_VERSIONTYPE nVersion;
2246     QOMX_VPP_HQV_MODE mode;
2247     QOMX_VPP_HQVCONTROLTYPE ctrl_type;
2248     union {
2249         QOMX_VPP_HQVCTRL_CADE cade;
2250         QOMX_VPP_HQVCTRL_DI di;
2251         QOMX_VPP_HQVCTRL_CNR cnr;
2252         QOMX_VPP_HQVCTRL_AIE aie;
2253         QOMX_VPP_HQVCTRL_CUSTOM custom;
2254         QOMX_VPP_HQVCTRL_GLOBAL_DEMO global_demo;
2255         QOMX_VPP_HQVCTRL_FRC frc;
2256     };
2257 } QOMX_VPP_HQVCONTROL;
2258 
2259 /* STRUCTURE TO TURN VPP ON */
2260 typedef struct QOMX_VPP_ENABLE {
2261     OMX_U32 nSize;
2262     OMX_VERSIONTYPE nVersion;
2263     OMX_BOOL enable_vpp;
2264 } QOMX_VPP_ENABLE;
2265 
2266 typedef struct QOMX_EXTRADATA_ENABLE {
2267     OMX_U32 nSize;
2268     OMX_VERSIONTYPE nVersion;
2269     OMX_U32 nPortIndex;
2270     OMX_BOOL bEnable;
2271 } QOMX_EXTRADATA_ENABLE;
2272 
2273 typedef enum OMX_QOMX_VIDEO_MBISTATISTICSTYPE {
2274     QOMX_MBI_STATISTICS_MODE_DEFAULT = 0,
2275     QOMX_MBI_STATISTICS_MODE_1 = 0x01,
2276     QOMX_MBI_STATISTICS_MODE_2 = 0x02,
2277 } OMX_QOMX_VIDEO_MBISTATISTICSTYPE;
2278 
2279 typedef struct OMX_QOMX_VIDEO_MBI_STATISTICS {
2280     OMX_U32 nSize;
2281     OMX_VERSIONTYPE nVersion;
2282     OMX_U32 nPortIndex;
2283     OMX_QOMX_VIDEO_MBISTATISTICSTYPE eMBIStatisticsType;
2284 } OMX_QOMX_VIDEO_MBI_STATISTICS;
2285 
2286 typedef struct QOMX_VIDEO_BATCHSIZETYPE {
2287     OMX_U32 nSize;
2288     OMX_VERSIONTYPE nVersion;
2289     OMX_U32 nPortIndex;
2290     OMX_U32 nBatchSize;
2291 } QOMX_VIDEO_BATCHSIZETYPE;
2292 
2293 typedef struct QOMX_VIDEO_CLIENT_EXTRADATA {
2294     OMX_U32 nSize;
2295     OMX_VERSIONTYPE nVersion;
2296     OMX_U32 nPortIndex;
2297     OMX_U32 nFd;
2298     OMX_U32 nExtradataAllocSize;
2299     OMX_U32 nExtradataSize;
2300 } QOMX_VIDEO_CLIENT_EXTRADATATYPE;
2301 
2302 #if defined(__cplusplus) && defined(USE_CAMERA_METABUFFER_UTILS)
2303 
2304 #define CAM_META_BUFFER_EVENT_PERF 0x01
2305 
2306 /**
2307  * Camera1 meta-buffer payload create/access/modify utility
2308  */
2309 struct MetaBufferUtil {
2310 
2311     enum {
2312         INT_OFFSET      = 1,
2313         INT_SIZE        = 2,
2314         INT_USAGE       = 3,
2315         INT_TIMESTAMP   = 4,
2316         INT_COLORFORMAT = 5,
2317         INT_BUFINDEX    = 6,
2318         INT_BUFEVENT    = 7,
2319         INT_TOTAL       = INT_BUFINDEX,
2320     };
2321 
getNumFdsForBatchMetaBufferUtil2322     static int getNumFdsForBatch(int batchSize) {
2323         return batchSize;
2324     }
getNumIntsForBatchMetaBufferUtil2325     static int getNumIntsForBatch(int batchSize) {
2326         return batchSize * INT_TOTAL;
2327     }
getBatchSizeMetaBufferUtil2328     static int getBatchSize(const native_handle_t *hnd) {
2329         return MetaBufferUtil::isHandleSane(hnd) ? hnd->numFds : -1;
2330     }
2331 
2332     /* getters */
2333     /* return a fd at index or -1 if index is invalid */
getFdAtMetaBufferUtil2334     static int getFdAt(const native_handle_t *hnd, int index) {
2335         return (MetaBufferUtil::isHandleSane(hnd) && (index < hnd->numFds)) ? hnd->data[index] : -1;
2336     }
2337     /* return a int of type at index or -1 if index or type is invalid */
getIntAtMetaBufferUtil2338     static int getIntAt(const native_handle_t *hnd, int index, int type) {
2339         int idx = MetaBufferUtil::getIntIndex(hnd, index, type);
2340         return idx < 0 ? -1 : hnd->data[idx];
2341     }
2342 
2343     /* setters */
2344     /* replace the fd at index and return 0. Return -1 if index is invalid */
setFdAtMetaBufferUtil2345     static int setFdAt(native_handle_t *hnd, int index, int fd) {
2346         return (MetaBufferUtil::isHandleSane(hnd) && (index < hnd->numFds)) ? hnd->data[index] = fd, 0 : -1;
2347     }
2348     /* replace an int of type at index and return 0. Return -1 if index or type is invalid */
setIntAtMetaBufferUtil2349     static int setIntAt(native_handle_t *hnd, int index, int type, int value) {
2350         int idx = MetaBufferUtil::getIntIndex(hnd, index, type);
2351         return idx < 0 ? -1 : hnd->data[idx] = value, 0;
2352     }
2353 
2354 private:
isHandleSaneMetaBufferUtil2355     static bool isHandleSane(const native_handle_t *hnd) {
2356         return hnd && hnd->version == sizeof(native_handle_t);
2357     }
2358 
getIntIndexMetaBufferUtil2359     static int getIntIndex(const native_handle_t *hnd, int index, int type) {
2360         int idx = index + type * MetaBufferUtil::getBatchSize(hnd);
2361         return (MetaBufferUtil::isHandleSane(hnd) && (idx < (hnd->numInts + hnd->numFds))) ? idx : -1;
2362     }
2363 };
2364 
2365 #endif // __cplusplus
2366 
2367 typedef enum QOMX_VIDEO_DITHERTYPE {
2368     QOMX_DITHER_DISABLE = 0,
2369     QOMX_DITHER_COLORSPACE_EXCEPT_BT2020 = 0x01,
2370     QOMX_DITHER_ALL_COLORSPACE = 0x02,
2371 } QOMX_VIDEO_DITHERTYPE;
2372 
2373 typedef struct QOMX_VIDEO_DITHER_CONTROL {
2374     OMX_U32 nSize;
2375     OMX_VERSIONTYPE nVersion;
2376     OMX_U32 nPortIndex;
2377     QOMX_VIDEO_DITHERTYPE eDitherType;
2378 } QOMX_VIDEO_DITHER_CONTROL;
2379 
2380 typedef enum QOMX_VIDEO_SLICEMODETYPE {
2381     QOMX_SLICEMODE_DISABLE = 0,
2382     QOMX_SLICEMODE_MB_COUNT = 0x01,
2383     QOMX_SLICEMODE_BYTE_COUNT = 0x02,
2384 } QOMX_VIDEO_SLICEMODETYPE;
2385 
2386 typedef struct QOMX_VIDEO_PARAM_SLICE_SPACING_TYPE {
2387     OMX_U32 nSize;
2388     OMX_VERSIONTYPE nVersion;
2389     OMX_U32 nPortIndex;
2390     QOMX_VIDEO_SLICEMODETYPE eSliceMode;
2391     OMX_U32 nSliceSize;
2392 } QOMX_VIDEO_PARAM_SLICE_SPACING_TYPE;
2393 
2394 #ifdef __cplusplus
2395 }
2396 #endif /* __cplusplus */
2397 
2398 #endif /* __OMX_QCOM_EXTENSIONS_H__ */
2399