Hamsalekha S | 8d3d303 | 2015-03-13 21:24:58 +0530 | [diff] [blame^] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Copyright (C) 2015 The Android Open Source Project |
| 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at: |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | * |
| 17 | ***************************************************************************** |
| 18 | * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore |
| 19 | */ |
| 20 | /** |
| 21 | ******************************************************************************* |
| 22 | * @file |
| 23 | * iv.h |
| 24 | * |
| 25 | * @brief |
| 26 | * This file contains all the necessary structure and enumeration |
| 27 | * definitions needed for the Application Program Interface(API) of the |
| 28 | * Ittiam Video and Image codecs |
| 29 | * |
| 30 | * @author |
| 31 | * 100239(RCY) |
| 32 | * |
| 33 | * @par List of Functions: |
| 34 | * |
| 35 | * @remarks |
| 36 | * None |
| 37 | * |
| 38 | ******************************************************************************* |
| 39 | */ |
| 40 | |
| 41 | |
| 42 | #ifndef _IV_H |
| 43 | #define _IV_H |
| 44 | |
| 45 | /*****************************************************************************/ |
| 46 | /* Constant Macros */ |
| 47 | /*****************************************************************************/ |
| 48 | |
| 49 | |
| 50 | /*****************************************************************************/ |
| 51 | /* Typedefs */ |
| 52 | /*****************************************************************************/ |
| 53 | |
| 54 | /*****************************************************************************/ |
| 55 | /* Enums */ |
| 56 | /*****************************************************************************/ |
| 57 | |
| 58 | |
| 59 | /* IV_API_CALL_STATUS_T:This is only to return the FAIL/PASS status to the */ |
| 60 | /* application for the current API call */ |
| 61 | |
| 62 | typedef enum { |
| 63 | IV_STATUS_NA = 0x7FFFFFFF, |
| 64 | IV_SUCCESS = 0x0, |
| 65 | IV_FAIL = 0x1, |
| 66 | }IV_API_CALL_STATUS_T; |
| 67 | |
| 68 | /* IV_MEM_TYPE_T: This Enumeration defines the type of memory (Internal/Ext */ |
| 69 | /* -ernal) along with the cacheable/non-cacheable attributes */ |
| 70 | |
| 71 | typedef enum { |
| 72 | IV_NA_MEM_TYPE = 0x7FFFFFFF, |
| 73 | IV_INTERNAL_CACHEABLE_PERSISTENT_MEM = 0x1, |
| 74 | IV_INTERNAL_CACHEABLE_SCRATCH_MEM = 0x2, |
| 75 | IV_EXTERNAL_CACHEABLE_PERSISTENT_MEM = 0x3, |
| 76 | IV_EXTERNAL_CACHEABLE_SCRATCH_MEM = 0x4, |
| 77 | IV_INTERNAL_NONCACHEABLE_PERSISTENT_MEM = 0x5, |
| 78 | IV_INTERNAL_NONCACHEABLE_SCRATCH_MEM = 0x6, |
| 79 | IV_EXTERNAL_NONCACHEABLE_PERSISTENT_MEM = 0x7, |
| 80 | IV_EXTERNAL_NONCACHEABLE_SCRATCH_MEM = 0x8 |
| 81 | }IV_MEM_TYPE_T; |
| 82 | |
| 83 | /* IV_COLOR_FORMAT_T: This enumeration lists all the color formats which */ |
| 84 | /* finds usage in video/image codecs */ |
| 85 | |
| 86 | typedef enum { |
| 87 | IV_CHROMA_NA = 0x7FFFFFFF, |
| 88 | IV_YUV_420P = 0x1, |
| 89 | IV_YUV_422P = 0x2, |
| 90 | IV_420_UV_INTL = 0x3, |
| 91 | IV_YUV_422IBE = 0x4, |
| 92 | IV_YUV_422ILE = 0x5, |
| 93 | IV_YUV_444P = 0x6, |
| 94 | IV_YUV_411P = 0x7, |
| 95 | IV_GRAY = 0x8, |
| 96 | IV_RGB_565 = 0x9, |
| 97 | IV_RGB_24 = 0xa, |
| 98 | IV_YUV_420SP_UV = 0xb, |
| 99 | IV_YUV_420SP_VU = 0xc, |
| 100 | IV_RGBA_8888 = 0xd |
| 101 | }IV_COLOR_FORMAT_T; |
| 102 | |
| 103 | /* IV_PICTURE_CODING_TYPE_T: VOP/Frame coding type Enumeration */ |
| 104 | |
| 105 | typedef enum { |
| 106 | IV_NA_FRAME = 0x7FFFFFFF, |
| 107 | IV_I_FRAME = 0x0, |
| 108 | IV_P_FRAME = 0x1, |
| 109 | IV_B_FRAME = 0x2, |
| 110 | IV_IDR_FRAME = 0x3, |
| 111 | IV_II_FRAME = 0x4, |
| 112 | IV_IP_FRAME = 0x5, |
| 113 | IV_IB_FRAME = 0x6, |
| 114 | IV_PI_FRAME = 0x7, |
| 115 | IV_PP_FRAME = 0x8, |
| 116 | IV_PB_FRAME = 0x9, |
| 117 | IV_BI_FRAME = 0xa, |
| 118 | IV_BP_FRAME = 0xb, |
| 119 | IV_BB_FRAME = 0xc, |
| 120 | IV_MBAFF_I_FRAME = 0xd, |
| 121 | IV_MBAFF_P_FRAME = 0xe, |
| 122 | IV_MBAFF_B_FRAME = 0xf, |
| 123 | IV_MBAFF_IDR_FRAME = 0x10, |
| 124 | IV_NOT_CODED_FRAME = 0x11, |
| 125 | IV_FRAMETYPE_DEFAULT = IV_I_FRAME |
| 126 | }IV_PICTURE_CODING_TYPE_T; |
| 127 | |
| 128 | /* IV_FLD_TYPE_T: field type Enumeration */ |
| 129 | |
| 130 | typedef enum { |
| 131 | IV_NA_FLD = 0x7FFFFFFF, |
| 132 | IV_TOP_FLD = 0x0, |
| 133 | IV_BOT_FLD = 0x1, |
| 134 | IV_FLD_TYPE_DEFAULT = IV_TOP_FLD |
| 135 | }IV_FLD_TYPE_T; |
| 136 | |
| 137 | /* IV_CONTENT_TYPE_T: Video content type */ |
| 138 | |
| 139 | typedef enum { |
| 140 | IV_CONTENTTYPE_NA = 0x7FFFFFFF, |
| 141 | IV_PROGRESSIVE = 0x0, |
| 142 | IV_INTERLACED = 0x1, |
| 143 | IV_PROGRESSIVE_FRAME = 0x2, |
| 144 | IV_INTERLACED_FRAME = 0x3, |
| 145 | IV_INTERLACED_TOPFIELD = 0x4, |
| 146 | IV_INTERLACED_BOTTOMFIELD = 0x5, |
| 147 | IV_CONTENTTYPE_DEFAULT = IV_PROGRESSIVE, |
| 148 | }IV_CONTENT_TYPE_T; |
| 149 | |
| 150 | /* IV_API_COMMAND_TYPE_T:API command type */ |
| 151 | typedef enum { |
| 152 | IV_CMD_NA = 0x7FFFFFFF, |
| 153 | IV_CMD_GET_NUM_MEM_REC = 0x0, |
| 154 | IV_CMD_FILL_NUM_MEM_REC = 0x1, |
| 155 | IV_CMD_RETRIEVE_MEMREC = 0x2, |
| 156 | IV_CMD_INIT = 0x3, |
| 157 | IV_CMD_DUMMY_ELEMENT = 0x4, |
| 158 | }IV_API_COMMAND_TYPE_T; |
| 159 | |
| 160 | /*****************************************************************************/ |
| 161 | /* Structure */ |
| 162 | /*****************************************************************************/ |
| 163 | |
| 164 | /* IV_OBJ_T: This structure defines the handle for the codec instance */ |
| 165 | |
| 166 | typedef struct { |
| 167 | /** |
| 168 | * u4_size of the structure |
| 169 | */ |
| 170 | UWORD32 u4_size; |
| 171 | |
| 172 | /** |
| 173 | * Pointer to the API function pointer table of the codec |
| 174 | */ |
| 175 | void *pv_fxns; |
| 176 | |
| 177 | /** |
| 178 | * Pointer to the handle of the codec |
| 179 | */ |
| 180 | void *pv_codec_handle; |
| 181 | }iv_obj_t; |
| 182 | |
| 183 | /* iv_mem_rec_t: This structure defines the memory record holder which will */ |
| 184 | /* be used by the codec to communicate its memory requirements to the */ |
| 185 | /* application through appropriate API functions */ |
| 186 | |
| 187 | typedef struct { |
| 188 | /** |
| 189 | * u4_size of the structure |
| 190 | */ |
| 191 | UWORD32 u4_size; |
| 192 | |
| 193 | /** |
| 194 | * Pointer to the memory allocated by the application |
| 195 | */ |
| 196 | void *pv_base; |
| 197 | |
| 198 | /** |
| 199 | * u4_size of the memory to be allocated |
| 200 | */ |
| 201 | UWORD32 u4_mem_size; |
| 202 | |
| 203 | /** |
| 204 | * Alignment of the memory pointer |
| 205 | */ |
| 206 | UWORD32 u4_mem_alignment; |
| 207 | /** |
| 208 | * Nature of the memory to be allocated |
| 209 | */ |
| 210 | IV_MEM_TYPE_T e_mem_type; |
| 211 | }iv_mem_rec_t; |
| 212 | |
| 213 | /* IV_YUV_BUF_T: This structure defines attributes for the yuv buffer */ |
| 214 | |
| 215 | typedef struct { |
| 216 | /** |
| 217 | * u4_size of the structure |
| 218 | */ |
| 219 | UWORD32 u4_size; |
| 220 | |
| 221 | /** |
| 222 | * Pointer to Luma (Y) Buffer |
| 223 | */ |
| 224 | |
| 225 | void *pv_y_buf; |
| 226 | /** |
| 227 | * Pointer to Chroma (Cb) Buffer |
| 228 | */ |
| 229 | void *pv_u_buf; |
| 230 | |
| 231 | /** |
| 232 | * Pointer to Chroma (Cr) Buffer |
| 233 | */ |
| 234 | void *pv_v_buf; |
| 235 | |
| 236 | /** |
| 237 | * Width of the Luma (Y) Buffer |
| 238 | */ |
| 239 | UWORD32 u4_y_wd; |
| 240 | |
| 241 | /** |
| 242 | * Height of the Luma (Y) Buffer |
| 243 | */ |
| 244 | UWORD32 u4_y_ht; |
| 245 | |
| 246 | /** |
| 247 | * Stride/Pitch of the Luma (Y) Buffer |
| 248 | */ |
| 249 | UWORD32 u4_y_strd; |
| 250 | |
| 251 | /** |
| 252 | * Width of the Chroma (Cb) Buffer |
| 253 | */ |
| 254 | UWORD32 u4_u_wd; |
| 255 | |
| 256 | /** |
| 257 | * Height of the Chroma (Cb) Buffer |
| 258 | */ |
| 259 | UWORD32 u4_u_ht; |
| 260 | |
| 261 | /** |
| 262 | * Stride/Pitch of the Chroma (Cb) Buffer |
| 263 | */ |
| 264 | UWORD32 u4_u_strd; |
| 265 | |
| 266 | /** |
| 267 | * Width of the Chroma (Cr) Buffer |
| 268 | */ |
| 269 | UWORD32 u4_v_wd; |
| 270 | |
| 271 | /** |
| 272 | * Height of the Chroma (Cr) Buffer |
| 273 | */ |
| 274 | UWORD32 u4_v_ht; |
| 275 | |
| 276 | /** |
| 277 | * Stride/Pitch of the Chroma (Cr) Buffer |
| 278 | */ |
| 279 | UWORD32 u4_v_strd; |
| 280 | }iv_yuv_buf_t; |
| 281 | |
| 282 | /*****************************************************************************/ |
| 283 | /* Get Number of Memory Records */ |
| 284 | /*****************************************************************************/ |
| 285 | |
| 286 | /* IV_API_COMMAND_TYPE_T::e_cmd = IV_CMD_GET_NUM_MEM_REC */ |
| 287 | |
| 288 | |
| 289 | typedef struct { |
| 290 | /** |
| 291 | * u4_size of the structure |
| 292 | */ |
| 293 | UWORD32 u4_size; |
| 294 | |
| 295 | /** |
| 296 | * cmd |
| 297 | */ |
| 298 | IV_API_COMMAND_TYPE_T e_cmd; |
| 299 | }iv_num_mem_rec_ip_t; |
| 300 | |
| 301 | |
| 302 | typedef struct { |
| 303 | /** |
| 304 | * u4_size of the structure |
| 305 | */ |
| 306 | UWORD32 u4_size; |
| 307 | |
| 308 | /** |
| 309 | * error code |
| 310 | */ |
| 311 | UWORD32 u4_error_code; |
| 312 | |
| 313 | /** |
| 314 | * num_mem_rec |
| 315 | */ |
| 316 | UWORD32 u4_num_mem_rec; |
| 317 | }iv_num_mem_rec_op_t; |
| 318 | |
| 319 | |
| 320 | /*****************************************************************************/ |
| 321 | /* Fill Memory Records */ |
| 322 | /*****************************************************************************/ |
| 323 | |
| 324 | /* IV_API_COMMAND_TYPE_T::e_cmd = IV_CMD_FILL_NUM_MEM_REC */ |
| 325 | |
| 326 | |
| 327 | typedef struct { |
| 328 | /** |
| 329 | * u4_size of the structure |
| 330 | */ |
| 331 | UWORD32 u4_size; |
| 332 | |
| 333 | /** |
| 334 | * cmd |
| 335 | */ |
| 336 | IV_API_COMMAND_TYPE_T e_cmd; |
| 337 | |
| 338 | /** |
| 339 | * pointer to array of memrecords structures should be filled by codec |
| 340 | with details of memory resource requirements |
| 341 | */ |
| 342 | iv_mem_rec_t *pv_mem_rec_location; |
| 343 | |
| 344 | /** |
| 345 | * maximum width for which codec should request memory requirements |
| 346 | */ |
| 347 | UWORD32 u4_max_frm_wd; |
| 348 | |
| 349 | /** |
| 350 | * maximum height for which codec should request memory requirements |
| 351 | */ |
| 352 | UWORD32 u4_max_frm_ht; |
| 353 | }iv_fill_mem_rec_ip_t; |
| 354 | |
| 355 | |
| 356 | typedef struct { |
| 357 | /** |
| 358 | * u4_size of the structure |
| 359 | */ |
| 360 | UWORD32 u4_size; |
| 361 | |
| 362 | /** |
| 363 | * error_code |
| 364 | */ |
| 365 | UWORD32 u4_error_code; |
| 366 | |
| 367 | /** |
| 368 | * no of memory record structures which are filled by codec |
| 369 | */ |
| 370 | UWORD32 u4_num_mem_rec_filled; |
| 371 | }iv_fill_mem_rec_op_t; |
| 372 | |
| 373 | |
| 374 | /*****************************************************************************/ |
| 375 | /* Retrieve Memory Records */ |
| 376 | /*****************************************************************************/ |
| 377 | |
| 378 | /* IV_API_COMMAND_TYPE_T::e_cmd = IV_CMD_RETRIEVE_MEMREC */ |
| 379 | |
| 380 | |
| 381 | |
| 382 | typedef struct { |
| 383 | /** |
| 384 | * u4_size of the structure |
| 385 | */ |
| 386 | UWORD32 u4_size; |
| 387 | |
| 388 | /** |
| 389 | * cmd |
| 390 | */ |
| 391 | IV_API_COMMAND_TYPE_T e_cmd; |
| 392 | |
| 393 | /** |
| 394 | * array of structures where codec should fill with all resources(memory) with it |
| 395 | */ |
| 396 | iv_mem_rec_t *pv_mem_rec_location; |
| 397 | }iv_retrieve_mem_rec_ip_t; |
| 398 | |
| 399 | |
| 400 | typedef struct { |
| 401 | /** |
| 402 | * u4_size of the structure |
| 403 | */ |
| 404 | UWORD32 u4_size; |
| 405 | |
| 406 | /** |
| 407 | * error_code |
| 408 | */ |
| 409 | UWORD32 u4_error_code; |
| 410 | |
| 411 | /** |
| 412 | * no of memory records filled by codec |
| 413 | */ |
| 414 | UWORD32 u4_num_mem_rec_filled; |
| 415 | }iv_retrieve_mem_rec_op_t; |
| 416 | |
| 417 | |
| 418 | |
| 419 | #endif /* _IV_H */ |
| 420 | |