• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef CODEC_OMX_EXT_H
17 #define CODEC_OMX_EXT_H
18 #include <OMX_IVCommon.h>
19 #ifdef __cplusplus
20 #if __cplusplus
21 extern "C" {
22 #endif
23 #endif /* __cplusplus */
24 /**
25  * @brief Enumerates the extended codec codingtyps.
26  */
27 enum CodecVideoExType {
28     CODEC_OMX_VIDEO_CodingHEVC = 11, /** HEVC Index in Codec HDI */
29 };
30 
31 /**
32  * @brief Enumerates the extended HEVC profile.
33  */
34 enum CodecHevcProfile {
35     CODEC_HEVC_PROFILE_INVALID = 0x0,
36     CODEC_HEVC_PROFILE_MAIN = 0x1,
37     CODEC_HEVC_PROFILE_MAIN10 = 0x2,
38     CODEC_HEVC_PROFILE_MAIN_STILL = 0x3,
39     // main_10 profile with HDR SEI support.
40     CODEC_HEVC_PROFILE_MAIN10_HDR10 = 0x1000,
41     CODEC_HEVC_PROFILE_MAIN10_HDR10_PLUS = 0x2000,
42     CODEC_HEVC_PROFILE_MAX = 0x7FFFFFFF
43 };
44 
45 /**
46  * @brief Enumerates the extended HEVC level.
47  */
48 enum CodecHevcLevel {
49     CODEC_HEVC_LEVEL_INVALID = 0x0,
50     CODEC_HEVC_MAIN_TIER_LEVEL1 = 0x1,
51     CODEC_HEVC_HIGH_TIER_LEVEL1 = 0x2,
52     CODEC_HEVC_MAIN_TIER_LEVEL2 = 0x4,
53     CODEC_HEVC_HIGH_TIER_LEVEL2 = 0x8,
54     CODEC_HEVC_MAIN_TIER_LEVEL21 = 0x10,
55     CODEC_HEVC_HIGH_TIER_LEVEL21 = 0x20,
56     CODEC_HEVC_MAIN_TIER_LEVEL3 = 0x40,
57     CODEC_HEVC_HIGH_TIER_LEVEL3 = 0x80,
58     CODEC_HEVC_MAIN_TIER_LEVEL31 = 0x100,
59     CODEC_HEVC_HIGH_TIER_LEVEL31 = 0x200,
60     CODEC_HEVC_MAIN_TIER_LEVEL4 = 0x400,
61     CODEC_HEVC_HIGH_TIER_LEVEL4 = 0x800,
62     CODEC_HEVC_MAIN_TIER_LEVEL41 = 0x1000,
63     CODEC_HEVC_HIGH_TIER_LEVEL41 = 0x2000,
64     CODEC_HEVC_MAIN_TIER_LEVEL5 = 0x4000,
65     CODEC_HEVC_HIGH_TIER_LEVEL5 = 0x8000,
66     CODEC_HEVC_MAIN_TIER_LEVEL51 = 0x10000,
67     CODEC_HEVC_HIGH_TIER_LEVEL51 = 0x20000,
68     CODEC_HEVC_MAIN_TIER_LEVEL52 = 0x40000,
69     CODEC_HEVC_HIGH_TIER_LEVEL52 = 0x80000,
70     CODEC_HEVC_MAIN_TIER_LEVEL6 = 0x100000,
71     CODEC_HEVC_HIGH_TIER_LEVEL6 = 0x200000,
72     CODEC_HEVC_MAIN_TIER_LEVEL61 = 0x400000,
73     CODEC_HEVC_HIGH_TIER_LEVEL61 = 0x800000,
74     CODEC_HEVC_MAIN_TIER_LEVEL62 = 0x1000000,
75     CODEC_HEVC_HIGH_TIER_LEVEL62 = 0x2000000,
76     CODEC_HEVC_HIGH_TIER_MAX = 0x7FFFFFFF
77 };
78 
79 /**
80  * @brief Enumerates the extended codec color format.
81  */
82 enum CodecColorFormatExt {
83     CODEC_COLOR_FORMAT_RGBA8888 = OMX_COLOR_FormatVendorStartUnused + 100,
84 };
85 
86 /**
87  * @brief Enumerates the buffer types.
88  */
89 enum CodecBufferType {
90     /** Invalid buffer type. */
91     CODEC_BUFFER_TYPE_INVALID = 0,
92     /** Virtual address type. */
93     CODEC_BUFFER_TYPE_VIRTUAL_ADDR = 0x1,
94     /** Shared memory. */
95     CODEC_BUFFER_TYPE_AVSHARE_MEM_FD = 0x2,
96     /** Handle. */
97     CODEC_BUFFER_TYPE_HANDLE = 0x4,
98     /** Dynamic handle. */
99     CODEC_BUFFER_TYPE_DYNAMIC_HANDLE = 0x8,
100 };
101 
102 /**
103  * @brief Defines the <b>SupportBuffer</b>.
104  */
105 struct SupportBufferType {
106     uint32_t size;                 /** Size of the structure */
107     union OMX_VERSIONTYPE version; /** Component version */
108     uint32_t portIndex;            /** Port index */
109     uint32_t bufferTypes;          /** Supported buffer types */
110 };
111 
112 /**
113  * @brief Define the <b>UseBuffer</b>.
114  */
115 struct UseBufferType {
116     uint32_t size;                 /** Size of the structure */
117     union OMX_VERSIONTYPE version; /** Component version */
118     uint32_t portIndex;            /** Port index */
119     uint32_t bufferType;           /** Buffer type */
120 };
121 
122 /**
123  * @brief Defines the <b>BufferHandleUsage</b>.
124  */
125 struct GetBufferHandleUsageParams {
126     uint32_t size;                 /** Size of the structure */
127     union OMX_VERSIONTYPE version; /** Component version */
128     uint32_t portIndex;            /** Port index */
129     uint64_t usage;                /** Usage */
130 };
131 
132 /**
133  * @brief Defines the <b>CodecVideoPortFormatParam</b>.
134  */
135 struct CodecVideoPortFormatParam {
136     uint32_t size;                                         /** Size of the structure */
137     union OMX_VERSIONTYPE version;                         /** Component version */
138     uint32_t portIndex;                                    /** Port index */
139     uint32_t codecColorIndex;                              /** Color format index */
140     uint32_t codecColorFormat;                             /** Color format defined in Display */
141     uint32_t codecCompressFormat;                          /** See  */
142     uint32_t framerate;                                    /** Q16 format */
143 };
144 
145 /**
146  * @brief Defines the <b>ControlRateConstantQuality</b>.
147  */
148 struct ControlRateConstantQuality {
149     uint32_t size;                                         /** Size of the structure */
150     union OMX_VERSIONTYPE version;                         /** Component version */
151     uint32_t portIndex;                                    /** Port index */
152     uint32_t qualityValue;                                 /** Control rate constant quality */
153 };
154 
155 /**
156  * @brief Defines the <b>PassthroughParam</b>.
157  */
158 struct PassthroughParam {
159     int32_t key;   /**< Parameter type index */
160     void *val;     /**< Pointer to the parameter value */
161     int size;      /**< Parameter value size */
162 };
163 
164 /**
165  * @brief Enumerates the extended codec indexes.
166  */
167 enum OmxIndexCodecExType {
168     /** Extended BufferType index */
169     OMX_IndexExtBufferTypeStartUnused = OMX_IndexKhronosExtensions + 0x00a00000,
170     /** SupportBuffer */
171     OMX_IndexParamSupportBufferType,
172     /** UseBuffer */
173     OMX_IndexParamUseBufferType,
174     /** GetBufferHandleUsage */
175     OMX_IndexParamGetBufferHandleUsage,
176     /** CodecVideoPortFormatParam */
177     OMX_IndexCodecVideoPortFormat,
178     /** ControlRateConstantQuality */
179     OMX_IndexParamControlRateConstantQuality,
180     /** PassthroughParam */
181     OMX_IndexParamPassthrough,
182     /** OMX_IndexParamVideoHevc */
183     OMX_IndexParamVideoHevc,
184 };
185 
186 /**
187  * @brief Structure for controlling HEVC video encoding
188  */
189 struct CodecVideoParamHevc {
190     uint32_t size;                        /** Size of the structure */
191     union OMX_VERSIONTYPE version;        /** Component version */
192     uint32_t portIndex;                   /** Port index */
193     enum CodecHevcProfile profile;        /** Hevc profile. For details,  see {@link CodecHevcProfile}. */
194     enum CodecHevcLevel level;            /** Hevc level. For details,  see {@link CodecHevcLevel}. */
195     uint32_t keyFrameInterval;            /** Distance between consecutive I-frames (including one of the I frams).
196                                               0 means interval is unspecified and can be freely chosen by the codec.
197                                               1 means a stream of only I frams. other  means the real value. */
198 };
199 
200 #ifdef __cplusplus
201 #if __cplusplus
202 }
203 #endif
204 #endif /* __cplusplus */
205 
206 #endif  // CODEC_OMX_EXT_H