| 1 | /* | 
|---|
| 2 | * Copyright (c) 2007-2009 Intel Corporation. All Rights Reserved. | 
|---|
| 3 | * | 
|---|
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a | 
|---|
| 5 | * copy of this software and associated documentation files (the | 
|---|
| 6 | * "Software"), to deal in the Software without restriction, including | 
|---|
| 7 | * without limitation the rights to use, copy, modify, merge, publish, | 
|---|
| 8 | * distribute, sub license, and/or sell copies of the Software, and to | 
|---|
| 9 | * permit persons to whom the Software is furnished to do so, subject to | 
|---|
| 10 | * the following conditions: | 
|---|
| 11 | * | 
|---|
| 12 | * The above copyright notice and this permission notice (including the | 
|---|
| 13 | * next paragraph) shall be included in all copies or substantial portions | 
|---|
| 14 | * of the Software. | 
|---|
| 15 | * | 
|---|
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | 
|---|
| 17 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | 
|---|
| 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. | 
|---|
| 19 | * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR | 
|---|
| 20 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | 
|---|
| 21 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | 
|---|
| 22 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 
|---|
| 23 | */ | 
|---|
| 24 | /* | 
|---|
| 25 | * Video Acceleration (VA) API Specification | 
|---|
| 26 | * | 
|---|
| 27 | * Rev. 0.30 | 
|---|
| 28 | * <[email protected]> | 
|---|
| 29 | * | 
|---|
| 30 | * Revision History: | 
|---|
| 31 | * rev 0.10 (12/10/2006 Jonathan Bian) - Initial draft | 
|---|
| 32 | * rev 0.11 (12/15/2006 Jonathan Bian) - Fixed some errors | 
|---|
| 33 | * rev 0.12 (02/05/2007 Jonathan Bian) - Added VC-1 data structures for slice level decode | 
|---|
| 34 | * rev 0.13 (02/28/2007 Jonathan Bian) - Added GetDisplay() | 
|---|
| 35 | * rev 0.14 (04/13/2007 Jonathan Bian) - Fixed MPEG-2 PictureParameter structure, cleaned up a few funcs. | 
|---|
| 36 | * rev 0.15 (04/20/2007 Jonathan Bian) - Overhauled buffer management | 
|---|
| 37 | * rev 0.16 (05/02/2007 Jonathan Bian) - Added error codes and fixed some issues with configuration | 
|---|
| 38 | * rev 0.17 (05/07/2007 Jonathan Bian) - Added H.264/AVC data structures for slice level decode. | 
|---|
| 39 | * rev 0.18 (05/14/2007 Jonathan Bian) - Added data structures for MPEG-4 slice level decode | 
|---|
| 40 | *                                       and MPEG-2 motion compensation. | 
|---|
| 41 | * rev 0.19 (08/06/2007 Jonathan Bian) - Removed extra type for bitplane data. | 
|---|
| 42 | * rev 0.20 (08/08/2007 Jonathan Bian) - Added missing fields to VC-1 PictureParameter structure. | 
|---|
| 43 | * rev 0.21 (08/20/2007 Jonathan Bian) - Added image and subpicture support. | 
|---|
| 44 | * rev 0.22 (08/27/2007 Jonathan Bian) - Added support for chroma-keying and global alpha. | 
|---|
| 45 | * rev 0.23 (09/11/2007 Jonathan Bian) - Fixed some issues with images and subpictures. | 
|---|
| 46 | * rev 0.24 (09/18/2007 Jonathan Bian) - Added display attributes. | 
|---|
| 47 | * rev 0.25 (10/18/2007 Jonathan Bian) - Changed to use IDs only for some types. | 
|---|
| 48 | * rev 0.26 (11/07/2007 Waldo Bastian) - Change vaCreateBuffer semantics | 
|---|
| 49 | * rev 0.27 (11/19/2007 Matt Sottek)   - Added DeriveImage | 
|---|
| 50 | * rev 0.28 (12/06/2007 Jonathan Bian) - Added new versions of PutImage and AssociateSubpicture | 
|---|
| 51 | *                                       to enable scaling | 
|---|
| 52 | * rev 0.29 (02/07/2008 Jonathan Bian) - VC1 parameter fixes, | 
|---|
| 53 | *                                       added VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED | 
|---|
| 54 | * rev 0.30 (03/01/2009 Jonathan Bian) - Added encoding support for H.264 BP and MPEG-4 SP and fixes | 
|---|
| 55 | *                                       for ISO C conformance. | 
|---|
| 56 | * rev 0.31 (09/02/2009 Gwenole Beauchesne) - VC-1/H264 fields change for VDPAU and XvBA backend | 
|---|
| 57 | *                                       Application needs to relink with the new library. | 
|---|
| 58 | * | 
|---|
| 59 | * rev 0.31.1 (03/29/2009)              - Data structure for JPEG encode | 
|---|
| 60 | * rev 0.31.2 (01/13/2011 Anthony Pabon)- Added a flag to indicate Subpicture coordinates are screen | 
|---|
| 61 | *                                        screen relative rather than source video relative. | 
|---|
| 62 | * rev 0.32.0 (01/13/2011 Xiang Haihao) - Add profile into VAPictureParameterBufferVC1 | 
|---|
| 63 | *                                        update VAAPI to 0.32.0 | 
|---|
| 64 | * | 
|---|
| 65 | * Acknowledgements: | 
|---|
| 66 | *  Some concepts borrowed from XvMC and XvImage. | 
|---|
| 67 | *  Waldo Bastian (Intel), Matt Sottek (Intel),  Austin Yuan (Intel), and Gwenole Beauchesne (SDS) | 
|---|
| 68 | *  contributed to various aspects of the API. | 
|---|
| 69 | */ | 
|---|
| 70 |  | 
|---|
| 71 | /** | 
|---|
| 72 | * \file va.h | 
|---|
| 73 | * \brief The Core API | 
|---|
| 74 | * | 
|---|
| 75 | * This file contains the \ref api_core "Core API". | 
|---|
| 76 | */ | 
|---|
| 77 |  | 
|---|
| 78 | #ifndef _VA_H_ | 
|---|
| 79 | #define _VA_H_ | 
|---|
| 80 |  | 
|---|
| 81 | #include <stddef.h> | 
|---|
| 82 | #include <stdint.h> | 
|---|
| 83 | #include <va/va_version.h> | 
|---|
| 84 |  | 
|---|
| 85 | #ifdef __cplusplus | 
|---|
| 86 | extern "C"{ | 
|---|
| 87 | #endif | 
|---|
| 88 |  | 
|---|
| 89 | #if defined(__GNUC__) && !defined(__COVERITY__) | 
|---|
| 90 | #define va_deprecated __attribute__((deprecated)) | 
|---|
| 91 | #if __GNUC__ >= 6 | 
|---|
| 92 | #define va_deprecated_enum va_deprecated | 
|---|
| 93 | #else | 
|---|
| 94 | #define va_deprecated_enum | 
|---|
| 95 | #endif | 
|---|
| 96 | #else | 
|---|
| 97 | #define va_deprecated | 
|---|
| 98 | #define va_deprecated_enum | 
|---|
| 99 | #endif | 
|---|
| 100 |  | 
|---|
| 101 | /** | 
|---|
| 102 | * \mainpage Video Acceleration (VA) API | 
|---|
| 103 | * | 
|---|
| 104 | * \section intro Introduction | 
|---|
| 105 | * | 
|---|
| 106 | * The main motivation for VA-API (Video Acceleration API) is to | 
|---|
| 107 | * enable hardware accelerated video decode and encode at various | 
|---|
| 108 | * entry-points (VLD, IDCT, Motion Compensation etc.) for the | 
|---|
| 109 | * prevailing coding standards today (MPEG-2, MPEG-4 ASP/H.263, MPEG-4 | 
|---|
| 110 | * AVC/H.264, VC-1/VMW3, and JPEG, HEVC/H265, VP8, VP9) and video pre/post | 
|---|
| 111 | * processing | 
|---|
| 112 | * | 
|---|
| 113 | * VA-API is split into several modules: | 
|---|
| 114 | * - \ref api_core | 
|---|
| 115 | * - Encoder (H264, HEVC, JPEG, MPEG2, VP8, VP9) | 
|---|
| 116 | *  - \ref api_enc_h264 | 
|---|
| 117 | *  - \ref api_enc_hevc | 
|---|
| 118 | *  - \ref api_enc_jpeg | 
|---|
| 119 | *  - \ref api_enc_mpeg2 | 
|---|
| 120 | *  - \ref api_enc_vp8 | 
|---|
| 121 | *  - \ref api_enc_vp9 | 
|---|
| 122 | *  - \ref api_enc_av1 | 
|---|
| 123 | * - Decoder (HEVC, JPEG, VP8, VP9, AV1) | 
|---|
| 124 | *      - \ref api_dec_hevc | 
|---|
| 125 | *      - \ref api_dec_jpeg | 
|---|
| 126 | *      - \ref api_dec_vp8 | 
|---|
| 127 | *      - \ref api_dec_vp9 | 
|---|
| 128 | *      - \ref api_dec_av1 | 
|---|
| 129 | * - \ref api_vpp | 
|---|
| 130 | * - \ref api_prot | 
|---|
| 131 | * - FEI (H264, HEVC) | 
|---|
| 132 | *  - \ref api_fei | 
|---|
| 133 | *  - \ref api_fei_h264 | 
|---|
| 134 | *  - \ref api_fei_hevc | 
|---|
| 135 | * | 
|---|
| 136 | * \section threading Multithreading Guide | 
|---|
| 137 | * All VAAPI functions implemented in libva are thread-safe. For any VAAPI | 
|---|
| 138 | * function that requires the implementation of a backend (e.g. hardware driver), | 
|---|
| 139 | * the backend must ensure that its implementation is also thread-safe. If the | 
|---|
| 140 | * backend implementation of a VAAPI function is not thread-safe then this should | 
|---|
| 141 | * be considered as a bug against the backend implementation. | 
|---|
| 142 | * | 
|---|
| 143 | * It is assumed that none of the VAAPI functions will be called from signal | 
|---|
| 144 | * handlers. | 
|---|
| 145 | * | 
|---|
| 146 | * Thread-safety in this context means that when VAAPI is being called by multiple | 
|---|
| 147 | * concurrent threads, it will not crash or hang the OS, and VAAPI internal | 
|---|
| 148 | * data structures will not be corrupted. When multiple threads are operating on | 
|---|
| 149 | * the same VAAPI objects, it is the application's responsibility to synchronize | 
|---|
| 150 | * these operations in order to generate the expected results. For example, using | 
|---|
| 151 | * a single VAContext from multiple threads may generate unexpected results. | 
|---|
| 152 | * | 
|---|
| 153 | * Following pseudo code illustrates a multithreaded transcoding scenario, where | 
|---|
| 154 | * one thread is handling the decoding operation and another thread is handling | 
|---|
| 155 | * the encoding operation, while synchronizing the use of a common pool of | 
|---|
| 156 | * surfaces. | 
|---|
| 157 | * | 
|---|
| 158 | * \code | 
|---|
| 159 | * // Initialization | 
|---|
| 160 | * dpy = vaGetDisplayDRM(fd); | 
|---|
| 161 | * vaInitialize(dpy, ...); | 
|---|
| 162 | * | 
|---|
| 163 | * // Create surfaces required for decoding and subsequence encoding | 
|---|
| 164 | * vaCreateSurfaces(dpy, VA_RT_FORMAT_YUV420, width, height, &surfaces[0], ...); | 
|---|
| 165 | * | 
|---|
| 166 | * // Set up a queue for the surfaces shared between decode and encode threads | 
|---|
| 167 | * surface_queue = queue_create(); | 
|---|
| 168 | * | 
|---|
| 169 | * // Create decode_thread | 
|---|
| 170 | * pthread_create(&decode_thread, NULL, decode, ...); | 
|---|
| 171 | * | 
|---|
| 172 | * // Create encode_thread | 
|---|
| 173 | * pthread_create(&encode_thread, NULL, encode, ...); | 
|---|
| 174 | * | 
|---|
| 175 | * // Decode thread function | 
|---|
| 176 | * decode() { | 
|---|
| 177 | *   // Find the decode entrypoint for H.264 | 
|---|
| 178 | *   vaQueryConfigEntrypoints(dpy, h264_profile, entrypoints, ...); | 
|---|
| 179 | * | 
|---|
| 180 | *   // Create a config for H.264 decode | 
|---|
| 181 | *   vaCreateConfig(dpy, h264_profile, VAEntrypointVLD, ...); | 
|---|
| 182 | * | 
|---|
| 183 | *   // Create a context for decode | 
|---|
| 184 | *   vaCreateContext(dpy, config, width, height, VA_PROGRESSIVE, surfaces, | 
|---|
| 185 | *     num_surfaces, &decode_context); | 
|---|
| 186 | * | 
|---|
| 187 | *   // Decode frames in the bitstream | 
|---|
| 188 | *   for (;;) { | 
|---|
| 189 | *     // Parse one frame and decode | 
|---|
| 190 | *     vaBeginPicture(dpy, decode_context, surfaces[surface_index]); | 
|---|
| 191 | *     vaRenderPicture(dpy, decode_context, buf, ...); | 
|---|
| 192 | *     vaEndPicture(dpy, decode_context); | 
|---|
| 193 | *     // Poll the decoding status and enqueue the surface in display order after | 
|---|
| 194 | *     // decoding is complete | 
|---|
| 195 | *     vaQuerySurfaceStatus(); | 
|---|
| 196 | *     enqueue(surface_queue, surface_index); | 
|---|
| 197 | *   } | 
|---|
| 198 | * } | 
|---|
| 199 | * | 
|---|
| 200 | * // Encode thread function | 
|---|
| 201 | * encode() { | 
|---|
| 202 | *   // Find the encode entrypoint for HEVC | 
|---|
| 203 | *   vaQueryConfigEntrypoints(dpy, hevc_profile, entrypoints, ...); | 
|---|
| 204 | * | 
|---|
| 205 | *   // Create a config for HEVC encode | 
|---|
| 206 | *   vaCreateConfig(dpy, hevc_profile, VAEntrypointEncSlice, ...); | 
|---|
| 207 | * | 
|---|
| 208 | *   // Create a context for encode | 
|---|
| 209 | *   vaCreateContext(dpy, config, width, height, VA_PROGRESSIVE, surfaces, | 
|---|
| 210 | *     num_surfaces, &encode_context); | 
|---|
| 211 | * | 
|---|
| 212 | *   // Encode frames produced by the decoder | 
|---|
| 213 | *   for (;;) { | 
|---|
| 214 | *     // Dequeue the surface enqueued by the decoder | 
|---|
| 215 | *     surface_index = dequeue(surface_queue); | 
|---|
| 216 | *     // Encode using this surface as the source | 
|---|
| 217 | *     vaBeginPicture(dpy, encode_context, surfaces[surface_index]); | 
|---|
| 218 | *     vaRenderPicture(dpy, encode_context, buf, ...); | 
|---|
| 219 | *     vaEndPicture(dpy, encode_context); | 
|---|
| 220 | *   } | 
|---|
| 221 | * } | 
|---|
| 222 | * \endcode | 
|---|
| 223 | */ | 
|---|
| 224 |  | 
|---|
| 225 | /** | 
|---|
| 226 | * \defgroup api_core Core API | 
|---|
| 227 | * | 
|---|
| 228 | * @{ | 
|---|
| 229 | */ | 
|---|
| 230 |  | 
|---|
| 231 | /** | 
|---|
| 232 | Overview | 
|---|
| 233 |  | 
|---|
| 234 | The VA API is intended to provide an interface between a video decode/encode/processing | 
|---|
| 235 | application (client) and a hardware accelerator (server), to off-load | 
|---|
| 236 | video decode/encode/processing operations from the host to the hardware accelerator at various | 
|---|
| 237 | entry-points. | 
|---|
| 238 |  | 
|---|
| 239 | The basic operation steps are: | 
|---|
| 240 |  | 
|---|
| 241 | - Negotiate a mutually acceptable configuration with the server to lock | 
|---|
| 242 | down profile, entrypoints, and other attributes that will not change on | 
|---|
| 243 | a frame-by-frame basis. | 
|---|
| 244 | - Create a video decode, encode or processing context which represents a | 
|---|
| 245 | "virtualized" hardware device | 
|---|
| 246 | - Get and fill the render buffers with the corresponding data (depending on | 
|---|
| 247 | profiles and entrypoints) | 
|---|
| 248 | - Pass the render buffers to the server to handle the current frame | 
|---|
| 249 |  | 
|---|
| 250 | Initialization & Configuration Management | 
|---|
| 251 |  | 
|---|
| 252 | - Find out supported profiles | 
|---|
| 253 | - Find out entrypoints for a given profile | 
|---|
| 254 | - Find out configuration attributes for a given profile/entrypoint pair | 
|---|
| 255 | - Create a configuration for use by the application | 
|---|
| 256 |  | 
|---|
| 257 | */ | 
|---|
| 258 |  | 
|---|
| 259 | typedef void* VADisplay;    /* window system dependent */ | 
|---|
| 260 |  | 
|---|
| 261 | typedef int VAStatus;   /** Return status type from functions */ | 
|---|
| 262 | /** Values for the return status */ | 
|---|
| 263 | #define VA_STATUS_SUCCESS           0x00000000 | 
|---|
| 264 | #define VA_STATUS_ERROR_OPERATION_FAILED    0x00000001 | 
|---|
| 265 | #define VA_STATUS_ERROR_ALLOCATION_FAILED   0x00000002 | 
|---|
| 266 | #define VA_STATUS_ERROR_INVALID_DISPLAY     0x00000003 | 
|---|
| 267 | #define VA_STATUS_ERROR_INVALID_CONFIG      0x00000004 | 
|---|
| 268 | #define VA_STATUS_ERROR_INVALID_CONTEXT     0x00000005 | 
|---|
| 269 | #define VA_STATUS_ERROR_INVALID_SURFACE     0x00000006 | 
|---|
| 270 | #define VA_STATUS_ERROR_INVALID_BUFFER      0x00000007 | 
|---|
| 271 | #define VA_STATUS_ERROR_INVALID_IMAGE       0x00000008 | 
|---|
| 272 | #define VA_STATUS_ERROR_INVALID_SUBPICTURE  0x00000009 | 
|---|
| 273 | #define VA_STATUS_ERROR_ATTR_NOT_SUPPORTED  0x0000000a | 
|---|
| 274 | #define VA_STATUS_ERROR_MAX_NUM_EXCEEDED    0x0000000b | 
|---|
| 275 | #define VA_STATUS_ERROR_UNSUPPORTED_PROFILE 0x0000000c | 
|---|
| 276 | #define VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT  0x0000000d | 
|---|
| 277 | #define VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT   0x0000000e | 
|---|
| 278 | #define VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE  0x0000000f | 
|---|
| 279 | #define VA_STATUS_ERROR_SURFACE_BUSY        0x00000010 | 
|---|
| 280 | #define VA_STATUS_ERROR_FLAG_NOT_SUPPORTED      0x00000011 | 
|---|
| 281 | #define VA_STATUS_ERROR_INVALID_PARAMETER   0x00000012 | 
|---|
| 282 | #define VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED 0x00000013 | 
|---|
| 283 | #define VA_STATUS_ERROR_UNIMPLEMENTED           0x00000014 | 
|---|
| 284 | #define VA_STATUS_ERROR_SURFACE_IN_DISPLAYING   0x00000015 | 
|---|
| 285 | #define VA_STATUS_ERROR_INVALID_IMAGE_FORMAT    0x00000016 | 
|---|
| 286 | #define VA_STATUS_ERROR_DECODING_ERROR          0x00000017 | 
|---|
| 287 | #define VA_STATUS_ERROR_ENCODING_ERROR          0x00000018 | 
|---|
| 288 | /** | 
|---|
| 289 | * \brief An invalid/unsupported value was supplied. | 
|---|
| 290 | * | 
|---|
| 291 | * This is a catch-all error code for invalid or unsupported values. | 
|---|
| 292 | * e.g. value exceeding the valid range, invalid type in the context | 
|---|
| 293 | * of generic attribute values. | 
|---|
| 294 | */ | 
|---|
| 295 | #define VA_STATUS_ERROR_INVALID_VALUE           0x00000019 | 
|---|
| 296 | /** \brief An unsupported filter was supplied. */ | 
|---|
| 297 | #define VA_STATUS_ERROR_UNSUPPORTED_FILTER      0x00000020 | 
|---|
| 298 | /** \brief An invalid filter chain was supplied. */ | 
|---|
| 299 | #define VA_STATUS_ERROR_INVALID_FILTER_CHAIN    0x00000021 | 
|---|
| 300 | /** \brief Indicate HW busy (e.g. run multiple encoding simultaneously). */ | 
|---|
| 301 | #define VA_STATUS_ERROR_HW_BUSY                 0x00000022 | 
|---|
| 302 | /** \brief An unsupported memory type was supplied. */ | 
|---|
| 303 | #define VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE 0x00000024 | 
|---|
| 304 | /** \brief Indicate allocated buffer size is not enough for input or output. */ | 
|---|
| 305 | #define VA_STATUS_ERROR_NOT_ENOUGH_BUFFER       0x00000025 | 
|---|
| 306 | /** \brief Indicate an operation isn't completed because time-out interval elapsed. */ | 
|---|
| 307 | #define VA_STATUS_ERROR_TIMEDOUT                0x00000026 | 
|---|
| 308 | #define VA_STATUS_ERROR_UNKNOWN         0xFFFFFFFF | 
|---|
| 309 |  | 
|---|
| 310 | /** | 
|---|
| 311 | * 1. De-interlacing flags for vaPutSurface() | 
|---|
| 312 | * 2. Surface sample type for input/output surface flag | 
|---|
| 313 | *    - Progressive: VA_FRAME_PICTURE | 
|---|
| 314 | *    - Interleaved: VA_TOP_FIELD_FIRST, VA_BOTTOM_FIELD_FIRST | 
|---|
| 315 | *    - Field: VA_TOP_FIELD, VA_BOTTOM_FIELD | 
|---|
| 316 | */ | 
|---|
| 317 | #define VA_FRAME_PICTURE        0x00000000 | 
|---|
| 318 | #define VA_TOP_FIELD            0x00000001 | 
|---|
| 319 | #define VA_BOTTOM_FIELD         0x00000002 | 
|---|
| 320 | #define VA_TOP_FIELD_FIRST      0x00000004 | 
|---|
| 321 | #define VA_BOTTOM_FIELD_FIRST   0x00000008 | 
|---|
| 322 |  | 
|---|
| 323 | /** | 
|---|
| 324 | * Enabled the positioning/cropping/blending feature: | 
|---|
| 325 | * 1, specify the video playback position in the isurface | 
|---|
| 326 | * 2, specify the cropping info for video playback | 
|---|
| 327 | * 3, encoded video will blend with background color | 
|---|
| 328 | */ | 
|---|
| 329 | #define VA_ENABLE_BLEND         0x00000004 /* video area blend with the constant color */ | 
|---|
| 330 |  | 
|---|
| 331 | /** | 
|---|
| 332 | * Clears the drawable with background color. | 
|---|
| 333 | * for hardware overlay based implementation this flag | 
|---|
| 334 | * can be used to turn off the overlay | 
|---|
| 335 | */ | 
|---|
| 336 | #define VA_CLEAR_DRAWABLE       0x00000008 | 
|---|
| 337 |  | 
|---|
| 338 | /** Color space conversion flags for vaPutSurface() */ | 
|---|
| 339 | #define VA_SRC_COLOR_MASK       0x000000f0 | 
|---|
| 340 | #define VA_SRC_BT601            0x00000010 | 
|---|
| 341 | #define VA_SRC_BT709            0x00000020 | 
|---|
| 342 | #define VA_SRC_SMPTE_240        0x00000040 | 
|---|
| 343 |  | 
|---|
| 344 | /** Scaling flags for vaPutSurface() */ | 
|---|
| 345 | #define VA_FILTER_SCALING_DEFAULT       0x00000000 | 
|---|
| 346 | #define VA_FILTER_SCALING_FAST          0x00000100 | 
|---|
| 347 | #define VA_FILTER_SCALING_HQ            0x00000200 | 
|---|
| 348 | #define VA_FILTER_SCALING_NL_ANAMORPHIC 0x00000300 | 
|---|
| 349 | #define VA_FILTER_SCALING_MASK          0x00000f00 | 
|---|
| 350 |  | 
|---|
| 351 | /** Interpolation method for scaling */ | 
|---|
| 352 | #define VA_FILTER_INTERPOLATION_DEFAULT                    0x00000000 | 
|---|
| 353 | #define VA_FILTER_INTERPOLATION_NEAREST_NEIGHBOR           0x00001000 | 
|---|
| 354 | #define VA_FILTER_INTERPOLATION_BILINEAR                   0x00002000 | 
|---|
| 355 | #define VA_FILTER_INTERPOLATION_ADVANCED                   0x00003000 | 
|---|
| 356 | #define VA_FILTER_INTERPOLATION_MASK                       0x0000f000 | 
|---|
| 357 |  | 
|---|
| 358 | /** Padding size in 4-bytes */ | 
|---|
| 359 | #define VA_PADDING_LOW          4 | 
|---|
| 360 | #define VA_PADDING_MEDIUM       8 | 
|---|
| 361 | #define VA_PADDING_HIGH         16 | 
|---|
| 362 | #define VA_PADDING_LARGE        32 | 
|---|
| 363 |  | 
|---|
| 364 | /** operation options */ | 
|---|
| 365 | /** synchronization, block call, output should be ready after execution function return*/ | 
|---|
| 366 | #define VA_EXEC_SYNC              0x0 | 
|---|
| 367 | /** asynchronization,application should call additonal sync operation to access output */ | 
|---|
| 368 | #define VA_EXEC_ASYNC             0x1 | 
|---|
| 369 |  | 
|---|
| 370 | /** operation mode */ | 
|---|
| 371 | #define VA_EXEC_MODE_DEFAULT      0x0 | 
|---|
| 372 | #define VA_EXEC_MODE_POWER_SAVING 0x1 | 
|---|
| 373 | #define VA_EXEC_MODE_PERFORMANCE  0x2 | 
|---|
| 374 |  | 
|---|
| 375 | /* Values used to describe device features. */ | 
|---|
| 376 | /** The feature is not supported by the device. | 
|---|
| 377 | * | 
|---|
| 378 | * Any corresponding feature flag must not be set. | 
|---|
| 379 | */ | 
|---|
| 380 | #define VA_FEATURE_NOT_SUPPORTED  0 | 
|---|
| 381 | /** The feature is supported by the device. | 
|---|
| 382 | * | 
|---|
| 383 | * The user may decide whether or not to use this feature. | 
|---|
| 384 | * | 
|---|
| 385 | * Note that support for a feature only indicates that the hardware | 
|---|
| 386 | * is able to use it; whether it is actually a positive change to | 
|---|
| 387 | * enable it in a given situation will depend on other factors | 
|---|
| 388 | * including the input provided by the user. | 
|---|
| 389 | */ | 
|---|
| 390 | #define VA_FEATURE_SUPPORTED      1 | 
|---|
| 391 | /** The feature is required by the device. | 
|---|
| 392 | * | 
|---|
| 393 | * The device does not support not enabling this feature, so any | 
|---|
| 394 | * corresponding feature flag must be set and any additional | 
|---|
| 395 | * configuration needed by the feature must be supplied. | 
|---|
| 396 | */ | 
|---|
| 397 | #define VA_FEATURE_REQUIRED       2 | 
|---|
| 398 |  | 
|---|
| 399 | /** | 
|---|
| 400 | * Returns a short english description of error_status | 
|---|
| 401 | */ | 
|---|
| 402 | const char *vaErrorStr(VAStatus error_status); | 
|---|
| 403 |  | 
|---|
| 404 | typedef struct _VARectangle { | 
|---|
| 405 | int16_t x; | 
|---|
| 406 | int16_t y; | 
|---|
| 407 | uint16_t width; | 
|---|
| 408 | uint16_t height; | 
|---|
| 409 | } VARectangle; | 
|---|
| 410 |  | 
|---|
| 411 | /** \brief Generic motion vector data structure. */ | 
|---|
| 412 | typedef struct _VAMotionVector { | 
|---|
| 413 | /** \mv0[0]: horizontal motion vector for past reference */ | 
|---|
| 414 | /** \mv0[1]: vertical motion vector for past reference */ | 
|---|
| 415 | /** \mv1[0]: horizontal motion vector for future reference */ | 
|---|
| 416 | /** \mv1[1]: vertical motion vector for future reference */ | 
|---|
| 417 | int16_t  mv0[2];  /* past reference */ | 
|---|
| 418 | int16_t  mv1[2];  /* future reference */ | 
|---|
| 419 | } VAMotionVector; | 
|---|
| 420 |  | 
|---|
| 421 | /** Type of a message callback, used for both error and info log. */ | 
|---|
| 422 | typedef void (*VAMessageCallback)(void *user_context, const char *message); | 
|---|
| 423 |  | 
|---|
| 424 | /** | 
|---|
| 425 | * Set the callback for error messages, or NULL for no logging. | 
|---|
| 426 | * Returns the previous one, or NULL if it was disabled. | 
|---|
| 427 | */ | 
|---|
| 428 | VAMessageCallback vaSetErrorCallback(VADisplay dpy, VAMessageCallback callback, void *user_context); | 
|---|
| 429 |  | 
|---|
| 430 | /** | 
|---|
| 431 | * Set the callback for info messages, or NULL for no logging. | 
|---|
| 432 | * Returns the previous one, or NULL if it was disabled. | 
|---|
| 433 | */ | 
|---|
| 434 | VAMessageCallback vaSetInfoCallback(VADisplay dpy, VAMessageCallback callback, void *user_context); | 
|---|
| 435 |  | 
|---|
| 436 | /** | 
|---|
| 437 | * Initialization: | 
|---|
| 438 | * A display must be obtained by calling vaGetDisplay() before calling | 
|---|
| 439 | * vaInitialize() and other functions. This connects the API to the | 
|---|
| 440 | * native window system. | 
|---|
| 441 | * For X Windows, native_dpy would be from XOpenDisplay() | 
|---|
| 442 | */ | 
|---|
| 443 | typedef void* VANativeDisplay;  /* window system dependent */ | 
|---|
| 444 |  | 
|---|
| 445 | int vaDisplayIsValid(VADisplay dpy); | 
|---|
| 446 |  | 
|---|
| 447 | /** | 
|---|
| 448 | *  Set the override driver name instead of queried driver driver. | 
|---|
| 449 | */ | 
|---|
| 450 | VAStatus vaSetDriverName(VADisplay dpy, | 
|---|
| 451 | char *driver_name | 
|---|
| 452 | ); | 
|---|
| 453 |  | 
|---|
| 454 | /** | 
|---|
| 455 | * Initialize the library | 
|---|
| 456 | */ | 
|---|
| 457 | VAStatus vaInitialize( | 
|---|
| 458 | VADisplay dpy, | 
|---|
| 459 | int *major_version,  /* out */ | 
|---|
| 460 | int *minor_version   /* out */ | 
|---|
| 461 | ); | 
|---|
| 462 |  | 
|---|
| 463 | /** | 
|---|
| 464 | * After this call, all library internal resources will be cleaned up | 
|---|
| 465 | */ | 
|---|
| 466 | VAStatus vaTerminate( | 
|---|
| 467 | VADisplay dpy | 
|---|
| 468 | ); | 
|---|
| 469 |  | 
|---|
| 470 | /** | 
|---|
| 471 | * vaQueryVendorString returns a pointer to a zero-terminated string | 
|---|
| 472 | * describing some aspects of the VA implemenation on a specific | 
|---|
| 473 | * hardware accelerator. The format of the returned string is vendor | 
|---|
| 474 | * specific and at the discretion of the implementer. | 
|---|
| 475 | * e.g. for the Intel GMA500 implementation, an example would be: | 
|---|
| 476 | * "Intel GMA500 - 2.0.0.32L.0005" | 
|---|
| 477 | */ | 
|---|
| 478 | const char *vaQueryVendorString( | 
|---|
| 479 | VADisplay dpy | 
|---|
| 480 | ); | 
|---|
| 481 |  | 
|---|
| 482 | typedef int (*VAPrivFunc)(void); | 
|---|
| 483 |  | 
|---|
| 484 | /** | 
|---|
| 485 | * Return a function pointer given a function name in the library. | 
|---|
| 486 | * This allows private interfaces into the library | 
|---|
| 487 | */ | 
|---|
| 488 | VAPrivFunc vaGetLibFunc( | 
|---|
| 489 | VADisplay dpy, | 
|---|
| 490 | const char *func | 
|---|
| 491 | ); | 
|---|
| 492 |  | 
|---|
| 493 | /** Currently defined profiles */ | 
|---|
| 494 | typedef enum { | 
|---|
| 495 | /** \brief Profile ID used for video processing. */ | 
|---|
| 496 | VAProfileNone                       = -1, | 
|---|
| 497 | VAProfileMPEG2Simple        = 0, | 
|---|
| 498 | VAProfileMPEG2Main          = 1, | 
|---|
| 499 | VAProfileMPEG4Simple        = 2, | 
|---|
| 500 | VAProfileMPEG4AdvancedSimple    = 3, | 
|---|
| 501 | VAProfileMPEG4Main          = 4, | 
|---|
| 502 | VAProfileH264Baseline va_deprecated_enum = 5, | 
|---|
| 503 | VAProfileH264Main           = 6, | 
|---|
| 504 | VAProfileH264High           = 7, | 
|---|
| 505 | VAProfileVC1Simple          = 8, | 
|---|
| 506 | VAProfileVC1Main            = 9, | 
|---|
| 507 | VAProfileVC1Advanced        = 10, | 
|---|
| 508 | VAProfileH263Baseline       = 11, | 
|---|
| 509 | VAProfileJPEGBaseline               = 12, | 
|---|
| 510 | VAProfileH264ConstrainedBaseline    = 13, | 
|---|
| 511 | VAProfileVP8Version0_3              = 14, | 
|---|
| 512 | VAProfileH264MultiviewHigh          = 15, | 
|---|
| 513 | VAProfileH264StereoHigh             = 16, | 
|---|
| 514 | VAProfileHEVCMain                   = 17, | 
|---|
| 515 | VAProfileHEVCMain10                 = 18, | 
|---|
| 516 | VAProfileVP9Profile0                = 19, | 
|---|
| 517 | VAProfileVP9Profile1                = 20, | 
|---|
| 518 | VAProfileVP9Profile2                = 21, | 
|---|
| 519 | VAProfileVP9Profile3                = 22, | 
|---|
| 520 | VAProfileHEVCMain12                 = 23, | 
|---|
| 521 | VAProfileHEVCMain422_10             = 24, | 
|---|
| 522 | VAProfileHEVCMain422_12             = 25, | 
|---|
| 523 | VAProfileHEVCMain444                = 26, | 
|---|
| 524 | VAProfileHEVCMain444_10             = 27, | 
|---|
| 525 | VAProfileHEVCMain444_12             = 28, | 
|---|
| 526 | VAProfileHEVCSccMain                = 29, | 
|---|
| 527 | VAProfileHEVCSccMain10              = 30, | 
|---|
| 528 | VAProfileHEVCSccMain444             = 31, | 
|---|
| 529 | VAProfileAV1Profile0                = 32, | 
|---|
| 530 | VAProfileAV1Profile1                = 33, | 
|---|
| 531 | VAProfileHEVCSccMain444_10          = 34, | 
|---|
| 532 | /** \brief Profile ID used for protected video playback. */ | 
|---|
| 533 | VAProfileProtected                  = 35 | 
|---|
| 534 | } VAProfile; | 
|---|
| 535 |  | 
|---|
| 536 | /** | 
|---|
| 537 | *  Currently defined entrypoints | 
|---|
| 538 | */ | 
|---|
| 539 | typedef enum { | 
|---|
| 540 | VAEntrypointVLD     = 1, | 
|---|
| 541 | VAEntrypointIZZ     = 2, | 
|---|
| 542 | VAEntrypointIDCT        = 3, | 
|---|
| 543 | VAEntrypointMoComp      = 4, | 
|---|
| 544 | VAEntrypointDeblocking  = 5, | 
|---|
| 545 | VAEntrypointEncSlice    = 6,    /* slice level encode */ | 
|---|
| 546 | VAEntrypointEncPicture  = 7,    /* pictuer encode, JPEG, etc */ | 
|---|
| 547 | /* | 
|---|
| 548 | * For an implementation that supports a low power/high performance variant | 
|---|
| 549 | * for slice level encode, it can choose to expose the | 
|---|
| 550 | * VAEntrypointEncSliceLP entrypoint. Certain encoding tools may not be | 
|---|
| 551 | * available with this entrypoint (e.g. interlace, MBAFF) and the | 
|---|
| 552 | * application can query the encoding configuration attributes to find | 
|---|
| 553 | * out more details if this entrypoint is supported. | 
|---|
| 554 | */ | 
|---|
| 555 | VAEntrypointEncSliceLP  = 8, | 
|---|
| 556 | VAEntrypointVideoProc       = 10,   /**< Video pre/post-processing. */ | 
|---|
| 557 | /** | 
|---|
| 558 | * \brief VAEntrypointFEI | 
|---|
| 559 | * | 
|---|
| 560 | * The purpose of FEI (Flexible Encoding Infrastructure) is to allow applications to | 
|---|
| 561 | * have more controls and trade off quality for speed with their own IPs. | 
|---|
| 562 | * The application can optionally provide input to ENC for extra encode control | 
|---|
| 563 | * and get the output from ENC. Application can chose to modify the ENC | 
|---|
| 564 | * output/PAK input during encoding, but the performance impact is significant. | 
|---|
| 565 | * | 
|---|
| 566 | * On top of the existing buffers for normal encode, there will be | 
|---|
| 567 | * one extra input buffer (VAEncMiscParameterFEIFrameControl) and | 
|---|
| 568 | * three extra output buffers (VAEncFEIMVBufferType, VAEncFEIMBModeBufferType | 
|---|
| 569 | * and VAEncFEIDistortionBufferType) for VAEntrypointFEI entry function. | 
|---|
| 570 | * If separate PAK is set, two extra input buffers | 
|---|
| 571 | * (VAEncFEIMVBufferType, VAEncFEIMBModeBufferType) are needed for PAK input. | 
|---|
| 572 | **/ | 
|---|
| 573 | VAEntrypointFEI         = 11, | 
|---|
| 574 | /** | 
|---|
| 575 | * \brief VAEntrypointStats | 
|---|
| 576 | * | 
|---|
| 577 | * A pre-processing function for getting some statistics and motion vectors is added, | 
|---|
| 578 | * and some extra controls for Encode pipeline are provided. The application can | 
|---|
| 579 | * optionally call the statistics function to get motion vectors and statistics like | 
|---|
| 580 | * variances, distortions before calling Encode function via this entry point. | 
|---|
| 581 | * | 
|---|
| 582 | * Checking whether Statistics is supported can be performed with vaQueryConfigEntrypoints(). | 
|---|
| 583 | * If Statistics entry point is supported, then the list of returned entry-points will | 
|---|
| 584 | * include #VAEntrypointStats. Supported pixel format, maximum resolution and statistics | 
|---|
| 585 | * specific attributes can be obtained via normal attribute query. One input buffer | 
|---|
| 586 | * (VAStatsStatisticsParameterBufferType) and one or two output buffers | 
|---|
| 587 | * (VAStatsStatisticsBufferType, VAStatsStatisticsBottomFieldBufferType (for interlace only) | 
|---|
| 588 | * and VAStatsMVBufferType) are needed for this entry point. | 
|---|
| 589 | **/ | 
|---|
| 590 | VAEntrypointStats       = 12, | 
|---|
| 591 | /** | 
|---|
| 592 | * \brief VAEntrypointProtectedTEEComm | 
|---|
| 593 | * | 
|---|
| 594 | * A function for communicating with TEE (Trusted Execution Environment). | 
|---|
| 595 | **/ | 
|---|
| 596 | VAEntrypointProtectedTEEComm       = 13, | 
|---|
| 597 | /** | 
|---|
| 598 | * \brief VAEntrypointProtectedContent | 
|---|
| 599 | * | 
|---|
| 600 | * A function for protected content to decrypt encrypted content. | 
|---|
| 601 | **/ | 
|---|
| 602 | VAEntrypointProtectedContent       = 14, | 
|---|
| 603 | } VAEntrypoint; | 
|---|
| 604 |  | 
|---|
| 605 | /** Currently defined configuration attribute types */ | 
|---|
| 606 | typedef enum { | 
|---|
| 607 | VAConfigAttribRTFormat      = 0, | 
|---|
| 608 | VAConfigAttribSpatialResidual   = 1, | 
|---|
| 609 | VAConfigAttribSpatialClipping   = 2, | 
|---|
| 610 | VAConfigAttribIntraResidual     = 3, | 
|---|
| 611 | VAConfigAttribEncryption        = 4, | 
|---|
| 612 | VAConfigAttribRateControl       = 5, | 
|---|
| 613 |  | 
|---|
| 614 | /** @name Attributes for decoding */ | 
|---|
| 615 | /**@{*/ | 
|---|
| 616 | /** | 
|---|
| 617 | * \brief Slice Decoding mode. Read/write. | 
|---|
| 618 | * | 
|---|
| 619 | * This attribute determines what mode the driver supports for slice | 
|---|
| 620 | * decoding, through vaGetConfigAttributes(); and what mode the user | 
|---|
| 621 | * will be providing to the driver, through vaCreateConfig(), if the | 
|---|
| 622 | * driver supports those. If this attribute is not set by the user then | 
|---|
| 623 | * it is assumed that VA_DEC_SLICE_MODE_NORMAL mode is used. | 
|---|
| 624 | * | 
|---|
| 625 | * See \c VA_DEC_SLICE_MODE_xxx for the list of slice decoding modes. | 
|---|
| 626 | */ | 
|---|
| 627 | VAConfigAttribDecSliceMode      = 6, | 
|---|
| 628 | /** | 
|---|
| 629 | * \brief JPEG decoding attribute. Read-only. | 
|---|
| 630 | * | 
|---|
| 631 | * This attribute exposes a number of capabilities of the underlying | 
|---|
| 632 | * JPEG implementation. The attribute value is partitioned into fields as defined in the | 
|---|
| 633 | * VAConfigAttribValDecJPEG union. | 
|---|
| 634 | */ | 
|---|
| 635 | VAConfigAttribDecJPEG             = 7, | 
|---|
| 636 | /** | 
|---|
| 637 | * \brief Decode processing support. Read/write. | 
|---|
| 638 | * | 
|---|
| 639 | * This attribute determines if the driver supports video processing | 
|---|
| 640 | * with decoding using the decoding context in a single call, through | 
|---|
| 641 | * vaGetConfigAttributes(); and if the user may use this feature, | 
|---|
| 642 | * through vaCreateConfig(), if the driver supports the user scenario. | 
|---|
| 643 | * The user will essentially create a regular decode VAContext.  Therefore, | 
|---|
| 644 | * the parameters of vaCreateContext() such as picture_width, picture_height | 
|---|
| 645 | * and render_targets are in relation to the decode output parameters | 
|---|
| 646 | * (not processing output parameters) as normal. | 
|---|
| 647 | * If this attribute is not set by the user then it is assumed that no | 
|---|
| 648 | * extra processing is done after decoding for this decode context. | 
|---|
| 649 | * | 
|---|
| 650 | * Since essentially the application is creating a decoder config and context, | 
|---|
| 651 | * all function calls that take in the config (e.g. vaQuerySurfaceAttributes()) | 
|---|
| 652 | * or context are in relation to the decoder, except those video processing | 
|---|
| 653 | * function specified in the next paragraph. | 
|---|
| 654 | * | 
|---|
| 655 | * Once the decode config and context are created, the user must further | 
|---|
| 656 | * query the supported processing filters using vaQueryVideoProcFilters(), | 
|---|
| 657 | * vaQueryVideoProcFilterCaps(), vaQueryVideoProcPipelineCaps() by specifying | 
|---|
| 658 | * the created decode context.  The user must provide processing information | 
|---|
| 659 | * and extra processing output surfaces as "additional_outputs" to the driver | 
|---|
| 660 | * through VAProcPipelineParameterBufferType.  The render_target specified | 
|---|
| 661 | * at vaBeginPicture() time refers to the decode output surface.  The | 
|---|
| 662 | * target surface for the output of processing needs to be a different | 
|---|
| 663 | * surface since the decode process requires the original reconstructed buffer. | 
|---|
| 664 | * The “surface” member of VAProcPipelineParameterBuffer should be set to the | 
|---|
| 665 | * same as “render_target” set in vaBeginPicture(), but the driver may choose | 
|---|
| 666 | * to ignore this parameter. | 
|---|
| 667 | */ | 
|---|
| 668 | VAConfigAttribDecProcessing     = 8, | 
|---|
| 669 | /** @name Attributes for encoding */ | 
|---|
| 670 | /**@{*/ | 
|---|
| 671 | /** | 
|---|
| 672 | * \brief Packed headers mode. Read/write. | 
|---|
| 673 | * | 
|---|
| 674 | * This attribute determines what packed headers the driver supports, | 
|---|
| 675 | * through vaGetConfigAttributes(); and what packed headers the user | 
|---|
| 676 | * will be providing to the driver, through vaCreateConfig(), if the | 
|---|
| 677 | * driver supports those. | 
|---|
| 678 | * | 
|---|
| 679 | * See \c VA_ENC_PACKED_HEADER_xxx for the list of packed headers. | 
|---|
| 680 | */ | 
|---|
| 681 | = 10, | 
|---|
| 682 | /** | 
|---|
| 683 | * \brief Interlaced mode. Read/write. | 
|---|
| 684 | * | 
|---|
| 685 | * This attribute determines what kind of interlaced encoding mode | 
|---|
| 686 | * the driver supports. | 
|---|
| 687 | * | 
|---|
| 688 | * See \c VA_ENC_INTERLACED_xxx for the list of interlaced modes. | 
|---|
| 689 | */ | 
|---|
| 690 | VAConfigAttribEncInterlaced         = 11, | 
|---|
| 691 | /** | 
|---|
| 692 | * \brief Maximum number of reference frames. Read-only. | 
|---|
| 693 | * | 
|---|
| 694 | * This attribute determines the maximum number of reference | 
|---|
| 695 | * frames supported for encoding. | 
|---|
| 696 | * | 
|---|
| 697 | * Note: for H.264 encoding, the value represents the maximum number | 
|---|
| 698 | * of reference frames for both the reference picture list 0 (bottom | 
|---|
| 699 | * 16 bits) and the reference picture list 1 (top 16 bits). | 
|---|
| 700 | */ | 
|---|
| 701 | VAConfigAttribEncMaxRefFrames       = 13, | 
|---|
| 702 | /** | 
|---|
| 703 | * \brief Maximum number of slices per frame. Read-only. | 
|---|
| 704 | * | 
|---|
| 705 | * This attribute determines the maximum number of slices the | 
|---|
| 706 | * driver can support to encode a single frame. | 
|---|
| 707 | */ | 
|---|
| 708 | VAConfigAttribEncMaxSlices          = 14, | 
|---|
| 709 | /** | 
|---|
| 710 | * \brief Slice structure. Read-only. | 
|---|
| 711 | * | 
|---|
| 712 | * This attribute determines slice structures supported by the | 
|---|
| 713 | * driver for encoding. This attribute is a hint to the user so | 
|---|
| 714 | * that he can choose a suitable surface size and how to arrange | 
|---|
| 715 | * the encoding process of multiple slices per frame. | 
|---|
| 716 | * | 
|---|
| 717 | * More specifically, for H.264 encoding, this attribute | 
|---|
| 718 | * determines the range of accepted values to | 
|---|
| 719 | * VAEncSliceParameterBufferH264::macroblock_address and | 
|---|
| 720 | * VAEncSliceParameterBufferH264::num_macroblocks. | 
|---|
| 721 | * | 
|---|
| 722 | * See \c VA_ENC_SLICE_STRUCTURE_xxx for the supported slice | 
|---|
| 723 | * structure types. | 
|---|
| 724 | */ | 
|---|
| 725 | VAConfigAttribEncSliceStructure     = 15, | 
|---|
| 726 | /** | 
|---|
| 727 | * \brief Macroblock information. Read-only. | 
|---|
| 728 | * | 
|---|
| 729 | * This attribute determines whether the driver supports extra | 
|---|
| 730 | * encoding information per-macroblock. e.g. QP. | 
|---|
| 731 | * | 
|---|
| 732 | * More specifically, for H.264 encoding, if the driver returns a non-zero | 
|---|
| 733 | * value for this attribute, this means the application can create | 
|---|
| 734 | * additional #VAEncMacroblockParameterBufferH264 buffers referenced | 
|---|
| 735 | * through VAEncSliceParameterBufferH264::macroblock_info. | 
|---|
| 736 | */ | 
|---|
| 737 | VAConfigAttribEncMacroblockInfo     = 16, | 
|---|
| 738 | /** | 
|---|
| 739 | * \brief Maximum picture width. Read-only. | 
|---|
| 740 | * | 
|---|
| 741 | * This attribute determines the maximum picture width the driver supports | 
|---|
| 742 | * for a given configuration. | 
|---|
| 743 | */ | 
|---|
| 744 | VAConfigAttribMaxPictureWidth     = 18, | 
|---|
| 745 | /** | 
|---|
| 746 | * \brief Maximum picture height. Read-only. | 
|---|
| 747 | * | 
|---|
| 748 | * This attribute determines the maximum picture height the driver supports | 
|---|
| 749 | * for a given configuration. | 
|---|
| 750 | */ | 
|---|
| 751 | VAConfigAttribMaxPictureHeight    = 19, | 
|---|
| 752 | /** | 
|---|
| 753 | * \brief JPEG encoding attribute. Read-only. | 
|---|
| 754 | * | 
|---|
| 755 | * This attribute exposes a number of capabilities of the underlying | 
|---|
| 756 | * JPEG implementation. The attribute value is partitioned into fields as defined in the | 
|---|
| 757 | * VAConfigAttribValEncJPEG union. | 
|---|
| 758 | */ | 
|---|
| 759 | VAConfigAttribEncJPEG             = 20, | 
|---|
| 760 | /** | 
|---|
| 761 | * \brief Encoding quality range attribute. Read-only. | 
|---|
| 762 | * | 
|---|
| 763 | * This attribute conveys whether the driver supports different quality level settings | 
|---|
| 764 | * for encoding. A value less than or equal to 1 means that the encoder only has a single | 
|---|
| 765 | * quality setting, and a value greater than 1 represents the number of quality levels | 
|---|
| 766 | * that can be configured. e.g. a value of 2 means there are two distinct quality levels. | 
|---|
| 767 | */ | 
|---|
| 768 | VAConfigAttribEncQualityRange     = 21, | 
|---|
| 769 | /** | 
|---|
| 770 | * \brief Encoding quantization attribute. Read-only. | 
|---|
| 771 | * | 
|---|
| 772 | * This attribute conveys whether the driver supports certain types of quantization methods | 
|---|
| 773 | * for encoding (e.g. trellis). See \c VA_ENC_QUANTIZATION_xxx for the list of quantization methods | 
|---|
| 774 | */ | 
|---|
| 775 | VAConfigAttribEncQuantization     = 22, | 
|---|
| 776 | /** | 
|---|
| 777 | * \brief Encoding intra refresh attribute. Read-only. | 
|---|
| 778 | * | 
|---|
| 779 | * This attribute conveys whether the driver supports certain types of intra refresh methods | 
|---|
| 780 | * for encoding (e.g. adaptive intra refresh or rolling intra refresh). | 
|---|
| 781 | * See \c VA_ENC_INTRA_REFRESH_xxx for intra refresh methods | 
|---|
| 782 | */ | 
|---|
| 783 | VAConfigAttribEncIntraRefresh     = 23, | 
|---|
| 784 | /** | 
|---|
| 785 | * \brief Encoding skip frame attribute. Read-only. | 
|---|
| 786 | * | 
|---|
| 787 | * This attribute conveys whether the driver supports sending skip frame parameters | 
|---|
| 788 | * (VAEncMiscParameterTypeSkipFrame) to the encoder's rate control, when the user has | 
|---|
| 789 | * externally skipped frames. | 
|---|
| 790 | */ | 
|---|
| 791 | VAConfigAttribEncSkipFrame        = 24, | 
|---|
| 792 | /** | 
|---|
| 793 | * \brief Encoding region-of-interest (ROI) attribute. Read-only. | 
|---|
| 794 | * | 
|---|
| 795 | * This attribute conveys whether the driver supports region-of-interest (ROI) encoding, | 
|---|
| 796 | * based on user provided ROI rectangles.  The attribute value is partitioned into fields | 
|---|
| 797 | * as defined in the VAConfigAttribValEncROI union. | 
|---|
| 798 | * | 
|---|
| 799 | * If ROI encoding is supported, the ROI information is passed to the driver using | 
|---|
| 800 | * VAEncMiscParameterTypeROI. | 
|---|
| 801 | */ | 
|---|
| 802 | VAConfigAttribEncROI              = 25, | 
|---|
| 803 | /** | 
|---|
| 804 | * \brief Encoding extended rate control attribute. Read-only. | 
|---|
| 805 | * | 
|---|
| 806 | * This attribute conveys whether the driver supports any extended rate control features | 
|---|
| 807 | * The attribute value is partitioned into fields as defined in the | 
|---|
| 808 | * VAConfigAttribValEncRateControlExt union. | 
|---|
| 809 | */ | 
|---|
| 810 | VAConfigAttribEncRateControlExt   = 26, | 
|---|
| 811 | /** | 
|---|
| 812 | * \brief Processing rate reporting attribute. Read-only. | 
|---|
| 813 | * | 
|---|
| 814 | * This attribute conveys whether the driver supports reporting of | 
|---|
| 815 | * encode/decode processing rate based on certain set of parameters | 
|---|
| 816 | * (i.e. levels, I frame internvals) for a given configuration. | 
|---|
| 817 | * If this is supported, vaQueryProcessingRate() can be used to get | 
|---|
| 818 | * encode or decode processing rate. | 
|---|
| 819 | * See \c VA_PROCESSING_RATE_xxx for encode/decode processing rate | 
|---|
| 820 | */ | 
|---|
| 821 | VAConfigAttribProcessingRate    = 27, | 
|---|
| 822 | /** | 
|---|
| 823 | * \brief Encoding dirty rectangle. Read-only. | 
|---|
| 824 | * | 
|---|
| 825 | * This attribute conveys whether the driver supports dirty rectangle. | 
|---|
| 826 | * encoding, based on user provided ROI rectangles which indicate the rectangular areas | 
|---|
| 827 | * where the content has changed as compared to the previous picture.  The regions of the | 
|---|
| 828 | * picture that are not covered by dirty rect rectangles are assumed to have not changed | 
|---|
| 829 | * compared to the previous picture.  The encoder may do some optimizations based on | 
|---|
| 830 | * this information.  The attribute value returned indicates the number of regions that | 
|---|
| 831 | * are supported.  e.g. A value of 0 means dirty rect encoding is not supported.  If dirty | 
|---|
| 832 | * rect encoding is supported, the ROI information is passed to the driver using | 
|---|
| 833 | * VAEncMiscParameterTypeDirtyRect. | 
|---|
| 834 | */ | 
|---|
| 835 | VAConfigAttribEncDirtyRect       = 28, | 
|---|
| 836 | /** | 
|---|
| 837 | * \brief Parallel Rate Control (hierachical B) attribute. Read-only. | 
|---|
| 838 | * | 
|---|
| 839 | * This attribute conveys whether the encoder supports parallel rate control. | 
|---|
| 840 | * It is a integer value 0 - unsupported, > 0 - maximum layer supported. | 
|---|
| 841 | * This is the way when hireachical B frames are encoded, multiple independent B frames | 
|---|
| 842 | * on the same layer may be processed at same time. If supported, app may enable it by | 
|---|
| 843 | * setting enable_parallel_brc in VAEncMiscParameterRateControl,and the number of B frames | 
|---|
| 844 | * per layer per GOP will be passed to driver through VAEncMiscParameterParallelRateControl | 
|---|
| 845 | * structure.Currently three layers are defined. | 
|---|
| 846 | */ | 
|---|
| 847 | VAConfigAttribEncParallelRateControl   = 29, | 
|---|
| 848 | /** | 
|---|
| 849 | * \brief Dynamic Scaling Attribute. Read-only. | 
|---|
| 850 | * | 
|---|
| 851 | * This attribute conveys whether encoder is capable to determine dynamic frame | 
|---|
| 852 | * resolutions adaptive to bandwidth utilization and processing power, etc. | 
|---|
| 853 | * It is a boolean value 0 - unsupported, 1 - supported. | 
|---|
| 854 | * If it is supported,for VP9, suggested frame resolution can be retrieved from VACodedBufferVP9Status. | 
|---|
| 855 | */ | 
|---|
| 856 | VAConfigAttribEncDynamicScaling        = 30, | 
|---|
| 857 | /** | 
|---|
| 858 | * \brief frame size tolerance support | 
|---|
| 859 | * it indicates the tolerance of frame size | 
|---|
| 860 | */ | 
|---|
| 861 | VAConfigAttribFrameSizeToleranceSupport = 31, | 
|---|
| 862 | /** | 
|---|
| 863 | * \brief Encode function type for FEI. | 
|---|
| 864 | * | 
|---|
| 865 | * This attribute conveys whether the driver supports different function types for encode. | 
|---|
| 866 | * It can be VA_FEI_FUNCTION_ENC, VA_FEI_FUNCTION_PAK, or VA_FEI_FUNCTION_ENC_PAK. Currently | 
|---|
| 867 | * it is for FEI entry point only. | 
|---|
| 868 | * Default is VA_FEI_FUNCTION_ENC_PAK. | 
|---|
| 869 | */ | 
|---|
| 870 | VAConfigAttribFEIFunctionType     = 32, | 
|---|
| 871 | /** | 
|---|
| 872 | * \brief Maximum number of FEI MV predictors. Read-only. | 
|---|
| 873 | * | 
|---|
| 874 | * This attribute determines the maximum number of MV predictors the driver | 
|---|
| 875 | * can support to encode a single frame. 0 means no MV predictor is supported. | 
|---|
| 876 | * Currently it is for FEI entry point only. | 
|---|
| 877 | */ | 
|---|
| 878 | VAConfigAttribFEIMVPredictors     = 33, | 
|---|
| 879 | /** | 
|---|
| 880 | * \brief Statistics attribute. Read-only. | 
|---|
| 881 | * | 
|---|
| 882 | * This attribute exposes a number of capabilities of the VAEntrypointStats entry | 
|---|
| 883 | * point. The attribute value is partitioned into fields as defined in the | 
|---|
| 884 | * VAConfigAttribValStats union. Currently it is for VAEntrypointStats only. | 
|---|
| 885 | */ | 
|---|
| 886 | VAConfigAttribStats               = 34, | 
|---|
| 887 | /** | 
|---|
| 888 | * \brief Tile Support Attribute. Read-only. | 
|---|
| 889 | * | 
|---|
| 890 | * This attribute conveys whether encoder is capable to support tiles. | 
|---|
| 891 | * If not supported, the tile related parameters sent to encoder, such as | 
|---|
| 892 | * tiling structure, should be ignored. 0 - unsupported, 1 - supported. | 
|---|
| 893 | */ | 
|---|
| 894 | VAConfigAttribEncTileSupport        = 35, | 
|---|
| 895 | /** | 
|---|
| 896 | * \brief whether accept rouding setting from application. Read-only. | 
|---|
| 897 | * This attribute is for encode quality, if it is report, | 
|---|
| 898 | * application can change the rounding setting by VAEncMiscParameterTypeCustomRoundingControl | 
|---|
| 899 | */ | 
|---|
| 900 | VAConfigAttribCustomRoundingControl = 36, | 
|---|
| 901 | /** | 
|---|
| 902 | * \brief Encoding QP info block size attribute. Read-only. | 
|---|
| 903 | * This attribute conveys the block sizes that underlying driver | 
|---|
| 904 | * support for QP info for buffer #VAEncQpBuffer. | 
|---|
| 905 | */ | 
|---|
| 906 | VAConfigAttribQPBlockSize            = 37, | 
|---|
| 907 | /** | 
|---|
| 908 | * \brief encode max frame size attribute. Read-only | 
|---|
| 909 | * attribute value \c VAConfigAttribValMaxFrameSize represent max frame size support | 
|---|
| 910 | */ | 
|---|
| 911 | VAConfigAttribMaxFrameSize           = 38, | 
|---|
| 912 | /** \brief inter frame prediction directrion attribute. Read-only. | 
|---|
| 913 | * this attribute conveys the prediction direction (backward or forword) for specific config | 
|---|
| 914 | * the value could be  VA_PREDICTION_DIRECTION_XXXX. it can be combined with VAConfigAttribEncMaxRefFrames | 
|---|
| 915 | * to describe reference list , and the prediction direction. if this attrib is not present,both direction | 
|---|
| 916 | * should be supported, no restriction. | 
|---|
| 917 | * for example: normal HEVC encoding , maximum reference frame number in reflist 0 and reflist 1 is deduced | 
|---|
| 918 | * by  VAConfigAttribEncMaxRefFrames. so there are typical P frame, B frame, | 
|---|
| 919 | * if VAConfigAttribPredictionDirection is also present. it will stipulate prediction direction in both | 
|---|
| 920 | * reference list. if only one prediction direction present(such as PREVIOUS),all reference frame should be | 
|---|
| 921 | *  previous frame (PoC < current). | 
|---|
| 922 | */ | 
|---|
| 923 | VAConfigAttribPredictionDirection   = 39, | 
|---|
| 924 | /** \brief combined submission of multiple frames from different streams, it is optimization for different HW | 
|---|
| 925 | * implementation, multiple frames encode/decode can improve HW concurrency | 
|---|
| 926 | */ | 
|---|
| 927 | VAConfigAttribMultipleFrame         = 40, | 
|---|
| 928 | /** \brief priority setting for the context. Read-Write | 
|---|
| 929 | *  attribute value is \c VAConfigAttribValContextPriority | 
|---|
| 930 | *  this setting also could be update by \c VAContextParameterUpdateBuffer | 
|---|
| 931 | */ | 
|---|
| 932 | VAConfigAttribContextPriority       = 41, | 
|---|
| 933 | /** \brief AV1 decoding features.  Read-only. | 
|---|
| 934 | * | 
|---|
| 935 | * This attribute describes the supported features of an | 
|---|
| 936 | * AV1 decoder configuration.  The value returned uses the | 
|---|
| 937 | * VAConfigAttribValDecAV1Features type. | 
|---|
| 938 | */ | 
|---|
| 939 | VAConfigAttribDecAV1Features    = 42, | 
|---|
| 940 | /** \brief TEE could be any HW secure device. Read-only */ | 
|---|
| 941 | VAConfigAttribTEEType               = 43, | 
|---|
| 942 | /** \brief TEE type client is a specific module supporting specific functions in TEE. Read-only*/ | 
|---|
| 943 | VAConfigAttribTEETypeClient         = 44, | 
|---|
| 944 | /** | 
|---|
| 945 | * \brief Cipher algorithm of the protected content session. | 
|---|
| 946 | * | 
|---|
| 947 | * This attribute specifies the cipher algorithm of the protected content session. It | 
|---|
| 948 | * could be \c VA_PC_CIPHER_AES, etc.... | 
|---|
| 949 | */ | 
|---|
| 950 | VAConfigAttribProtectedContentCipherAlgorithm = 45, | 
|---|
| 951 | /** | 
|---|
| 952 | * \brief Cipher block size of the protected content session. | 
|---|
| 953 | * | 
|---|
| 954 | * This attribute specifies the block size of the protected content session. It could be | 
|---|
| 955 | * \c VA_PC_BLOCK_SIZE_128, \c VA_PC_BLOCK_SIZE_192, or \c VA_PC_BLOCK_SIZE_256, etc.... | 
|---|
| 956 | */ | 
|---|
| 957 | VAConfigAttribProtectedContentCipherBlockSize = 46, | 
|---|
| 958 | /** | 
|---|
| 959 | * \brief Cipher mode of the protected content session. | 
|---|
| 960 | * | 
|---|
| 961 | * This attribute specifies the cipher mode of the protected content session. It could | 
|---|
| 962 | * be \c VA_PC_CIPHER_MODE_ECB, \c VA_PC_CIPHER_MODE_CBC, \c VA_PC_CIPHER_MODE_CTR, etc... | 
|---|
| 963 | */ | 
|---|
| 964 | VAConfigAttribProtectedContentCipherMode = 47, | 
|---|
| 965 | /** | 
|---|
| 966 | * \brief Decryption sample type of the protected content session. | 
|---|
| 967 | * | 
|---|
| 968 | * This attribute specifies the decryption sample type of the protected content session. | 
|---|
| 969 | * It could be \c VA_PC_SAMPLE_TYPE_FULLSAMPLE or \c VA_PC_SAMPLE_TYPE_SUBSAMPLE. | 
|---|
| 970 | */ | 
|---|
| 971 | VAConfigAttribProtectedContentCipherSampleType = 48, | 
|---|
| 972 | /** | 
|---|
| 973 | * \brief Special usage attribute of the protected session. | 
|---|
| 974 | * | 
|---|
| 975 | * The attribute specifies the flow for the protected session could be used. For | 
|---|
| 976 | * example, it could be \c VA_PC_USAGE_DEFAULT, \c VA_PC_USAGE_WIDEVINE, etc.... | 
|---|
| 977 | */ | 
|---|
| 978 | VAConfigAttribProtectedContentUsage = 49, | 
|---|
| 979 |  | 
|---|
| 980 | /** \brief HEVC/H.265 encoding features.  Read-only. | 
|---|
| 981 | * | 
|---|
| 982 | * This attribute describes the supported features of an | 
|---|
| 983 | * HEVC/H.265 encoder configuration.  The value returned uses the | 
|---|
| 984 | * VAConfigAttribValEncHEVCFeatures type. | 
|---|
| 985 | * | 
|---|
| 986 | * If this attribute is supported by a driver then it must also | 
|---|
| 987 | * support the VAConfigAttribEncHEVCBlockSizes attribute. | 
|---|
| 988 | */ | 
|---|
| 989 | VAConfigAttribEncHEVCFeatures       = 50, | 
|---|
| 990 | /** \brief HEVC/H.265 encoding block sizes.  Read-only. | 
|---|
| 991 | * | 
|---|
| 992 | * This attribute describes the supported coding tree and transform | 
|---|
| 993 | * block sizes of an HEVC/H.265 encoder configuration.  The value | 
|---|
| 994 | * returned uses the VAConfigAttribValEncHEVCBlockSizes type. | 
|---|
| 995 | * | 
|---|
| 996 | * If this attribute is supported by a driver then it must also | 
|---|
| 997 | * support the VAConfigAttribEncHEVCFeatures attribute. | 
|---|
| 998 | */ | 
|---|
| 999 | VAConfigAttribEncHEVCBlockSizes     = 51, | 
|---|
| 1000 | /** | 
|---|
| 1001 | * \brief AV1 encoding attribute. Read-only. | 
|---|
| 1002 | * | 
|---|
| 1003 | * This attribute exposes a number of capabilities of the underlying | 
|---|
| 1004 | * AV1 implementation. The attribute value is partitioned into fields as defined in the | 
|---|
| 1005 | * VAConfigAttribValEncAV1 union. | 
|---|
| 1006 | */ | 
|---|
| 1007 | VAConfigAttribEncAV1                = 52, | 
|---|
| 1008 | /** | 
|---|
| 1009 | * \brief AV1 encoding attribute extend1. Read-only. | 
|---|
| 1010 | * | 
|---|
| 1011 | * This attribute exposes a number of capabilities of the underlying | 
|---|
| 1012 | * AV1 implementation. The attribute value is partitioned into fields as defined in the | 
|---|
| 1013 | * VAConfigAttribValEncAV1Ext1 union. | 
|---|
| 1014 | */ | 
|---|
| 1015 | VAConfigAttribEncAV1Ext1            = 53, | 
|---|
| 1016 | /** | 
|---|
| 1017 | * \brief AV1 encoding attribute extend2. Read-only. | 
|---|
| 1018 | * | 
|---|
| 1019 | * This attribute exposes a number of capabilities of the underlying | 
|---|
| 1020 | * AV1 implementation. The attribute value is partitioned into fields as defined in the | 
|---|
| 1021 | * VAConfigAttribValEncAV1Ext2 union. | 
|---|
| 1022 | */ | 
|---|
| 1023 | VAConfigAttribEncAV1Ext2            = 54, | 
|---|
| 1024 | /**@}*/ | 
|---|
| 1025 | VAConfigAttribTypeMax | 
|---|
| 1026 | } VAConfigAttribType; | 
|---|
| 1027 |  | 
|---|
| 1028 | /** | 
|---|
| 1029 | * Configuration attributes | 
|---|
| 1030 | * If there is more than one value for an attribute, a default | 
|---|
| 1031 | * value will be assigned to the attribute if the client does not | 
|---|
| 1032 | * specify the attribute when creating a configuration | 
|---|
| 1033 | */ | 
|---|
| 1034 | typedef struct _VAConfigAttrib { | 
|---|
| 1035 | VAConfigAttribType type; | 
|---|
| 1036 | uint32_t value; /* OR'd flags (bits) for this attribute */ | 
|---|
| 1037 | } VAConfigAttrib; | 
|---|
| 1038 |  | 
|---|
| 1039 | /* Attribute values for VAConfigAttribRTFormat. */ | 
|---|
| 1040 |  | 
|---|
| 1041 | #define VA_RT_FORMAT_YUV420 0x00000001  ///< YUV 4:2:0 8-bit. | 
|---|
| 1042 | #define VA_RT_FORMAT_YUV422 0x00000002  ///< YUV 4:2:2 8-bit. | 
|---|
| 1043 | #define VA_RT_FORMAT_YUV444 0x00000004  ///< YUV 4:4:4 8-bit. | 
|---|
| 1044 | #define VA_RT_FORMAT_YUV411 0x00000008  ///< YUV 4:1:1 8-bit. | 
|---|
| 1045 | #define VA_RT_FORMAT_YUV400 0x00000010  ///< Greyscale 8-bit. | 
|---|
| 1046 | #define VA_RT_FORMAT_YUV420_10  0x00000100  ///< YUV 4:2:0 10-bit. | 
|---|
| 1047 | #define VA_RT_FORMAT_YUV422_10  0x00000200  ///< YUV 4:2:2 10-bit. | 
|---|
| 1048 | #define VA_RT_FORMAT_YUV444_10  0x00000400  ///< YUV 4:4:4 10-bit. | 
|---|
| 1049 | #define VA_RT_FORMAT_YUV420_12  0x00001000  ///< YUV 4:2:0 12-bit. | 
|---|
| 1050 | #define VA_RT_FORMAT_YUV422_12  0x00002000  ///< YUV 4:2:2 12-bit. | 
|---|
| 1051 | #define VA_RT_FORMAT_YUV444_12  0x00004000  ///< YUV 4:4:4 12-bit. | 
|---|
| 1052 |  | 
|---|
| 1053 | #define VA_RT_FORMAT_RGB16  0x00010000  ///< Packed RGB, 16 bits per pixel. | 
|---|
| 1054 | #define VA_RT_FORMAT_RGB32  0x00020000  ///< Packed RGB, 32 bits per pixel, 8 bits per colour sample. | 
|---|
| 1055 | #define VA_RT_FORMAT_RGBP   0x00100000  ///< Planar RGB, 8 bits per sample. | 
|---|
| 1056 | #define VA_RT_FORMAT_RGB32_10   0x00200000  ///< Packed RGB, 32 bits per pixel, 10 bits per colour sample. | 
|---|
| 1057 |  | 
|---|
| 1058 | #define VA_RT_FORMAT_PROTECTED  0x80000000 | 
|---|
| 1059 |  | 
|---|
| 1060 | #define VA_RT_FORMAT_RGB32_10BPP    VA_RT_FORMAT_RGB32_10   ///< @deprecated use VA_RT_FORMAT_RGB32_10 instead. | 
|---|
| 1061 | #define VA_RT_FORMAT_YUV420_10BPP   VA_RT_FORMAT_YUV420_10  ///< @deprecated use VA_RT_FORMAT_YUV420_10 instead. | 
|---|
| 1062 |  | 
|---|
| 1063 | /** @name Attribute values for VAConfigAttribRateControl */ | 
|---|
| 1064 | /**@{*/ | 
|---|
| 1065 | /** \brief Driver does not support any form of rate control. */ | 
|---|
| 1066 | #define VA_RC_NONE                      0x00000001 | 
|---|
| 1067 | /** \brief Constant bitrate. */ | 
|---|
| 1068 | #define VA_RC_CBR                       0x00000002 | 
|---|
| 1069 | /** \brief Variable bitrate. */ | 
|---|
| 1070 | #define VA_RC_VBR                       0x00000004 | 
|---|
| 1071 | /** \brief Video conference mode. */ | 
|---|
| 1072 | #define VA_RC_VCM                       0x00000008 | 
|---|
| 1073 | /** \brief Constant QP. */ | 
|---|
| 1074 | #define VA_RC_CQP                       0x00000010 | 
|---|
| 1075 | /** \brief Variable bitrate with peak rate higher than average bitrate. */ | 
|---|
| 1076 | #define VA_RC_VBR_CONSTRAINED           0x00000020 | 
|---|
| 1077 | /** \brief Intelligent Constant Quality. Provided an initial ICQ_quality_factor, | 
|---|
| 1078 | *  adjusts QP at a frame and MB level based on motion to improve subjective quality. */ | 
|---|
| 1079 | #define VA_RC_ICQ           0x00000040 | 
|---|
| 1080 | /** \brief Macroblock based rate control.  Per MB control is decided | 
|---|
| 1081 | *  internally in the encoder. It may be combined with other RC modes, except CQP. */ | 
|---|
| 1082 | #define VA_RC_MB                        0x00000080 | 
|---|
| 1083 | /** \brief Constant Frame Size, it is used for small tolerent  */ | 
|---|
| 1084 | #define VA_RC_CFS                       0x00000100 | 
|---|
| 1085 | /** \brief Parallel BRC, for hierachical B. | 
|---|
| 1086 | * | 
|---|
| 1087 | *  For hierachical B, B frames can be refered by other B frames. | 
|---|
| 1088 | *  Currently three layers of hierachy are defined: | 
|---|
| 1089 | *  B0 - regular B, no reference to other B frames. | 
|---|
| 1090 | *  B1 - reference to only I, P and regular B0 frames. | 
|---|
| 1091 | *  B2 - reference to any other frames, including B1. | 
|---|
| 1092 | *  In Hierachical B structure, B frames on the same layer can be processed | 
|---|
| 1093 | *  simultaneously. And BRC would adjust accordingly. This is so called | 
|---|
| 1094 | *  Parallel BRC. */ | 
|---|
| 1095 | #define VA_RC_PARALLEL                  0x00000200 | 
|---|
| 1096 | /** \brief Quality defined VBR | 
|---|
| 1097 | * Use Quality factor to determine the good enough QP for each MB such that | 
|---|
| 1098 | * good enough quality can be obtained without waste of bits | 
|---|
| 1099 | * for this BRC mode, you must set all legacy VBR parameters | 
|---|
| 1100 | * and reuse quality_factor in \c VAEncMiscParameterRateControl | 
|---|
| 1101 | * */ | 
|---|
| 1102 | #define VA_RC_QVBR                      0x00000400 | 
|---|
| 1103 | /** \brief Average VBR | 
|---|
| 1104 | *  Average variable bitrate control algorithm focuses on overall encoding | 
|---|
| 1105 | *  quality while meeting the specified target bitrate, within the accuracy | 
|---|
| 1106 | *  range, after a convergence period. | 
|---|
| 1107 | *  bits_per_second in VAEncMiscParameterRateControl is target bitrate for AVBR. | 
|---|
| 1108 | *  Convergence is specified in the unit of frame. | 
|---|
| 1109 | *  window_size in VAEncMiscParameterRateControl is equal to convergence for AVBR. | 
|---|
| 1110 | *  Accuracy is in the range of [1,100], 1 means one percent, and so on. | 
|---|
| 1111 | *  target_percentage in VAEncMiscParameterRateControl is equal to accuracy for AVBR. | 
|---|
| 1112 | * */ | 
|---|
| 1113 | #define VA_RC_AVBR                      0x00000800 | 
|---|
| 1114 | /** \brief Transport Controlled BRC | 
|---|
| 1115 | *  Specific bitrate control for real time streaming. | 
|---|
| 1116 | *  TCBRC can instantly react to channel change to remove or significantly reduce the delay. | 
|---|
| 1117 | *  Application (transport) provides channel feedback to driver through TargetFrameSize. | 
|---|
| 1118 | *  When channel condition is very good (almost no constraint on instant frame size), | 
|---|
| 1119 | *  the app should set target frame size as zero. Otherwise, channel capacity divided by fps | 
|---|
| 1120 | *  should be used. | 
|---|
| 1121 | * */ | 
|---|
| 1122 | #define VA_RC_TCBRC                     0x00001000 | 
|---|
| 1123 |  | 
|---|
| 1124 | /**@}*/ | 
|---|
| 1125 |  | 
|---|
| 1126 | /** @name Attribute values for VAConfigAttribDecSliceMode */ | 
|---|
| 1127 | /**@{*/ | 
|---|
| 1128 | /** \brief Driver supports normal mode for slice decoding */ | 
|---|
| 1129 | #define VA_DEC_SLICE_MODE_NORMAL       0x00000001 | 
|---|
| 1130 | /** \brief Driver supports base mode for slice decoding */ | 
|---|
| 1131 | #define VA_DEC_SLICE_MODE_BASE         0x00000002 | 
|---|
| 1132 |  | 
|---|
| 1133 | /** @name Attribute values for VAConfigAttribDecJPEG */ | 
|---|
| 1134 | /**@{*/ | 
|---|
| 1135 | typedef union _VAConfigAttribValDecJPEG { | 
|---|
| 1136 | struct { | 
|---|
| 1137 | /** \brief Set to (1 << VA_ROTATION_xxx) for supported rotation angles. */ | 
|---|
| 1138 | uint32_t rotation : 4; | 
|---|
| 1139 | /** \brief Reserved for future use. */ | 
|---|
| 1140 | uint32_t reserved : 28; | 
|---|
| 1141 | } bits; | 
|---|
| 1142 | uint32_t value; | 
|---|
| 1143 | } VAConfigAttribValDecJPEG; | 
|---|
| 1144 | /** @name Attribute values for VAConfigAttribDecProcessing */ | 
|---|
| 1145 | /**@{*/ | 
|---|
| 1146 | /** \brief No decoding + processing in a single decoding call. */ | 
|---|
| 1147 | #define VA_DEC_PROCESSING_NONE     0x00000000 | 
|---|
| 1148 | /** \brief Decode + processing in a single decoding call. */ | 
|---|
| 1149 | #define VA_DEC_PROCESSING          0x00000001 | 
|---|
| 1150 | /**@}*/ | 
|---|
| 1151 |  | 
|---|
| 1152 | /** @name Attribute values for VAConfigAttribEncPackedHeaders */ | 
|---|
| 1153 | /**@{*/ | 
|---|
| 1154 | /** \brief Driver does not support any packed headers mode. */ | 
|---|
| 1155 | #define        0x00000000 | 
|---|
| 1156 | /** | 
|---|
| 1157 | * \brief Driver supports packed sequence headers. e.g. SPS for H.264. | 
|---|
| 1158 | * | 
|---|
| 1159 | * Application must provide it to driver once this flag is returned through | 
|---|
| 1160 | * vaGetConfigAttributes() | 
|---|
| 1161 | */ | 
|---|
| 1162 | #define    0x00000001 | 
|---|
| 1163 | /** | 
|---|
| 1164 | * \brief Driver supports packed picture headers. e.g. PPS for H.264. | 
|---|
| 1165 | * | 
|---|
| 1166 | * Application must provide it to driver once this falg is returned through | 
|---|
| 1167 | * vaGetConfigAttributes() | 
|---|
| 1168 | */ | 
|---|
| 1169 | #define     0x00000002 | 
|---|
| 1170 | /** | 
|---|
| 1171 | * \brief Driver supports packed slice headers. e.g. slice_header() for H.264. | 
|---|
| 1172 | * | 
|---|
| 1173 | * Application must provide it to driver once this flag is returned through | 
|---|
| 1174 | * vaGetConfigAttributes() | 
|---|
| 1175 | */ | 
|---|
| 1176 | #define       0x00000004 | 
|---|
| 1177 | /** | 
|---|
| 1178 | * \brief Driver supports misc packed headers. e.g. SEI for H.264. | 
|---|
| 1179 | * | 
|---|
| 1180 | * @deprecated | 
|---|
| 1181 | * This is a deprecated packed header flag, All applications can use | 
|---|
| 1182 | * \c VA_ENC_PACKED_HEADER_RAW_DATA to pass the corresponding packed | 
|---|
| 1183 | * header data buffer to the driver | 
|---|
| 1184 | */ | 
|---|
| 1185 | #define        0x00000008 | 
|---|
| 1186 | /** \brief Driver supports raw packed header, see VAEncPackedHeaderRawData */ | 
|---|
| 1187 | #define    0x00000010 | 
|---|
| 1188 | /**@}*/ | 
|---|
| 1189 |  | 
|---|
| 1190 | /** @name Attribute values for VAConfigAttribEncInterlaced */ | 
|---|
| 1191 | /**@{*/ | 
|---|
| 1192 | /** \brief Driver does not support interlaced coding. */ | 
|---|
| 1193 | #define VA_ENC_INTERLACED_NONE          0x00000000 | 
|---|
| 1194 | /** \brief Driver supports interlaced frame coding. */ | 
|---|
| 1195 | #define VA_ENC_INTERLACED_FRAME         0x00000001 | 
|---|
| 1196 | /** \brief Driver supports interlaced field coding. */ | 
|---|
| 1197 | #define VA_ENC_INTERLACED_FIELD         0x00000002 | 
|---|
| 1198 | /** \brief Driver supports macroblock adaptive frame field coding. */ | 
|---|
| 1199 | #define VA_ENC_INTERLACED_MBAFF         0x00000004 | 
|---|
| 1200 | /** \brief Driver supports picture adaptive frame field coding. */ | 
|---|
| 1201 | #define VA_ENC_INTERLACED_PAFF          0x00000008 | 
|---|
| 1202 | /**@}*/ | 
|---|
| 1203 |  | 
|---|
| 1204 | /** @name Attribute values for VAConfigAttribEncSliceStructure */ | 
|---|
| 1205 | /**@{*/ | 
|---|
| 1206 | /** \brief Driver supports a power-of-two number of rows per slice. */ | 
|---|
| 1207 | #define VA_ENC_SLICE_STRUCTURE_POWER_OF_TWO_ROWS        0x00000001 | 
|---|
| 1208 | /** \brief Driver supports an arbitrary number of macroblocks per slice. */ | 
|---|
| 1209 | #define VA_ENC_SLICE_STRUCTURE_ARBITRARY_MACROBLOCKS    0x00000002 | 
|---|
| 1210 | /** \brief Driver support 1 row per slice */ | 
|---|
| 1211 | #define VA_ENC_SLICE_STRUCTURE_EQUAL_ROWS               0x00000004 | 
|---|
| 1212 | /** \brief Driver support max encoded slice size per slice */ | 
|---|
| 1213 | #define VA_ENC_SLICE_STRUCTURE_MAX_SLICE_SIZE           0x00000008 | 
|---|
| 1214 | /** \brief Driver supports an arbitrary number of rows per slice. */ | 
|---|
| 1215 | #define VA_ENC_SLICE_STRUCTURE_ARBITRARY_ROWS           0x00000010 | 
|---|
| 1216 | /** \brief Driver supports any number of rows per slice but they must be the same | 
|---|
| 1217 | *       for all slices except for the last one, which must be equal or smaller | 
|---|
| 1218 | *       to the previous slices. */ | 
|---|
| 1219 | #define VA_ENC_SLICE_STRUCTURE_EQUAL_MULTI_ROWS         0x00000020 | 
|---|
| 1220 | /**@}*/ | 
|---|
| 1221 |  | 
|---|
| 1222 | /** \brief Attribute value for VAConfigAttribMaxFrameSize */ | 
|---|
| 1223 | typedef union _VAConfigAttribValMaxFrameSize { | 
|---|
| 1224 | struct { | 
|---|
| 1225 | /** \brief support max frame size | 
|---|
| 1226 | * if max_frame_size == 1, VAEncMiscParameterTypeMaxFrameSize/VAEncMiscParameterBufferMaxFrameSize | 
|---|
| 1227 | * could be used to set the frame size, if multiple_pass also equal 1, VAEncMiscParameterTypeMultiPassFrameSize | 
|---|
| 1228 | * VAEncMiscParameterBufferMultiPassFrameSize could be used to set frame size and pass information | 
|---|
| 1229 | */ | 
|---|
| 1230 | uint32_t max_frame_size : 1; | 
|---|
| 1231 | /** \brief multiple_pass support */ | 
|---|
| 1232 | uint32_t multiple_pass  : 1; | 
|---|
| 1233 | /** \brief reserved bits for future, must be zero*/ | 
|---|
| 1234 | uint32_t reserved       : 30; | 
|---|
| 1235 | } bits; | 
|---|
| 1236 | uint32_t value; | 
|---|
| 1237 | } VAConfigAttribValMaxFrameSize; | 
|---|
| 1238 |  | 
|---|
| 1239 | /** \brief Attribute value for VAConfigAttribEncJPEG */ | 
|---|
| 1240 | typedef union _VAConfigAttribValEncJPEG { | 
|---|
| 1241 | struct { | 
|---|
| 1242 | /** \brief set to 1 for arithmatic coding. */ | 
|---|
| 1243 | uint32_t arithmatic_coding_mode : 1; | 
|---|
| 1244 | /** \brief set to 1 for progressive dct. */ | 
|---|
| 1245 | uint32_t progressive_dct_mode : 1; | 
|---|
| 1246 | /** \brief set to 1 for non-interleaved. */ | 
|---|
| 1247 | uint32_t non_interleaved_mode : 1; | 
|---|
| 1248 | /** \brief set to 1 for differential. */ | 
|---|
| 1249 | uint32_t differential_mode : 1; | 
|---|
| 1250 | uint32_t max_num_components : 3; | 
|---|
| 1251 | uint32_t max_num_scans : 4; | 
|---|
| 1252 | uint32_t max_num_huffman_tables : 3; | 
|---|
| 1253 | uint32_t max_num_quantization_tables : 3; | 
|---|
| 1254 | } bits; | 
|---|
| 1255 | uint32_t value; | 
|---|
| 1256 | } VAConfigAttribValEncJPEG; | 
|---|
| 1257 |  | 
|---|
| 1258 | /** @name Attribute values for VAConfigAttribEncQuantization */ | 
|---|
| 1259 | /**@{*/ | 
|---|
| 1260 | /** \brief Driver does not support special types of quantization */ | 
|---|
| 1261 | #define VA_ENC_QUANTIZATION_NONE                        0x00000000 | 
|---|
| 1262 | /** \brief Driver supports trellis quantization */ | 
|---|
| 1263 | #define VA_ENC_QUANTIZATION_TRELLIS_SUPPORTED           0x00000001 | 
|---|
| 1264 | /**@}*/ | 
|---|
| 1265 |  | 
|---|
| 1266 | /** @name Attribute values for VAConfigAttribPredictionDirection */ | 
|---|
| 1267 | /**@{*/ | 
|---|
| 1268 | /** \brief Driver support forward reference frame (inter frame for vpx, P frame for H26x MPEG) | 
|---|
| 1269 | * can work with the VAConfigAttribEncMaxRefFrames. for example: low delay B frame of HEVC. | 
|---|
| 1270 | * these value can be OR'd together. typical value should be VA_PREDICTION_DIRECTION_PREVIOUS | 
|---|
| 1271 | * or VA_PREDICTION_DIRECTION_PREVIOUS | VA_PREDICTION_DIRECTION_FUTURE, theoretically, there | 
|---|
| 1272 | * are no stream only include future reference frame. | 
|---|
| 1273 | */ | 
|---|
| 1274 | #define VA_PREDICTION_DIRECTION_PREVIOUS                0x00000001 | 
|---|
| 1275 | /** \brief Driver support backward prediction frame/slice */ | 
|---|
| 1276 | #define VA_PREDICTION_DIRECTION_FUTURE                  0x00000002 | 
|---|
| 1277 | /** \brief Dirver require both reference list must be not empty for inter frame */ | 
|---|
| 1278 | #define VA_PREDICTION_DIRECTION_BI_NOT_EMPTY            0x00000004 | 
|---|
| 1279 | /**@}*/ | 
|---|
| 1280 |  | 
|---|
| 1281 | /** @name Attribute values for VAConfigAttribEncIntraRefresh */ | 
|---|
| 1282 | /**@{*/ | 
|---|
| 1283 | /** \brief Driver does not support intra refresh */ | 
|---|
| 1284 | #define VA_ENC_INTRA_REFRESH_NONE                       0x00000000 | 
|---|
| 1285 | /** \brief Driver supports column based rolling intra refresh */ | 
|---|
| 1286 | #define VA_ENC_INTRA_REFRESH_ROLLING_COLUMN             0x00000001 | 
|---|
| 1287 | /** \brief Driver supports row based rolling intra refresh */ | 
|---|
| 1288 | #define VA_ENC_INTRA_REFRESH_ROLLING_ROW                0x00000002 | 
|---|
| 1289 | /** \brief Driver supports adaptive intra refresh */ | 
|---|
| 1290 | #define VA_ENC_INTRA_REFRESH_ADAPTIVE                   0x00000010 | 
|---|
| 1291 | /** \brief Driver supports cyclic intra refresh */ | 
|---|
| 1292 | #define VA_ENC_INTRA_REFRESH_CYCLIC                     0x00000020 | 
|---|
| 1293 | /** \brief Driver supports intra refresh of P frame*/ | 
|---|
| 1294 | #define VA_ENC_INTRA_REFRESH_P_FRAME                    0x00010000 | 
|---|
| 1295 | /** \brief Driver supports intra refresh of B frame */ | 
|---|
| 1296 | #define VA_ENC_INTRA_REFRESH_B_FRAME                    0x00020000 | 
|---|
| 1297 | /** \brief Driver supports intra refresh of multiple reference encoder */ | 
|---|
| 1298 | #define VA_ENC_INTRA_REFRESH_MULTI_REF                  0x00040000 | 
|---|
| 1299 |  | 
|---|
| 1300 | /**@}*/ | 
|---|
| 1301 |  | 
|---|
| 1302 | /** \brief Attribute value for VAConfigAttribEncROI */ | 
|---|
| 1303 | typedef union _VAConfigAttribValEncROI { | 
|---|
| 1304 | struct { | 
|---|
| 1305 | /** \brief The number of ROI regions supported, 0 if ROI is not supported. */ | 
|---|
| 1306 | uint32_t num_roi_regions        : 8; | 
|---|
| 1307 | /** | 
|---|
| 1308 | * \brief A flag indicates whether ROI priority is supported | 
|---|
| 1309 | * | 
|---|
| 1310 | * \ref roi_rc_priority_support equal to 1 specifies the underlying driver supports | 
|---|
| 1311 | * ROI priority when VAConfigAttribRateControl != VA_RC_CQP, user can use \c roi_value | 
|---|
| 1312 | * in #VAEncROI to set ROI priority. \ref roi_rc_priority_support equal to 0 specifies | 
|---|
| 1313 | * the underlying driver doesn't support ROI priority. | 
|---|
| 1314 | * | 
|---|
| 1315 | * User should ignore \ref roi_rc_priority_support when VAConfigAttribRateControl == VA_RC_CQP | 
|---|
| 1316 | * because ROI delta QP is always required when VAConfigAttribRateControl == VA_RC_CQP. | 
|---|
| 1317 | */ | 
|---|
| 1318 | uint32_t roi_rc_priority_support    : 1; | 
|---|
| 1319 | /** | 
|---|
| 1320 | * \brief A flag indicates whether ROI delta QP is supported | 
|---|
| 1321 | * | 
|---|
| 1322 | * \ref roi_rc_qp_delta_support equal to 1 specifies the underlying driver supports | 
|---|
| 1323 | * ROI delta QP when VAConfigAttribRateControl != VA_RC_CQP, user can use \c roi_value | 
|---|
| 1324 | * in #VAEncROI to set ROI delta QP. \ref roi_rc_qp_delta_support equal to 0 specifies | 
|---|
| 1325 | * the underlying driver doesn't support ROI delta QP. | 
|---|
| 1326 | * | 
|---|
| 1327 | * User should ignore \ref roi_rc_qp_delta_support when VAConfigAttribRateControl == VA_RC_CQP | 
|---|
| 1328 | * because ROI delta QP is always required when VAConfigAttribRateControl == VA_RC_CQP. | 
|---|
| 1329 | */ | 
|---|
| 1330 | uint32_t roi_rc_qp_delta_support    : 1; | 
|---|
| 1331 | uint32_t reserved                   : 22; | 
|---|
| 1332 | } bits; | 
|---|
| 1333 | uint32_t value; | 
|---|
| 1334 | } VAConfigAttribValEncROI; | 
|---|
| 1335 |  | 
|---|
| 1336 | /** \brief Attribute value for VAConfigAttribEncRateControlExt */ | 
|---|
| 1337 | typedef union _VAConfigAttribValEncRateControlExt { | 
|---|
| 1338 | struct { | 
|---|
| 1339 | /** | 
|---|
| 1340 | * \brief The maximum number of temporal layers minus 1 | 
|---|
| 1341 | * | 
|---|
| 1342 | * \ref max_num_temporal_layers_minus1 plus 1 specifies the maximum number of temporal | 
|---|
| 1343 | * layers that supported by the underlying driver. \ref max_num_temporal_layers_minus1 | 
|---|
| 1344 | * equal to 0 implies the underlying driver doesn't support encoding with temporal layer. | 
|---|
| 1345 | */ | 
|---|
| 1346 | uint32_t max_num_temporal_layers_minus1      : 8; | 
|---|
| 1347 |  | 
|---|
| 1348 | /** | 
|---|
| 1349 | * /brief support temporal layer bit-rate control flag | 
|---|
| 1350 | * | 
|---|
| 1351 | * \ref temporal_layer_bitrate_control_flag equal to 1 specifies the underlying driver | 
|---|
| 1352 | * can support bit-rate control per temporal layer when (#VAConfigAttribRateControl == #VA_RC_CBR || | 
|---|
| 1353 | * #VAConfigAttribRateControl == #VA_RC_VBR). | 
|---|
| 1354 | * | 
|---|
| 1355 | * The underlying driver must set \ref temporal_layer_bitrate_control_flag to 0 when | 
|---|
| 1356 | * \c max_num_temporal_layers_minus1 is equal to 0 | 
|---|
| 1357 | * | 
|---|
| 1358 | * To use bit-rate control per temporal layer, an application must send the right layer | 
|---|
| 1359 | * structure via #VAEncMiscParameterTemporalLayerStructure at the beginning of a coded sequence | 
|---|
| 1360 | * and then followed by #VAEncMiscParameterRateControl and #VAEncMiscParameterFrameRate structures | 
|---|
| 1361 | * for each layer, using the \c temporal_id field as the layer identifier. Otherwise | 
|---|
| 1362 | * the driver doesn't use bitrate control per temporal layer if an application doesn't send the | 
|---|
| 1363 | * layer structure via #VAEncMiscParameterTemporalLayerStructure to the driver. The driver returns | 
|---|
| 1364 | * VA_STATUS_ERROR_INVALID_PARAMETER if an application sends a wrong layer structure or doesn't send | 
|---|
| 1365 | * #VAEncMiscParameterRateControl and #VAEncMiscParameterFrameRate for each layer. | 
|---|
| 1366 | * | 
|---|
| 1367 | * The driver will ignore #VAEncMiscParameterTemporalLayerStructure and the \c temporal_id field | 
|---|
| 1368 | * in #VAEncMiscParameterRateControl and #VAEncMiscParameterFrameRate if | 
|---|
| 1369 | * \ref temporal_layer_bitrate_control_flag is equal to 0 or #VAConfigAttribRateControl == #VA_RC_CQP | 
|---|
| 1370 | */ | 
|---|
| 1371 | uint32_t temporal_layer_bitrate_control_flag : 1; | 
|---|
| 1372 | uint32_t reserved                            : 23; | 
|---|
| 1373 | } bits; | 
|---|
| 1374 | uint32_t value; | 
|---|
| 1375 | } VAConfigAttribValEncRateControlExt; | 
|---|
| 1376 |  | 
|---|
| 1377 | /** \brief Attribute value for VAConfigAttribMultipleFrame*/ | 
|---|
| 1378 | typedef union _VAConfigAttribValMultipleFrame { | 
|---|
| 1379 | struct { | 
|---|
| 1380 | /** \brief max num of concurrent frames from different stream */ | 
|---|
| 1381 | uint32_t max_num_concurrent_frames      : 8; | 
|---|
| 1382 | /** \brief indicate whether all stream must support same quality level | 
|---|
| 1383 | *  if mixed_quality_level == 0, same quality level setting for multple streams is required | 
|---|
| 1384 | *  if mixed_quality_level == 1, different stream can have different quality level*/ | 
|---|
| 1385 | uint32_t mixed_quality_level            : 1; | 
|---|
| 1386 | /** \brief reserved bit for future, must be zero */ | 
|---|
| 1387 | uint32_t reserved                       : 23; | 
|---|
| 1388 | } bits; | 
|---|
| 1389 | uint32_t value; | 
|---|
| 1390 | } VAConfigAttribValMultipleFrame; | 
|---|
| 1391 |  | 
|---|
| 1392 | /** brief Attribute value VAConfigAttribValContextPriority */ | 
|---|
| 1393 | typedef union _VAConfigAttribValContextPriority { | 
|---|
| 1394 | struct { | 
|---|
| 1395 | /** \brief the priority , for the Query operation (read) it represents highest priority | 
|---|
| 1396 | * for the set operation (write), value should be [0~highest priority] , 0 is lowest priority*/ | 
|---|
| 1397 | uint32_t priority     : 16; | 
|---|
| 1398 | /** \brief reserved bits for future, must be zero*/ | 
|---|
| 1399 | uint32_t reserved     : 16; | 
|---|
| 1400 | } bits; | 
|---|
| 1401 | uint32_t value; | 
|---|
| 1402 | } VAConfigAttribValContextPriority; | 
|---|
| 1403 |  | 
|---|
| 1404 | /** @name Attribute values for VAConfigAttribProtectedContentCipherAlgorithm */ | 
|---|
| 1405 | /** \brief AES cipher */ | 
|---|
| 1406 | #define VA_PC_CIPHER_AES                    0x00000001 | 
|---|
| 1407 |  | 
|---|
| 1408 | /** @name Attribute values for VAConfigAttribProtectedContentCipherBlockSize */ | 
|---|
| 1409 | /** \brief 128 bits block size */ | 
|---|
| 1410 | #define VA_PC_BLOCK_SIZE_128                0x00000001 | 
|---|
| 1411 | /** \brief 192 bits block size */ | 
|---|
| 1412 | #define VA_PC_BLOCK_SIZE_192                0x00000002 | 
|---|
| 1413 | /** \brief 256 bits block size */ | 
|---|
| 1414 | #define VA_PC_BLOCK_SIZE_256                0x00000004 | 
|---|
| 1415 |  | 
|---|
| 1416 | /** @name Attribute values for VAConfigAttribProtectedContentCipherMode */ | 
|---|
| 1417 | /** \brief AES ECB */ | 
|---|
| 1418 | #define VA_PC_CIPHER_MODE_ECB               0x00000001 | 
|---|
| 1419 | /** \brief AES CBC */ | 
|---|
| 1420 | #define VA_PC_CIPHER_MODE_CBC               0x00000002 | 
|---|
| 1421 | /** \brief AES CTR */ | 
|---|
| 1422 | #define VA_PC_CIPHER_MODE_CTR               0x00000004 | 
|---|
| 1423 |  | 
|---|
| 1424 | /** @name Attribute values for VAConfigAttribProtectedContentCipherSampleType */ | 
|---|
| 1425 | /** \brief Full sample */ | 
|---|
| 1426 | #define VA_PC_SAMPLE_TYPE_FULLSAMPLE        0x00000001 | 
|---|
| 1427 | /** \brief Sub sample */ | 
|---|
| 1428 | #define VA_PC_SAMPLE_TYPE_SUBSAMPLE         0x00000002 | 
|---|
| 1429 |  | 
|---|
| 1430 | /** @name Attribute values for VAConfigAttribProtectedContentUsage */ | 
|---|
| 1431 | /** \brief Default usage */ | 
|---|
| 1432 | #define VA_PC_USAGE_DEFAULT                 0x00000000 | 
|---|
| 1433 | /** \brief Widevine */ | 
|---|
| 1434 | #define VA_PC_USAGE_WIDEVINE                0x00000001 | 
|---|
| 1435 |  | 
|---|
| 1436 | /** @name Attribute values for VAConfigAttribProcessingRate. */ | 
|---|
| 1437 | /**@{*/ | 
|---|
| 1438 | /** \brief Driver does not support processing rate report */ | 
|---|
| 1439 | #define VA_PROCESSING_RATE_NONE                       0x00000000 | 
|---|
| 1440 | /** \brief Driver supports encode processing rate report  */ | 
|---|
| 1441 | #define VA_PROCESSING_RATE_ENCODE                     0x00000001 | 
|---|
| 1442 | /** \brief Driver supports decode processing rate report  */ | 
|---|
| 1443 | #define VA_PROCESSING_RATE_DECODE                     0x00000002 | 
|---|
| 1444 | /**@}*/ | 
|---|
| 1445 | /** | 
|---|
| 1446 | * if an attribute is not applicable for a given | 
|---|
| 1447 | * profile/entrypoint pair, then set the value to the following | 
|---|
| 1448 | */ | 
|---|
| 1449 | #define VA_ATTRIB_NOT_SUPPORTED 0x80000000 | 
|---|
| 1450 |  | 
|---|
| 1451 | /** Get maximum number of profiles supported by the implementation */ | 
|---|
| 1452 | int vaMaxNumProfiles( | 
|---|
| 1453 | VADisplay dpy | 
|---|
| 1454 | ); | 
|---|
| 1455 |  | 
|---|
| 1456 | /** Get maximum number of entrypoints supported by the implementation */ | 
|---|
| 1457 | int vaMaxNumEntrypoints( | 
|---|
| 1458 | VADisplay dpy | 
|---|
| 1459 | ); | 
|---|
| 1460 |  | 
|---|
| 1461 | /** Get maximum number of attributs supported by the implementation */ | 
|---|
| 1462 | int vaMaxNumConfigAttributes( | 
|---|
| 1463 | VADisplay dpy | 
|---|
| 1464 | ); | 
|---|
| 1465 |  | 
|---|
| 1466 | /** | 
|---|
| 1467 | * Query supported profiles | 
|---|
| 1468 | * The caller must provide a "profile_list" array that can hold at | 
|---|
| 1469 | * least vaMaxNumProfile() entries. The actual number of profiles | 
|---|
| 1470 | * returned in "profile_list" is returned in "num_profile". | 
|---|
| 1471 | */ | 
|---|
| 1472 | VAStatus vaQueryConfigProfiles( | 
|---|
| 1473 | VADisplay dpy, | 
|---|
| 1474 | VAProfile *profile_list,    /* out */ | 
|---|
| 1475 | int *num_profiles       /* out */ | 
|---|
| 1476 | ); | 
|---|
| 1477 |  | 
|---|
| 1478 | /** | 
|---|
| 1479 | * Query supported entrypoints for a given profile | 
|---|
| 1480 | * The caller must provide an "entrypoint_list" array that can hold at | 
|---|
| 1481 | * least vaMaxNumEntrypoints() entries. The actual number of entrypoints | 
|---|
| 1482 | * returned in "entrypoint_list" is returned in "num_entrypoints". | 
|---|
| 1483 | */ | 
|---|
| 1484 | VAStatus vaQueryConfigEntrypoints( | 
|---|
| 1485 | VADisplay dpy, | 
|---|
| 1486 | VAProfile profile, | 
|---|
| 1487 | VAEntrypoint *entrypoint_list,  /* out */ | 
|---|
| 1488 | int *num_entrypoints        /* out */ | 
|---|
| 1489 | ); | 
|---|
| 1490 |  | 
|---|
| 1491 | /** | 
|---|
| 1492 | * Get attributes for a given profile/entrypoint pair | 
|---|
| 1493 | * The caller must provide an "attrib_list" with all attributes to be | 
|---|
| 1494 | * retrieved.  Upon return, the attributes in "attrib_list" have been | 
|---|
| 1495 | * updated with their value.  Unknown attributes or attributes that are | 
|---|
| 1496 | * not supported for the given profile/entrypoint pair will have their | 
|---|
| 1497 | * value set to VA_ATTRIB_NOT_SUPPORTED | 
|---|
| 1498 | */ | 
|---|
| 1499 | VAStatus vaGetConfigAttributes( | 
|---|
| 1500 | VADisplay dpy, | 
|---|
| 1501 | VAProfile profile, | 
|---|
| 1502 | VAEntrypoint entrypoint, | 
|---|
| 1503 | VAConfigAttrib *attrib_list, /* in/out */ | 
|---|
| 1504 | int num_attribs | 
|---|
| 1505 | ); | 
|---|
| 1506 |  | 
|---|
| 1507 | /** Generic ID type, can be re-typed for specific implementation */ | 
|---|
| 1508 | typedef unsigned int VAGenericID; | 
|---|
| 1509 |  | 
|---|
| 1510 | typedef VAGenericID VAConfigID; | 
|---|
| 1511 |  | 
|---|
| 1512 | /** | 
|---|
| 1513 | * Create a configuration for the video decode/encode/processing pipeline | 
|---|
| 1514 | * it passes in the attribute list that specifies the attributes it cares | 
|---|
| 1515 | * about, with the rest taking default values. | 
|---|
| 1516 | */ | 
|---|
| 1517 | VAStatus vaCreateConfig( | 
|---|
| 1518 | VADisplay dpy, | 
|---|
| 1519 | VAProfile profile, | 
|---|
| 1520 | VAEntrypoint entrypoint, | 
|---|
| 1521 | VAConfigAttrib *attrib_list, | 
|---|
| 1522 | int num_attribs, | 
|---|
| 1523 | VAConfigID *config_id /* out */ | 
|---|
| 1524 | ); | 
|---|
| 1525 |  | 
|---|
| 1526 | /** | 
|---|
| 1527 | * Free resources associdated with a given config | 
|---|
| 1528 | */ | 
|---|
| 1529 | VAStatus vaDestroyConfig( | 
|---|
| 1530 | VADisplay dpy, | 
|---|
| 1531 | VAConfigID config_id | 
|---|
| 1532 | ); | 
|---|
| 1533 |  | 
|---|
| 1534 | /** | 
|---|
| 1535 | * Query all attributes for a given configuration | 
|---|
| 1536 | * The profile of the configuration is returned in "profile" | 
|---|
| 1537 | * The entrypoint of the configuration is returned in "entrypoint" | 
|---|
| 1538 | * The caller must provide an "attrib_list" array that can hold at least | 
|---|
| 1539 | * vaMaxNumConfigAttributes() entries. The actual number of attributes | 
|---|
| 1540 | * returned in "attrib_list" is returned in "num_attribs" | 
|---|
| 1541 | */ | 
|---|
| 1542 | VAStatus vaQueryConfigAttributes( | 
|---|
| 1543 | VADisplay dpy, | 
|---|
| 1544 | VAConfigID config_id, | 
|---|
| 1545 | VAProfile *profile,     /* out */ | 
|---|
| 1546 | VAEntrypoint *entrypoint,   /* out */ | 
|---|
| 1547 | VAConfigAttrib *attrib_list,/* out */ | 
|---|
| 1548 | int *num_attribs        /* out */ | 
|---|
| 1549 | ); | 
|---|
| 1550 |  | 
|---|
| 1551 |  | 
|---|
| 1552 | /** | 
|---|
| 1553 | * Contexts and Surfaces | 
|---|
| 1554 | * | 
|---|
| 1555 | * Context represents a "virtual" video decode, encode or video processing | 
|---|
| 1556 | * pipeline. Surfaces are render targets for a given context. The data in the | 
|---|
| 1557 | * surfaces are not accessible to the client except if derived image is supported | 
|---|
| 1558 | * and the internal data format of the surface is implementation specific. | 
|---|
| 1559 | * | 
|---|
| 1560 | * Surfaces are provided as a hint of what surfaces will be used when the context | 
|---|
| 1561 | * is created through vaCreateContext(). A surface may be used by different contexts | 
|---|
| 1562 | * at the same time as soon as application can make sure the operations are synchronized | 
|---|
| 1563 | * between different contexts, e.g. a surface is used as the output of a decode context | 
|---|
| 1564 | * and the input of a video process context. Surfaces can only be destroyed after all | 
|---|
| 1565 | * contexts using these surfaces have been destroyed. | 
|---|
| 1566 | * | 
|---|
| 1567 | * Both contexts and surfaces are identified by unique IDs and its | 
|---|
| 1568 | * implementation specific internals are kept opaque to the clients | 
|---|
| 1569 | */ | 
|---|
| 1570 |  | 
|---|
| 1571 | typedef VAGenericID VAContextID; | 
|---|
| 1572 |  | 
|---|
| 1573 | typedef VAGenericID VASurfaceID; | 
|---|
| 1574 |  | 
|---|
| 1575 | #define VA_INVALID_ID       0xffffffff | 
|---|
| 1576 | #define VA_INVALID_SURFACE  VA_INVALID_ID | 
|---|
| 1577 |  | 
|---|
| 1578 | /** \brief Generic value types. */ | 
|---|
| 1579 | typedef enum  { | 
|---|
| 1580 | VAGenericValueTypeInteger = 1,      /**< 32-bit signed integer. */ | 
|---|
| 1581 | VAGenericValueTypeFloat,            /**< 32-bit floating-point value. */ | 
|---|
| 1582 | VAGenericValueTypePointer,          /**< Generic pointer type */ | 
|---|
| 1583 | VAGenericValueTypeFunc              /**< Pointer to function */ | 
|---|
| 1584 | } VAGenericValueType; | 
|---|
| 1585 |  | 
|---|
| 1586 | /** \brief Generic function type. */ | 
|---|
| 1587 | typedef void (*VAGenericFunc)(void); | 
|---|
| 1588 |  | 
|---|
| 1589 | /** \brief Generic value. */ | 
|---|
| 1590 | typedef struct _VAGenericValue { | 
|---|
| 1591 | /** \brief Value type. See #VAGenericValueType. */ | 
|---|
| 1592 | VAGenericValueType  type; | 
|---|
| 1593 | /** \brief Value holder. */ | 
|---|
| 1594 | union { | 
|---|
| 1595 | /** \brief 32-bit signed integer. */ | 
|---|
| 1596 | int32_t             i; | 
|---|
| 1597 | /** \brief 32-bit float. */ | 
|---|
| 1598 | float           f; | 
|---|
| 1599 | /** \brief Generic pointer. */ | 
|---|
| 1600 | void           *p; | 
|---|
| 1601 | /** \brief Pointer to function. */ | 
|---|
| 1602 | VAGenericFunc   fn; | 
|---|
| 1603 | }                   value; | 
|---|
| 1604 | } VAGenericValue; | 
|---|
| 1605 |  | 
|---|
| 1606 | /** @name Surface attribute flags */ | 
|---|
| 1607 | /**@{*/ | 
|---|
| 1608 | /** \brief Surface attribute is not supported. */ | 
|---|
| 1609 | #define VA_SURFACE_ATTRIB_NOT_SUPPORTED 0x00000000 | 
|---|
| 1610 | /** \brief Surface attribute can be got through vaQuerySurfaceAttributes(). */ | 
|---|
| 1611 | #define VA_SURFACE_ATTRIB_GETTABLE      0x00000001 | 
|---|
| 1612 | /** \brief Surface attribute can be set through vaCreateSurfaces(). */ | 
|---|
| 1613 | #define VA_SURFACE_ATTRIB_SETTABLE      0x00000002 | 
|---|
| 1614 | /**@}*/ | 
|---|
| 1615 |  | 
|---|
| 1616 | /** \brief Surface attribute types. */ | 
|---|
| 1617 | typedef enum { | 
|---|
| 1618 | VASurfaceAttribNone = 0, | 
|---|
| 1619 | /** | 
|---|
| 1620 | * \brief Pixel format as a FOURCC (int, read/write). | 
|---|
| 1621 | * | 
|---|
| 1622 | * When vaQuerySurfaceAttributes() is called, the driver will return one | 
|---|
| 1623 | * PixelFormat attribute per supported pixel format. | 
|---|
| 1624 | * | 
|---|
| 1625 | * When provided as an input to vaCreateSurfaces(), the driver will | 
|---|
| 1626 | * allocate a surface with the provided pixel format. | 
|---|
| 1627 | */ | 
|---|
| 1628 | VASurfaceAttribPixelFormat, | 
|---|
| 1629 | /** \brief Minimal width in pixels (int, read-only). */ | 
|---|
| 1630 | VASurfaceAttribMinWidth, | 
|---|
| 1631 | /** \brief Maximal width in pixels (int, read-only). */ | 
|---|
| 1632 | VASurfaceAttribMaxWidth, | 
|---|
| 1633 | /** \brief Minimal height in pixels (int, read-only). */ | 
|---|
| 1634 | VASurfaceAttribMinHeight, | 
|---|
| 1635 | /** \brief Maximal height in pixels (int, read-only). */ | 
|---|
| 1636 | VASurfaceAttribMaxHeight, | 
|---|
| 1637 | /** \brief Surface memory type expressed in bit fields (int, read/write). */ | 
|---|
| 1638 | VASurfaceAttribMemoryType, | 
|---|
| 1639 | /** \brief External buffer descriptor (pointer, write). | 
|---|
| 1640 | * | 
|---|
| 1641 | * Refer to the documentation for the memory type being created to | 
|---|
| 1642 | * determine what descriptor structure to pass here.  If not otherwise | 
|---|
| 1643 | * stated, the common VASurfaceAttribExternalBuffers should be used. | 
|---|
| 1644 | */ | 
|---|
| 1645 | VASurfaceAttribExternalBufferDescriptor, | 
|---|
| 1646 | /** \brief Surface usage hint, gives the driver a hint of intended usage | 
|---|
| 1647 | *  to optimize allocation (e.g. tiling) (int, read/write). */ | 
|---|
| 1648 | VASurfaceAttribUsageHint, | 
|---|
| 1649 | /** \brief List of possible DRM format modifiers (pointer, write). | 
|---|
| 1650 | * | 
|---|
| 1651 | * The value must be a pointer to a VADRMFormatModifierList. This can only | 
|---|
| 1652 | * be used when allocating a new buffer, it's invalid to use this attribute | 
|---|
| 1653 | * when importing an existing buffer. | 
|---|
| 1654 | */ | 
|---|
| 1655 | VASurfaceAttribDRMFormatModifiers, | 
|---|
| 1656 | /** \brief Number of surface attributes. */ | 
|---|
| 1657 | VASurfaceAttribCount | 
|---|
| 1658 | } VASurfaceAttribType; | 
|---|
| 1659 |  | 
|---|
| 1660 | /** \brief Surface attribute. */ | 
|---|
| 1661 | typedef struct _VASurfaceAttrib { | 
|---|
| 1662 | /** \brief Type. */ | 
|---|
| 1663 | VASurfaceAttribType type; | 
|---|
| 1664 | /** \brief Flags. See "Surface attribute flags". */ | 
|---|
| 1665 | uint32_t        flags; | 
|---|
| 1666 | /** \brief Value. See "Surface attribute types" for the expected types. */ | 
|---|
| 1667 | VAGenericValue      value; | 
|---|
| 1668 | } VASurfaceAttrib; | 
|---|
| 1669 |  | 
|---|
| 1670 | /** | 
|---|
| 1671 | * @name VASurfaceAttribMemoryType values in bit fields. | 
|---|
| 1672 | * Bit 0:7 are reserved for generic types, Bit 31:28 are reserved for | 
|---|
| 1673 | * Linux DRM, Bit 23:20 are reserved for Android. DRM and Android specific | 
|---|
| 1674 | * types are defined in DRM and Android header files. | 
|---|
| 1675 | */ | 
|---|
| 1676 | /**@{*/ | 
|---|
| 1677 | /** \brief VA memory type (default) is supported. */ | 
|---|
| 1678 | #define VA_SURFACE_ATTRIB_MEM_TYPE_VA           0x00000001 | 
|---|
| 1679 | /** \brief V4L2 buffer memory type is supported. */ | 
|---|
| 1680 | #define VA_SURFACE_ATTRIB_MEM_TYPE_V4L2         0x00000002 | 
|---|
| 1681 | /** \brief User pointer memory type is supported. */ | 
|---|
| 1682 | #define VA_SURFACE_ATTRIB_MEM_TYPE_USER_PTR     0x00000004 | 
|---|
| 1683 | /**@}*/ | 
|---|
| 1684 |  | 
|---|
| 1685 | /** | 
|---|
| 1686 | * \brief VASurfaceAttribExternalBuffers structure for | 
|---|
| 1687 | * the VASurfaceAttribExternalBufferDescriptor attribute. | 
|---|
| 1688 | */ | 
|---|
| 1689 | typedef struct _VASurfaceAttribExternalBuffers { | 
|---|
| 1690 | /** \brief pixel format in fourcc. */ | 
|---|
| 1691 | uint32_t pixel_format; | 
|---|
| 1692 | /** \brief width in pixels. */ | 
|---|
| 1693 | uint32_t width; | 
|---|
| 1694 | /** \brief height in pixels. */ | 
|---|
| 1695 | uint32_t height; | 
|---|
| 1696 | /** \brief total size of the buffer in bytes. */ | 
|---|
| 1697 | uint32_t data_size; | 
|---|
| 1698 | /** \brief number of planes for planar layout */ | 
|---|
| 1699 | uint32_t num_planes; | 
|---|
| 1700 | /** \brief pitch for each plane in bytes */ | 
|---|
| 1701 | uint32_t pitches[4]; | 
|---|
| 1702 | /** \brief offset for each plane in bytes */ | 
|---|
| 1703 | uint32_t offsets[4]; | 
|---|
| 1704 | /** \brief buffer handles or user pointers */ | 
|---|
| 1705 | uintptr_t *buffers; | 
|---|
| 1706 | /** \brief number of elements in the "buffers" array */ | 
|---|
| 1707 | uint32_t num_buffers; | 
|---|
| 1708 | /** \brief flags. See "Surface external buffer descriptor flags". */ | 
|---|
| 1709 | uint32_t flags; | 
|---|
| 1710 | /** \brief reserved for passing private data */ | 
|---|
| 1711 | void *private_data; | 
|---|
| 1712 | } VASurfaceAttribExternalBuffers; | 
|---|
| 1713 |  | 
|---|
| 1714 | /** @name VASurfaceAttribExternalBuffers flags */ | 
|---|
| 1715 | /**@{*/ | 
|---|
| 1716 | /** \brief Enable memory tiling */ | 
|---|
| 1717 | #define VA_SURFACE_EXTBUF_DESC_ENABLE_TILING    0x00000001 | 
|---|
| 1718 | /** \brief Memory is cacheable */ | 
|---|
| 1719 | #define VA_SURFACE_EXTBUF_DESC_CACHED       0x00000002 | 
|---|
| 1720 | /** \brief Memory is non-cacheable */ | 
|---|
| 1721 | #define VA_SURFACE_EXTBUF_DESC_UNCACHED     0x00000004 | 
|---|
| 1722 | /** \brief Memory is write-combined */ | 
|---|
| 1723 | #define VA_SURFACE_EXTBUF_DESC_WC       0x00000008 | 
|---|
| 1724 | /** \brief Memory is protected */ | 
|---|
| 1725 | #define VA_SURFACE_EXTBUF_DESC_PROTECTED        0x80000000 | 
|---|
| 1726 |  | 
|---|
| 1727 | /** @name VASurfaceAttribUsageHint attribute usage hint flags */ | 
|---|
| 1728 | /**@{*/ | 
|---|
| 1729 | /** \brief Surface usage not indicated. */ | 
|---|
| 1730 | #define VA_SURFACE_ATTRIB_USAGE_HINT_GENERIC    0x00000000 | 
|---|
| 1731 | /** \brief Surface used by video decoder. */ | 
|---|
| 1732 | #define VA_SURFACE_ATTRIB_USAGE_HINT_DECODER    0x00000001 | 
|---|
| 1733 | /** \brief Surface used by video encoder. */ | 
|---|
| 1734 | #define VA_SURFACE_ATTRIB_USAGE_HINT_ENCODER    0x00000002 | 
|---|
| 1735 | /** \brief Surface read by video post-processing. */ | 
|---|
| 1736 | #define VA_SURFACE_ATTRIB_USAGE_HINT_VPP_READ   0x00000004 | 
|---|
| 1737 | /** \brief Surface written by video post-processing. */ | 
|---|
| 1738 | #define VA_SURFACE_ATTRIB_USAGE_HINT_VPP_WRITE  0x00000008 | 
|---|
| 1739 | /** \brief Surface used for display. */ | 
|---|
| 1740 | #define VA_SURFACE_ATTRIB_USAGE_HINT_DISPLAY    0x00000010 | 
|---|
| 1741 | /** \brief Surface used for export to third-party APIs, e.g. via | 
|---|
| 1742 | *  vaExportSurfaceHandle(). */ | 
|---|
| 1743 | #define VA_SURFACE_ATTRIB_USAGE_HINT_EXPORT     0x00000020 | 
|---|
| 1744 |  | 
|---|
| 1745 | /**@}*/ | 
|---|
| 1746 |  | 
|---|
| 1747 | /** | 
|---|
| 1748 | * \brief Queries surface attributes for the supplied config. | 
|---|
| 1749 | * | 
|---|
| 1750 | * This function queries for all supported attributes for the | 
|---|
| 1751 | * supplied VA @config. In particular, if the underlying hardware | 
|---|
| 1752 | * supports the creation of VA surfaces in various formats, then | 
|---|
| 1753 | * this function will enumerate all pixel formats that are supported. | 
|---|
| 1754 | * | 
|---|
| 1755 | * The \c attrib_list array is allocated by the user and \c | 
|---|
| 1756 | * num_attribs shall be initialized to the number of allocated | 
|---|
| 1757 | * elements in that array. Upon successful return, the actual number | 
|---|
| 1758 | * of attributes will be overwritten into \c num_attribs. Otherwise, | 
|---|
| 1759 | * \c VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned and \c num_attribs | 
|---|
| 1760 | * is adjusted to the number of elements that would be returned if | 
|---|
| 1761 | * enough space was available. | 
|---|
| 1762 | * | 
|---|
| 1763 | * Note: it is perfectly valid to pass NULL to the \c attrib_list | 
|---|
| 1764 | * argument when vaQuerySurfaceAttributes() is used to determine the | 
|---|
| 1765 | * actual number of elements that need to be allocated. | 
|---|
| 1766 | * | 
|---|
| 1767 | * @param[in] dpy               the VA display | 
|---|
| 1768 | * @param[in] config            the config identifying a codec or a video | 
|---|
| 1769 | *     processing pipeline | 
|---|
| 1770 | * @param[out] attrib_list      the output array of #VASurfaceAttrib elements | 
|---|
| 1771 | * @param[in,out] num_attribs   the number of elements allocated on | 
|---|
| 1772 | *      input, the number of elements actually filled in output | 
|---|
| 1773 | */ | 
|---|
| 1774 | VAStatus | 
|---|
| 1775 | vaQuerySurfaceAttributes( | 
|---|
| 1776 | VADisplay           dpy, | 
|---|
| 1777 | VAConfigID          config, | 
|---|
| 1778 | VASurfaceAttrib    *attrib_list, | 
|---|
| 1779 | unsigned int       *num_attribs | 
|---|
| 1780 | ); | 
|---|
| 1781 |  | 
|---|
| 1782 | /** | 
|---|
| 1783 | * \brief Creates an array of surfaces | 
|---|
| 1784 | * | 
|---|
| 1785 | * Creates an array of surfaces. The optional list of attributes shall | 
|---|
| 1786 | * be constructed based on what the underlying hardware could expose | 
|---|
| 1787 | * through vaQuerySurfaceAttributes(). | 
|---|
| 1788 | * | 
|---|
| 1789 | * @param[in] dpy               the VA display | 
|---|
| 1790 | * @param[in] format            the desired surface format. See \c VA_RT_FORMAT_* | 
|---|
| 1791 | * @param[in] width             the surface width | 
|---|
| 1792 | * @param[in] height            the surface height | 
|---|
| 1793 | * @param[out] surfaces         the array of newly created surfaces | 
|---|
| 1794 | * @param[in] num_surfaces      the number of surfaces to create | 
|---|
| 1795 | * @param[in] attrib_list       the list of (optional) attributes, or \c NULL | 
|---|
| 1796 | * @param[in] num_attribs       the number of attributes supplied in | 
|---|
| 1797 | *     \c attrib_list, or zero | 
|---|
| 1798 | */ | 
|---|
| 1799 | VAStatus | 
|---|
| 1800 | vaCreateSurfaces( | 
|---|
| 1801 | VADisplay           dpy, | 
|---|
| 1802 | unsigned int        format, | 
|---|
| 1803 | unsigned int        width, | 
|---|
| 1804 | unsigned int        height, | 
|---|
| 1805 | VASurfaceID        *surfaces, | 
|---|
| 1806 | unsigned int        num_surfaces, | 
|---|
| 1807 | VASurfaceAttrib    *attrib_list, | 
|---|
| 1808 | unsigned int        num_attribs | 
|---|
| 1809 | ); | 
|---|
| 1810 |  | 
|---|
| 1811 | /** | 
|---|
| 1812 | * vaDestroySurfaces - Destroy resources associated with surfaces. | 
|---|
| 1813 | *  Surfaces can only be destroyed after all contexts using these surfaces have been | 
|---|
| 1814 | *  destroyed. | 
|---|
| 1815 | *  dpy: display | 
|---|
| 1816 | *  surfaces: array of surfaces to destroy | 
|---|
| 1817 | *  num_surfaces: number of surfaces in the array to be destroyed. | 
|---|
| 1818 | */ | 
|---|
| 1819 | VAStatus vaDestroySurfaces( | 
|---|
| 1820 | VADisplay dpy, | 
|---|
| 1821 | VASurfaceID *surfaces, | 
|---|
| 1822 | int num_surfaces | 
|---|
| 1823 | ); | 
|---|
| 1824 |  | 
|---|
| 1825 | #define VA_PROGRESSIVE 0x1 | 
|---|
| 1826 | /** | 
|---|
| 1827 | * vaCreateContext - Create a context | 
|---|
| 1828 | *  dpy: display | 
|---|
| 1829 | *  config_id: configuration for the context | 
|---|
| 1830 | *  picture_width: coded picture width | 
|---|
| 1831 | *  picture_height: coded picture height | 
|---|
| 1832 | *  flag: any combination of the following: | 
|---|
| 1833 | *    VA_PROGRESSIVE (only progressive frame pictures in the sequence when set) | 
|---|
| 1834 | *  render_targets: a hint for render targets (surfaces) tied to the context | 
|---|
| 1835 | *  num_render_targets: number of render targets in the above array | 
|---|
| 1836 | *  context: created context id upon return | 
|---|
| 1837 | */ | 
|---|
| 1838 | VAStatus vaCreateContext( | 
|---|
| 1839 | VADisplay dpy, | 
|---|
| 1840 | VAConfigID config_id, | 
|---|
| 1841 | int picture_width, | 
|---|
| 1842 | int picture_height, | 
|---|
| 1843 | int flag, | 
|---|
| 1844 | VASurfaceID *render_targets, | 
|---|
| 1845 | int num_render_targets, | 
|---|
| 1846 | VAContextID *context        /* out */ | 
|---|
| 1847 | ); | 
|---|
| 1848 |  | 
|---|
| 1849 | /** | 
|---|
| 1850 | * vaDestroyContext - Destroy a context | 
|---|
| 1851 | *  dpy: display | 
|---|
| 1852 | *  context: context to be destroyed | 
|---|
| 1853 | */ | 
|---|
| 1854 | VAStatus vaDestroyContext( | 
|---|
| 1855 | VADisplay dpy, | 
|---|
| 1856 | VAContextID context | 
|---|
| 1857 | ); | 
|---|
| 1858 |  | 
|---|
| 1859 | //Multi-frame context | 
|---|
| 1860 | typedef VAGenericID VAMFContextID; | 
|---|
| 1861 | /** | 
|---|
| 1862 | * vaCreateMFContext - Create a multi-frame context | 
|---|
| 1863 | *  interface encapsulating common for all streams memory objects and structures | 
|---|
| 1864 | *  required for single GPU task submission from several VAContextID's. | 
|---|
| 1865 | *  Allocation: This call only creates an instance, doesn't allocate any additional memory. | 
|---|
| 1866 | *  Support identification: Application can identify multi-frame feature support by ability | 
|---|
| 1867 | *  to create multi-frame context. If driver supports multi-frame - call successful, | 
|---|
| 1868 | *  mf_context != NULL and VAStatus = VA_STATUS_SUCCESS, otherwise if multi-frame processing | 
|---|
| 1869 | *  not supported driver returns VA_STATUS_ERROR_UNIMPLEMENTED and mf_context = NULL. | 
|---|
| 1870 | *  return values: | 
|---|
| 1871 | *  VA_STATUS_SUCCESS - operation successful. | 
|---|
| 1872 | *  VA_STATUS_ERROR_UNIMPLEMENTED - no support for multi-frame. | 
|---|
| 1873 | *  dpy: display adapter. | 
|---|
| 1874 | *  mf_context: Multi-Frame context encapsulating all associated context | 
|---|
| 1875 | *  for multi-frame submission. | 
|---|
| 1876 | */ | 
|---|
| 1877 | VAStatus vaCreateMFContext( | 
|---|
| 1878 | VADisplay dpy, | 
|---|
| 1879 | VAMFContextID *mf_context    /* out */ | 
|---|
| 1880 | ); | 
|---|
| 1881 |  | 
|---|
| 1882 | /** | 
|---|
| 1883 | * vaMFAddContext - Provide ability to associate each context used for | 
|---|
| 1884 | *  Multi-Frame submission and common Multi-Frame context. | 
|---|
| 1885 | *  Try to add context to understand if it is supported. | 
|---|
| 1886 | *  Allocation: this call allocates and/or reallocates all memory objects | 
|---|
| 1887 | *  common for all contexts associated with particular Multi-Frame context. | 
|---|
| 1888 | *  All memory required for each context(pixel buffers, internal driver | 
|---|
| 1889 | *  buffers required for processing) allocated during standard vaCreateContext call for each context. | 
|---|
| 1890 | *  Runtime dependency - if current implementation doesn't allow to run different entry points/profile, | 
|---|
| 1891 | *  first context added will set entry point/profile for whole Multi-Frame context, | 
|---|
| 1892 | *  all other entry points and profiles can be rejected to be added. | 
|---|
| 1893 | *  Return values: | 
|---|
| 1894 | *  VA_STATUS_SUCCESS - operation successful, context was added. | 
|---|
| 1895 | *  VA_STATUS_ERROR_OPERATION_FAILED - something unexpected happened - application have to close | 
|---|
| 1896 | *  current mf_context and associated contexts and start working with new ones. | 
|---|
| 1897 | *  VA_STATUS_ERROR_INVALID_CONTEXT - ContextID is invalid, means: | 
|---|
| 1898 | *  1 - mf_context is not valid context or | 
|---|
| 1899 | *  2 - driver can't suport different VAEntrypoint or VAProfile simultaneosly | 
|---|
| 1900 | *  and current context contradicts with previously added, application can continue with current mf_context | 
|---|
| 1901 | *  and other contexts passed this call, rejected context can continue work in stand-alone | 
|---|
| 1902 | *  mode or other mf_context. | 
|---|
| 1903 | *  VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT - particular context being added was created with with | 
|---|
| 1904 | *  unsupported VAEntrypoint. Application can continue with current mf_context | 
|---|
| 1905 | *  and other contexts passed this call, rejected context can continue work in stand-alone | 
|---|
| 1906 | *  mode. | 
|---|
| 1907 | *  VA_STATUS_ERROR_UNSUPPORTED_PROFILE - Current context with Particular VAEntrypoint is supported | 
|---|
| 1908 | *  but VAProfile is not supported. Application can continue with current mf_context | 
|---|
| 1909 | *  and other contexts passed this call, rejected context can continue work in stand-alone | 
|---|
| 1910 | *  mode. | 
|---|
| 1911 | *  dpy: display adapter. | 
|---|
| 1912 | *  context: context being associated with Multi-Frame context. | 
|---|
| 1913 | *  mf_context: - multi-frame context used to associate contexts for multi-frame submission. | 
|---|
| 1914 | */ | 
|---|
| 1915 | VAStatus vaMFAddContext( | 
|---|
| 1916 | VADisplay dpy, | 
|---|
| 1917 | VAMFContextID mf_context, | 
|---|
| 1918 | VAContextID context | 
|---|
| 1919 | ); | 
|---|
| 1920 |  | 
|---|
| 1921 | /** | 
|---|
| 1922 | * vaMFReleaseContext - Removes context from multi-frame and | 
|---|
| 1923 | *  association with multi-frame context. | 
|---|
| 1924 | *  After association removed vaEndPicture will submit tasks, but not vaMFSubmit. | 
|---|
| 1925 | *  Return values: | 
|---|
| 1926 | *  VA_STATUS_SUCCESS - operation successful, context was removed. | 
|---|
| 1927 | *  VA_STATUS_ERROR_OPERATION_FAILED - something unexpected happened. | 
|---|
| 1928 | *  application need to destroy this VAMFContextID and all assotiated VAContextID | 
|---|
| 1929 | *  dpy: display | 
|---|
| 1930 | *  mf_context: VAMFContextID where context is added | 
|---|
| 1931 | *  context: VAContextID to be added | 
|---|
| 1932 | */ | 
|---|
| 1933 | VAStatus vaMFReleaseContext( | 
|---|
| 1934 | VADisplay dpy, | 
|---|
| 1935 | VAMFContextID mf_context, | 
|---|
| 1936 | VAContextID context | 
|---|
| 1937 | ); | 
|---|
| 1938 |  | 
|---|
| 1939 | /** | 
|---|
| 1940 | * Buffers | 
|---|
| 1941 | * Buffers are used to pass various types of data from the | 
|---|
| 1942 | * client to the server. The server maintains a data store | 
|---|
| 1943 | * for each buffer created, and the client idenfies a buffer | 
|---|
| 1944 | * through a unique buffer id assigned by the server. | 
|---|
| 1945 | */ | 
|---|
| 1946 |  | 
|---|
| 1947 | typedef VAGenericID VABufferID; | 
|---|
| 1948 |  | 
|---|
| 1949 | typedef enum { | 
|---|
| 1950 | VAPictureParameterBufferType    = 0, | 
|---|
| 1951 | VAIQMatrixBufferType        = 1, | 
|---|
| 1952 | VABitPlaneBufferType        = 2, | 
|---|
| 1953 | VASliceGroupMapBufferType       = 3, | 
|---|
| 1954 | VASliceParameterBufferType      = 4, | 
|---|
| 1955 | VASliceDataBufferType       = 5, | 
|---|
| 1956 | VAMacroblockParameterBufferType = 6, | 
|---|
| 1957 | VAResidualDataBufferType        = 7, | 
|---|
| 1958 | VADeblockingParameterBufferType = 8, | 
|---|
| 1959 | VAImageBufferType           = 9, | 
|---|
| 1960 | VAProtectedSliceDataBufferType  = 10, | 
|---|
| 1961 | VAQMatrixBufferType                 = 11, | 
|---|
| 1962 | VAHuffmanTableBufferType            = 12, | 
|---|
| 1963 | VAProbabilityBufferType             = 13, | 
|---|
| 1964 |  | 
|---|
| 1965 | /* Following are encode buffer types */ | 
|---|
| 1966 | VAEncCodedBufferType        = 21, | 
|---|
| 1967 | VAEncSequenceParameterBufferType    = 22, | 
|---|
| 1968 | VAEncPictureParameterBufferType = 23, | 
|---|
| 1969 | VAEncSliceParameterBufferType   = 24, | 
|---|
| 1970 | = 25, | 
|---|
| 1971 | = 26, | 
|---|
| 1972 | VAEncMiscParameterBufferType    = 27, | 
|---|
| 1973 | VAEncMacroblockParameterBufferType  = 28, | 
|---|
| 1974 | VAEncMacroblockMapBufferType        = 29, | 
|---|
| 1975 |  | 
|---|
| 1976 | /** | 
|---|
| 1977 | * \brief Encoding QP buffer | 
|---|
| 1978 | * | 
|---|
| 1979 | * This buffer contains QP per MB for encoding. Currently | 
|---|
| 1980 | * VAEncQPBufferH264 is defined for H.264 encoding, see | 
|---|
| 1981 | * #VAEncQPBufferH264 for details | 
|---|
| 1982 | */ | 
|---|
| 1983 | VAEncQPBufferType                   = 30, | 
|---|
| 1984 | /* Following are video processing buffer types */ | 
|---|
| 1985 | /** | 
|---|
| 1986 | * \brief Video processing pipeline parameter buffer. | 
|---|
| 1987 | * | 
|---|
| 1988 | * This buffer describes the video processing pipeline. See | 
|---|
| 1989 | * #VAProcPipelineParameterBuffer for details. | 
|---|
| 1990 | */ | 
|---|
| 1991 | VAProcPipelineParameterBufferType   = 41, | 
|---|
| 1992 | /** | 
|---|
| 1993 | * \brief Video filter parameter buffer. | 
|---|
| 1994 | * | 
|---|
| 1995 | * This buffer describes the video filter parameters. All buffers | 
|---|
| 1996 | * inherit from #VAProcFilterParameterBufferBase, thus including | 
|---|
| 1997 | * a unique filter buffer type. | 
|---|
| 1998 | * | 
|---|
| 1999 | * The default buffer used by most filters is #VAProcFilterParameterBuffer. | 
|---|
| 2000 | * Filters requiring advanced parameters include, but are not limited to, | 
|---|
| 2001 | * deinterlacing (#VAProcFilterParameterBufferDeinterlacing), | 
|---|
| 2002 | * color balance (#VAProcFilterParameterBufferColorBalance), etc. | 
|---|
| 2003 | */ | 
|---|
| 2004 | VAProcFilterParameterBufferType     = 42, | 
|---|
| 2005 | /** | 
|---|
| 2006 | * \brief FEI specific buffer types | 
|---|
| 2007 | */ | 
|---|
| 2008 | VAEncFEIMVBufferType                = 43, | 
|---|
| 2009 | VAEncFEIMBCodeBufferType            = 44, | 
|---|
| 2010 | VAEncFEIDistortionBufferType        = 45, | 
|---|
| 2011 | VAEncFEIMBControlBufferType         = 46, | 
|---|
| 2012 | VAEncFEIMVPredictorBufferType       = 47, | 
|---|
| 2013 | VAStatsStatisticsParameterBufferType = 48, | 
|---|
| 2014 | /** \brief Statistics output for VAEntrypointStats progressive and top field of interlaced case*/ | 
|---|
| 2015 | VAStatsStatisticsBufferType         = 49, | 
|---|
| 2016 | /** \brief Statistics output for VAEntrypointStats bottom field of interlaced case*/ | 
|---|
| 2017 | VAStatsStatisticsBottomFieldBufferType = 50, | 
|---|
| 2018 | VAStatsMVBufferType                 = 51, | 
|---|
| 2019 | VAStatsMVPredictorBufferType        = 52, | 
|---|
| 2020 | /** Force MB's to be non skip for encode.it's per-mb control buffer, The width of the MB map | 
|---|
| 2021 | * Surface is (width of the Picture in MB unit) * 1 byte, multiple of 64 bytes. | 
|---|
| 2022 | * The height is (height of the picture in MB unit). The picture is either | 
|---|
| 2023 | * frame or non-interleaved top or bottom field.  If the application provides this | 
|---|
| 2024 | *surface, it will override the "skipCheckDisable" setting in VAEncMiscParameterEncQuality. | 
|---|
| 2025 | */ | 
|---|
| 2026 | VAEncMacroblockDisableSkipMapBufferType = 53, | 
|---|
| 2027 | /** | 
|---|
| 2028 | * \brief HEVC FEI CTB level cmd buffer | 
|---|
| 2029 | * it is CTB level information for future usage. | 
|---|
| 2030 | */ | 
|---|
| 2031 | VAEncFEICTBCmdBufferType            = 54, | 
|---|
| 2032 | /** | 
|---|
| 2033 | * \brief HEVC FEI CU level data buffer | 
|---|
| 2034 | * it's CTB level information for future usage | 
|---|
| 2035 | */ | 
|---|
| 2036 | VAEncFEICURecordBufferType          = 55, | 
|---|
| 2037 | /** decode stream out buffer, intermedia data of decode, it may include MV, MB mode etc. | 
|---|
| 2038 | * it can be used to detect motion and analyze the frame contain  */ | 
|---|
| 2039 | VADecodeStreamoutBufferType             = 56, | 
|---|
| 2040 |  | 
|---|
| 2041 | /** \brief HEVC Decoding Subset Parameter buffer type | 
|---|
| 2042 | * | 
|---|
| 2043 | * The subsets parameter buffer is concatenation with one or multiple | 
|---|
| 2044 | * subset entry point offsets. All the offset values are layed out one | 
|---|
| 2045 | * by one according to slice order with first slice segment first, second | 
|---|
| 2046 | * slice segment second, etc... The entry number is indicated by parameter | 
|---|
| 2047 | * \ref num_entry_point_offsets. And the first entry position of the entry | 
|---|
| 2048 | * point offsets for any slice segment is indicated by parameter | 
|---|
| 2049 | * entry_offset_to_subset_array in VAPictureParameterBufferHEVC data structure. | 
|---|
| 2050 | */ | 
|---|
| 2051 | VASubsetsParameterBufferType        = 57, | 
|---|
| 2052 | /** \brief adjust context parameters dynamically | 
|---|
| 2053 | * | 
|---|
| 2054 | * this parameter is used to update context parameters, detail parameter is in | 
|---|
| 2055 | *  \c VAContextParameterUpdateBuffer | 
|---|
| 2056 | */ | 
|---|
| 2057 | VAContextParameterUpdateBufferType  = 58, | 
|---|
| 2058 | /** | 
|---|
| 2059 | * \brief Protected session execution buffer type | 
|---|
| 2060 | * | 
|---|
| 2061 | * It's for TEE execution usage (vaProtectedSessionExecute()). The buffer structure is in | 
|---|
| 2062 | * \c VAProtectedSessionExecuteBuffer | 
|---|
| 2063 | */ | 
|---|
| 2064 | VAProtectedSessionExecuteBufferType = 59, | 
|---|
| 2065 |  | 
|---|
| 2066 | /** \brief Encryption parameters buffer for protected content session. | 
|---|
| 2067 | * | 
|---|
| 2068 | * Refer to \c VAEncryptionParameters | 
|---|
| 2069 | */ | 
|---|
| 2070 | VAEncryptionParameterBufferType = 60, | 
|---|
| 2071 |  | 
|---|
| 2072 | VABufferTypeMax | 
|---|
| 2073 | } VABufferType; | 
|---|
| 2074 |  | 
|---|
| 2075 | /** \brief update the context parameter | 
|---|
| 2076 | * this structure is used to update context parameters, such as priority of the context | 
|---|
| 2077 | * backend driver should keep the parameter unchanged if there no new | 
|---|
| 2078 | * parameter updated. | 
|---|
| 2079 | */ | 
|---|
| 2080 | typedef struct _VAContextParameterUpdateBuffer { | 
|---|
| 2081 | union { | 
|---|
| 2082 | struct { | 
|---|
| 2083 | /** \brief indicate whether context priority changed */ | 
|---|
| 2084 | uint32_t context_priority_update : 1; | 
|---|
| 2085 | /** \brief Reserved bits for future use, must be zero */ | 
|---|
| 2086 | uint32_t reserved                : 31; | 
|---|
| 2087 | } bits; | 
|---|
| 2088 | uint32_t value; | 
|---|
| 2089 | } flags; | 
|---|
| 2090 | /** \brief task/context priority */ | 
|---|
| 2091 | VAConfigAttribValContextPriority context_priority; | 
|---|
| 2092 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 2093 | uint32_t reserved[VA_PADDING_MEDIUM]; | 
|---|
| 2094 | } VAContextParameterUpdateBuffer; | 
|---|
| 2095 |  | 
|---|
| 2096 | /** | 
|---|
| 2097 | * These ENCRYPTION_TYPEs are used for the attribute values for | 
|---|
| 2098 | * \c VAConfigAttribEncryption and for encryption_type in | 
|---|
| 2099 | * VAEncryptionParameters. | 
|---|
| 2100 | * | 
|---|
| 2101 | * When used for \c VAConfigAttribEncryption, it be used via | 
|---|
| 2102 | * vaQueryConfigEntrypoints to check which type are supported for specific | 
|---|
| 2103 | * profile or not. | 
|---|
| 2104 | * | 
|---|
| 2105 | * When used for encryption_type in VAEncryptionParameters, it tells driver | 
|---|
| 2106 | * the parameters in VAEncryptionParameters are used for which encryption type. | 
|---|
| 2107 | */ | 
|---|
| 2108 | #define VA_ENCRYPTION_TYPE_FULLSAMPLE_CTR       0x00000001  /* AES CTR fullsample */ | 
|---|
| 2109 | #define VA_ENCRYPTION_TYPE_FULLSAMPLE_CBC       0x00000002  /* AES CBC fullsample */ | 
|---|
| 2110 | #define VA_ENCRYPTION_TYPE_SUBSAMPLE_CTR        0x00000004  /* AES CTR fullsample */ | 
|---|
| 2111 | #define VA_ENCRYPTION_TYPE_SUBSAMPLE_CBC        0x00000008  /* AES CBC fullsample */ | 
|---|
| 2112 |  | 
|---|
| 2113 | /** \brief structure for encrypted segment info. */ | 
|---|
| 2114 | typedef struct _VAEncryptionSegmentInfo { | 
|---|
| 2115 | /** \brief  The offset relative to the start of the bitstream input in | 
|---|
| 2116 | *  bytes of the start of the segment */ | 
|---|
| 2117 | uint32_t segment_start_offset; | 
|---|
| 2118 | /** \brief  The length of the segments in bytes */ | 
|---|
| 2119 | uint32_t segment_length; | 
|---|
| 2120 | /** \brief  The length in bytes of the remainder of an incomplete block | 
|---|
| 2121 | *  from a previous segment*/ | 
|---|
| 2122 | uint32_t partial_aes_block_size; | 
|---|
| 2123 | /** \brief  The length in bytes of the initial clear data */ | 
|---|
| 2124 | uint32_t init_byte_length; | 
|---|
| 2125 | /** \brief  This will be AES counter for secure decode and secure encode | 
|---|
| 2126 | *  when numSegments equals 1, valid size is specified by | 
|---|
| 2127 | * \c key_blob_size */ | 
|---|
| 2128 | uint8_t aes_cbc_iv_or_ctr[64]; | 
|---|
| 2129 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 2130 | uint32_t va_reserved[VA_PADDING_MEDIUM]; | 
|---|
| 2131 | } VAEncryptionSegmentInfo; | 
|---|
| 2132 |  | 
|---|
| 2133 | /** \brief Encryption parameters buffer for VAEncryptionParameterBufferType */ | 
|---|
| 2134 | typedef struct _VAEncryptionParameters { | 
|---|
| 2135 | /** \brief Encryption type, refer to \c VA_ENCRYPTION_TYPE_FULLSAMPLE_CTR, | 
|---|
| 2136 | * \c VA_ENCRYPTION_TYPE_FULLSAMPLE_CBC, \c VA_ENCRYPTION_TYPE_SUBSAMPLE_CTR, | 
|---|
| 2137 | * or \c VA_ENCRYPTION_TYPE_SUBSAMPLE_CBC */ | 
|---|
| 2138 | uint32_t encryption_type; | 
|---|
| 2139 | /** \brief The number of sengments */ | 
|---|
| 2140 | uint32_t num_segments; | 
|---|
| 2141 | /** \brief Pointer of segments */ | 
|---|
| 2142 | VAEncryptionSegmentInfo *segment_info; | 
|---|
| 2143 | /** \brief The status report index reserved for CENC fullsample workload. | 
|---|
| 2144 | * The related structures and definitions are vendor specific. | 
|---|
| 2145 | */ | 
|---|
| 2146 | uint32_t status_report_index; | 
|---|
| 2147 | /** \brief CENC counter length */ | 
|---|
| 2148 | uint32_t size_of_length; | 
|---|
| 2149 | /** \brief Wrapped decrypt blob (Snd)kb, valid size is specified by | 
|---|
| 2150 | * \c key_blob_size */ | 
|---|
| 2151 | uint8_t wrapped_decrypt_blob[64]; | 
|---|
| 2152 | /** \brief Wrapped Key blob info (Sne)kb, valid size is specified by | 
|---|
| 2153 | * \c key_blob_size */ | 
|---|
| 2154 | uint8_t wrapped_encrypt_blob[64]; | 
|---|
| 2155 | /** \brief key blob size | 
|---|
| 2156 | * It could be \c VA_PC_BLOCK_SIZE_128, \c VA_PC_BLOCK_SIZE_192, or | 
|---|
| 2157 | * \c VA_PC_BLOCK_SIZE_256 | 
|---|
| 2158 | */ | 
|---|
| 2159 | uint32_t key_blob_size; | 
|---|
| 2160 | /** \brief Indicates the number of 16-byte BLOCKS that are encrypted in any | 
|---|
| 2161 | *  given encrypted region of segments. | 
|---|
| 2162 | *  If this value is zero: | 
|---|
| 2163 | *    1. All bytes in encrypted region of segments are encrypted, i.e. the | 
|---|
| 2164 | *       CENC or CBC1 scheme is being used | 
|---|
| 2165 | *    2. blocks_stripe_clear must also be zero. | 
|---|
| 2166 | *  If this value is non-zero, blocks_stripe_clear must also be non-zero. | 
|---|
| 2167 | */ | 
|---|
| 2168 | uint32_t blocks_stripe_encrypted; | 
|---|
| 2169 | /** \brief Indicates the number of 16-byte BLOCKS that are clear in any given | 
|---|
| 2170 | *  encrypted region of segments, as defined by the CENS and CBCS schemes in | 
|---|
| 2171 | *  the common encryption spec. | 
|---|
| 2172 | *  If this value is zero, all bytes in encrypted region of segments are | 
|---|
| 2173 | *  encrypted, i.e. the CENC or CBC1 scheme is being used. | 
|---|
| 2174 | */ | 
|---|
| 2175 | uint32_t blocks_stripe_clear; | 
|---|
| 2176 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 2177 | uint32_t va_reserved[VA_PADDING_MEDIUM]; | 
|---|
| 2178 | } VAEncryptionParameters; | 
|---|
| 2179 |  | 
|---|
| 2180 | /** | 
|---|
| 2181 | * Processing rate parameter for encode. | 
|---|
| 2182 | */ | 
|---|
| 2183 | typedef struct _VAProcessingRateParameterEnc { | 
|---|
| 2184 | /** \brief Profile level */ | 
|---|
| 2185 | uint8_t         level_idc; | 
|---|
| 2186 | uint8_t         reserved[3]; | 
|---|
| 2187 | /** \brief quality level. When set to 0, default quality | 
|---|
| 2188 | * level is used. | 
|---|
| 2189 | */ | 
|---|
| 2190 | uint32_t        quality_level; | 
|---|
| 2191 | /** \brief Period between I frames. */ | 
|---|
| 2192 | uint32_t        intra_period; | 
|---|
| 2193 | /** \brief Period between I/P frames. */ | 
|---|
| 2194 | uint32_t        ip_period; | 
|---|
| 2195 | } VAProcessingRateParameterEnc; | 
|---|
| 2196 |  | 
|---|
| 2197 | /** | 
|---|
| 2198 | * Processing rate parameter for decode. | 
|---|
| 2199 | */ | 
|---|
| 2200 | typedef struct _VAProcessingRateParameterDec { | 
|---|
| 2201 | /** \brief Profile level */ | 
|---|
| 2202 | uint8_t         level_idc; | 
|---|
| 2203 | uint8_t         reserved0[3]; | 
|---|
| 2204 | uint32_t        reserved; | 
|---|
| 2205 | } VAProcessingRateParameterDec; | 
|---|
| 2206 |  | 
|---|
| 2207 | typedef struct _VAProcessingRateParameter { | 
|---|
| 2208 | union { | 
|---|
| 2209 | VAProcessingRateParameterEnc proc_buf_enc; | 
|---|
| 2210 | VAProcessingRateParameterDec proc_buf_dec; | 
|---|
| 2211 | }; | 
|---|
| 2212 | } VAProcessingRateParameter; | 
|---|
| 2213 |  | 
|---|
| 2214 | /** | 
|---|
| 2215 | * \brief Queries processing rate for the supplied config. | 
|---|
| 2216 | * | 
|---|
| 2217 | * This function queries the processing rate based on parameters in | 
|---|
| 2218 | * \c proc_buf for the given \c config. Upon successful return, the processing | 
|---|
| 2219 | * rate value will be stored in \c processing_rate. Processing rate is | 
|---|
| 2220 | * specified as the number of macroblocks/CTU per second. | 
|---|
| 2221 | * | 
|---|
| 2222 | * If NULL is passed to the \c proc_buf, the default processing rate for the | 
|---|
| 2223 | * given configuration will be returned. | 
|---|
| 2224 | * | 
|---|
| 2225 | * @param[in] dpy               the VA display | 
|---|
| 2226 | * @param[in] config            the config identifying a codec or a video | 
|---|
| 2227 | *     processing pipeline | 
|---|
| 2228 | * @param[in] proc_buf       the buffer that contains the parameters for | 
|---|
| 2229 | either the encode or decode processing rate | 
|---|
| 2230 | * @param[out] processing_rate  processing rate in number of macroblocks per | 
|---|
| 2231 | second constrained by parameters specified in proc_buf | 
|---|
| 2232 | * | 
|---|
| 2233 | */ | 
|---|
| 2234 | VAStatus | 
|---|
| 2235 | vaQueryProcessingRate( | 
|---|
| 2236 | VADisplay           dpy, | 
|---|
| 2237 | VAConfigID          config, | 
|---|
| 2238 | VAProcessingRateParameter *proc_buf, | 
|---|
| 2239 | unsigned int       *processing_rate | 
|---|
| 2240 | ); | 
|---|
| 2241 |  | 
|---|
| 2242 | typedef enum { | 
|---|
| 2243 | VAEncMiscParameterTypeFrameRate     = 0, | 
|---|
| 2244 | VAEncMiscParameterTypeRateControl   = 1, | 
|---|
| 2245 | VAEncMiscParameterTypeMaxSliceSize  = 2, | 
|---|
| 2246 | VAEncMiscParameterTypeAIR       = 3, | 
|---|
| 2247 | /** \brief Buffer type used to express a maximum frame size (in bits). */ | 
|---|
| 2248 | VAEncMiscParameterTypeMaxFrameSize  = 4, | 
|---|
| 2249 | /** \brief Buffer type used for HRD parameters. */ | 
|---|
| 2250 | VAEncMiscParameterTypeHRD           = 5, | 
|---|
| 2251 | VAEncMiscParameterTypeQualityLevel  = 6, | 
|---|
| 2252 | /** \brief Buffer type used for Rolling intra refresh */ | 
|---|
| 2253 | VAEncMiscParameterTypeRIR           = 7, | 
|---|
| 2254 | /** \brief Buffer type used for quantization parameters, it's per-sequence parameter*/ | 
|---|
| 2255 | VAEncMiscParameterTypeQuantization  = 8, | 
|---|
| 2256 | /** \brief Buffer type used for sending skip frame parameters to the encoder's | 
|---|
| 2257 | * rate control, when the user has externally skipped frames. */ | 
|---|
| 2258 | VAEncMiscParameterTypeSkipFrame     = 9, | 
|---|
| 2259 | /** \brief Buffer type used for region-of-interest (ROI) parameters. */ | 
|---|
| 2260 | VAEncMiscParameterTypeROI           = 10, | 
|---|
| 2261 | /** \brief Buffer type used to express a maximum frame size (in bytes) settings for multiple pass. */ | 
|---|
| 2262 | VAEncMiscParameterTypeMultiPassFrameSize       = 11, | 
|---|
| 2263 | /** \brief Buffer type used for temporal layer structure */ | 
|---|
| 2264 | VAEncMiscParameterTypeTemporalLayerStructure   = 12, | 
|---|
| 2265 | /** \brief Buffer type used for dirty region-of-interest (ROI) parameters. */ | 
|---|
| 2266 | VAEncMiscParameterTypeDirtyRect      = 13, | 
|---|
| 2267 | /** \brief Buffer type used for parallel BRC parameters. */ | 
|---|
| 2268 | VAEncMiscParameterTypeParallelBRC   = 14, | 
|---|
| 2269 | /** \brief Set MB partion mode mask and Half-pel/Quant-pel motion search */ | 
|---|
| 2270 | VAEncMiscParameterTypeSubMbPartPel = 15, | 
|---|
| 2271 | /** \brief set encode quality tuning */ | 
|---|
| 2272 | VAEncMiscParameterTypeEncQuality = 16, | 
|---|
| 2273 | /** \brief Buffer type used for encoder rounding offset parameters. */ | 
|---|
| 2274 | VAEncMiscParameterTypeCustomRoundingControl = 17, | 
|---|
| 2275 | /** \brief Buffer type used for FEI input frame level parameters */ | 
|---|
| 2276 | VAEncMiscParameterTypeFEIFrameControl = 18, | 
|---|
| 2277 | /** \brief encode extension buffer, ect. MPEG2 Sequence extenstion data */ | 
|---|
| 2278 | VAEncMiscParameterTypeExtensionData = 19 | 
|---|
| 2279 | } VAEncMiscParameterType; | 
|---|
| 2280 |  | 
|---|
| 2281 | /** \brief Packed header type. */ | 
|---|
| 2282 | typedef enum { | 
|---|
| 2283 | /** \brief Packed sequence header. */ | 
|---|
| 2284 | = 1, | 
|---|
| 2285 | /** \brief Packed picture header. */ | 
|---|
| 2286 | = 2, | 
|---|
| 2287 | /** \brief Packed slice header. */ | 
|---|
| 2288 | = 3, | 
|---|
| 2289 | /** | 
|---|
| 2290 | * \brief Packed raw header. | 
|---|
| 2291 | * | 
|---|
| 2292 | * Packed raw data header can be used by the client to insert a header | 
|---|
| 2293 | * into the bitstream data buffer at the point it is passed, the driver | 
|---|
| 2294 | * will handle the raw packed header based on "has_emulation_bytes" field | 
|---|
| 2295 | * in the packed header parameter structure. | 
|---|
| 2296 | */ | 
|---|
| 2297 | = 4, | 
|---|
| 2298 | /** | 
|---|
| 2299 | * \brief Misc packed header. See codec-specific definitions. | 
|---|
| 2300 | * | 
|---|
| 2301 | * @deprecated | 
|---|
| 2302 | * This is a deprecated packed header type. All applications can use | 
|---|
| 2303 | * \c VAEncPackedHeaderRawData to insert a codec-specific packed header | 
|---|
| 2304 | */ | 
|---|
| 2305 | va_deprecated_enum  = 0x80000000, | 
|---|
| 2306 | } ; | 
|---|
| 2307 |  | 
|---|
| 2308 | /** \brief Packed header parameter. */ | 
|---|
| 2309 | typedef struct  { | 
|---|
| 2310 | /** Type of the packed header buffer. See #VAEncPackedHeaderType. */ | 
|---|
| 2311 | uint32_t                ; | 
|---|
| 2312 | /** \brief Size of the #VAEncPackedHeaderDataBuffer in bits. */ | 
|---|
| 2313 | uint32_t                ; | 
|---|
| 2314 | /** \brief Flag: buffer contains start code emulation prevention bytes? */ | 
|---|
| 2315 | uint8_t               ; | 
|---|
| 2316 |  | 
|---|
| 2317 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 2318 | uint32_t                [VA_PADDING_LOW]; | 
|---|
| 2319 | } ; | 
|---|
| 2320 |  | 
|---|
| 2321 | /** | 
|---|
| 2322 | *  For application, e.g. set a new bitrate | 
|---|
| 2323 | *    VABufferID buf_id; | 
|---|
| 2324 | *    VAEncMiscParameterBuffer *misc_param; | 
|---|
| 2325 | *    VAEncMiscParameterRateControl *misc_rate_ctrl; | 
|---|
| 2326 | * | 
|---|
| 2327 | *    vaCreateBuffer(dpy, context, VAEncMiscParameterBufferType, | 
|---|
| 2328 | *              sizeof(VAEncMiscParameterBuffer) + sizeof(VAEncMiscParameterRateControl), | 
|---|
| 2329 | *              1, NULL, &buf_id); | 
|---|
| 2330 | * | 
|---|
| 2331 | *    vaMapBuffer(dpy,buf_id,(void **)&misc_param); | 
|---|
| 2332 | *    misc_param->type = VAEncMiscParameterTypeRateControl; | 
|---|
| 2333 | *    misc_rate_ctrl= (VAEncMiscParameterRateControl *)misc_param->data; | 
|---|
| 2334 | *    misc_rate_ctrl->bits_per_second = 6400000; | 
|---|
| 2335 | *    vaUnmapBuffer(dpy, buf_id); | 
|---|
| 2336 | *    vaRenderPicture(dpy, context, &buf_id, 1); | 
|---|
| 2337 | */ | 
|---|
| 2338 | typedef struct _VAEncMiscParameterBuffer { | 
|---|
| 2339 | VAEncMiscParameterType type; | 
|---|
| 2340 | uint32_t data[]; | 
|---|
| 2341 | } VAEncMiscParameterBuffer; | 
|---|
| 2342 |  | 
|---|
| 2343 | /** \brief Temporal layer Structure*/ | 
|---|
| 2344 | typedef struct _VAEncMiscParameterTemporalLayerStructure { | 
|---|
| 2345 | /** \brief The number of temporal layers */ | 
|---|
| 2346 | uint32_t number_of_layers; | 
|---|
| 2347 | /** \brief The length of the array defining frame layer membership. Should be 1-32 */ | 
|---|
| 2348 | uint32_t periodicity; | 
|---|
| 2349 | /** | 
|---|
| 2350 | * \brief The array indicating the layer id for each frame | 
|---|
| 2351 | * | 
|---|
| 2352 | * The layer id for the first frame in a coded sequence is always 0, so layer_id[] specifies the layer | 
|---|
| 2353 | * ids for frames starting from the 2nd frame. | 
|---|
| 2354 | */ | 
|---|
| 2355 | uint32_t layer_id[32]; | 
|---|
| 2356 |  | 
|---|
| 2357 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 2358 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 2359 | } VAEncMiscParameterTemporalLayerStructure; | 
|---|
| 2360 |  | 
|---|
| 2361 |  | 
|---|
| 2362 | /** \brief Rate control parameters */ | 
|---|
| 2363 | typedef struct _VAEncMiscParameterRateControl { | 
|---|
| 2364 | /** The maximum bit-rate which the the rate controller should generate. */ | 
|---|
| 2365 | uint32_t bits_per_second; | 
|---|
| 2366 | /** The target bit-rate which the rate controller should generate, as a percentage of the | 
|---|
| 2367 | * maximum bit-rate. | 
|---|
| 2368 | * | 
|---|
| 2369 | * In CBR mode this value is ignored (treated as 100%). | 
|---|
| 2370 | */ | 
|---|
| 2371 | uint32_t target_percentage; | 
|---|
| 2372 | /** Rate control window size in milliseconds. | 
|---|
| 2373 | * | 
|---|
| 2374 | * The rate controller will attempt to guarantee that the target and maximum bit-rates are | 
|---|
| 2375 | * correct over this window. | 
|---|
| 2376 | */ | 
|---|
| 2377 | uint32_t window_size; | 
|---|
| 2378 | /** Initial quantiser value used at the start of the stream. | 
|---|
| 2379 | * | 
|---|
| 2380 | * Ignored if set to zero. | 
|---|
| 2381 | */ | 
|---|
| 2382 | uint32_t initial_qp; | 
|---|
| 2383 | /** Minimum quantiser value to use. | 
|---|
| 2384 | * | 
|---|
| 2385 | * The quantiser will not go below the value - if this limit is hit, the output bitrate may | 
|---|
| 2386 | * be lower than the target.  Ignored if set to zero. | 
|---|
| 2387 | */ | 
|---|
| 2388 | uint32_t min_qp; | 
|---|
| 2389 | /** Basic unit size. | 
|---|
| 2390 | * | 
|---|
| 2391 | * Only used by some drivers - see driver documentation for details.  Set to zero if unused. | 
|---|
| 2392 | */ | 
|---|
| 2393 | uint32_t basic_unit_size; | 
|---|
| 2394 | union { | 
|---|
| 2395 | struct { | 
|---|
| 2396 | /** Force rate controller reset. | 
|---|
| 2397 | * | 
|---|
| 2398 | * The next frame will be treated as the start of a new stream, with all rate | 
|---|
| 2399 | * controller state reset to its initial values. | 
|---|
| 2400 | */ | 
|---|
| 2401 | uint32_t reset : 1; | 
|---|
| 2402 | /** Disable frame skip in rate control mode. */ | 
|---|
| 2403 | uint32_t disable_frame_skip : 1; | 
|---|
| 2404 | /** Disable bit stuffing in rate control mode. */ | 
|---|
| 2405 | uint32_t disable_bit_stuffing : 1; | 
|---|
| 2406 | /** Macroblock-level rate control. | 
|---|
| 2407 | * | 
|---|
| 2408 | * 0: use default, 1: always enable, 2: always disable, other: reserved. | 
|---|
| 2409 | * | 
|---|
| 2410 | * This feature is only available if VAConfigAttribRateControl has the | 
|---|
| 2411 | * \ref VA_RC_MB bit set. | 
|---|
| 2412 | */ | 
|---|
| 2413 | uint32_t mb_rate_control : 4; | 
|---|
| 2414 | /** The temporal layer that these rate control parameters apply to. */ | 
|---|
| 2415 | uint32_t temporal_id : 8; | 
|---|
| 2416 | /** Ensure that intra frames also conform to the constant frame size. */ | 
|---|
| 2417 | uint32_t cfs_I_frames : 1; | 
|---|
| 2418 | /** Enable parallel rate control for hierarchical B frames. | 
|---|
| 2419 | * | 
|---|
| 2420 | * See \ref VA_RC_PARALLEL. | 
|---|
| 2421 | */ | 
|---|
| 2422 | uint32_t enable_parallel_brc    : 1; | 
|---|
| 2423 | uint32_t enable_dynamic_scaling : 1; | 
|---|
| 2424 | /** Frame tolerance mode. | 
|---|
| 2425 | * | 
|---|
| 2426 | *  Indicates the tolerance the application has to variations in the frame size. | 
|---|
| 2427 | *  For example, wireless display scenarios may require very steady bit rate to | 
|---|
| 2428 | *  reduce buffering time. It affects the rate control algorithm used, | 
|---|
| 2429 | *  but may or may not have an effect based on the combination of other BRC | 
|---|
| 2430 | *  parameters.  Only valid when the driver reports support for | 
|---|
| 2431 | *  #VAConfigAttribFrameSizeToleranceSupport. | 
|---|
| 2432 | * | 
|---|
| 2433 | *  equals 0    -- normal mode; | 
|---|
| 2434 | *  equals 1    -- maps to sliding window; | 
|---|
| 2435 | *  equals 2    -- maps to low delay mode; | 
|---|
| 2436 | *  other       -- invalid. | 
|---|
| 2437 | */ | 
|---|
| 2438 | uint32_t frame_tolerance_mode   : 2; | 
|---|
| 2439 | /** Reserved for future use, must be zero. */ | 
|---|
| 2440 | uint32_t reserved               : 12; | 
|---|
| 2441 | } bits; | 
|---|
| 2442 | uint32_t value; | 
|---|
| 2443 | } rc_flags; | 
|---|
| 2444 | /** Initial quality factor used in ICQ mode. | 
|---|
| 2445 | * | 
|---|
| 2446 | * This value must be between 1 and 51. | 
|---|
| 2447 | * this value will be deprecated in future, to use quality_factor instead of it. | 
|---|
| 2448 | */ | 
|---|
| 2449 | uint32_t ICQ_quality_factor; | 
|---|
| 2450 | /** Maximum quantiser value to use. | 
|---|
| 2451 | * | 
|---|
| 2452 | * The quantiser will not go above this value - if this limit is hit, the output bitrate | 
|---|
| 2453 | * may exceed the target.  Ignored if set to zero. | 
|---|
| 2454 | */ | 
|---|
| 2455 | uint32_t max_qp; | 
|---|
| 2456 | /** Quality factor | 
|---|
| 2457 | * | 
|---|
| 2458 | *  the range will be different for different codec | 
|---|
| 2459 | */ | 
|---|
| 2460 | uint32_t quality_factor; | 
|---|
| 2461 | /** Target frame size | 
|---|
| 2462 | * | 
|---|
| 2463 | *  Desired frame size in bytes. | 
|---|
| 2464 | *  This parameter can be used in some RC modes (like Transport Controlled BRC) | 
|---|
| 2465 | *  where feedback from the app is required. | 
|---|
| 2466 | *  Zero value means no limits. | 
|---|
| 2467 | * | 
|---|
| 2468 | */ | 
|---|
| 2469 | uint32_t target_frame_size; | 
|---|
| 2470 | /** Reserved bytes for future use, must be zero. */ | 
|---|
| 2471 | uint32_t va_reserved[VA_PADDING_LOW]; | 
|---|
| 2472 | } VAEncMiscParameterRateControl; | 
|---|
| 2473 |  | 
|---|
| 2474 | /** Encode framerate parameters. | 
|---|
| 2475 | * | 
|---|
| 2476 | * Sets the encode framerate used by the rate controller.  This should be | 
|---|
| 2477 | * provided in all modes using a bitrate target (variable framerate is not | 
|---|
| 2478 | * supported). | 
|---|
| 2479 | */ | 
|---|
| 2480 | typedef struct _VAEncMiscParameterFrameRate { | 
|---|
| 2481 | /** Encode framerate. | 
|---|
| 2482 | * | 
|---|
| 2483 | * The framerate is specified as a number of frames per second, as a | 
|---|
| 2484 | * fraction.  The denominator of the fraction is given in the top half | 
|---|
| 2485 | * (the high two bytes) of the framerate field, and the numerator is | 
|---|
| 2486 | * given in the bottom half (the low two bytes). | 
|---|
| 2487 | * | 
|---|
| 2488 | * That is: | 
|---|
| 2489 | * denominator = framerate >> 16 & 0xffff; | 
|---|
| 2490 | * numerator   = framerate & 0xffff; | 
|---|
| 2491 | * fps         = numerator / denominator; | 
|---|
| 2492 | * | 
|---|
| 2493 | * For example, if framerate is set to (100 << 16 | 750), this is | 
|---|
| 2494 | * 750 / 100, hence 7.5fps. | 
|---|
| 2495 | * | 
|---|
| 2496 | * If the denominator is zero (the high two bytes are both zero) then | 
|---|
| 2497 | * it takes the value one instead, so the framerate is just the integer | 
|---|
| 2498 | * in the low 2 bytes. | 
|---|
| 2499 | */ | 
|---|
| 2500 | uint32_t framerate; | 
|---|
| 2501 | union { | 
|---|
| 2502 | struct { | 
|---|
| 2503 | /** The temporal layer that these framerate parameters apply to. */ | 
|---|
| 2504 | uint32_t temporal_id : 8; | 
|---|
| 2505 | /** Reserved for future use, must be zero. */ | 
|---|
| 2506 | uint32_t reserved : 24; | 
|---|
| 2507 | } bits; | 
|---|
| 2508 | uint32_t value; | 
|---|
| 2509 | } framerate_flags; | 
|---|
| 2510 |  | 
|---|
| 2511 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 2512 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 2513 | } VAEncMiscParameterFrameRate; | 
|---|
| 2514 |  | 
|---|
| 2515 | /** | 
|---|
| 2516 | * Allow a maximum slice size to be specified (in bits). | 
|---|
| 2517 | * The encoder will attempt to make sure that individual slices do not exceed this size | 
|---|
| 2518 | * Or to signal applicate if the slice size exceed this size, see "status" of VACodedBufferSegment | 
|---|
| 2519 | */ | 
|---|
| 2520 | typedef struct _VAEncMiscParameterMaxSliceSize { | 
|---|
| 2521 | uint32_t max_slice_size; | 
|---|
| 2522 |  | 
|---|
| 2523 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 2524 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 2525 | } VAEncMiscParameterMaxSliceSize; | 
|---|
| 2526 |  | 
|---|
| 2527 | typedef struct _VAEncMiscParameterAIR { | 
|---|
| 2528 | uint32_t air_num_mbs; | 
|---|
| 2529 | uint32_t air_threshold; | 
|---|
| 2530 | uint32_t air_auto; /* if set to 1 then hardware auto-tune the AIR threshold */ | 
|---|
| 2531 |  | 
|---|
| 2532 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 2533 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 2534 | } VAEncMiscParameterAIR; | 
|---|
| 2535 |  | 
|---|
| 2536 | /* | 
|---|
| 2537 | * \brief Rolling intra refresh data structure for encoding. | 
|---|
| 2538 | */ | 
|---|
| 2539 | typedef struct _VAEncMiscParameterRIR { | 
|---|
| 2540 | union { | 
|---|
| 2541 | struct | 
|---|
| 2542 | /** | 
|---|
| 2543 | * \brief Indicate if intra refresh is enabled in column/row. | 
|---|
| 2544 | * | 
|---|
| 2545 | * App should query VAConfigAttribEncIntraRefresh to confirm RIR support | 
|---|
| 2546 | * by the driver before sending this structure. | 
|---|
| 2547 | */ | 
|---|
| 2548 | { | 
|---|
| 2549 | /* \brief enable RIR in column */ | 
|---|
| 2550 | uint32_t enable_rir_column : 1; | 
|---|
| 2551 | /* \brief enable RIR in row */ | 
|---|
| 2552 | uint32_t enable_rir_row : 1; | 
|---|
| 2553 | uint32_t reserved : 30; | 
|---|
| 2554 | } bits; | 
|---|
| 2555 | uint32_t value; | 
|---|
| 2556 | } rir_flags; | 
|---|
| 2557 | /** | 
|---|
| 2558 | * \brief Indicates the column or row location in MB. It is ignored if | 
|---|
| 2559 | * rir_flags is 0. | 
|---|
| 2560 | */ | 
|---|
| 2561 | uint16_t intra_insertion_location; | 
|---|
| 2562 | /** | 
|---|
| 2563 | * \brief Indicates the number of columns or rows in MB. It is ignored if | 
|---|
| 2564 | * rir_flags is 0. | 
|---|
| 2565 | */ | 
|---|
| 2566 | uint16_t intra_insert_size; | 
|---|
| 2567 | /** | 
|---|
| 2568 | * \brief indicates the Qp difference for inserted intra columns or rows. | 
|---|
| 2569 | * App can use this to adjust intra Qp based on bitrate & max frame size. | 
|---|
| 2570 | */ | 
|---|
| 2571 | uint8_t  qp_delta_for_inserted_intra; | 
|---|
| 2572 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 2573 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 2574 | } VAEncMiscParameterRIR; | 
|---|
| 2575 |  | 
|---|
| 2576 | /** HRD / VBV buffering parameters for encoding. | 
|---|
| 2577 | * | 
|---|
| 2578 | * This sets the HRD / VBV parameters which will be used by the rate | 
|---|
| 2579 | * controller for encoding.  It should be specified in modes using a bitrate | 
|---|
| 2580 | * target when the buffering of the output stream needs to be constrained. | 
|---|
| 2581 | * | 
|---|
| 2582 | * If not provided, the encoder may use arbitrary amounts of buffering. | 
|---|
| 2583 | */ | 
|---|
| 2584 | typedef struct _VAEncMiscParameterHRD { | 
|---|
| 2585 | /** The initial fullness of the HRD coded picture buffer, in bits. | 
|---|
| 2586 | * | 
|---|
| 2587 | * This sets how full the CPB is when encoding begins - that is, how much | 
|---|
| 2588 | * buffering will happen on the decoder side before the first frame. | 
|---|
| 2589 | * The CPB fullness will be reset to this value after any rate control | 
|---|
| 2590 | * reset (a change in parameters or an explicit reset). | 
|---|
| 2591 | * | 
|---|
| 2592 | * For H.264, it should match the value of initial_cpb_removal_delay in | 
|---|
| 2593 | * buffering_period SEI messages. | 
|---|
| 2594 | */ | 
|---|
| 2595 | uint32_t initial_buffer_fullness; | 
|---|
| 2596 | /** The HRD coded picture buffer size, in bits. | 
|---|
| 2597 | * | 
|---|
| 2598 | * For H.264, it should match the value of cpb_size_value_minus1 in the VUI | 
|---|
| 2599 | * parameters. | 
|---|
| 2600 | */ | 
|---|
| 2601 | uint32_t buffer_size; | 
|---|
| 2602 |  | 
|---|
| 2603 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 2604 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 2605 | } VAEncMiscParameterHRD; | 
|---|
| 2606 |  | 
|---|
| 2607 | /** | 
|---|
| 2608 | * \brief Defines a maximum frame size (in bits). | 
|---|
| 2609 | * | 
|---|
| 2610 | * This misc parameter buffer defines the maximum size of a frame (in | 
|---|
| 2611 | * bits). The encoder will try to make sure that each frame does not | 
|---|
| 2612 | * exceed this size. Otherwise, if the frame size exceeds this size, | 
|---|
| 2613 | * the \c status flag of #VACodedBufferSegment will contain | 
|---|
| 2614 | * #VA_CODED_BUF_STATUS_FRAME_SIZE_OVERFLOW. | 
|---|
| 2615 | */ | 
|---|
| 2616 | typedef struct _VAEncMiscParameterBufferMaxFrameSize { | 
|---|
| 2617 | /** \brief Type. Shall be set to #VAEncMiscParameterTypeMaxFrameSize. */ | 
|---|
| 2618 | /** duplicated with VAEncMiscParameterBuffer, should be deprecated*/ | 
|---|
| 2619 | va_deprecated VAEncMiscParameterType      type; | 
|---|
| 2620 | /** \brief Maximum size of a frame (in bits). */ | 
|---|
| 2621 | uint32_t                max_frame_size; | 
|---|
| 2622 |  | 
|---|
| 2623 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 2624 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 2625 | } VAEncMiscParameterBufferMaxFrameSize; | 
|---|
| 2626 |  | 
|---|
| 2627 | /** | 
|---|
| 2628 | * \brief Maximum frame size (in bytes) settings for multiple pass. | 
|---|
| 2629 | * | 
|---|
| 2630 | * This misc parameter buffer defines the maximum size of a frame (in | 
|---|
| 2631 | * bytes) settings for multiple pass. currently only AVC encoder can | 
|---|
| 2632 | * support this settings in multiple pass case. If the frame size exceeds | 
|---|
| 2633 | * this size, the encoder will do more pak passes to adjust the QP value | 
|---|
| 2634 | * to control the frame size. | 
|---|
| 2635 | */ | 
|---|
| 2636 | typedef struct _VAEncMiscParameterBufferMultiPassFrameSize { | 
|---|
| 2637 | /** \brief Type. Shall be set to #VAEncMiscParameterTypeMultiPassMaxFrameSize. */ | 
|---|
| 2638 | /** duplicated with VAEncMiscParameterBuffer, should be deprecated*/ | 
|---|
| 2639 | va_deprecated VAEncMiscParameterType      type; | 
|---|
| 2640 | /** \brief Maximum size of a frame (in byte) */ | 
|---|
| 2641 | uint32_t                max_frame_size; | 
|---|
| 2642 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 2643 | uint32_t                reserved; | 
|---|
| 2644 | /** \brief number of passes, every pass has different QP, currently AVC encoder can support up to 4 passes */ | 
|---|
| 2645 | uint8_t                 num_passes; | 
|---|
| 2646 | /** \brief delta QP list for every pass */ | 
|---|
| 2647 | uint8_t                *delta_qp; | 
|---|
| 2648 |  | 
|---|
| 2649 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 2650 | unsigned long           va_reserved[VA_PADDING_LOW]; | 
|---|
| 2651 | } VAEncMiscParameterBufferMultiPassFrameSize; | 
|---|
| 2652 |  | 
|---|
| 2653 | /** | 
|---|
| 2654 | * \brief Encoding quality level. | 
|---|
| 2655 | * | 
|---|
| 2656 | * The encoding quality could be set through this structure, if the implementation | 
|---|
| 2657 | * supports multiple quality levels. The quality level set through this structure is | 
|---|
| 2658 | * persistent over the entire coded sequence, or until a new structure is being sent. | 
|---|
| 2659 | * The quality level range can be queried through the VAConfigAttribEncQualityRange | 
|---|
| 2660 | * attribute. A lower value means higher quality, and a value of 1 represents the highest | 
|---|
| 2661 | * quality. The quality level setting is used as a trade-off between quality and speed/power | 
|---|
| 2662 | * consumption, with higher quality corresponds to lower speed and higher power consumption. | 
|---|
| 2663 | */ | 
|---|
| 2664 | typedef struct _VAEncMiscParameterBufferQualityLevel { | 
|---|
| 2665 | /** \brief Encoding quality level setting. When set to 0, default quality | 
|---|
| 2666 | * level is used. | 
|---|
| 2667 | */ | 
|---|
| 2668 | uint32_t                quality_level; | 
|---|
| 2669 |  | 
|---|
| 2670 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 2671 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 2672 | } VAEncMiscParameterBufferQualityLevel; | 
|---|
| 2673 |  | 
|---|
| 2674 | /** | 
|---|
| 2675 | * \brief Quantization settings for encoding. | 
|---|
| 2676 | * | 
|---|
| 2677 | * Some encoders support special types of quantization such as trellis, and this structure | 
|---|
| 2678 | * can be used by the app to control these special types of quantization by the encoder. | 
|---|
| 2679 | */ | 
|---|
| 2680 | typedef struct _VAEncMiscParameterQuantization { | 
|---|
| 2681 | union { | 
|---|
| 2682 | /* if no flags is set then quantization is determined by the driver */ | 
|---|
| 2683 | struct { | 
|---|
| 2684 | /* \brief disable trellis for all frames/fields */ | 
|---|
| 2685 | uint32_t disable_trellis : 1; | 
|---|
| 2686 | /* \brief enable trellis for I frames/fields */ | 
|---|
| 2687 | uint32_t enable_trellis_I : 1; | 
|---|
| 2688 | /* \brief enable trellis for P frames/fields */ | 
|---|
| 2689 | uint32_t enable_trellis_P : 1; | 
|---|
| 2690 | /* \brief enable trellis for B frames/fields */ | 
|---|
| 2691 | uint32_t enable_trellis_B : 1; | 
|---|
| 2692 | uint32_t reserved : 28; | 
|---|
| 2693 | } bits; | 
|---|
| 2694 | uint32_t value; | 
|---|
| 2695 | } quantization_flags; | 
|---|
| 2696 | uint32_t va_reserved; | 
|---|
| 2697 | } VAEncMiscParameterQuantization; | 
|---|
| 2698 |  | 
|---|
| 2699 | /** | 
|---|
| 2700 | * \brief Encoding skip frame. | 
|---|
| 2701 | * | 
|---|
| 2702 | * The application may choose to skip frames externally to the encoder (e.g. drop completely or | 
|---|
| 2703 | * code as all skip's). For rate control purposes the encoder will need to know the size and number | 
|---|
| 2704 | * of skipped frames.  Skip frame(s) indicated through this structure is applicable only to the | 
|---|
| 2705 | * current frame.  It is allowed for the application to still send in packed headers for the driver to | 
|---|
| 2706 | * pack, although no frame will be encoded (e.g. for HW to encrypt the frame). | 
|---|
| 2707 | */ | 
|---|
| 2708 | typedef struct _VAEncMiscParameterSkipFrame { | 
|---|
| 2709 | /** \brief Indicates skip frames as below. | 
|---|
| 2710 | * 0: Encode as normal, no skip. | 
|---|
| 2711 | * 1: One or more frames were skipped prior to the current frame, encode the current frame as normal. | 
|---|
| 2712 | * 2: The current frame is to be skipped, do not encode it but pack/encrypt the packed header contents | 
|---|
| 2713 | *    (all except VAEncPackedHeaderSlice) which could contain actual frame contents (e.g. pack the frame | 
|---|
| 2714 | *    in VAEncPackedHeaderPicture).  */ | 
|---|
| 2715 | uint8_t               skip_frame_flag; | 
|---|
| 2716 | /** \brief The number of frames skipped prior to the current frame.  Valid when skip_frame_flag = 1. */ | 
|---|
| 2717 | uint8_t               num_skip_frames; | 
|---|
| 2718 | /** \brief When skip_frame_flag = 1, the size of the skipped frames in bits.   When skip_frame_flag = 2, | 
|---|
| 2719 | * the size of the current skipped frame that is to be packed/encrypted in bits. */ | 
|---|
| 2720 | uint32_t                size_skip_frames; | 
|---|
| 2721 |  | 
|---|
| 2722 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 2723 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 2724 | } VAEncMiscParameterSkipFrame; | 
|---|
| 2725 |  | 
|---|
| 2726 | /** | 
|---|
| 2727 | * \brief Encoding region-of-interest (ROI). | 
|---|
| 2728 | * | 
|---|
| 2729 | * The encoding ROI can be set through VAEncMiscParameterBufferROI, if the implementation | 
|---|
| 2730 | * supports ROI input. The ROI set through this structure is applicable only to the | 
|---|
| 2731 | * current frame or field, so must be sent every frame or field to be applied.  The number of | 
|---|
| 2732 | * supported ROIs can be queried through the VAConfigAttribEncROI.  The encoder will use the | 
|---|
| 2733 | * ROI information to adjust the QP values of the MB's that fall within the ROIs. | 
|---|
| 2734 | */ | 
|---|
| 2735 | typedef struct _VAEncROI { | 
|---|
| 2736 | /** \brief Defines the ROI boundary in pixels, the driver will map it to appropriate | 
|---|
| 2737 | *  codec coding units.  It is relative to frame coordinates for the frame case and | 
|---|
| 2738 | *  to field coordinates for the field case. */ | 
|---|
| 2739 | VARectangle     roi_rectangle; | 
|---|
| 2740 | /** | 
|---|
| 2741 | * \brief ROI value | 
|---|
| 2742 | * | 
|---|
| 2743 | * \ref roi_value specifies ROI delta QP or ROI priority. | 
|---|
| 2744 | * --  ROI delta QP is the value that will be added on top of the frame level QP. | 
|---|
| 2745 | * --  ROI priority specifies the priority of a region, it can be positive (more important) | 
|---|
| 2746 | * or negative (less important) values and is compared with non-ROI region (taken as value 0), | 
|---|
| 2747 | * E.g. ROI region with \ref roi_value -3 is less important than the non-ROI region (\ref roi_value | 
|---|
| 2748 | * implied to be 0) which is less important than ROI region with roi_value +2. For overlapping | 
|---|
| 2749 | * regions, the roi_value that is first in the ROI array will have priority. | 
|---|
| 2750 | * | 
|---|
| 2751 | * \ref roi_value always specifes ROI delta QP when VAConfigAttribRateControl == VA_RC_CQP, no matter | 
|---|
| 2752 | * the value of \c roi_value_is_qp_delta in #VAEncMiscParameterBufferROI. | 
|---|
| 2753 | * | 
|---|
| 2754 | * \ref roi_value depends on \c roi_value_is_qp_delta in #VAEncMiscParameterBufferROI when | 
|---|
| 2755 | * VAConfigAttribRateControl != VA_RC_CQP. \ref roi_value specifies ROI_delta QP if \c roi_value_is_qp_delta | 
|---|
| 2756 | * in VAEncMiscParameterBufferROI is 1, otherwise \ref roi_value specifies ROI priority. | 
|---|
| 2757 | */ | 
|---|
| 2758 | int8_t            roi_value; | 
|---|
| 2759 | } VAEncROI; | 
|---|
| 2760 |  | 
|---|
| 2761 | typedef struct _VAEncMiscParameterBufferROI { | 
|---|
| 2762 | /** \brief Number of ROIs being sent.*/ | 
|---|
| 2763 | uint32_t        num_roi; | 
|---|
| 2764 |  | 
|---|
| 2765 | /** \brief Valid when VAConfigAttribRateControl != VA_RC_CQP, then the encoder's | 
|---|
| 2766 | *  rate control will determine actual delta QPs.  Specifies the max/min allowed delta | 
|---|
| 2767 | *  QPs. */ | 
|---|
| 2768 | int8_t                max_delta_qp; | 
|---|
| 2769 | int8_t                min_delta_qp; | 
|---|
| 2770 |  | 
|---|
| 2771 | /** \brief Pointer to a VAEncROI array with num_roi elements.  It is relative to frame | 
|---|
| 2772 | *  coordinates for the frame case and to field coordinates for the field case.*/ | 
|---|
| 2773 | VAEncROI            *roi; | 
|---|
| 2774 | union { | 
|---|
| 2775 | struct { | 
|---|
| 2776 | /** | 
|---|
| 2777 | * \brief An indication for roi value. | 
|---|
| 2778 | * | 
|---|
| 2779 | * \ref roi_value_is_qp_delta equal to 1 indicates \c roi_value in #VAEncROI should | 
|---|
| 2780 | * be used as ROI delta QP. \ref roi_value_is_qp_delta equal to 0 indicates \c roi_value | 
|---|
| 2781 | * in #VAEncROI should be used as ROI priority. | 
|---|
| 2782 | * | 
|---|
| 2783 | * \ref roi_value_is_qp_delta is only available when VAConfigAttribRateControl != VA_RC_CQP, | 
|---|
| 2784 | * the setting must comply with \c roi_rc_priority_support and \c roi_rc_qp_delta_support in | 
|---|
| 2785 | * #VAConfigAttribValEncROI. The underlying driver should ignore this field | 
|---|
| 2786 | * when VAConfigAttribRateControl == VA_RC_CQP. | 
|---|
| 2787 | */ | 
|---|
| 2788 | uint32_t  roi_value_is_qp_delta    : 1; | 
|---|
| 2789 | uint32_t  reserved                 : 31; | 
|---|
| 2790 | } bits; | 
|---|
| 2791 | uint32_t value; | 
|---|
| 2792 | } roi_flags; | 
|---|
| 2793 |  | 
|---|
| 2794 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 2795 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 2796 | } VAEncMiscParameterBufferROI; | 
|---|
| 2797 | /* | 
|---|
| 2798 | * \brief Dirty rectangle data structure for encoding. | 
|---|
| 2799 | * | 
|---|
| 2800 | * The encoding dirty rect can be set through VAEncMiscParameterBufferDirtyRect, if the | 
|---|
| 2801 | * implementation supports dirty rect input. The rect set through this structure is applicable | 
|---|
| 2802 | * only to the current frame or field, so must be sent every frame or field to be applied. | 
|---|
| 2803 | * The number of supported rects can be queried through the VAConfigAttribEncDirtyRect.  The | 
|---|
| 2804 | * encoder will use the rect information to know those rectangle areas have changed while the | 
|---|
| 2805 | * areas not covered by dirty rect rectangles are assumed to have not changed compared to the | 
|---|
| 2806 | * previous picture.  The encoder may do some internal optimizations. | 
|---|
| 2807 | */ | 
|---|
| 2808 | typedef struct _VAEncMiscParameterBufferDirtyRect { | 
|---|
| 2809 | /** \brief Number of Rectangle being sent.*/ | 
|---|
| 2810 | uint32_t    num_roi_rectangle; | 
|---|
| 2811 |  | 
|---|
| 2812 | /** \brief Pointer to a VARectangle array with num_roi_rectangle elements.*/ | 
|---|
| 2813 | VARectangle    *roi_rectangle; | 
|---|
| 2814 | } VAEncMiscParameterBufferDirtyRect; | 
|---|
| 2815 |  | 
|---|
| 2816 | /** \brief Attribute value for VAConfigAttribEncParallelRateControl */ | 
|---|
| 2817 | typedef struct _VAEncMiscParameterParallelRateControl { | 
|---|
| 2818 | /** brief Number of layers*/ | 
|---|
| 2819 | uint32_t num_layers; | 
|---|
| 2820 | /** brief Number of B frames per layer per GOP. | 
|---|
| 2821 | * | 
|---|
| 2822 | * it should be allocated by application, and the is num_layers. | 
|---|
| 2823 | *  num_b_in_gop[0] is the number of regular B which refers to only I or P frames. */ | 
|---|
| 2824 | uint32_t *num_b_in_gop; | 
|---|
| 2825 | } VAEncMiscParameterParallelRateControl; | 
|---|
| 2826 |  | 
|---|
| 2827 | /** per frame encoder quality controls, once set they will persist for all future frames | 
|---|
| 2828 | *till it is updated again. */ | 
|---|
| 2829 | typedef struct _VAEncMiscParameterEncQuality { | 
|---|
| 2830 | union { | 
|---|
| 2831 | struct { | 
|---|
| 2832 | /** Use raw frames for reference instead of reconstructed frames. | 
|---|
| 2833 | * it only impact motion estimation (ME)  stage, and will not impact MC stage | 
|---|
| 2834 | * so the reconstruct picture will can match with decode side */ | 
|---|
| 2835 | uint32_t useRawPicForRef                    : 1; | 
|---|
| 2836 | /**  Disables skip check for ME stage, it will increase the bistream size | 
|---|
| 2837 | * but will improve the qulity */ | 
|---|
| 2838 | uint32_t skipCheckDisable                   : 1; | 
|---|
| 2839 | /**  Indicates app will override default driver FTQ settings using FTQEnable. | 
|---|
| 2840 | *  FTQ is forward transform quantization */ | 
|---|
| 2841 | uint32_t FTQOverride                        : 1; | 
|---|
| 2842 | /** Enables/disables FTQ. */ | 
|---|
| 2843 | uint32_t FTQEnable                          : 1; | 
|---|
| 2844 | /** Indicates the app will provide the Skip Threshold LUT to use when FTQ is | 
|---|
| 2845 | * enabled (FTQSkipThresholdLUT), else default driver thresholds will be used. */ | 
|---|
| 2846 | uint32_t FTQSkipThresholdLUTInput           : 1; | 
|---|
| 2847 | /** Indicates the app will provide the Skip Threshold LUT to use when FTQ is | 
|---|
| 2848 | * disabled (NonFTQSkipThresholdLUT), else default driver thresholds will be used. */ | 
|---|
| 2849 | uint32_t NonFTQSkipThresholdLUTInput        : 1; | 
|---|
| 2850 | uint32_t ReservedBit                        : 1; | 
|---|
| 2851 | /** Control to enable the ME mode decision algorithm to bias to fewer B Direct/Skip types. | 
|---|
| 2852 | * Applies only to B frames, all other frames will ignore this setting.  */ | 
|---|
| 2853 | uint32_t directBiasAdjustmentEnable         : 1; | 
|---|
| 2854 | /** Enables global motion bias. global motion also is called HME (Heirarchical Motion Estimation ) | 
|---|
| 2855 | * HME is used to handle large motions and avoiding local minima in the video encoding process | 
|---|
| 2856 | * down scaled the input and reference picture, then do ME. the result will be a predictor to next level HME or ME | 
|---|
| 2857 | * current interface divide the HME to 3 level. UltraHME , SuperHME, and HME, result of UltraHME will be input of SurperHME, | 
|---|
| 2858 | * result of superHME will be a input for HME. HME result will be input of ME. it is a switch for HMEMVCostScalingFactor | 
|---|
| 2859 | * can change the HME bias inside RDO stage*/ | 
|---|
| 2860 | uint32_t globalMotionBiasAdjustmentEnable   : 1; | 
|---|
| 2861 | /** MV cost scaling ratio for HME ( predictors.  It is used when | 
|---|
| 2862 | * globalMotionBiasAdjustmentEnable == 1, else it is ignored.  Values are: | 
|---|
| 2863 | *     0: set MV cost to be 0 for HME predictor. | 
|---|
| 2864 | *     1: scale MV cost to be 1/2 of the default value for HME predictor. | 
|---|
| 2865 | *     2: scale MV cost to be 1/4 of the default value for HME predictor. | 
|---|
| 2866 | *     3: scale MV cost to be 1/8 of the default value for HME predictor. */ | 
|---|
| 2867 | uint32_t HMEMVCostScalingFactor             : 2; | 
|---|
| 2868 | /**disable HME, if it is disabled. Super*ultraHME should also be disabled  */ | 
|---|
| 2869 | uint32_t HMEDisable                         : 1; | 
|---|
| 2870 | /**disable Super HME, if it is disabled, ultraHME should be disabled */ | 
|---|
| 2871 | uint32_t SuperHMEDisable                    : 1; | 
|---|
| 2872 | /** disable Ultra HME */ | 
|---|
| 2873 | uint32_t UltraHMEDisable                    : 1; | 
|---|
| 2874 | /** disable panic mode. Panic mode happened when there are extreme BRC (bit rate control) requirement | 
|---|
| 2875 | * frame size cant achieve the target of BRC.  when Panic mode is triggered, Coefficients will | 
|---|
| 2876 | *  be set to zero. disable panic mode will improve quality but will impact BRC */ | 
|---|
| 2877 | uint32_t PanicModeDisable                   : 1; | 
|---|
| 2878 | /** Force RepartitionCheck | 
|---|
| 2879 | *  0: DEFAULT - follow driver default settings. | 
|---|
| 2880 | *  1: FORCE_ENABLE - enable this feature totally for all cases. | 
|---|
| 2881 | *  2: FORCE_DISABLE - disable this feature totally for all cases. */ | 
|---|
| 2882 | uint32_t ForceRepartitionCheck              : 2; | 
|---|
| 2883 |  | 
|---|
| 2884 | }; | 
|---|
| 2885 | uint32_t encControls; | 
|---|
| 2886 | }; | 
|---|
| 2887 |  | 
|---|
| 2888 | /** Maps QP to skip thresholds when FTQ is enabled.  Valid range is 0-255. */ | 
|---|
| 2889 | uint8_t FTQSkipThresholdLUT[52]; | 
|---|
| 2890 | /** Maps QP to skip thresholds when FTQ is disabled.  Valid range is 0-65535. */ | 
|---|
| 2891 | uint16_t NonFTQSkipThresholdLUT[52]; | 
|---|
| 2892 |  | 
|---|
| 2893 | uint32_t reserved[VA_PADDING_HIGH];  // Reserved for future use. | 
|---|
| 2894 |  | 
|---|
| 2895 | } VAEncMiscParameterEncQuality; | 
|---|
| 2896 |  | 
|---|
| 2897 | /** | 
|---|
| 2898 | *  \brief Custom Encoder Rounding Offset Control. | 
|---|
| 2899 | *  Application may use this structure to set customized rounding | 
|---|
| 2900 | *  offset parameters for quantization. | 
|---|
| 2901 | *  Valid when \c VAConfigAttribCustomRoundingControl equals 1. | 
|---|
| 2902 | */ | 
|---|
| 2903 | typedef struct _VAEncMiscParameterCustomRoundingControl { | 
|---|
| 2904 | union { | 
|---|
| 2905 | struct { | 
|---|
| 2906 | /** \brief Enable customized rounding offset for intra blocks. | 
|---|
| 2907 | *  If 0, default value would be taken by driver for intra | 
|---|
| 2908 | *  rounding offset. | 
|---|
| 2909 | */ | 
|---|
| 2910 | uint32_t    enable_custom_rouding_intra     : 1 ; | 
|---|
| 2911 |  | 
|---|
| 2912 | /** \brief Intra rounding offset | 
|---|
| 2913 | *  Ignored if \c enable_custom_rouding_intra equals 0. | 
|---|
| 2914 | */ | 
|---|
| 2915 | uint32_t    rounding_offset_intra           : 7; | 
|---|
| 2916 |  | 
|---|
| 2917 | /** \brief Enable customized rounding offset for inter blocks. | 
|---|
| 2918 | *  If 0, default value would be taken by driver for inter | 
|---|
| 2919 | *  rounding offset. | 
|---|
| 2920 | */ | 
|---|
| 2921 | uint32_t    enable_custom_rounding_inter    : 1 ; | 
|---|
| 2922 |  | 
|---|
| 2923 | /** \brief Inter rounding offset | 
|---|
| 2924 | *  Ignored if \c enable_custom_rouding_inter equals 0. | 
|---|
| 2925 | */ | 
|---|
| 2926 | uint32_t    rounding_offset_inter           : 7; | 
|---|
| 2927 |  | 
|---|
| 2928 | /* Reserved */ | 
|---|
| 2929 | uint32_t    reserved                        : 16; | 
|---|
| 2930 | }  bits; | 
|---|
| 2931 | uint32_t    value; | 
|---|
| 2932 | }   rounding_offset_setting; | 
|---|
| 2933 | } VAEncMiscParameterCustomRoundingControl; | 
|---|
| 2934 |  | 
|---|
| 2935 | /** | 
|---|
| 2936 | * There will be cases where the bitstream buffer will not have enough room to hold | 
|---|
| 2937 | * the data for the entire slice, and the following flags will be used in the slice | 
|---|
| 2938 | * parameter to signal to the server for the possible cases. | 
|---|
| 2939 | * If a slice parameter buffer and slice data buffer pair is sent to the server with | 
|---|
| 2940 | * the slice data partially in the slice data buffer (BEGIN and MIDDLE cases below), | 
|---|
| 2941 | * then a slice parameter and data buffer needs to be sent again to complete this slice. | 
|---|
| 2942 | */ | 
|---|
| 2943 | #define VA_SLICE_DATA_FLAG_ALL      0x00    /* whole slice is in the buffer */ | 
|---|
| 2944 | #define VA_SLICE_DATA_FLAG_BEGIN    0x01    /* The beginning of the slice is in the buffer but the end if not */ | 
|---|
| 2945 | #define VA_SLICE_DATA_FLAG_MIDDLE   0x02    /* Neither beginning nor end of the slice is in the buffer */ | 
|---|
| 2946 | #define VA_SLICE_DATA_FLAG_END      0x04    /* end of the slice is in the buffer */ | 
|---|
| 2947 |  | 
|---|
| 2948 | /* Codec-independent Slice Parameter Buffer base */ | 
|---|
| 2949 | typedef struct _VASliceParameterBufferBase { | 
|---|
| 2950 | uint32_t slice_data_size;   /* number of bytes in the slice data buffer for this slice */ | 
|---|
| 2951 | uint32_t slice_data_offset; /* the offset to the first byte of slice data */ | 
|---|
| 2952 | uint32_t slice_data_flag;   /* see VA_SLICE_DATA_FLAG_XXX definitions */ | 
|---|
| 2953 | } VASliceParameterBufferBase; | 
|---|
| 2954 |  | 
|---|
| 2955 | /********************************** | 
|---|
| 2956 | * JPEG common  data structures | 
|---|
| 2957 | **********************************/ | 
|---|
| 2958 | /** | 
|---|
| 2959 | * \brief Huffman table for JPEG decoding. | 
|---|
| 2960 | * | 
|---|
| 2961 | * This structure holds the complete Huffman tables. This is an | 
|---|
| 2962 | * aggregation of all Huffman table (DHT) segments maintained by the | 
|---|
| 2963 | * application. i.e. up to 2 Huffman tables are stored in there for | 
|---|
| 2964 | * baseline profile. | 
|---|
| 2965 | * | 
|---|
| 2966 | * The #load_huffman_table array can be used as a hint to notify the | 
|---|
| 2967 | * VA driver implementation about which table(s) actually changed | 
|---|
| 2968 | * since the last submission of this buffer. | 
|---|
| 2969 | */ | 
|---|
| 2970 | typedef struct _VAHuffmanTableBufferJPEGBaseline { | 
|---|
| 2971 | /** \brief Specifies which #huffman_table is valid. */ | 
|---|
| 2972 | uint8_t       load_huffman_table[2]; | 
|---|
| 2973 | /** \brief Huffman tables indexed by table identifier (Th). */ | 
|---|
| 2974 | struct { | 
|---|
| 2975 | /** @name DC table (up to 12 categories) */ | 
|---|
| 2976 | /**@{*/ | 
|---|
| 2977 | /** \brief Number of Huffman codes of length i + 1 (Li). */ | 
|---|
| 2978 | uint8_t   num_dc_codes[16]; | 
|---|
| 2979 | /** \brief Value associated with each Huffman code (Vij). */ | 
|---|
| 2980 | uint8_t   dc_values[12]; | 
|---|
| 2981 | /**@}*/ | 
|---|
| 2982 | /** @name AC table (2 special codes + up to 16 * 10 codes) */ | 
|---|
| 2983 | /**@{*/ | 
|---|
| 2984 | /** \brief Number of Huffman codes of length i + 1 (Li). */ | 
|---|
| 2985 | uint8_t   num_ac_codes[16]; | 
|---|
| 2986 | /** \brief Value associated with each Huffman code (Vij). */ | 
|---|
| 2987 | uint8_t   ac_values[162]; | 
|---|
| 2988 | /** \brief Padding to 4-byte boundaries. Must be set to zero. */ | 
|---|
| 2989 | uint8_t   pad[2]; | 
|---|
| 2990 | /**@}*/ | 
|---|
| 2991 | }                   huffman_table[2]; | 
|---|
| 2992 |  | 
|---|
| 2993 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 2994 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 2995 | } VAHuffmanTableBufferJPEGBaseline; | 
|---|
| 2996 |  | 
|---|
| 2997 | /**************************** | 
|---|
| 2998 | * MPEG-2 data structures | 
|---|
| 2999 | ****************************/ | 
|---|
| 3000 |  | 
|---|
| 3001 | /* MPEG-2 Picture Parameter Buffer */ | 
|---|
| 3002 | /* | 
|---|
| 3003 | * For each frame or field, and before any slice data, a single | 
|---|
| 3004 | * picture parameter buffer must be send. | 
|---|
| 3005 | */ | 
|---|
| 3006 | typedef struct _VAPictureParameterBufferMPEG2 { | 
|---|
| 3007 | uint16_t horizontal_size; | 
|---|
| 3008 | uint16_t vertical_size; | 
|---|
| 3009 | VASurfaceID forward_reference_picture; | 
|---|
| 3010 | VASurfaceID backward_reference_picture; | 
|---|
| 3011 | /* meanings of the following fields are the same as in the standard */ | 
|---|
| 3012 | int32_t picture_coding_type; | 
|---|
| 3013 | int32_t f_code; /* pack all four fcode into this */ | 
|---|
| 3014 | union { | 
|---|
| 3015 | struct { | 
|---|
| 3016 | uint32_t intra_dc_precision     : 2; | 
|---|
| 3017 | uint32_t picture_structure      : 2; | 
|---|
| 3018 | uint32_t top_field_first        : 1; | 
|---|
| 3019 | uint32_t frame_pred_frame_dct       : 1; | 
|---|
| 3020 | uint32_t concealment_motion_vectors : 1; | 
|---|
| 3021 | uint32_t q_scale_type           : 1; | 
|---|
| 3022 | uint32_t intra_vlc_format       : 1; | 
|---|
| 3023 | uint32_t alternate_scan         : 1; | 
|---|
| 3024 | uint32_t repeat_first_field     : 1; | 
|---|
| 3025 | uint32_t progressive_frame      : 1; | 
|---|
| 3026 | uint32_t is_first_field         : 1; /* indicate whether the current field | 
|---|
| 3027 | * is the first field for field picture | 
|---|
| 3028 | */ | 
|---|
| 3029 | } bits; | 
|---|
| 3030 | uint32_t value; | 
|---|
| 3031 | } picture_coding_extension; | 
|---|
| 3032 |  | 
|---|
| 3033 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 3034 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 3035 | } VAPictureParameterBufferMPEG2; | 
|---|
| 3036 |  | 
|---|
| 3037 | /** MPEG-2 Inverse Quantization Matrix Buffer */ | 
|---|
| 3038 | typedef struct _VAIQMatrixBufferMPEG2 { | 
|---|
| 3039 | /** \brief Same as the MPEG-2 bitstream syntax element. */ | 
|---|
| 3040 | int32_t load_intra_quantiser_matrix; | 
|---|
| 3041 | /** \brief Same as the MPEG-2 bitstream syntax element. */ | 
|---|
| 3042 | int32_t load_non_intra_quantiser_matrix; | 
|---|
| 3043 | /** \brief Same as the MPEG-2 bitstream syntax element. */ | 
|---|
| 3044 | int32_t load_chroma_intra_quantiser_matrix; | 
|---|
| 3045 | /** \brief Same as the MPEG-2 bitstream syntax element. */ | 
|---|
| 3046 | int32_t load_chroma_non_intra_quantiser_matrix; | 
|---|
| 3047 | /** \brief Luminance intra matrix, in zig-zag scan order. */ | 
|---|
| 3048 | uint8_t intra_quantiser_matrix[64]; | 
|---|
| 3049 | /** \brief Luminance non-intra matrix, in zig-zag scan order. */ | 
|---|
| 3050 | uint8_t non_intra_quantiser_matrix[64]; | 
|---|
| 3051 | /** \brief Chroma intra matrix, in zig-zag scan order. */ | 
|---|
| 3052 | uint8_t chroma_intra_quantiser_matrix[64]; | 
|---|
| 3053 | /** \brief Chroma non-intra matrix, in zig-zag scan order. */ | 
|---|
| 3054 | uint8_t chroma_non_intra_quantiser_matrix[64]; | 
|---|
| 3055 |  | 
|---|
| 3056 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 3057 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 3058 | } VAIQMatrixBufferMPEG2; | 
|---|
| 3059 |  | 
|---|
| 3060 | /** MPEG-2 Slice Parameter Buffer */ | 
|---|
| 3061 | typedef struct _VASliceParameterBufferMPEG2 { | 
|---|
| 3062 | uint32_t slice_data_size;/* number of bytes in the slice data buffer for this slice */ | 
|---|
| 3063 | uint32_t slice_data_offset;/* the offset to the first byte of slice data */ | 
|---|
| 3064 | uint32_t slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */ | 
|---|
| 3065 | uint32_t macroblock_offset;/* the offset to the first bit of MB from the first byte of slice data */ | 
|---|
| 3066 | uint32_t slice_horizontal_position; | 
|---|
| 3067 | uint32_t slice_vertical_position; | 
|---|
| 3068 | int32_t quantiser_scale_code; | 
|---|
| 3069 | int32_t intra_slice_flag; | 
|---|
| 3070 |  | 
|---|
| 3071 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 3072 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 3073 | } VASliceParameterBufferMPEG2; | 
|---|
| 3074 |  | 
|---|
| 3075 | /** MPEG-2 Macroblock Parameter Buffer */ | 
|---|
| 3076 | typedef struct _VAMacroblockParameterBufferMPEG2 { | 
|---|
| 3077 | uint16_t macroblock_address; | 
|---|
| 3078 | /* | 
|---|
| 3079 | * macroblock_address (in raster scan order) | 
|---|
| 3080 | * top-left: 0 | 
|---|
| 3081 | * bottom-right: picture-height-in-mb*picture-width-in-mb - 1 | 
|---|
| 3082 | */ | 
|---|
| 3083 | uint8_t macroblock_type;  /* see definition below */ | 
|---|
| 3084 | union { | 
|---|
| 3085 | struct { | 
|---|
| 3086 | uint32_t frame_motion_type      : 2; | 
|---|
| 3087 | uint32_t field_motion_type      : 2; | 
|---|
| 3088 | uint32_t dct_type           : 1; | 
|---|
| 3089 | } bits; | 
|---|
| 3090 | uint32_t value; | 
|---|
| 3091 | } macroblock_modes; | 
|---|
| 3092 | uint8_t motion_vertical_field_select; | 
|---|
| 3093 | /* | 
|---|
| 3094 | * motion_vertical_field_select: | 
|---|
| 3095 | * see section 6.3.17.2 in the spec | 
|---|
| 3096 | * only the lower 4 bits are used | 
|---|
| 3097 | * bit 0: first vector forward | 
|---|
| 3098 | * bit 1: first vector backward | 
|---|
| 3099 | * bit 2: second vector forward | 
|---|
| 3100 | * bit 3: second vector backward | 
|---|
| 3101 | */ | 
|---|
| 3102 | int16_t PMV[2][2][2]; /* see Table 7-7 in the spec */ | 
|---|
| 3103 | uint16_t coded_block_pattern; | 
|---|
| 3104 | /* | 
|---|
| 3105 | * The bitplanes for coded_block_pattern are described | 
|---|
| 3106 | * in Figure 6.10-12 in the spec | 
|---|
| 3107 | */ | 
|---|
| 3108 |  | 
|---|
| 3109 | /* Number of skipped macroblocks after this macroblock */ | 
|---|
| 3110 | uint16_t num_skipped_macroblocks; | 
|---|
| 3111 |  | 
|---|
| 3112 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 3113 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 3114 | } VAMacroblockParameterBufferMPEG2; | 
|---|
| 3115 |  | 
|---|
| 3116 | /* | 
|---|
| 3117 | * OR'd flags for macroblock_type (section 6.3.17.1 in the spec) | 
|---|
| 3118 | */ | 
|---|
| 3119 | #define VA_MB_TYPE_MOTION_FORWARD   0x02 | 
|---|
| 3120 | #define VA_MB_TYPE_MOTION_BACKWARD  0x04 | 
|---|
| 3121 | #define VA_MB_TYPE_MOTION_PATTERN   0x08 | 
|---|
| 3122 | #define VA_MB_TYPE_MOTION_INTRA     0x10 | 
|---|
| 3123 |  | 
|---|
| 3124 | /** | 
|---|
| 3125 | * MPEG-2 Residual Data Buffer | 
|---|
| 3126 | * For each macroblock, there wil be 64 shorts (16-bit) in the | 
|---|
| 3127 | * residual data buffer | 
|---|
| 3128 | */ | 
|---|
| 3129 |  | 
|---|
| 3130 | /**************************** | 
|---|
| 3131 | * MPEG-4 Part 2 data structures | 
|---|
| 3132 | ****************************/ | 
|---|
| 3133 |  | 
|---|
| 3134 | /* MPEG-4 Picture Parameter Buffer */ | 
|---|
| 3135 | /* | 
|---|
| 3136 | * For each frame or field, and before any slice data, a single | 
|---|
| 3137 | * picture parameter buffer must be send. | 
|---|
| 3138 | */ | 
|---|
| 3139 | typedef struct _VAPictureParameterBufferMPEG4 { | 
|---|
| 3140 | uint16_t vop_width; | 
|---|
| 3141 | uint16_t vop_height; | 
|---|
| 3142 | VASurfaceID forward_reference_picture; | 
|---|
| 3143 | VASurfaceID backward_reference_picture; | 
|---|
| 3144 | union { | 
|---|
| 3145 | struct { | 
|---|
| 3146 | uint32_t      : 1; | 
|---|
| 3147 | uint32_t chroma_format          : 2; | 
|---|
| 3148 | uint32_t interlaced         : 1; | 
|---|
| 3149 | uint32_t obmc_disable           : 1; | 
|---|
| 3150 | uint32_t sprite_enable          : 2; | 
|---|
| 3151 | uint32_t sprite_warping_accuracy    : 2; | 
|---|
| 3152 | uint32_t quant_type         : 1; | 
|---|
| 3153 | uint32_t quarter_sample         : 1; | 
|---|
| 3154 | uint32_t data_partitioned       : 1; | 
|---|
| 3155 | uint32_t reversible_vlc         : 1; | 
|---|
| 3156 | uint32_t resync_marker_disable      : 1; | 
|---|
| 3157 | } bits; | 
|---|
| 3158 | uint32_t value; | 
|---|
| 3159 | } vol_fields; | 
|---|
| 3160 | uint8_t no_of_sprite_warping_points; | 
|---|
| 3161 | int16_t sprite_trajectory_du[3]; | 
|---|
| 3162 | int16_t sprite_trajectory_dv[3]; | 
|---|
| 3163 | uint8_t quant_precision; | 
|---|
| 3164 | union { | 
|---|
| 3165 | struct { | 
|---|
| 3166 | uint32_t vop_coding_type        : 2; | 
|---|
| 3167 | uint32_t backward_reference_vop_coding_type : 2; | 
|---|
| 3168 | uint32_t vop_rounding_type      : 1; | 
|---|
| 3169 | uint32_t intra_dc_vlc_thr       : 3; | 
|---|
| 3170 | uint32_t top_field_first        : 1; | 
|---|
| 3171 | uint32_t alternate_vertical_scan_flag   : 1; | 
|---|
| 3172 | } bits; | 
|---|
| 3173 | uint32_t value; | 
|---|
| 3174 | } vop_fields; | 
|---|
| 3175 | uint8_t vop_fcode_forward; | 
|---|
| 3176 | uint8_t vop_fcode_backward; | 
|---|
| 3177 | uint16_t vop_time_increment_resolution; | 
|---|
| 3178 | /* short header related */ | 
|---|
| 3179 | uint8_t num_gobs_in_vop; | 
|---|
| 3180 | uint8_t num_macroblocks_in_gob; | 
|---|
| 3181 | /* for direct mode prediction */ | 
|---|
| 3182 | int16_t TRB; | 
|---|
| 3183 | int16_t TRD; | 
|---|
| 3184 |  | 
|---|
| 3185 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 3186 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 3187 | } VAPictureParameterBufferMPEG4; | 
|---|
| 3188 |  | 
|---|
| 3189 | /** MPEG-4 Inverse Quantization Matrix Buffer */ | 
|---|
| 3190 | typedef struct _VAIQMatrixBufferMPEG4 { | 
|---|
| 3191 | /** Same as the MPEG-4:2 bitstream syntax element. */ | 
|---|
| 3192 | int32_t load_intra_quant_mat; | 
|---|
| 3193 | /** Same as the MPEG-4:2 bitstream syntax element. */ | 
|---|
| 3194 | int32_t load_non_intra_quant_mat; | 
|---|
| 3195 | /** The matrix for intra blocks, in zig-zag scan order. */ | 
|---|
| 3196 | uint8_t intra_quant_mat[64]; | 
|---|
| 3197 | /** The matrix for non-intra blocks, in zig-zag scan order. */ | 
|---|
| 3198 | uint8_t non_intra_quant_mat[64]; | 
|---|
| 3199 |  | 
|---|
| 3200 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 3201 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 3202 | } VAIQMatrixBufferMPEG4; | 
|---|
| 3203 |  | 
|---|
| 3204 | /** MPEG-4 Slice Parameter Buffer */ | 
|---|
| 3205 | typedef struct _VASliceParameterBufferMPEG4 { | 
|---|
| 3206 | uint32_t slice_data_size;/* number of bytes in the slice data buffer for this slice */ | 
|---|
| 3207 | uint32_t slice_data_offset;/* the offset to the first byte of slice data */ | 
|---|
| 3208 | uint32_t slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */ | 
|---|
| 3209 | uint32_t macroblock_offset;/* the offset to the first bit of MB from the first byte of slice data */ | 
|---|
| 3210 | uint32_t macroblock_number; | 
|---|
| 3211 | int32_t quant_scale; | 
|---|
| 3212 |  | 
|---|
| 3213 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 3214 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 3215 | } VASliceParameterBufferMPEG4; | 
|---|
| 3216 |  | 
|---|
| 3217 | /** | 
|---|
| 3218 | VC-1 data structures | 
|---|
| 3219 | */ | 
|---|
| 3220 |  | 
|---|
| 3221 | typedef enum   /* see 7.1.1.32 */ | 
|---|
| 3222 | { | 
|---|
| 3223 | VAMvMode1Mv                        = 0, | 
|---|
| 3224 | VAMvMode1MvHalfPel                 = 1, | 
|---|
| 3225 | VAMvMode1MvHalfPelBilinear         = 2, | 
|---|
| 3226 | VAMvModeMixedMv                    = 3, | 
|---|
| 3227 | VAMvModeIntensityCompensation      = 4 | 
|---|
| 3228 | } VAMvModeVC1; | 
|---|
| 3229 |  | 
|---|
| 3230 | /** VC-1 Picture Parameter Buffer */ | 
|---|
| 3231 | /* | 
|---|
| 3232 | * For each picture, and before any slice data, a picture parameter | 
|---|
| 3233 | * buffer must be send. Multiple picture parameter buffers may be | 
|---|
| 3234 | * sent for a single picture. In that case picture parameters will | 
|---|
| 3235 | * apply to all slice data that follow it until a new picture | 
|---|
| 3236 | * parameter buffer is sent. | 
|---|
| 3237 | * | 
|---|
| 3238 | * Notes: | 
|---|
| 3239 | *   pic_quantizer_type should be set to the applicable quantizer | 
|---|
| 3240 | *   type as defined by QUANTIZER (J.1.19) and either | 
|---|
| 3241 | *   PQUANTIZER (7.1.1.8) or PQINDEX (7.1.1.6) | 
|---|
| 3242 | */ | 
|---|
| 3243 | typedef struct _VAPictureParameterBufferVC1 { | 
|---|
| 3244 | VASurfaceID forward_reference_picture; | 
|---|
| 3245 | VASurfaceID backward_reference_picture; | 
|---|
| 3246 | /* if out-of-loop post-processing is done on the render | 
|---|
| 3247 | target, then we need to keep the in-loop decoded | 
|---|
| 3248 | picture as a reference picture */ | 
|---|
| 3249 | VASurfaceID inloop_decoded_picture; | 
|---|
| 3250 |  | 
|---|
| 3251 | /* sequence layer for AP or meta data for SP and MP */ | 
|---|
| 3252 | union { | 
|---|
| 3253 | struct { | 
|---|
| 3254 | uint32_t pulldown   : 1; /* SEQUENCE_LAYER::PULLDOWN */ | 
|---|
| 3255 | uint32_t interlace  : 1; /* SEQUENCE_LAYER::INTERLACE */ | 
|---|
| 3256 | uint32_t tfcntrflag : 1; /* SEQUENCE_LAYER::TFCNTRFLAG */ | 
|---|
| 3257 | uint32_t finterpflag    : 1; /* SEQUENCE_LAYER::FINTERPFLAG */ | 
|---|
| 3258 | uint32_t psf        : 1; /* SEQUENCE_LAYER::PSF */ | 
|---|
| 3259 | uint32_t multires   : 1; /* METADATA::MULTIRES */ | 
|---|
| 3260 | uint32_t overlap    : 1; /* METADATA::OVERLAP */ | 
|---|
| 3261 | uint32_t syncmarker : 1; /* METADATA::SYNCMARKER */ | 
|---|
| 3262 | uint32_t rangered   : 1; /* METADATA::RANGERED */ | 
|---|
| 3263 | uint32_t max_b_frames   : 3; /* METADATA::MAXBFRAMES */ | 
|---|
| 3264 | uint32_t profile    : 2; /* SEQUENCE_LAYER::PROFILE or The MSB of METADATA::PROFILE */ | 
|---|
| 3265 | } bits; | 
|---|
| 3266 | uint32_t value; | 
|---|
| 3267 | } sequence_fields; | 
|---|
| 3268 |  | 
|---|
| 3269 | uint16_t coded_width;       /* ENTRY_POINT_LAYER::CODED_WIDTH */ | 
|---|
| 3270 | uint16_t coded_height;  /* ENTRY_POINT_LAYER::CODED_HEIGHT */ | 
|---|
| 3271 | union { | 
|---|
| 3272 | struct { | 
|---|
| 3273 | uint32_t broken_link    : 1; /* ENTRY_POINT_LAYER::BROKEN_LINK */ | 
|---|
| 3274 | uint32_t closed_entry   : 1; /* ENTRY_POINT_LAYER::CLOSED_ENTRY */ | 
|---|
| 3275 | uint32_t panscan_flag   : 1; /* ENTRY_POINT_LAYER::PANSCAN_FLAG */ | 
|---|
| 3276 | uint32_t loopfilter : 1; /* ENTRY_POINT_LAYER::LOOPFILTER */ | 
|---|
| 3277 | } bits; | 
|---|
| 3278 | uint32_t value; | 
|---|
| 3279 | } entrypoint_fields; | 
|---|
| 3280 | uint8_t conditional_overlap_flag; /* ENTRY_POINT_LAYER::CONDOVER */ | 
|---|
| 3281 | uint8_t fast_uvmc_flag; /* ENTRY_POINT_LAYER::FASTUVMC */ | 
|---|
| 3282 | union { | 
|---|
| 3283 | struct { | 
|---|
| 3284 | uint32_t luma_flag  : 1; /* ENTRY_POINT_LAYER::RANGE_MAPY_FLAG */ | 
|---|
| 3285 | uint32_t luma       : 3; /* ENTRY_POINT_LAYER::RANGE_MAPY */ | 
|---|
| 3286 | uint32_t chroma_flag    : 1; /* ENTRY_POINT_LAYER::RANGE_MAPUV_FLAG */ | 
|---|
| 3287 | uint32_t chroma     : 3; /* ENTRY_POINT_LAYER::RANGE_MAPUV */ | 
|---|
| 3288 | } bits; | 
|---|
| 3289 | uint32_t value; | 
|---|
| 3290 | } range_mapping_fields; | 
|---|
| 3291 |  | 
|---|
| 3292 | uint8_t b_picture_fraction; /* Index for PICTURE_LAYER::BFRACTION value in Table 40 (7.1.1.14) */ | 
|---|
| 3293 | uint8_t cbp_table;      /* PICTURE_LAYER::CBPTAB/ICBPTAB */ | 
|---|
| 3294 | uint8_t mb_mode_table;  /* PICTURE_LAYER::MBMODETAB */ | 
|---|
| 3295 | uint8_t range_reduction_frame;/* PICTURE_LAYER::RANGEREDFRM */ | 
|---|
| 3296 | uint8_t rounding_control;   /* PICTURE_LAYER::RNDCTRL */ | 
|---|
| 3297 | uint8_t post_processing;    /* PICTURE_LAYER::POSTPROC */ | 
|---|
| 3298 | uint8_t picture_resolution_index;   /* PICTURE_LAYER::RESPIC */ | 
|---|
| 3299 | uint8_t luma_scale;     /* PICTURE_LAYER::LUMSCALE */ | 
|---|
| 3300 | uint8_t luma_shift;     /* PICTURE_LAYER::LUMSHIFT */ | 
|---|
| 3301 |  | 
|---|
| 3302 | union { | 
|---|
| 3303 | struct { | 
|---|
| 3304 | uint32_t picture_type       : 3; /* PICTURE_LAYER::PTYPE */ | 
|---|
| 3305 | uint32_t frame_coding_mode  : 3; /* PICTURE_LAYER::FCM */ | 
|---|
| 3306 | uint32_t top_field_first    : 1; /* PICTURE_LAYER::TFF */ | 
|---|
| 3307 | uint32_t is_first_field     : 1; /* set to 1 if it is the first field */ | 
|---|
| 3308 | uint32_t intensity_compensation : 1; /* PICTURE_LAYER::INTCOMP */ | 
|---|
| 3309 | } bits; | 
|---|
| 3310 | uint32_t value; | 
|---|
| 3311 | } picture_fields; | 
|---|
| 3312 | union { | 
|---|
| 3313 | struct { | 
|---|
| 3314 | uint32_t mv_type_mb : 1;    /* PICTURE::MVTYPEMB */ | 
|---|
| 3315 | uint32_t direct_mb  : 1;    /* PICTURE::DIRECTMB */ | 
|---|
| 3316 | uint32_t skip_mb    : 1;    /* PICTURE::SKIPMB */ | 
|---|
| 3317 | uint32_t field_tx   : 1;    /* PICTURE::FIELDTX */ | 
|---|
| 3318 | uint32_t forward_mb : 1;    /* PICTURE::FORWARDMB */ | 
|---|
| 3319 | uint32_t ac_pred    : 1;    /* PICTURE::ACPRED */ | 
|---|
| 3320 | uint32_t overflags  : 1;    /* PICTURE::OVERFLAGS */ | 
|---|
| 3321 | } flags; | 
|---|
| 3322 | uint32_t value; | 
|---|
| 3323 | } raw_coding; | 
|---|
| 3324 | union { | 
|---|
| 3325 | struct { | 
|---|
| 3326 | uint32_t bp_mv_type_mb   : 1;    /* PICTURE::MVTYPEMB */ | 
|---|
| 3327 | uint32_t bp_direct_mb    : 1;    /* PICTURE::DIRECTMB */ | 
|---|
| 3328 | uint32_t bp_skip_mb      : 1;    /* PICTURE::SKIPMB */ | 
|---|
| 3329 | uint32_t bp_field_tx     : 1;    /* PICTURE::FIELDTX */ | 
|---|
| 3330 | uint32_t bp_forward_mb   : 1;    /* PICTURE::FORWARDMB */ | 
|---|
| 3331 | uint32_t bp_ac_pred      : 1;    /* PICTURE::ACPRED */ | 
|---|
| 3332 | uint32_t bp_overflags    : 1;    /* PICTURE::OVERFLAGS */ | 
|---|
| 3333 | } flags; | 
|---|
| 3334 | uint32_t value; | 
|---|
| 3335 | } bitplane_present; /* signal what bitplane is being passed via the bitplane buffer */ | 
|---|
| 3336 | union { | 
|---|
| 3337 | struct { | 
|---|
| 3338 | uint32_t reference_distance_flag : 1;/* PICTURE_LAYER::REFDIST_FLAG */ | 
|---|
| 3339 | uint32_t reference_distance : 5;/* PICTURE_LAYER::REFDIST */ | 
|---|
| 3340 | uint32_t num_reference_pictures: 1;/* PICTURE_LAYER::NUMREF */ | 
|---|
| 3341 | uint32_t reference_field_pic_indicator  : 1;/* PICTURE_LAYER::REFFIELD */ | 
|---|
| 3342 | } bits; | 
|---|
| 3343 | uint32_t value; | 
|---|
| 3344 | } reference_fields; | 
|---|
| 3345 | union { | 
|---|
| 3346 | struct { | 
|---|
| 3347 | uint32_t mv_mode        : 3; /* PICTURE_LAYER::MVMODE */ | 
|---|
| 3348 | uint32_t mv_mode2       : 3; /* PICTURE_LAYER::MVMODE2 */ | 
|---|
| 3349 | uint32_t mv_table       : 3; /* PICTURE_LAYER::MVTAB/IMVTAB */ | 
|---|
| 3350 | uint32_t two_mv_block_pattern_table: 2; /* PICTURE_LAYER::2MVBPTAB */ | 
|---|
| 3351 | uint32_t four_mv_switch     : 1; /* PICTURE_LAYER::4MVSWITCH */ | 
|---|
| 3352 | uint32_t four_mv_block_pattern_table : 2; /* PICTURE_LAYER::4MVBPTAB */ | 
|---|
| 3353 | uint32_t extended_mv_flag   : 1; /* ENTRY_POINT_LAYER::EXTENDED_MV */ | 
|---|
| 3354 | uint32_t extended_mv_range  : 2; /* PICTURE_LAYER::MVRANGE */ | 
|---|
| 3355 | uint32_t extended_dmv_flag  : 1; /* ENTRY_POINT_LAYER::EXTENDED_DMV */ | 
|---|
| 3356 | uint32_t extended_dmv_range : 2; /* PICTURE_LAYER::DMVRANGE */ | 
|---|
| 3357 | } bits; | 
|---|
| 3358 | uint32_t value; | 
|---|
| 3359 | } mv_fields; | 
|---|
| 3360 | union { | 
|---|
| 3361 | struct { | 
|---|
| 3362 | uint32_t dquant : 2;    /* ENTRY_POINT_LAYER::DQUANT */ | 
|---|
| 3363 | uint32_t quantizer     : 2;     /* ENTRY_POINT_LAYER::QUANTIZER */ | 
|---|
| 3364 | uint32_t half_qp    : 1;    /* PICTURE_LAYER::HALFQP */ | 
|---|
| 3365 | uint32_t pic_quantizer_scale : 5;/* PICTURE_LAYER::PQUANT */ | 
|---|
| 3366 | uint32_t pic_quantizer_type : 1;/* PICTURE_LAYER::PQUANTIZER */ | 
|---|
| 3367 | uint32_t dq_frame   : 1;    /* VOPDQUANT::DQUANTFRM */ | 
|---|
| 3368 | uint32_t dq_profile : 2;    /* VOPDQUANT::DQPROFILE */ | 
|---|
| 3369 | uint32_t dq_sb_edge : 2;    /* VOPDQUANT::DQSBEDGE */ | 
|---|
| 3370 | uint32_t dq_db_edge     : 2;    /* VOPDQUANT::DQDBEDGE */ | 
|---|
| 3371 | uint32_t dq_binary_level : 1;   /* VOPDQUANT::DQBILEVEL */ | 
|---|
| 3372 | uint32_t alt_pic_quantizer : 5;/* VOPDQUANT::ALTPQUANT */ | 
|---|
| 3373 | } bits; | 
|---|
| 3374 | uint32_t value; | 
|---|
| 3375 | } pic_quantizer_fields; | 
|---|
| 3376 | union { | 
|---|
| 3377 | struct { | 
|---|
| 3378 | uint32_t variable_sized_transform_flag  : 1;/* ENTRY_POINT_LAYER::VSTRANSFORM */ | 
|---|
| 3379 | uint32_t mb_level_transform_type_flag   : 1;/* PICTURE_LAYER::TTMBF */ | 
|---|
| 3380 | uint32_t frame_level_transform_type : 2;/* PICTURE_LAYER::TTFRM */ | 
|---|
| 3381 | uint32_t transform_ac_codingset_idx1    : 2;/* PICTURE_LAYER::TRANSACFRM */ | 
|---|
| 3382 | uint32_t transform_ac_codingset_idx2    : 2;/* PICTURE_LAYER::TRANSACFRM2 */ | 
|---|
| 3383 | uint32_t intra_transform_dc_table   : 1;/* PICTURE_LAYER::TRANSDCTAB */ | 
|---|
| 3384 | } bits; | 
|---|
| 3385 | uint32_t value; | 
|---|
| 3386 | } transform_fields; | 
|---|
| 3387 |  | 
|---|
| 3388 | uint8_t luma_scale2;                  /* PICTURE_LAYER::LUMSCALE2 */ | 
|---|
| 3389 | uint8_t luma_shift2;                  /* PICTURE_LAYER::LUMSHIFT2 */ | 
|---|
| 3390 | uint8_t intensity_compensation_field; /* Index for PICTURE_LAYER::INTCOMPFIELD value in Table 109 (9.1.1.48) */ | 
|---|
| 3391 |  | 
|---|
| 3392 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 3393 | uint32_t                va_reserved[VA_PADDING_MEDIUM - 1]; | 
|---|
| 3394 | } VAPictureParameterBufferVC1; | 
|---|
| 3395 |  | 
|---|
| 3396 | /** VC-1 Bitplane Buffer | 
|---|
| 3397 | There will be at most three bitplanes coded in any picture header. To send | 
|---|
| 3398 | the bitplane data more efficiently, each byte is divided in two nibbles, with | 
|---|
| 3399 | each nibble carrying three bitplanes for one macroblock.  The following table | 
|---|
| 3400 | shows the bitplane data arrangement within each nibble based on the picture | 
|---|
| 3401 | type. | 
|---|
| 3402 |  | 
|---|
| 3403 | Picture Type    Bit3        Bit2        Bit1        Bit0 | 
|---|
| 3404 | I or BI             OVERFLAGS   ACPRED      FIELDTX | 
|---|
| 3405 | P               MYTYPEMB    SKIPMB      DIRECTMB | 
|---|
| 3406 | B               FORWARDMB   SKIPMB      DIRECTMB | 
|---|
| 3407 |  | 
|---|
| 3408 | Within each byte, the lower nibble is for the first MB and the upper nibble is | 
|---|
| 3409 | for the second MB.  E.g. the lower nibble of the first byte in the bitplane | 
|---|
| 3410 | buffer is for Macroblock #1 and the upper nibble of the first byte is for | 
|---|
| 3411 | Macroblock #2 in the first row. | 
|---|
| 3412 | */ | 
|---|
| 3413 |  | 
|---|
| 3414 | /* VC-1 Slice Parameter Buffer */ | 
|---|
| 3415 | typedef struct _VASliceParameterBufferVC1 { | 
|---|
| 3416 | uint32_t slice_data_size;/* number of bytes in the slice data buffer for this slice */ | 
|---|
| 3417 | uint32_t slice_data_offset;/* the offset to the first byte of slice data */ | 
|---|
| 3418 | uint32_t slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */ | 
|---|
| 3419 | uint32_t macroblock_offset;/* the offset to the first bit of MB from the first byte of slice data */ | 
|---|
| 3420 | uint32_t slice_vertical_position; | 
|---|
| 3421 |  | 
|---|
| 3422 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 3423 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 3424 | } VASliceParameterBufferVC1; | 
|---|
| 3425 |  | 
|---|
| 3426 | /* VC-1 Slice Data Buffer */ | 
|---|
| 3427 | /* | 
|---|
| 3428 | This is simplely a buffer containing raw bit-stream bytes | 
|---|
| 3429 | */ | 
|---|
| 3430 |  | 
|---|
| 3431 | /**************************** | 
|---|
| 3432 | * H.264/AVC data structures | 
|---|
| 3433 | ****************************/ | 
|---|
| 3434 |  | 
|---|
| 3435 | typedef struct _VAPictureH264 { | 
|---|
| 3436 | VASurfaceID picture_id; | 
|---|
| 3437 | uint32_t frame_idx; | 
|---|
| 3438 | uint32_t flags; | 
|---|
| 3439 | int32_t TopFieldOrderCnt; | 
|---|
| 3440 | int32_t BottomFieldOrderCnt; | 
|---|
| 3441 |  | 
|---|
| 3442 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 3443 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 3444 | } VAPictureH264; | 
|---|
| 3445 | /* flags in VAPictureH264 could be OR of the following */ | 
|---|
| 3446 | #define VA_PICTURE_H264_INVALID         0x00000001 | 
|---|
| 3447 | #define VA_PICTURE_H264_TOP_FIELD       0x00000002 | 
|---|
| 3448 | #define VA_PICTURE_H264_BOTTOM_FIELD        0x00000004 | 
|---|
| 3449 | #define VA_PICTURE_H264_SHORT_TERM_REFERENCE    0x00000008 | 
|---|
| 3450 | #define VA_PICTURE_H264_LONG_TERM_REFERENCE 0x00000010 | 
|---|
| 3451 |  | 
|---|
| 3452 | /** H.264 Picture Parameter Buffer */ | 
|---|
| 3453 | /* | 
|---|
| 3454 | * For each picture, and before any slice data, a single | 
|---|
| 3455 | * picture parameter buffer must be send. | 
|---|
| 3456 | */ | 
|---|
| 3457 | typedef struct _VAPictureParameterBufferH264 { | 
|---|
| 3458 | VAPictureH264 CurrPic; | 
|---|
| 3459 | VAPictureH264 ReferenceFrames[16];  /* in DPB */ | 
|---|
| 3460 | uint16_t picture_width_in_mbs_minus1; | 
|---|
| 3461 | uint16_t picture_height_in_mbs_minus1; | 
|---|
| 3462 | uint8_t bit_depth_luma_minus8; | 
|---|
| 3463 | uint8_t bit_depth_chroma_minus8; | 
|---|
| 3464 | uint8_t num_ref_frames; | 
|---|
| 3465 | union { | 
|---|
| 3466 | struct { | 
|---|
| 3467 | uint32_t chroma_format_idc          : 2; | 
|---|
| 3468 | uint32_t residual_colour_transform_flag     : 1; /* Renamed to separate_colour_plane_flag in newer standard versions. */ | 
|---|
| 3469 | uint32_t gaps_in_frame_num_value_allowed_flag   : 1; | 
|---|
| 3470 | uint32_t frame_mbs_only_flag            : 1; | 
|---|
| 3471 | uint32_t mb_adaptive_frame_field_flag       : 1; | 
|---|
| 3472 | uint32_t direct_8x8_inference_flag      : 1; | 
|---|
| 3473 | uint32_t MinLumaBiPredSize8x8           : 1; /* see A.3.3.2 */ | 
|---|
| 3474 | uint32_t log2_max_frame_num_minus4      : 4; | 
|---|
| 3475 | uint32_t pic_order_cnt_type         : 2; | 
|---|
| 3476 | uint32_t log2_max_pic_order_cnt_lsb_minus4  : 4; | 
|---|
| 3477 | uint32_t delta_pic_order_always_zero_flag   : 1; | 
|---|
| 3478 | } bits; | 
|---|
| 3479 | uint32_t value; | 
|---|
| 3480 | } seq_fields; | 
|---|
| 3481 | // FMO is not supported. | 
|---|
| 3482 | va_deprecated uint8_t num_slice_groups_minus1; | 
|---|
| 3483 | va_deprecated uint8_t slice_group_map_type; | 
|---|
| 3484 | va_deprecated uint16_t slice_group_change_rate_minus1; | 
|---|
| 3485 | int8_t pic_init_qp_minus26; | 
|---|
| 3486 | int8_t pic_init_qs_minus26; | 
|---|
| 3487 | int8_t chroma_qp_index_offset; | 
|---|
| 3488 | int8_t second_chroma_qp_index_offset; | 
|---|
| 3489 | union { | 
|---|
| 3490 | struct { | 
|---|
| 3491 | uint32_t entropy_coding_mode_flag   : 1; | 
|---|
| 3492 | uint32_t weighted_pred_flag     : 1; | 
|---|
| 3493 | uint32_t weighted_bipred_idc        : 2; | 
|---|
| 3494 | uint32_t transform_8x8_mode_flag    : 1; | 
|---|
| 3495 | uint32_t field_pic_flag         : 1; | 
|---|
| 3496 | uint32_t constrained_intra_pred_flag    : 1; | 
|---|
| 3497 | uint32_t pic_order_present_flag         : 1; /* Renamed to bottom_field_pic_order_in_frame_present_flag in newer standard versions. */ | 
|---|
| 3498 | uint32_t deblocking_filter_control_present_flag : 1; | 
|---|
| 3499 | uint32_t redundant_pic_cnt_present_flag     : 1; | 
|---|
| 3500 | uint32_t reference_pic_flag         : 1; /* nal_ref_idc != 0 */ | 
|---|
| 3501 | } bits; | 
|---|
| 3502 | uint32_t value; | 
|---|
| 3503 | } pic_fields; | 
|---|
| 3504 | uint16_t frame_num; | 
|---|
| 3505 |  | 
|---|
| 3506 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 3507 | uint32_t                va_reserved[VA_PADDING_MEDIUM]; | 
|---|
| 3508 | } VAPictureParameterBufferH264; | 
|---|
| 3509 |  | 
|---|
| 3510 | /** H.264 Inverse Quantization Matrix Buffer */ | 
|---|
| 3511 | typedef struct _VAIQMatrixBufferH264 { | 
|---|
| 3512 | /** \brief 4x4 scaling list, in raster scan order. */ | 
|---|
| 3513 | uint8_t ScalingList4x4[6][16]; | 
|---|
| 3514 | /** \brief 8x8 scaling list, in raster scan order. */ | 
|---|
| 3515 | uint8_t ScalingList8x8[2][64]; | 
|---|
| 3516 |  | 
|---|
| 3517 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 3518 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 3519 | } VAIQMatrixBufferH264; | 
|---|
| 3520 |  | 
|---|
| 3521 | /** H.264 Slice Parameter Buffer */ | 
|---|
| 3522 | typedef struct _VASliceParameterBufferH264 { | 
|---|
| 3523 | uint32_t slice_data_size;/* number of bytes in the slice data buffer for this slice */ | 
|---|
| 3524 | /** \brief Byte offset to the NAL Header Unit for this slice. */ | 
|---|
| 3525 | uint32_t slice_data_offset; | 
|---|
| 3526 | uint32_t slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */ | 
|---|
| 3527 | /** | 
|---|
| 3528 | * \brief Bit offset from NAL Header Unit to the begining of slice_data(). | 
|---|
| 3529 | * | 
|---|
| 3530 | * This bit offset is relative to and includes the NAL unit byte | 
|---|
| 3531 | * and represents the number of bits parsed in the slice_header() | 
|---|
| 3532 | * after the removal of any emulation prevention bytes in | 
|---|
| 3533 | * there. However, the slice data buffer passed to the hardware is | 
|---|
| 3534 | * the original bitstream, thus including any emulation prevention | 
|---|
| 3535 | * bytes. | 
|---|
| 3536 | */ | 
|---|
| 3537 | uint16_t slice_data_bit_offset; | 
|---|
| 3538 | uint16_t first_mb_in_slice; | 
|---|
| 3539 | uint8_t slice_type; | 
|---|
| 3540 | uint8_t direct_spatial_mv_pred_flag; | 
|---|
| 3541 | /** | 
|---|
| 3542 | * H264/AVC syntax element | 
|---|
| 3543 | * | 
|---|
| 3544 | * if num_ref_idx_active_override_flag equals 0, host decoder should | 
|---|
| 3545 | * set its value to num_ref_idx_l0_default_active_minus1. | 
|---|
| 3546 | */ | 
|---|
| 3547 | uint8_t num_ref_idx_l0_active_minus1; | 
|---|
| 3548 | /** | 
|---|
| 3549 | * H264/AVC syntax element | 
|---|
| 3550 | * | 
|---|
| 3551 | * if num_ref_idx_active_override_flag equals 0, host decoder should | 
|---|
| 3552 | * set its value to num_ref_idx_l1_default_active_minus1. | 
|---|
| 3553 | */ | 
|---|
| 3554 | uint8_t num_ref_idx_l1_active_minus1; | 
|---|
| 3555 | uint8_t cabac_init_idc; | 
|---|
| 3556 | int8_t slice_qp_delta; | 
|---|
| 3557 | uint8_t disable_deblocking_filter_idc; | 
|---|
| 3558 | int8_t slice_alpha_c0_offset_div2; | 
|---|
| 3559 | int8_t slice_beta_offset_div2; | 
|---|
| 3560 | VAPictureH264 RefPicList0[32];  /* See 8.2.4.2 */ | 
|---|
| 3561 | VAPictureH264 RefPicList1[32];  /* See 8.2.4.2 */ | 
|---|
| 3562 | uint8_t luma_log2_weight_denom; | 
|---|
| 3563 | uint8_t chroma_log2_weight_denom; | 
|---|
| 3564 | uint8_t luma_weight_l0_flag; | 
|---|
| 3565 | int16_t luma_weight_l0[32]; | 
|---|
| 3566 | int16_t luma_offset_l0[32]; | 
|---|
| 3567 | uint8_t chroma_weight_l0_flag; | 
|---|
| 3568 | int16_t chroma_weight_l0[32][2]; | 
|---|
| 3569 | int16_t chroma_offset_l0[32][2]; | 
|---|
| 3570 | uint8_t luma_weight_l1_flag; | 
|---|
| 3571 | int16_t luma_weight_l1[32]; | 
|---|
| 3572 | int16_t luma_offset_l1[32]; | 
|---|
| 3573 | uint8_t chroma_weight_l1_flag; | 
|---|
| 3574 | int16_t chroma_weight_l1[32][2]; | 
|---|
| 3575 | int16_t chroma_offset_l1[32][2]; | 
|---|
| 3576 |  | 
|---|
| 3577 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 3578 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 3579 | } VASliceParameterBufferH264; | 
|---|
| 3580 |  | 
|---|
| 3581 | /**************************** | 
|---|
| 3582 | * Common encode data structures | 
|---|
| 3583 | ****************************/ | 
|---|
| 3584 | typedef enum { | 
|---|
| 3585 | VAEncPictureTypeIntra       = 0, | 
|---|
| 3586 | VAEncPictureTypePredictive      = 1, | 
|---|
| 3587 | VAEncPictureTypeBidirectional   = 2, | 
|---|
| 3588 | } VAEncPictureType; | 
|---|
| 3589 |  | 
|---|
| 3590 | /** | 
|---|
| 3591 | * \brief Encode Slice Parameter Buffer. | 
|---|
| 3592 | * | 
|---|
| 3593 | * @deprecated | 
|---|
| 3594 | * This is a deprecated encode slice parameter buffer, All applications | 
|---|
| 3595 | * \c can use VAEncSliceParameterBufferXXX (XXX = MPEG2, HEVC, H264, JPEG) | 
|---|
| 3596 | */ | 
|---|
| 3597 | typedef struct _VAEncSliceParameterBuffer { | 
|---|
| 3598 | uint32_t start_row_number;  /* starting MB row number for this slice */ | 
|---|
| 3599 | uint32_t slice_height;  /* slice height measured in MB */ | 
|---|
| 3600 | union { | 
|---|
| 3601 | struct { | 
|---|
| 3602 | uint32_t is_intra   : 1; | 
|---|
| 3603 | uint32_t disable_deblocking_filter_idc : 2; | 
|---|
| 3604 | uint32_t uses_long_term_ref     : 1; | 
|---|
| 3605 | uint32_t is_long_term_ref       : 1; | 
|---|
| 3606 | } bits; | 
|---|
| 3607 | uint32_t value; | 
|---|
| 3608 | } slice_flags; | 
|---|
| 3609 |  | 
|---|
| 3610 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 3611 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 3612 | } VAEncSliceParameterBuffer; | 
|---|
| 3613 |  | 
|---|
| 3614 |  | 
|---|
| 3615 | /**************************** | 
|---|
| 3616 | * H.263 specific encode data structures | 
|---|
| 3617 | ****************************/ | 
|---|
| 3618 |  | 
|---|
| 3619 | typedef struct _VAEncSequenceParameterBufferH263 { | 
|---|
| 3620 | uint32_t intra_period; | 
|---|
| 3621 | uint32_t bits_per_second; | 
|---|
| 3622 | uint32_t frame_rate; | 
|---|
| 3623 | uint32_t initial_qp; | 
|---|
| 3624 | uint32_t min_qp; | 
|---|
| 3625 |  | 
|---|
| 3626 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 3627 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 3628 | } VAEncSequenceParameterBufferH263; | 
|---|
| 3629 |  | 
|---|
| 3630 | typedef struct _VAEncPictureParameterBufferH263 { | 
|---|
| 3631 | VASurfaceID reference_picture; | 
|---|
| 3632 | VASurfaceID reconstructed_picture; | 
|---|
| 3633 | VABufferID coded_buf; | 
|---|
| 3634 | uint16_t picture_width; | 
|---|
| 3635 | uint16_t picture_height; | 
|---|
| 3636 | VAEncPictureType picture_type; | 
|---|
| 3637 |  | 
|---|
| 3638 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 3639 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 3640 | } VAEncPictureParameterBufferH263; | 
|---|
| 3641 |  | 
|---|
| 3642 | /**************************** | 
|---|
| 3643 | * MPEG-4 specific encode data structures | 
|---|
| 3644 | ****************************/ | 
|---|
| 3645 |  | 
|---|
| 3646 | typedef struct _VAEncSequenceParameterBufferMPEG4 { | 
|---|
| 3647 | uint8_t profile_and_level_indication; | 
|---|
| 3648 | uint32_t intra_period; | 
|---|
| 3649 | uint32_t video_object_layer_width; | 
|---|
| 3650 | uint32_t video_object_layer_height; | 
|---|
| 3651 | uint32_t vop_time_increment_resolution; | 
|---|
| 3652 | uint32_t fixed_vop_rate; | 
|---|
| 3653 | uint32_t fixed_vop_time_increment; | 
|---|
| 3654 | uint32_t bits_per_second; | 
|---|
| 3655 | uint32_t frame_rate; | 
|---|
| 3656 | uint32_t initial_qp; | 
|---|
| 3657 | uint32_t min_qp; | 
|---|
| 3658 |  | 
|---|
| 3659 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 3660 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 3661 | } VAEncSequenceParameterBufferMPEG4; | 
|---|
| 3662 |  | 
|---|
| 3663 | typedef struct _VAEncPictureParameterBufferMPEG4 { | 
|---|
| 3664 | VASurfaceID reference_picture; | 
|---|
| 3665 | VASurfaceID reconstructed_picture; | 
|---|
| 3666 | VABufferID coded_buf; | 
|---|
| 3667 | uint16_t picture_width; | 
|---|
| 3668 | uint16_t picture_height; | 
|---|
| 3669 | uint32_t modulo_time_base; /* number of 1s */ | 
|---|
| 3670 | uint32_t vop_time_increment; | 
|---|
| 3671 | VAEncPictureType picture_type; | 
|---|
| 3672 |  | 
|---|
| 3673 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 3674 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 3675 | } VAEncPictureParameterBufferMPEG4; | 
|---|
| 3676 |  | 
|---|
| 3677 |  | 
|---|
| 3678 |  | 
|---|
| 3679 | /** Buffer functions */ | 
|---|
| 3680 |  | 
|---|
| 3681 | /** | 
|---|
| 3682 | * Creates a buffer for "num_elements" elements of "size" bytes and | 
|---|
| 3683 | * initalize with "data". | 
|---|
| 3684 | * if "data" is null, then the contents of the buffer data store | 
|---|
| 3685 | * are undefined. | 
|---|
| 3686 | * Basically there are two ways to get buffer data to the server side. One is | 
|---|
| 3687 | * to call vaCreateBuffer() with a non-null "data", which results the data being | 
|---|
| 3688 | * copied to the data store on the server side.  A different method that | 
|---|
| 3689 | * eliminates this copy is to pass null as "data" when calling vaCreateBuffer(), | 
|---|
| 3690 | * and then use vaMapBuffer() to map the data store from the server side to the | 
|---|
| 3691 | * client address space for access. | 
|---|
| 3692 | * The user must call vaDestroyBuffer() to destroy a buffer. | 
|---|
| 3693 | *  Note: image buffers are created by the library, not the client. Please see | 
|---|
| 3694 | *        vaCreateImage on how image buffers are managed. | 
|---|
| 3695 | */ | 
|---|
| 3696 | VAStatus vaCreateBuffer( | 
|---|
| 3697 | VADisplay dpy, | 
|---|
| 3698 | VAContextID context, | 
|---|
| 3699 | VABufferType type,  /* in */ | 
|---|
| 3700 | unsigned int size,  /* in */ | 
|---|
| 3701 | unsigned int num_elements, /* in */ | 
|---|
| 3702 | void *data,     /* in */ | 
|---|
| 3703 | VABufferID *buf_id  /* out */ | 
|---|
| 3704 | ); | 
|---|
| 3705 |  | 
|---|
| 3706 | /** | 
|---|
| 3707 | * Create a buffer for given width & height get unit_size, pitch, buf_id for 2D buffer | 
|---|
| 3708 | * for permb qp buffer, it will return unit_size for one MB or LCU and the pitch for alignments | 
|---|
| 3709 | * can call vaMapBuffer with this Buffer ID to get virtual address. | 
|---|
| 3710 | * e.g. AVC 1080P encode, 1920x1088, the size in MB is 120x68,but inside driver, | 
|---|
| 3711 | * maybe it should align with 256, and one byte present one Qp.so, call the function. | 
|---|
| 3712 | * then get unit_size = 1, pitch = 256. call vaMapBuffer to get the virtual address (pBuf). | 
|---|
| 3713 | * then read write the memory like 2D. the size is 256x68, application can only use 120x68 | 
|---|
| 3714 | * pBuf + 256 is the start of next line. | 
|---|
| 3715 | * different driver implementation maybe return different unit_size and pitch | 
|---|
| 3716 | */ | 
|---|
| 3717 | VAStatus vaCreateBuffer2( | 
|---|
| 3718 | VADisplay dpy, | 
|---|
| 3719 | VAContextID context, | 
|---|
| 3720 | VABufferType type, | 
|---|
| 3721 | unsigned int width, | 
|---|
| 3722 | unsigned int height, | 
|---|
| 3723 | unsigned int *unit_size, | 
|---|
| 3724 | unsigned int *pitch, | 
|---|
| 3725 | VABufferID *buf_id | 
|---|
| 3726 | ); | 
|---|
| 3727 |  | 
|---|
| 3728 | /** | 
|---|
| 3729 | * Convey to the server how many valid elements are in the buffer. | 
|---|
| 3730 | * e.g. if multiple slice parameters are being held in a single buffer, | 
|---|
| 3731 | * this will communicate to the server the number of slice parameters | 
|---|
| 3732 | * that are valid in the buffer. | 
|---|
| 3733 | */ | 
|---|
| 3734 | VAStatus vaBufferSetNumElements( | 
|---|
| 3735 | VADisplay dpy, | 
|---|
| 3736 | VABufferID buf_id,  /* in */ | 
|---|
| 3737 | unsigned int num_elements /* in */ | 
|---|
| 3738 | ); | 
|---|
| 3739 |  | 
|---|
| 3740 |  | 
|---|
| 3741 | /** | 
|---|
| 3742 | * device independent data structure for codedbuffer | 
|---|
| 3743 | */ | 
|---|
| 3744 |  | 
|---|
| 3745 | /* | 
|---|
| 3746 | * FICTURE_AVE_QP(bit7-0): The average Qp value used during this frame | 
|---|
| 3747 | * LARGE_SLICE(bit8):At least one slice in the current frame was large | 
|---|
| 3748 | *              enough for the encoder to attempt to limit its size. | 
|---|
| 3749 | * SLICE_OVERFLOW(bit9): At least one slice in the current frame has | 
|---|
| 3750 | *              exceeded the maximum slice size specified. | 
|---|
| 3751 | * BITRATE_OVERFLOW(bit10): The peak bitrate was exceeded for this frame. | 
|---|
| 3752 | * BITRATE_HIGH(bit11): The frame size got within the safety margin of the maximum size (VCM only) | 
|---|
| 3753 | * AIR_MB_OVER_THRESHOLD: the number of MBs adapted to Intra MB | 
|---|
| 3754 | */ | 
|---|
| 3755 | #define VA_CODED_BUF_STATUS_PICTURE_AVE_QP_MASK         0xff | 
|---|
| 3756 | #define VA_CODED_BUF_STATUS_LARGE_SLICE_MASK            0x100 | 
|---|
| 3757 | #define VA_CODED_BUF_STATUS_SLICE_OVERFLOW_MASK         0x200 | 
|---|
| 3758 | #define VA_CODED_BUF_STATUS_BITRATE_OVERFLOW        0x400 | 
|---|
| 3759 | #define VA_CODED_BUF_STATUS_BITRATE_HIGH        0x800 | 
|---|
| 3760 | /** | 
|---|
| 3761 | * \brief The frame has exceeded the maximum requested size. | 
|---|
| 3762 | * | 
|---|
| 3763 | * This flag indicates that the encoded frame size exceeds the value | 
|---|
| 3764 | * specified through a misc parameter buffer of type | 
|---|
| 3765 | * #VAEncMiscParameterTypeMaxFrameSize. | 
|---|
| 3766 | */ | 
|---|
| 3767 | #define VA_CODED_BUF_STATUS_FRAME_SIZE_OVERFLOW         0x1000 | 
|---|
| 3768 | /** | 
|---|
| 3769 | * \brief the bitstream is bad or corrupt. | 
|---|
| 3770 | */ | 
|---|
| 3771 | #define VA_CODED_BUF_STATUS_BAD_BITSTREAM               0x8000 | 
|---|
| 3772 | #define VA_CODED_BUF_STATUS_AIR_MB_OVER_THRESHOLD   0xff0000 | 
|---|
| 3773 |  | 
|---|
| 3774 | /** | 
|---|
| 3775 | * \brief The coded buffer segment status contains frame encoding passes number | 
|---|
| 3776 | * | 
|---|
| 3777 | * This is the mask to get the number of encoding passes from the coded | 
|---|
| 3778 | * buffer segment status. | 
|---|
| 3779 | * NUMBER_PASS(bit24~bit27): the number for encoding passes executed for the coded frame. | 
|---|
| 3780 | * | 
|---|
| 3781 | */ | 
|---|
| 3782 | #define VA_CODED_BUF_STATUS_NUMBER_PASSES_MASK          0xf000000 | 
|---|
| 3783 |  | 
|---|
| 3784 | /** | 
|---|
| 3785 | * \brief The coded buffer segment contains a single NAL unit. | 
|---|
| 3786 | * | 
|---|
| 3787 | * This flag indicates that the coded buffer segment contains a | 
|---|
| 3788 | * single NAL unit. This flag might be useful to the user for | 
|---|
| 3789 | * processing the coded buffer. | 
|---|
| 3790 | */ | 
|---|
| 3791 | #define VA_CODED_BUF_STATUS_SINGLE_NALU                 0x10000000 | 
|---|
| 3792 |  | 
|---|
| 3793 | /** | 
|---|
| 3794 | * \brief Coded buffer segment. | 
|---|
| 3795 | * | 
|---|
| 3796 | * #VACodedBufferSegment is an element of a linked list describing | 
|---|
| 3797 | * some information on the coded buffer. The coded buffer segment | 
|---|
| 3798 | * could contain either a single NAL unit, or more than one NAL unit. | 
|---|
| 3799 | * It is recommended (but not required) to return a single NAL unit | 
|---|
| 3800 | * in a coded buffer segment, and the implementation should set the | 
|---|
| 3801 | * VA_CODED_BUF_STATUS_SINGLE_NALU status flag if that is the case. | 
|---|
| 3802 | */ | 
|---|
| 3803 | typedef  struct _VACodedBufferSegment  { | 
|---|
| 3804 | /** | 
|---|
| 3805 | * \brief Size of the data buffer in this segment (in bytes). | 
|---|
| 3806 | */ | 
|---|
| 3807 | uint32_t        size; | 
|---|
| 3808 | /** \brief Bit offset into the data buffer where the video data starts. */ | 
|---|
| 3809 | uint32_t        bit_offset; | 
|---|
| 3810 | /** \brief Status set by the driver. See \c VA_CODED_BUF_STATUS_*. */ | 
|---|
| 3811 | uint32_t        status; | 
|---|
| 3812 | /** \brief Reserved for future use. */ | 
|---|
| 3813 | uint32_t        reserved; | 
|---|
| 3814 | /** \brief Pointer to the start of the data buffer. */ | 
|---|
| 3815 | void               *buf; | 
|---|
| 3816 | /** | 
|---|
| 3817 | * \brief Pointer to the next #VACodedBufferSegment element, | 
|---|
| 3818 | * or \c NULL if there is none. | 
|---|
| 3819 | */ | 
|---|
| 3820 | void               *next; | 
|---|
| 3821 |  | 
|---|
| 3822 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 3823 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 3824 | } VACodedBufferSegment; | 
|---|
| 3825 |  | 
|---|
| 3826 | /** | 
|---|
| 3827 | * Map data store of the buffer into the client's address space | 
|---|
| 3828 | * vaCreateBuffer() needs to be called with "data" set to NULL before | 
|---|
| 3829 | * calling vaMapBuffer() | 
|---|
| 3830 | * | 
|---|
| 3831 | * if buffer type is VAEncCodedBufferType, pbuf points to link-list of | 
|---|
| 3832 | * VACodedBufferSegment, and the list is terminated if "next" is NULL | 
|---|
| 3833 | */ | 
|---|
| 3834 | VAStatus vaMapBuffer( | 
|---|
| 3835 | VADisplay dpy, | 
|---|
| 3836 | VABufferID buf_id,  /* in */ | 
|---|
| 3837 | void **pbuf     /* out */ | 
|---|
| 3838 | ); | 
|---|
| 3839 |  | 
|---|
| 3840 | /** | 
|---|
| 3841 | * After client making changes to a mapped data store, it needs to | 
|---|
| 3842 | * "Unmap" it to let the server know that the data is ready to be | 
|---|
| 3843 | * consumed by the server | 
|---|
| 3844 | */ | 
|---|
| 3845 | VAStatus vaUnmapBuffer( | 
|---|
| 3846 | VADisplay dpy, | 
|---|
| 3847 | VABufferID buf_id   /* in */ | 
|---|
| 3848 | ); | 
|---|
| 3849 |  | 
|---|
| 3850 | /** | 
|---|
| 3851 | * After this call, the buffer is deleted and this buffer_id is no longer valid | 
|---|
| 3852 | * | 
|---|
| 3853 | * A buffer can be re-used and sent to the server by another Begin/Render/End | 
|---|
| 3854 | * sequence if vaDestroyBuffer() is not called with this buffer. | 
|---|
| 3855 | * | 
|---|
| 3856 | * Note re-using a shared buffer (e.g. a slice data buffer) between the host and the | 
|---|
| 3857 | * hardware accelerator can result in performance dropping. | 
|---|
| 3858 | */ | 
|---|
| 3859 | VAStatus vaDestroyBuffer( | 
|---|
| 3860 | VADisplay dpy, | 
|---|
| 3861 | VABufferID buffer_id | 
|---|
| 3862 | ); | 
|---|
| 3863 |  | 
|---|
| 3864 | /** \brief VA buffer information */ | 
|---|
| 3865 | typedef struct { | 
|---|
| 3866 | /** \brief Buffer handle */ | 
|---|
| 3867 | uintptr_t           handle; | 
|---|
| 3868 | /** \brief Buffer type (See \ref VABufferType). */ | 
|---|
| 3869 | uint32_t            type; | 
|---|
| 3870 | /** | 
|---|
| 3871 | * \brief Buffer memory type (See \ref VASurfaceAttribMemoryType). | 
|---|
| 3872 | * | 
|---|
| 3873 | * On input to vaAcquireBufferHandle(), this field can serve as a hint | 
|---|
| 3874 | * to specify the set of memory types the caller is interested in. | 
|---|
| 3875 | * On successful return from vaAcquireBufferHandle(), the field is | 
|---|
| 3876 | * updated with the best matching memory type. | 
|---|
| 3877 | */ | 
|---|
| 3878 | uint32_t            mem_type; | 
|---|
| 3879 | /** \brief Size of the underlying buffer. */ | 
|---|
| 3880 | size_t              mem_size; | 
|---|
| 3881 |  | 
|---|
| 3882 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 3883 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 3884 | } VABufferInfo; | 
|---|
| 3885 |  | 
|---|
| 3886 | /** | 
|---|
| 3887 | * \brief Acquires buffer handle for external API usage | 
|---|
| 3888 | * | 
|---|
| 3889 | * Locks the VA buffer object \ref buf_id for external API usage like | 
|---|
| 3890 | * EGL or OpenCL (OCL). This function is a synchronization point. This | 
|---|
| 3891 | * means that any pending operation is guaranteed to be completed | 
|---|
| 3892 | * prior to returning from the function. | 
|---|
| 3893 | * | 
|---|
| 3894 | * If the referenced VA buffer object is the backing store of a VA | 
|---|
| 3895 | * surface, then this function acts as if vaSyncSurface() on the | 
|---|
| 3896 | * parent surface was called first. | 
|---|
| 3897 | * | 
|---|
| 3898 | * The \ref VABufferInfo argument shall be zero'ed on input. On | 
|---|
| 3899 | * successful output, the data structure is filled in with all the | 
|---|
| 3900 | * necessary buffer level implementation details like handle, type, | 
|---|
| 3901 | * memory type and memory size. | 
|---|
| 3902 | * | 
|---|
| 3903 | * Note: the external API implementation, or the application, can | 
|---|
| 3904 | * express the memory types it is interested in by filling in the \ref | 
|---|
| 3905 | * mem_type field accordingly. On successful output, the memory type | 
|---|
| 3906 | * that fits best the request and that was used is updated in the \ref | 
|---|
| 3907 | * VABufferInfo data structure. If none of the supplied memory types | 
|---|
| 3908 | * is supported, then a \ref VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE | 
|---|
| 3909 | * error is returned. | 
|---|
| 3910 | * | 
|---|
| 3911 | * The \ref VABufferInfo data is valid until vaReleaseBufferHandle() | 
|---|
| 3912 | * is called. Besides, no additional operation is allowed on any of | 
|---|
| 3913 | * the buffer parent object until vaReleaseBufferHandle() is called. | 
|---|
| 3914 | * e.g. decoding into a VA surface backed with the supplied VA buffer | 
|---|
| 3915 | * object \ref buf_id would fail with a \ref VA_STATUS_ERROR_SURFACE_BUSY | 
|---|
| 3916 | * error. | 
|---|
| 3917 | * | 
|---|
| 3918 | * Possible errors: | 
|---|
| 3919 | * - \ref VA_STATUS_ERROR_UNIMPLEMENTED: the VA driver implementation | 
|---|
| 3920 | *   does not support this interface | 
|---|
| 3921 | * - \ref VA_STATUS_ERROR_INVALID_DISPLAY: an invalid display was supplied | 
|---|
| 3922 | * - \ref VA_STATUS_ERROR_INVALID_BUFFER: an invalid buffer was supplied | 
|---|
| 3923 | * - \ref VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE: the implementation | 
|---|
| 3924 | *   does not support exporting buffers of the specified type | 
|---|
| 3925 | * - \ref VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE: none of the requested | 
|---|
| 3926 | *   memory types in \ref VABufferInfo.mem_type was supported | 
|---|
| 3927 | * | 
|---|
| 3928 | * @param[in] dpy               the VA display | 
|---|
| 3929 | * @param[in] buf_id            the VA buffer | 
|---|
| 3930 | * @param[in,out] buf_info      the associated VA buffer information | 
|---|
| 3931 | * @return VA_STATUS_SUCCESS if successful | 
|---|
| 3932 | */ | 
|---|
| 3933 | VAStatus | 
|---|
| 3934 | vaAcquireBufferHandle(VADisplay dpy, VABufferID buf_id, VABufferInfo *buf_info); | 
|---|
| 3935 |  | 
|---|
| 3936 | /** | 
|---|
| 3937 | * \brief Releases buffer after usage from external API | 
|---|
| 3938 | * | 
|---|
| 3939 | * Unlocks the VA buffer object \ref buf_id from external API usage like | 
|---|
| 3940 | * EGL or OpenCL (OCL). This function is a synchronization point. This | 
|---|
| 3941 | * means that any pending operation is guaranteed to be completed | 
|---|
| 3942 | * prior to returning from the function. | 
|---|
| 3943 | * | 
|---|
| 3944 | * The \ref VABufferInfo argument shall point to the original data | 
|---|
| 3945 | * structure that was obtained from vaAcquireBufferHandle(), unaltered. | 
|---|
| 3946 | * This is necessary so that the VA driver implementation could | 
|---|
| 3947 | * deallocate any resources that were needed. | 
|---|
| 3948 | * | 
|---|
| 3949 | * In any case, returning from this function invalidates any contents | 
|---|
| 3950 | * in \ref VABufferInfo. i.e. the underlyng buffer handle is no longer | 
|---|
| 3951 | * valid. Therefore, VA driver implementations are free to reset this | 
|---|
| 3952 | * data structure to safe defaults. | 
|---|
| 3953 | * | 
|---|
| 3954 | * Possible errors: | 
|---|
| 3955 | * - \ref VA_STATUS_ERROR_UNIMPLEMENTED: the VA driver implementation | 
|---|
| 3956 | *   does not support this interface | 
|---|
| 3957 | * - \ref VA_STATUS_ERROR_INVALID_DISPLAY: an invalid display was supplied | 
|---|
| 3958 | * - \ref VA_STATUS_ERROR_INVALID_BUFFER: an invalid buffer was supplied | 
|---|
| 3959 | * - \ref VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE: the implementation | 
|---|
| 3960 | *   does not support exporting buffers of the specified type | 
|---|
| 3961 | * | 
|---|
| 3962 | * @param[in] dpy               the VA display | 
|---|
| 3963 | * @param[in] buf_id            the VA buffer | 
|---|
| 3964 | * @return VA_STATUS_SUCCESS if successful | 
|---|
| 3965 | */ | 
|---|
| 3966 | VAStatus | 
|---|
| 3967 | vaReleaseBufferHandle(VADisplay dpy, VABufferID buf_id); | 
|---|
| 3968 |  | 
|---|
| 3969 | /** @name vaExportSurfaceHandle() flags | 
|---|
| 3970 | * | 
|---|
| 3971 | * @{ | 
|---|
| 3972 | */ | 
|---|
| 3973 | /** Export surface to be read by external API. */ | 
|---|
| 3974 | #define VA_EXPORT_SURFACE_READ_ONLY        0x0001 | 
|---|
| 3975 | /** Export surface to be written by external API. */ | 
|---|
| 3976 | #define VA_EXPORT_SURFACE_WRITE_ONLY       0x0002 | 
|---|
| 3977 | /** Export surface to be both read and written by external API. */ | 
|---|
| 3978 | #define VA_EXPORT_SURFACE_READ_WRITE       0x0003 | 
|---|
| 3979 | /** Export surface with separate layers. | 
|---|
| 3980 | * | 
|---|
| 3981 | * For example, NV12 surfaces should be exported as two separate | 
|---|
| 3982 | * planes for luma and chroma. | 
|---|
| 3983 | */ | 
|---|
| 3984 | #define VA_EXPORT_SURFACE_SEPARATE_LAYERS  0x0004 | 
|---|
| 3985 | /** Export surface with composed layers. | 
|---|
| 3986 | * | 
|---|
| 3987 | * For example, NV12 surfaces should be exported as a single NV12 | 
|---|
| 3988 | * composed object. | 
|---|
| 3989 | */ | 
|---|
| 3990 | #define VA_EXPORT_SURFACE_COMPOSED_LAYERS  0x0008 | 
|---|
| 3991 |  | 
|---|
| 3992 | /** @} */ | 
|---|
| 3993 |  | 
|---|
| 3994 | /** | 
|---|
| 3995 | * \brief Export a handle to a surface for use with an external API | 
|---|
| 3996 | * | 
|---|
| 3997 | * The exported handles are owned by the caller, and the caller is | 
|---|
| 3998 | * responsible for freeing them when no longer needed (e.g. by closing | 
|---|
| 3999 | * DRM PRIME file descriptors). | 
|---|
| 4000 | * | 
|---|
| 4001 | * This does not perform any synchronisation.  If the contents of the | 
|---|
| 4002 | * surface will be read, vaSyncSurface() must be called before doing so. | 
|---|
| 4003 | * If the contents of the surface are written, then all operations must | 
|---|
| 4004 | * be completed externally before using the surface again by via VA-API | 
|---|
| 4005 | * functions. | 
|---|
| 4006 | * | 
|---|
| 4007 | * @param[in] dpy          VA display. | 
|---|
| 4008 | * @param[in] surface_id   Surface to export. | 
|---|
| 4009 | * @param[in] mem_type     Memory type to export to. | 
|---|
| 4010 | * @param[in] flags        Combination of flags to apply | 
|---|
| 4011 | *   (VA_EXPORT_SURFACE_*). | 
|---|
| 4012 | * @param[out] descriptor  Pointer to the descriptor structure to fill | 
|---|
| 4013 | *   with the handle details.  The type of this structure depends on | 
|---|
| 4014 | *   the value of mem_type. | 
|---|
| 4015 | * | 
|---|
| 4016 | * @return Status code: | 
|---|
| 4017 | * - VA_STATUS_SUCCESS:    Success. | 
|---|
| 4018 | * - VA_STATUS_ERROR_INVALID_DISPLAY:  The display is not valid. | 
|---|
| 4019 | * - VA_STATUS_ERROR_UNIMPLEMENTED:  The driver does not implement | 
|---|
| 4020 | *     this interface. | 
|---|
| 4021 | * - VA_STATUS_ERROR_INVALID_SURFACE:  The surface is not valid, or | 
|---|
| 4022 | *     the surface is not exportable in the specified way. | 
|---|
| 4023 | * - VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE:  The driver does not | 
|---|
| 4024 | *     support exporting surfaces to the specified memory type. | 
|---|
| 4025 | */ | 
|---|
| 4026 | VAStatus vaExportSurfaceHandle(VADisplay dpy, | 
|---|
| 4027 | VASurfaceID surface_id, | 
|---|
| 4028 | uint32_t mem_type, uint32_t flags, | 
|---|
| 4029 | void *descriptor); | 
|---|
| 4030 |  | 
|---|
| 4031 | /** | 
|---|
| 4032 | * Render (Video Decode/Encode/Processing) Pictures | 
|---|
| 4033 | * | 
|---|
| 4034 | * A picture represents either a frame or a field. | 
|---|
| 4035 | * | 
|---|
| 4036 | * The Begin/Render/End sequence sends the video decode/encode/processing buffers | 
|---|
| 4037 | * to the server | 
|---|
| 4038 | */ | 
|---|
| 4039 |  | 
|---|
| 4040 | /** | 
|---|
| 4041 | * Get ready for a video pipeline | 
|---|
| 4042 | * - decode a picture to a target surface | 
|---|
| 4043 | * - encode a picture from a target surface | 
|---|
| 4044 | * - process a picture to a target surface | 
|---|
| 4045 | */ | 
|---|
| 4046 | VAStatus vaBeginPicture( | 
|---|
| 4047 | VADisplay dpy, | 
|---|
| 4048 | VAContextID context, | 
|---|
| 4049 | VASurfaceID render_target | 
|---|
| 4050 | ); | 
|---|
| 4051 |  | 
|---|
| 4052 | /** | 
|---|
| 4053 | * Send video decode, encode or processing buffers to the server. | 
|---|
| 4054 | */ | 
|---|
| 4055 | VAStatus vaRenderPicture( | 
|---|
| 4056 | VADisplay dpy, | 
|---|
| 4057 | VAContextID context, | 
|---|
| 4058 | VABufferID *buffers, | 
|---|
| 4059 | int num_buffers | 
|---|
| 4060 | ); | 
|---|
| 4061 |  | 
|---|
| 4062 | /** | 
|---|
| 4063 | * Make the end of rendering for a picture. | 
|---|
| 4064 | * The server should start processing all pending operations for this | 
|---|
| 4065 | * surface. This call is non-blocking. The client can start another | 
|---|
| 4066 | * Begin/Render/End sequence on a different render target. | 
|---|
| 4067 | * if VAContextID used in this function previously successfully passed | 
|---|
| 4068 | * vaMFAddContext call, real processing will be started during vaMFSubmit | 
|---|
| 4069 | */ | 
|---|
| 4070 | VAStatus vaEndPicture( | 
|---|
| 4071 | VADisplay dpy, | 
|---|
| 4072 | VAContextID context | 
|---|
| 4073 | ); | 
|---|
| 4074 |  | 
|---|
| 4075 | /** | 
|---|
| 4076 | * Make the end of rendering for a pictures in contexts passed with submission. | 
|---|
| 4077 | * The server should start processing all pending operations for contexts. | 
|---|
| 4078 | * All contexts passed should be associated through vaMFAddContext | 
|---|
| 4079 | * and call sequence Begin/Render/End performed. | 
|---|
| 4080 | * This call is non-blocking. The client can start another | 
|---|
| 4081 | * Begin/Render/End/vaMFSubmit sequence on a different render targets. | 
|---|
| 4082 | * Return values: | 
|---|
| 4083 | * VA_STATUS_SUCCESS - operation successful, context was removed. | 
|---|
| 4084 | * VA_STATUS_ERROR_INVALID_CONTEXT - mf_context or one of contexts are invalid | 
|---|
| 4085 | * due to mf_context not created or one of contexts not assotiated with mf_context | 
|---|
| 4086 | * through vaAddContext. | 
|---|
| 4087 | * VA_STATUS_ERROR_INVALID_PARAMETER - one of context has not submitted it's frame | 
|---|
| 4088 | * through vaBeginPicture vaRenderPicture vaEndPicture call sequence. | 
|---|
| 4089 | * dpy: display | 
|---|
| 4090 | * mf_context: Multi-Frame context | 
|---|
| 4091 | * contexts: list of contexts submitting their tasks for multi-frame operation. | 
|---|
| 4092 | * num_contexts: number of passed contexts. | 
|---|
| 4093 | */ | 
|---|
| 4094 | VAStatus vaMFSubmit( | 
|---|
| 4095 | VADisplay dpy, | 
|---|
| 4096 | VAMFContextID mf_context, | 
|---|
| 4097 | VAContextID * contexts, | 
|---|
| 4098 | int num_contexts | 
|---|
| 4099 | ); | 
|---|
| 4100 |  | 
|---|
| 4101 | /* | 
|---|
| 4102 |  | 
|---|
| 4103 | Synchronization | 
|---|
| 4104 |  | 
|---|
| 4105 | */ | 
|---|
| 4106 |  | 
|---|
| 4107 | /** | 
|---|
| 4108 | * This function blocks until all pending operations on the render target | 
|---|
| 4109 | * have been completed.  Upon return it is safe to use the render target for a | 
|---|
| 4110 | * different picture. | 
|---|
| 4111 | */ | 
|---|
| 4112 | VAStatus vaSyncSurface( | 
|---|
| 4113 | VADisplay dpy, | 
|---|
| 4114 | VASurfaceID render_target | 
|---|
| 4115 | ); | 
|---|
| 4116 |  | 
|---|
| 4117 | /** \brief Indicates an infinite timeout. */ | 
|---|
| 4118 | #define VA_TIMEOUT_INFINITE 0xFFFFFFFFFFFFFFFF | 
|---|
| 4119 |  | 
|---|
| 4120 | /** | 
|---|
| 4121 | * \brief Synchronizes pending operations associated with the supplied surface. | 
|---|
| 4122 | * | 
|---|
| 4123 | * This function blocks during specified timeout (in nanoseconds) until | 
|---|
| 4124 | * all pending operations on the render target have been completed. | 
|---|
| 4125 | * If timeout is zero, the function returns immediately. | 
|---|
| 4126 | * | 
|---|
| 4127 | * Possible errors: | 
|---|
| 4128 | * - \ref VA_STATUS_ERROR_UNIMPLEMENTED: the VA driver implementation | 
|---|
| 4129 | *   does not support this interface | 
|---|
| 4130 | * - \ref VA_STATUS_ERROR_INVALID_DISPLAY: an invalid display was supplied | 
|---|
| 4131 | * - \ref VA_STATUS_ERROR_INVALID_SURFACE: an invalid surface was supplied | 
|---|
| 4132 | * - \ref VA_STATUS_ERROR_TIMEDOUT: synchronization is still in progress, | 
|---|
| 4133 | *   client should call the function again to complete synchronization | 
|---|
| 4134 | * | 
|---|
| 4135 | * @param[in] dpy         the VA display | 
|---|
| 4136 | * @param[in] surface     the surface for which synchronization is performed | 
|---|
| 4137 | * @param[in] timeout_ns  the timeout in nanoseconds | 
|---|
| 4138 | * | 
|---|
| 4139 | */ | 
|---|
| 4140 | VAStatus vaSyncSurface2( | 
|---|
| 4141 | VADisplay dpy, | 
|---|
| 4142 | VASurfaceID surface, | 
|---|
| 4143 | uint64_t timeout_ns | 
|---|
| 4144 | ); | 
|---|
| 4145 |  | 
|---|
| 4146 | typedef enum { | 
|---|
| 4147 | VASurfaceRendering  = 1, /* Rendering in progress */ | 
|---|
| 4148 | VASurfaceDisplaying = 2, /* Displaying in progress (not safe to render into it) */ | 
|---|
| 4149 | /* this status is useful if surface is used as the source */ | 
|---|
| 4150 | /* of an overlay */ | 
|---|
| 4151 | VASurfaceReady  = 4, /* not being rendered or displayed */ | 
|---|
| 4152 | VASurfaceSkipped    = 8  /* Indicate a skipped frame during encode */ | 
|---|
| 4153 | } VASurfaceStatus; | 
|---|
| 4154 |  | 
|---|
| 4155 | /** | 
|---|
| 4156 | * Find out any pending ops on the render target | 
|---|
| 4157 | */ | 
|---|
| 4158 | VAStatus vaQuerySurfaceStatus( | 
|---|
| 4159 | VADisplay dpy, | 
|---|
| 4160 | VASurfaceID render_target, | 
|---|
| 4161 | VASurfaceStatus *status /* out */ | 
|---|
| 4162 | ); | 
|---|
| 4163 |  | 
|---|
| 4164 | typedef enum { | 
|---|
| 4165 | VADecodeSliceMissing            = 0, | 
|---|
| 4166 | VADecodeMBError                 = 1, | 
|---|
| 4167 | } VADecodeErrorType; | 
|---|
| 4168 |  | 
|---|
| 4169 | /** | 
|---|
| 4170 | * Client calls vaQuerySurfaceError with VA_STATUS_ERROR_DECODING_ERROR, server side returns | 
|---|
| 4171 | * an array of structure VASurfaceDecodeMBErrors, and the array is terminated by setting status=-1 | 
|---|
| 4172 | */ | 
|---|
| 4173 | typedef struct _VASurfaceDecodeMBErrors { | 
|---|
| 4174 | int32_t status; /* 1 if hardware has returned detailed info below, -1 means this record is invalid */ | 
|---|
| 4175 | uint32_t start_mb; /* start mb address with errors */ | 
|---|
| 4176 | uint32_t end_mb;  /* end mb address with errors */ | 
|---|
| 4177 | VADecodeErrorType decode_error_type; | 
|---|
| 4178 | uint32_t num_mb;   /* number of mbs with errors */ | 
|---|
| 4179 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 4180 | uint32_t                va_reserved[VA_PADDING_LOW - 1]; | 
|---|
| 4181 | } VASurfaceDecodeMBErrors; | 
|---|
| 4182 |  | 
|---|
| 4183 | /** | 
|---|
| 4184 | * After the application gets VA_STATUS_ERROR_DECODING_ERROR after calling vaSyncSurface(), | 
|---|
| 4185 | * it can call vaQuerySurfaceError to find out further details on the particular error. | 
|---|
| 4186 | * VA_STATUS_ERROR_DECODING_ERROR should be passed in as "error_status", | 
|---|
| 4187 | * upon the return, error_info will point to an array of _VASurfaceDecodeMBErrors structure, | 
|---|
| 4188 | * which is allocated and filled by libVA with detailed information on the missing or error macroblocks. | 
|---|
| 4189 | * The array is terminated if "status==-1" is detected. | 
|---|
| 4190 | */ | 
|---|
| 4191 | VAStatus vaQuerySurfaceError( | 
|---|
| 4192 | VADisplay dpy, | 
|---|
| 4193 | VASurfaceID surface, | 
|---|
| 4194 | VAStatus error_status, | 
|---|
| 4195 | void **error_info | 
|---|
| 4196 | ); | 
|---|
| 4197 |  | 
|---|
| 4198 | /** | 
|---|
| 4199 | * \brief Synchronizes pending operations associated with the supplied buffer. | 
|---|
| 4200 | * | 
|---|
| 4201 | * This function blocks during specified timeout (in nanoseconds) until | 
|---|
| 4202 | * all pending operations on the supplied buffer have been completed. | 
|---|
| 4203 | * If timeout is zero, the function returns immediately. | 
|---|
| 4204 | * | 
|---|
| 4205 | * Possible errors: | 
|---|
| 4206 | * - \ref VA_STATUS_ERROR_UNIMPLEMENTED: the VA driver implementation | 
|---|
| 4207 | *   does not support this interface | 
|---|
| 4208 | * - \ref VA_STATUS_ERROR_INVALID_DISPLAY: an invalid display was supplied | 
|---|
| 4209 | * - \ref VA_STATUS_ERROR_INVALID_BUFFER: an invalid buffer was supplied | 
|---|
| 4210 | * - \ref VA_STATUS_ERROR_TIMEDOUT: synchronization is still in progress, | 
|---|
| 4211 | *   client should call the function again to complete synchronization | 
|---|
| 4212 | * | 
|---|
| 4213 | * @param[in] dpy         the VA display | 
|---|
| 4214 | * @param[in] buf_id      the buffer for which synchronization is performed | 
|---|
| 4215 | * @param[in] timeout_ns  the timeout in nanoseconds | 
|---|
| 4216 | * | 
|---|
| 4217 | */ | 
|---|
| 4218 | VAStatus vaSyncBuffer( | 
|---|
| 4219 | VADisplay dpy, | 
|---|
| 4220 | VABufferID buf_id, | 
|---|
| 4221 | uint64_t timeout_ns | 
|---|
| 4222 | ); | 
|---|
| 4223 |  | 
|---|
| 4224 | /** | 
|---|
| 4225 | * Notes about synchronization interfaces: | 
|---|
| 4226 | * vaSyncSurface: | 
|---|
| 4227 | * 1. Allows to synchronize output surface (i.e. from decoding or VP) | 
|---|
| 4228 | * 2. Allows to synchronize all bitstreams being encoded from the given input surface (1->N pipelines). | 
|---|
| 4229 | * | 
|---|
| 4230 | * vaSyncSurface2: | 
|---|
| 4231 | * 1. The same as vaSyncSurface but allows to specify a timeout | 
|---|
| 4232 | * | 
|---|
| 4233 | * vaSyncBuffer: | 
|---|
| 4234 | * 1. Allows to synchronize output buffer (e.g. bitstream from encoding). | 
|---|
| 4235 | *    Comparing to vaSyncSurface this function synchronizes given bitstream only. | 
|---|
| 4236 | */ | 
|---|
| 4237 |  | 
|---|
| 4238 | /** | 
|---|
| 4239 | * Images and Subpictures | 
|---|
| 4240 | * VAImage is used to either get the surface data to client memory, or | 
|---|
| 4241 | * to copy image data in client memory to a surface. | 
|---|
| 4242 | * Both images, subpictures and surfaces follow the same 2D coordinate system where origin | 
|---|
| 4243 | * is at the upper left corner with positive X to the right and positive Y down | 
|---|
| 4244 | */ | 
|---|
| 4245 | #define VA_FOURCC(ch0, ch1, ch2, ch3) \ | 
|---|
| 4246 | ((unsigned long)(unsigned char) (ch0) | ((unsigned long)(unsigned char) (ch1) << 8) | \ | 
|---|
| 4247 | ((unsigned long)(unsigned char) (ch2) << 16) | ((unsigned long)(unsigned char) (ch3) << 24 )) | 
|---|
| 4248 |  | 
|---|
| 4249 | /* Pre-defined fourcc codes. */ | 
|---|
| 4250 |  | 
|---|
| 4251 | /** NV12: two-plane 8-bit YUV 4:2:0. | 
|---|
| 4252 | * The first plane contains Y, the second plane contains U and V in pairs of bytes. | 
|---|
| 4253 | */ | 
|---|
| 4254 | #define VA_FOURCC_NV12      0x3231564E | 
|---|
| 4255 | /** NV21: two-plane 8-bit YUV 4:2:0. | 
|---|
| 4256 | * Same as NV12, but with U and V swapped. | 
|---|
| 4257 | */ | 
|---|
| 4258 | #define VA_FOURCC_NV21      0x3132564E | 
|---|
| 4259 |  | 
|---|
| 4260 | /** AI44: packed 4-bit YA. | 
|---|
| 4261 | * | 
|---|
| 4262 | * The bottom half of each byte contains luma, the top half contains alpha. | 
|---|
| 4263 | */ | 
|---|
| 4264 | #define VA_FOURCC_AI44      0x34344149 | 
|---|
| 4265 |  | 
|---|
| 4266 | /** RGBA: packed 8-bit RGBA. | 
|---|
| 4267 | * | 
|---|
| 4268 | * Four bytes per pixel: red, green, blue, alpha. | 
|---|
| 4269 | */ | 
|---|
| 4270 | #define VA_FOURCC_RGBA      0x41424752 | 
|---|
| 4271 | /** RGBX: packed 8-bit RGB. | 
|---|
| 4272 | * | 
|---|
| 4273 | * Four bytes per pixel: red, green, blue, unspecified. | 
|---|
| 4274 | */ | 
|---|
| 4275 | #define VA_FOURCC_RGBX      0x58424752 | 
|---|
| 4276 | /** BGRA: packed 8-bit RGBA. | 
|---|
| 4277 | * | 
|---|
| 4278 | * Four bytes per pixel: blue, green, red, alpha. | 
|---|
| 4279 | */ | 
|---|
| 4280 | #define VA_FOURCC_BGRA      0x41524742 | 
|---|
| 4281 | /** BGRX: packed 8-bit RGB. | 
|---|
| 4282 | * | 
|---|
| 4283 | * Four bytes per pixel: blue, green, red, unspecified. | 
|---|
| 4284 | */ | 
|---|
| 4285 | #define VA_FOURCC_BGRX      0x58524742 | 
|---|
| 4286 | /** ARGB: packed 8-bit RGBA. | 
|---|
| 4287 | * | 
|---|
| 4288 | * Four bytes per pixel: alpha, red, green, blue. | 
|---|
| 4289 | */ | 
|---|
| 4290 | #define VA_FOURCC_ARGB      0x42475241 | 
|---|
| 4291 | /** XRGB: packed 8-bit RGB. | 
|---|
| 4292 | * | 
|---|
| 4293 | * Four bytes per pixel: unspecified, red, green, blue. | 
|---|
| 4294 | */ | 
|---|
| 4295 | #define VA_FOURCC_XRGB      0x42475258 | 
|---|
| 4296 | /** ABGR: packed 8-bit RGBA. | 
|---|
| 4297 | * | 
|---|
| 4298 | * Four bytes per pixel: alpha, blue, green, red. | 
|---|
| 4299 | */ | 
|---|
| 4300 | #define VA_FOURCC_ABGR          0x52474241 | 
|---|
| 4301 | /** XBGR: packed 8-bit RGB. | 
|---|
| 4302 | * | 
|---|
| 4303 | * Four bytes per pixel: unspecified, blue, green, red. | 
|---|
| 4304 | */ | 
|---|
| 4305 | #define VA_FOURCC_XBGR          0x52474258 | 
|---|
| 4306 |  | 
|---|
| 4307 | /** UYUV: packed 8-bit YUV 4:2:2. | 
|---|
| 4308 | * | 
|---|
| 4309 | * Four bytes per pair of pixels: U, Y, U, V. | 
|---|
| 4310 | */ | 
|---|
| 4311 | #define VA_FOURCC_UYVY          0x59565955 | 
|---|
| 4312 | /** YUY2: packed 8-bit YUV 4:2:2. | 
|---|
| 4313 | * | 
|---|
| 4314 | * Four bytes per pair of pixels: Y, U, Y, V. | 
|---|
| 4315 | */ | 
|---|
| 4316 | #define VA_FOURCC_YUY2          0x32595559 | 
|---|
| 4317 | /** AYUV: packed 8-bit YUVA 4:4:4. | 
|---|
| 4318 | * | 
|---|
| 4319 | * Four bytes per pixel: A, Y, U, V. | 
|---|
| 4320 | */ | 
|---|
| 4321 | #define VA_FOURCC_AYUV          0x56555941 | 
|---|
| 4322 | /** NV11: two-plane 8-bit YUV 4:1:1. | 
|---|
| 4323 | * | 
|---|
| 4324 | * The first plane contains Y, the second plane contains U and V in pairs of bytes. | 
|---|
| 4325 | */ | 
|---|
| 4326 | #define VA_FOURCC_NV11          0x3131564e | 
|---|
| 4327 | /** YV12: three-plane 8-bit YUV 4:2:0. | 
|---|
| 4328 | * | 
|---|
| 4329 | * The three planes contain Y, V and U respectively. | 
|---|
| 4330 | */ | 
|---|
| 4331 | #define VA_FOURCC_YV12          0x32315659 | 
|---|
| 4332 | /** P208: two-plane 8-bit YUV 4:2:2. | 
|---|
| 4333 | * | 
|---|
| 4334 | * The first plane contains Y, the second plane contains U and V in pairs of bytes. | 
|---|
| 4335 | */ | 
|---|
| 4336 | #define VA_FOURCC_P208          0x38303250 | 
|---|
| 4337 | /** I420: three-plane 8-bit YUV 4:2:0. | 
|---|
| 4338 | * | 
|---|
| 4339 | * The three planes contain Y, U and V respectively. | 
|---|
| 4340 | */ | 
|---|
| 4341 | #define VA_FOURCC_I420          0x30323449 | 
|---|
| 4342 | /** YV24: three-plane 8-bit YUV 4:4:4. | 
|---|
| 4343 | * | 
|---|
| 4344 | * The three planes contain Y, V and U respectively. | 
|---|
| 4345 | */ | 
|---|
| 4346 | #define VA_FOURCC_YV24          0x34325659 | 
|---|
| 4347 | /** YV32: four-plane 8-bit YUVA 4:4:4 | 
|---|
| 4348 | * | 
|---|
| 4349 | * The four planes contain Y, V, U and A respectively. | 
|---|
| 4350 | */ | 
|---|
| 4351 | #define VA_FOURCC_YV32          0x32335659 | 
|---|
| 4352 | /** Y800: 8-bit greyscale. | 
|---|
| 4353 | */ | 
|---|
| 4354 | #define VA_FOURCC_Y800          0x30303859 | 
|---|
| 4355 | /** IMC3: three-plane 8-bit YUV 4:2:0. | 
|---|
| 4356 | * | 
|---|
| 4357 | * Equivalent to YV12, but with the additional constraint that the pitch of all three planes | 
|---|
| 4358 | * must be the same. | 
|---|
| 4359 | */ | 
|---|
| 4360 | #define VA_FOURCC_IMC3          0x33434D49 | 
|---|
| 4361 | /** 411P: three-plane 8-bit YUV 4:1:1. | 
|---|
| 4362 | * | 
|---|
| 4363 | * The three planes contain Y, U and V respectively. | 
|---|
| 4364 | */ | 
|---|
| 4365 | #define VA_FOURCC_411P          0x50313134 | 
|---|
| 4366 | /** 411R: three-plane 8-bit YUV. | 
|---|
| 4367 | * | 
|---|
| 4368 | * The subsampling is the transpose of 4:1:1 - full chroma appears on every fourth line. | 
|---|
| 4369 | * The three planes contain Y, U and V respectively. | 
|---|
| 4370 | */ | 
|---|
| 4371 | #define VA_FOURCC_411R          0x52313134 | 
|---|
| 4372 | /** 422H: three-plane 8-bit YUV 4:2:2. | 
|---|
| 4373 | * | 
|---|
| 4374 | * The three planes contain Y, U and V respectively. | 
|---|
| 4375 | */ | 
|---|
| 4376 | #define VA_FOURCC_422H          0x48323234 | 
|---|
| 4377 | /** 422V: three-plane 8-bit YUV 4:4:0. | 
|---|
| 4378 | * | 
|---|
| 4379 | * The three planes contain Y, U and V respectively. | 
|---|
| 4380 | */ | 
|---|
| 4381 | #define VA_FOURCC_422V          0x56323234 | 
|---|
| 4382 | /** 444P: three-plane 8-bit YUV 4:4:4. | 
|---|
| 4383 | * | 
|---|
| 4384 | * The three planes contain Y, U and V respectively. | 
|---|
| 4385 | */ | 
|---|
| 4386 | #define VA_FOURCC_444P          0x50343434 | 
|---|
| 4387 |  | 
|---|
| 4388 | /** RGBP: three-plane 8-bit RGB. | 
|---|
| 4389 | * | 
|---|
| 4390 | * The three planes contain red, green and blue respectively. | 
|---|
| 4391 | */ | 
|---|
| 4392 | #define VA_FOURCC_RGBP          0x50424752 | 
|---|
| 4393 | /** BGRP: three-plane 8-bit RGB. | 
|---|
| 4394 | * | 
|---|
| 4395 | * The three planes contain blue, green and red respectively. | 
|---|
| 4396 | */ | 
|---|
| 4397 | #define VA_FOURCC_BGRP          0x50524742 | 
|---|
| 4398 | /** RG16: packed 5/6-bit RGB. | 
|---|
| 4399 | * | 
|---|
| 4400 | * Each pixel is a two-byte little-endian value. | 
|---|
| 4401 | * Red, green and blue are found in bits 15:11, 10:5, 4:0 respectively. | 
|---|
| 4402 | */ | 
|---|
| 4403 | #define VA_FOURCC_RGB565        0x36314752 | 
|---|
| 4404 | /** BG16: packed 5/6-bit RGB. | 
|---|
| 4405 | * | 
|---|
| 4406 | * Each pixel is a two-byte little-endian value. | 
|---|
| 4407 | * Blue, green and red are found in bits 15:11, 10:5, 4:0 respectively. | 
|---|
| 4408 | */ | 
|---|
| 4409 | #define VA_FOURCC_BGR565        0x36314742 | 
|---|
| 4410 |  | 
|---|
| 4411 | /** Y210: packed 10-bit YUV 4:2:2. | 
|---|
| 4412 | * | 
|---|
| 4413 | * Eight bytes represent a pair of pixels.  Each sample is a two-byte little-endian value, | 
|---|
| 4414 | * with the bottom six bits ignored.  The samples are in the order Y, U, Y, V. | 
|---|
| 4415 | */ | 
|---|
| 4416 | #define VA_FOURCC_Y210          0x30313259 | 
|---|
| 4417 | /** Y212: packed 12-bit YUV 4:2:2. | 
|---|
| 4418 | * | 
|---|
| 4419 | * Eight bytes represent a pair of pixels.  Each sample is a two-byte little-endian value. | 
|---|
| 4420 | * The samples are in the order Y, U, Y, V. | 
|---|
| 4421 | */ | 
|---|
| 4422 | #define VA_FOURCC_Y212          0x32313259 | 
|---|
| 4423 | /** Y216: packed 16-bit YUV 4:2:2. | 
|---|
| 4424 | * | 
|---|
| 4425 | * Eight bytes represent a pair of pixels.  Each sample is a two-byte little-endian value. | 
|---|
| 4426 | * The samples are in the order Y, U, Y, V. | 
|---|
| 4427 | */ | 
|---|
| 4428 | #define VA_FOURCC_Y216          0x36313259 | 
|---|
| 4429 | /** Y410: packed 10-bit YUVA 4:4:4. | 
|---|
| 4430 | * | 
|---|
| 4431 | * Each pixel is a four-byte little-endian value. | 
|---|
| 4432 | * A, V, Y, U are found in bits 31:30, 29:20, 19:10, 9:0 respectively. | 
|---|
| 4433 | */ | 
|---|
| 4434 | #define VA_FOURCC_Y410          0x30313459 | 
|---|
| 4435 | /** Y412 packed 12-bit YUVA 4:4:4. | 
|---|
| 4436 | * | 
|---|
| 4437 | * Each pixel is a set of four samples, each of which is a two-byte little-endian value. | 
|---|
| 4438 | * The samples are in the order A, V, Y, U. | 
|---|
| 4439 | */ | 
|---|
| 4440 | #define VA_FOURCC_Y412          0x32313459 | 
|---|
| 4441 | /** Y416: packed 16-bit YUVA 4:4:4. | 
|---|
| 4442 | * | 
|---|
| 4443 | * Each pixel is a set of four samples, each of which is a two-byte little-endian value. | 
|---|
| 4444 | * The samples are in the order A, V, Y, U. | 
|---|
| 4445 | */ | 
|---|
| 4446 | #define VA_FOURCC_Y416          0x36313459 | 
|---|
| 4447 |  | 
|---|
| 4448 | /** YV16: three-plane 8-bit YUV 4:2:2. | 
|---|
| 4449 | * | 
|---|
| 4450 | * The three planes contain Y, V and U respectively. | 
|---|
| 4451 | */ | 
|---|
| 4452 | #define VA_FOURCC_YV16          0x36315659 | 
|---|
| 4453 | /** P010: two-plane 10-bit YUV 4:2:0. | 
|---|
| 4454 | * | 
|---|
| 4455 | * Each sample is a two-byte little-endian value with the bottom six bits ignored. | 
|---|
| 4456 | * The first plane contains Y, the second plane contains U and V in pairs of samples. | 
|---|
| 4457 | */ | 
|---|
| 4458 | #define VA_FOURCC_P010          0x30313050 | 
|---|
| 4459 | /** P012: two-plane 12-bit YUV 4:2:0. | 
|---|
| 4460 | * | 
|---|
| 4461 | * Each sample is a two-byte little-endian value with the bottom four bits ignored. | 
|---|
| 4462 | * The first plane contains Y, the second plane contains U and V in pairs of samples. | 
|---|
| 4463 | */ | 
|---|
| 4464 | #define VA_FOURCC_P012          0x32313050 | 
|---|
| 4465 | /** P016: two-plane 16-bit YUV 4:2:0. | 
|---|
| 4466 | * | 
|---|
| 4467 | * Each sample is a two-byte little-endian value.  The first plane contains Y, the second | 
|---|
| 4468 | * plane contains U and V in pairs of samples. | 
|---|
| 4469 | */ | 
|---|
| 4470 | #define VA_FOURCC_P016          0x36313050 | 
|---|
| 4471 |  | 
|---|
| 4472 | /** I010: three-plane 10-bit YUV 4:2:0. | 
|---|
| 4473 | * | 
|---|
| 4474 | * Each sample is a two-byte little-endian value with the top six bits ignored. | 
|---|
| 4475 | * The three planes contain Y, V and U respectively. | 
|---|
| 4476 | */ | 
|---|
| 4477 | #define VA_FOURCC_I010          0x30313049 | 
|---|
| 4478 |  | 
|---|
| 4479 | /** IYUV: three-plane 8-bit YUV 4:2:0. | 
|---|
| 4480 | * | 
|---|
| 4481 | * @deprecated Use I420 instead. | 
|---|
| 4482 | */ | 
|---|
| 4483 | #define VA_FOURCC_IYUV          0x56555949 | 
|---|
| 4484 | /** | 
|---|
| 4485 | * 10-bit Pixel RGB formats. | 
|---|
| 4486 | */ | 
|---|
| 4487 | #define VA_FOURCC_A2R10G10B10   0x30335241 /* VA_FOURCC('A','R','3','0') */ | 
|---|
| 4488 | /** | 
|---|
| 4489 | * 10-bit Pixel BGR formats. | 
|---|
| 4490 | */ | 
|---|
| 4491 | #define VA_FOURCC_A2B10G10R10   0x30334241 /* VA_FOURCC('A','B','3','0') */ | 
|---|
| 4492 | /** | 
|---|
| 4493 | * 10-bit Pixel RGB formats without alpha. | 
|---|
| 4494 | */ | 
|---|
| 4495 | #define VA_FOURCC_X2R10G10B10   0x30335258 /* VA_FOURCC('X','R','3','0') */ | 
|---|
| 4496 | /** | 
|---|
| 4497 | * 10-bit Pixel BGR formats without alpha. | 
|---|
| 4498 | */ | 
|---|
| 4499 | #define VA_FOURCC_X2B10G10R10   0x30334258 /* VA_FOURCC('X','B','3','0') */ | 
|---|
| 4500 |  | 
|---|
| 4501 | /** Y8: 8-bit greyscale. | 
|---|
| 4502 | * | 
|---|
| 4503 | * Only a single sample, 8 bit Y plane for monochrome images | 
|---|
| 4504 | */ | 
|---|
| 4505 | #define VA_FOURCC_Y8            0x20203859 | 
|---|
| 4506 | /** Y16: 16-bit greyscale. | 
|---|
| 4507 | * | 
|---|
| 4508 | * Only a single sample, 16 bit Y plane for monochrome images | 
|---|
| 4509 | */ | 
|---|
| 4510 | #define VA_FOURCC_Y16           0x20363159 | 
|---|
| 4511 | /** VYUV: packed 8-bit YUV 4:2:2. | 
|---|
| 4512 | * | 
|---|
| 4513 | * Four bytes per pair of pixels: V, Y, U, V. | 
|---|
| 4514 | */ | 
|---|
| 4515 | #define VA_FOURCC_VYUY          0x59555956 | 
|---|
| 4516 | /** YVYU: packed 8-bit YUV 4:2:2. | 
|---|
| 4517 | * | 
|---|
| 4518 | * Four bytes per pair of pixels: Y, V, Y, U. | 
|---|
| 4519 | */ | 
|---|
| 4520 | #define VA_FOURCC_YVYU          0x55595659 | 
|---|
| 4521 | /** AGRB64: three-plane 16-bit ARGB 16:16:16:16 | 
|---|
| 4522 | * | 
|---|
| 4523 | * The four planes contain: alpha, red, green, blue respectively. | 
|---|
| 4524 | */ | 
|---|
| 4525 | #define VA_FOURCC_ARGB64        0x34475241 | 
|---|
| 4526 | /** ABGR64: three-plane 16-bit ABGR 16:16:16:16 | 
|---|
| 4527 | * | 
|---|
| 4528 | * The four planes contain: alpha, blue, green, red respectively. | 
|---|
| 4529 | */ | 
|---|
| 4530 | #define VA_FOURCC_ABGR64        0x34474241 | 
|---|
| 4531 | /** XYUV: packed 8-bit YUVX 4:4:4. | 
|---|
| 4532 | * | 
|---|
| 4533 | * Four bytes per pixel: X, Y, U, V. | 
|---|
| 4534 | */ | 
|---|
| 4535 | #define VA_FOURCC_XYUV          0x56555958 | 
|---|
| 4536 |  | 
|---|
| 4537 | /* byte order */ | 
|---|
| 4538 | #define VA_LSB_FIRST        1 | 
|---|
| 4539 | #define VA_MSB_FIRST        2 | 
|---|
| 4540 |  | 
|---|
| 4541 | typedef struct _VAImageFormat { | 
|---|
| 4542 | uint32_t    fourcc; | 
|---|
| 4543 | uint32_t    byte_order; /* VA_LSB_FIRST, VA_MSB_FIRST */ | 
|---|
| 4544 | uint32_t    bits_per_pixel; | 
|---|
| 4545 | /* for RGB formats */ | 
|---|
| 4546 | uint32_t    depth; /* significant bits per pixel */ | 
|---|
| 4547 | uint32_t    red_mask; | 
|---|
| 4548 | uint32_t    green_mask; | 
|---|
| 4549 | uint32_t    blue_mask; | 
|---|
| 4550 | uint32_t    alpha_mask; | 
|---|
| 4551 |  | 
|---|
| 4552 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 4553 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 4554 | } VAImageFormat; | 
|---|
| 4555 |  | 
|---|
| 4556 | typedef VAGenericID VAImageID; | 
|---|
| 4557 |  | 
|---|
| 4558 | typedef struct _VAImage { | 
|---|
| 4559 | VAImageID       image_id; /* uniquely identify this image */ | 
|---|
| 4560 | VAImageFormat   format; | 
|---|
| 4561 | VABufferID      buf;    /* image data buffer */ | 
|---|
| 4562 | /* | 
|---|
| 4563 | * Image data will be stored in a buffer of type VAImageBufferType to facilitate | 
|---|
| 4564 | * data store on the server side for optimal performance. The buffer will be | 
|---|
| 4565 | * created by the CreateImage function, and proper storage allocated based on the image | 
|---|
| 4566 | * size and format. This buffer is managed by the library implementation, and | 
|---|
| 4567 | * accessed by the client through the buffer Map/Unmap functions. | 
|---|
| 4568 | */ | 
|---|
| 4569 | uint16_t    width; | 
|---|
| 4570 | uint16_t    height; | 
|---|
| 4571 | uint32_t    data_size; | 
|---|
| 4572 | uint32_t    num_planes; /* can not be greater than 3 */ | 
|---|
| 4573 | /* | 
|---|
| 4574 | * An array indicating the scanline pitch in bytes for each plane. | 
|---|
| 4575 | * Each plane may have a different pitch. Maximum 3 planes for planar formats | 
|---|
| 4576 | */ | 
|---|
| 4577 | uint32_t    pitches[3]; | 
|---|
| 4578 | /* | 
|---|
| 4579 | * An array indicating the byte offset from the beginning of the image data | 
|---|
| 4580 | * to the start of each plane. | 
|---|
| 4581 | */ | 
|---|
| 4582 | uint32_t    offsets[3]; | 
|---|
| 4583 |  | 
|---|
| 4584 | /* The following fields are only needed for paletted formats */ | 
|---|
| 4585 | int32_t num_palette_entries;   /* set to zero for non-palette images */ | 
|---|
| 4586 | /* | 
|---|
| 4587 | * Each component is one byte and entry_bytes indicates the number of components in | 
|---|
| 4588 | * each entry (eg. 3 for YUV palette entries). set to zero for non-palette images | 
|---|
| 4589 | */ | 
|---|
| 4590 | int32_t entry_bytes; | 
|---|
| 4591 | /* | 
|---|
| 4592 | * An array of ascii characters describing the order of the components within the bytes. | 
|---|
| 4593 | * Only entry_bytes characters of the string are used. | 
|---|
| 4594 | */ | 
|---|
| 4595 | int8_t component_order[4]; | 
|---|
| 4596 |  | 
|---|
| 4597 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 4598 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 4599 | } VAImage; | 
|---|
| 4600 |  | 
|---|
| 4601 | /** Get maximum number of image formats supported by the implementation */ | 
|---|
| 4602 | int vaMaxNumImageFormats( | 
|---|
| 4603 | VADisplay dpy | 
|---|
| 4604 | ); | 
|---|
| 4605 |  | 
|---|
| 4606 | /** | 
|---|
| 4607 | * Query supported image formats | 
|---|
| 4608 | * The caller must provide a "format_list" array that can hold at | 
|---|
| 4609 | * least vaMaxNumImageFormats() entries. The actual number of formats | 
|---|
| 4610 | * returned in "format_list" is returned in "num_formats". | 
|---|
| 4611 | */ | 
|---|
| 4612 | VAStatus vaQueryImageFormats( | 
|---|
| 4613 | VADisplay dpy, | 
|---|
| 4614 | VAImageFormat *format_list, /* out */ | 
|---|
| 4615 | int *num_formats        /* out */ | 
|---|
| 4616 | ); | 
|---|
| 4617 |  | 
|---|
| 4618 | /** | 
|---|
| 4619 | * Create a VAImage structure | 
|---|
| 4620 | * The width and height fields returned in the VAImage structure may get | 
|---|
| 4621 | * enlarged for some YUV formats. Upon return from this function, | 
|---|
| 4622 | * image->buf has been created and proper storage allocated by the library. | 
|---|
| 4623 | * The client can access the image through the Map/Unmap calls. | 
|---|
| 4624 | */ | 
|---|
| 4625 | VAStatus vaCreateImage( | 
|---|
| 4626 | VADisplay dpy, | 
|---|
| 4627 | VAImageFormat *format, | 
|---|
| 4628 | int width, | 
|---|
| 4629 | int height, | 
|---|
| 4630 | VAImage *image  /* out */ | 
|---|
| 4631 | ); | 
|---|
| 4632 |  | 
|---|
| 4633 | /** | 
|---|
| 4634 | * Should call DestroyImage before destroying the surface it is bound to | 
|---|
| 4635 | */ | 
|---|
| 4636 | VAStatus vaDestroyImage( | 
|---|
| 4637 | VADisplay dpy, | 
|---|
| 4638 | VAImageID image | 
|---|
| 4639 | ); | 
|---|
| 4640 |  | 
|---|
| 4641 | VAStatus vaSetImagePalette( | 
|---|
| 4642 | VADisplay dpy, | 
|---|
| 4643 | VAImageID image, | 
|---|
| 4644 | /* | 
|---|
| 4645 | * pointer to an array holding the palette data.  The size of the array is | 
|---|
| 4646 | * num_palette_entries * entry_bytes in size.  The order of the components | 
|---|
| 4647 | * in the palette is described by the component_order in VAImage struct | 
|---|
| 4648 | */ | 
|---|
| 4649 | unsigned char *palette | 
|---|
| 4650 | ); | 
|---|
| 4651 |  | 
|---|
| 4652 | /** | 
|---|
| 4653 | * Retrive surface data into a VAImage | 
|---|
| 4654 | * Image must be in a format supported by the implementation | 
|---|
| 4655 | */ | 
|---|
| 4656 | VAStatus vaGetImage( | 
|---|
| 4657 | VADisplay dpy, | 
|---|
| 4658 | VASurfaceID surface, | 
|---|
| 4659 | int x,  /* coordinates of the upper left source pixel */ | 
|---|
| 4660 | int y, | 
|---|
| 4661 | unsigned int width, /* width and height of the region */ | 
|---|
| 4662 | unsigned int height, | 
|---|
| 4663 | VAImageID image | 
|---|
| 4664 | ); | 
|---|
| 4665 |  | 
|---|
| 4666 | /** | 
|---|
| 4667 | * Copy data from a VAImage to a surface | 
|---|
| 4668 | * Image must be in a format supported by the implementation | 
|---|
| 4669 | * Returns a VA_STATUS_ERROR_SURFACE_BUSY if the surface | 
|---|
| 4670 | * shouldn't be rendered into when this is called | 
|---|
| 4671 | */ | 
|---|
| 4672 | VAStatus vaPutImage( | 
|---|
| 4673 | VADisplay dpy, | 
|---|
| 4674 | VASurfaceID surface, | 
|---|
| 4675 | VAImageID image, | 
|---|
| 4676 | int src_x, | 
|---|
| 4677 | int src_y, | 
|---|
| 4678 | unsigned int src_width, | 
|---|
| 4679 | unsigned int src_height, | 
|---|
| 4680 | int dest_x, | 
|---|
| 4681 | int dest_y, | 
|---|
| 4682 | unsigned int dest_width, | 
|---|
| 4683 | unsigned int dest_height | 
|---|
| 4684 | ); | 
|---|
| 4685 |  | 
|---|
| 4686 | /** | 
|---|
| 4687 | * Derive an VAImage from an existing surface. | 
|---|
| 4688 | * This interface will derive a VAImage and corresponding image buffer from | 
|---|
| 4689 | * an existing VA Surface. The image buffer can then be mapped/unmapped for | 
|---|
| 4690 | * direct CPU access. This operation is only possible on implementations with | 
|---|
| 4691 | * direct rendering capabilities and internal surface formats that can be | 
|---|
| 4692 | * represented with a VAImage. When the operation is not possible this interface | 
|---|
| 4693 | * will return VA_STATUS_ERROR_OPERATION_FAILED. Clients should then fall back | 
|---|
| 4694 | * to using vaCreateImage + vaPutImage to accomplish the same task in an | 
|---|
| 4695 | * indirect manner. | 
|---|
| 4696 | * | 
|---|
| 4697 | * Implementations should only return success when the resulting image buffer | 
|---|
| 4698 | * would be useable with vaMap/Unmap. | 
|---|
| 4699 | * | 
|---|
| 4700 | * When directly accessing a surface special care must be taken to insure | 
|---|
| 4701 | * proper synchronization with the graphics hardware. Clients should call | 
|---|
| 4702 | * vaQuerySurfaceStatus to insure that a surface is not the target of concurrent | 
|---|
| 4703 | * rendering or currently being displayed by an overlay. | 
|---|
| 4704 | * | 
|---|
| 4705 | * Additionally nothing about the contents of a surface should be assumed | 
|---|
| 4706 | * following a vaPutSurface. Implementations are free to modify the surface for | 
|---|
| 4707 | * scaling or subpicture blending within a call to vaPutImage. | 
|---|
| 4708 | * | 
|---|
| 4709 | * Calls to vaPutImage or vaGetImage using the same surface from which the image | 
|---|
| 4710 | * has been derived will return VA_STATUS_ERROR_SURFACE_BUSY. vaPutImage or | 
|---|
| 4711 | * vaGetImage with other surfaces is supported. | 
|---|
| 4712 | * | 
|---|
| 4713 | * An image created with vaDeriveImage should be freed with vaDestroyImage. The | 
|---|
| 4714 | * image and image buffer structures will be destroyed; however, the underlying | 
|---|
| 4715 | * surface will remain unchanged until freed with vaDestroySurfaces. | 
|---|
| 4716 | */ | 
|---|
| 4717 | VAStatus vaDeriveImage( | 
|---|
| 4718 | VADisplay dpy, | 
|---|
| 4719 | VASurfaceID surface, | 
|---|
| 4720 | VAImage *image  /* out */ | 
|---|
| 4721 | ); | 
|---|
| 4722 |  | 
|---|
| 4723 | /** | 
|---|
| 4724 | * Subpictures | 
|---|
| 4725 | * Subpicture is a special type of image that can be blended | 
|---|
| 4726 | * with a surface during vaPutSurface(). Subpicture can be used to render | 
|---|
| 4727 | * DVD sub-titles or closed captioning text etc. | 
|---|
| 4728 | */ | 
|---|
| 4729 |  | 
|---|
| 4730 | typedef VAGenericID VASubpictureID; | 
|---|
| 4731 |  | 
|---|
| 4732 | /** Get maximum number of subpicture formats supported by the implementation */ | 
|---|
| 4733 | int vaMaxNumSubpictureFormats( | 
|---|
| 4734 | VADisplay dpy | 
|---|
| 4735 | ); | 
|---|
| 4736 |  | 
|---|
| 4737 | /** flags for subpictures */ | 
|---|
| 4738 | #define VA_SUBPICTURE_CHROMA_KEYING         0x0001 | 
|---|
| 4739 | #define VA_SUBPICTURE_GLOBAL_ALPHA          0x0002 | 
|---|
| 4740 | #define VA_SUBPICTURE_DESTINATION_IS_SCREEN_COORD   0x0004 | 
|---|
| 4741 | /** | 
|---|
| 4742 | * Query supported subpicture formats | 
|---|
| 4743 | * The caller must provide a "format_list" array that can hold at | 
|---|
| 4744 | * least vaMaxNumSubpictureFormats() entries. The flags arrary holds the flag | 
|---|
| 4745 | * for each format to indicate additional capabilities for that format. The actual | 
|---|
| 4746 | * number of formats returned in "format_list" is returned in "num_formats". | 
|---|
| 4747 | *  flags: returned value to indicate addtional capabilities | 
|---|
| 4748 | *         VA_SUBPICTURE_CHROMA_KEYING - supports chroma-keying | 
|---|
| 4749 | *         VA_SUBPICTURE_GLOBAL_ALPHA - supports global alpha | 
|---|
| 4750 | *     VA_SUBPICTURE_DESTINATION_IS_SCREEN_COORD - supports unscaled screen relative subpictures for On Screen Display | 
|---|
| 4751 | */ | 
|---|
| 4752 |  | 
|---|
| 4753 | VAStatus vaQuerySubpictureFormats( | 
|---|
| 4754 | VADisplay dpy, | 
|---|
| 4755 | VAImageFormat *format_list, /* out */ | 
|---|
| 4756 | unsigned int *flags,    /* out */ | 
|---|
| 4757 | unsigned int *num_formats   /* out */ | 
|---|
| 4758 | ); | 
|---|
| 4759 |  | 
|---|
| 4760 | /** | 
|---|
| 4761 | * Subpictures are created with an image associated. | 
|---|
| 4762 | */ | 
|---|
| 4763 | VAStatus vaCreateSubpicture( | 
|---|
| 4764 | VADisplay dpy, | 
|---|
| 4765 | VAImageID image, | 
|---|
| 4766 | VASubpictureID *subpicture  /* out */ | 
|---|
| 4767 | ); | 
|---|
| 4768 |  | 
|---|
| 4769 | /** | 
|---|
| 4770 | * Destroy the subpicture before destroying the image it is assocated to | 
|---|
| 4771 | */ | 
|---|
| 4772 | VAStatus vaDestroySubpicture( | 
|---|
| 4773 | VADisplay dpy, | 
|---|
| 4774 | VASubpictureID subpicture | 
|---|
| 4775 | ); | 
|---|
| 4776 |  | 
|---|
| 4777 | /** | 
|---|
| 4778 | * Bind an image to the subpicture. This image will now be associated with | 
|---|
| 4779 | * the subpicture instead of the one at creation. | 
|---|
| 4780 | */ | 
|---|
| 4781 | VAStatus vaSetSubpictureImage( | 
|---|
| 4782 | VADisplay dpy, | 
|---|
| 4783 | VASubpictureID subpicture, | 
|---|
| 4784 | VAImageID image | 
|---|
| 4785 | ); | 
|---|
| 4786 |  | 
|---|
| 4787 | /** | 
|---|
| 4788 | * If chromakey is enabled, then the area where the source value falls within | 
|---|
| 4789 | * the chromakey [min, max] range is transparent | 
|---|
| 4790 | * The chromakey component format is the following: | 
|---|
| 4791 | *  For RGB: [0:7] Red [8:15] Blue [16:23] Green | 
|---|
| 4792 | *  For YUV: [0:7] V [8:15] U [16:23] Y | 
|---|
| 4793 | * The chromakey mask can be used to mask out certain components for chromakey | 
|---|
| 4794 | * comparision | 
|---|
| 4795 | */ | 
|---|
| 4796 | VAStatus vaSetSubpictureChromakey( | 
|---|
| 4797 | VADisplay dpy, | 
|---|
| 4798 | VASubpictureID subpicture, | 
|---|
| 4799 | unsigned int chromakey_min, | 
|---|
| 4800 | unsigned int chromakey_max, | 
|---|
| 4801 | unsigned int chromakey_mask | 
|---|
| 4802 | ); | 
|---|
| 4803 |  | 
|---|
| 4804 | /** | 
|---|
| 4805 | * Global alpha value is between 0 and 1. A value of 1 means fully opaque and | 
|---|
| 4806 | * a value of 0 means fully transparent. If per-pixel alpha is also specified then | 
|---|
| 4807 | * the overall alpha is per-pixel alpha multiplied by the global alpha | 
|---|
| 4808 | */ | 
|---|
| 4809 | VAStatus vaSetSubpictureGlobalAlpha( | 
|---|
| 4810 | VADisplay dpy, | 
|---|
| 4811 | VASubpictureID subpicture, | 
|---|
| 4812 | float global_alpha | 
|---|
| 4813 | ); | 
|---|
| 4814 |  | 
|---|
| 4815 | /** | 
|---|
| 4816 | * vaAssociateSubpicture associates the subpicture with target_surfaces. | 
|---|
| 4817 | * It defines the region mapping between the subpicture and the target | 
|---|
| 4818 | * surfaces through source and destination rectangles (with the same width and height). | 
|---|
| 4819 | * Both will be displayed at the next call to vaPutSurface.  Additional | 
|---|
| 4820 | * associations before the call to vaPutSurface simply overrides the association. | 
|---|
| 4821 | */ | 
|---|
| 4822 | VAStatus vaAssociateSubpicture( | 
|---|
| 4823 | VADisplay dpy, | 
|---|
| 4824 | VASubpictureID subpicture, | 
|---|
| 4825 | VASurfaceID *target_surfaces, | 
|---|
| 4826 | int num_surfaces, | 
|---|
| 4827 | int16_t src_x, /* upper left offset in subpicture */ | 
|---|
| 4828 | int16_t src_y, | 
|---|
| 4829 | uint16_t src_width, | 
|---|
| 4830 | uint16_t src_height, | 
|---|
| 4831 | int16_t dest_x, /* upper left offset in surface */ | 
|---|
| 4832 | int16_t dest_y, | 
|---|
| 4833 | uint16_t dest_width, | 
|---|
| 4834 | uint16_t dest_height, | 
|---|
| 4835 | /* | 
|---|
| 4836 | * whether to enable chroma-keying, global-alpha, or screen relative mode | 
|---|
| 4837 | * see VA_SUBPICTURE_XXX values | 
|---|
| 4838 | */ | 
|---|
| 4839 | uint32_t flags | 
|---|
| 4840 | ); | 
|---|
| 4841 |  | 
|---|
| 4842 | /** | 
|---|
| 4843 | * vaDeassociateSubpicture removes the association of the subpicture with target_surfaces. | 
|---|
| 4844 | */ | 
|---|
| 4845 | VAStatus vaDeassociateSubpicture( | 
|---|
| 4846 | VADisplay dpy, | 
|---|
| 4847 | VASubpictureID subpicture, | 
|---|
| 4848 | VASurfaceID *target_surfaces, | 
|---|
| 4849 | int num_surfaces | 
|---|
| 4850 | ); | 
|---|
| 4851 |  | 
|---|
| 4852 | /** | 
|---|
| 4853 | * Display attributes | 
|---|
| 4854 | * Display attributes are used to control things such as contrast, hue, saturation, | 
|---|
| 4855 | * brightness etc. in the rendering process.  The application can query what | 
|---|
| 4856 | * attributes are supported by the driver, and then set the appropriate attributes | 
|---|
| 4857 | * before calling vaPutSurface() | 
|---|
| 4858 | * | 
|---|
| 4859 | * Display attributes can also be used to query/set platform or display adaptor (vaDisplay) | 
|---|
| 4860 | * related information. These attributes do not depend on vaConfig, and could not be used | 
|---|
| 4861 | * for vaPutSurface. Application can use vaQueryDisplayAttributes/vaGetDisplayAttributes | 
|---|
| 4862 | * at anytime after vaInitialize, but (for settable attributes) vaSetDisplayAttributes should be | 
|---|
| 4863 | * called after vaInitialize and before any other function call. | 
|---|
| 4864 | * | 
|---|
| 4865 | * To distinguish these two types of display attributes, display adaptor related attributes | 
|---|
| 4866 | * should be marked as "HW attribute" in the description. | 
|---|
| 4867 | */ | 
|---|
| 4868 |  | 
|---|
| 4869 | /* PowerVR IEP Lite attributes */ | 
|---|
| 4870 | typedef enum { | 
|---|
| 4871 | VADISPLAYATTRIB_BLE_OFF              = 0x00, | 
|---|
| 4872 | VADISPLAYATTRIB_BLE_LOW, | 
|---|
| 4873 | VADISPLAYATTRIB_BLE_MEDIUM, | 
|---|
| 4874 | VADISPLAYATTRIB_BLE_HIGH, | 
|---|
| 4875 | VADISPLAYATTRIB_BLE_NONE, | 
|---|
| 4876 | } VADisplayAttribBLEMode; | 
|---|
| 4877 |  | 
|---|
| 4878 | /** attribute value for VADisplayAttribRotation   */ | 
|---|
| 4879 | #define VA_ROTATION_NONE        0x00000000 | 
|---|
| 4880 | #define VA_ROTATION_90          0x00000001 | 
|---|
| 4881 | #define VA_ROTATION_180         0x00000002 | 
|---|
| 4882 | #define VA_ROTATION_270         0x00000003 | 
|---|
| 4883 | /**@}*/ | 
|---|
| 4884 |  | 
|---|
| 4885 | /** | 
|---|
| 4886 | * @name Mirroring directions | 
|---|
| 4887 | * | 
|---|
| 4888 | * Those values could be used for VADisplayAttribMirror attribute or | 
|---|
| 4889 | * VAProcPipelineParameterBuffer::mirror_state. | 
|---|
| 4890 |  | 
|---|
| 4891 | */ | 
|---|
| 4892 | /**@{*/ | 
|---|
| 4893 | /** \brief No Mirroring. */ | 
|---|
| 4894 | #define VA_MIRROR_NONE              0x00000000 | 
|---|
| 4895 | /** \brief Horizontal Mirroring. */ | 
|---|
| 4896 | #define VA_MIRROR_HORIZONTAL        0x00000001 | 
|---|
| 4897 | /** \brief Vertical Mirroring. */ | 
|---|
| 4898 | #define VA_MIRROR_VERTICAL          0x00000002 | 
|---|
| 4899 | /**@}*/ | 
|---|
| 4900 |  | 
|---|
| 4901 | /** attribute value for VADisplayAttribOutOfLoopDeblock */ | 
|---|
| 4902 | #define VA_OOL_DEBLOCKING_FALSE 0x00000000 | 
|---|
| 4903 | #define VA_OOL_DEBLOCKING_TRUE  0x00000001 | 
|---|
| 4904 |  | 
|---|
| 4905 | /** Render mode */ | 
|---|
| 4906 | #define VA_RENDER_MODE_UNDEFINED           0 | 
|---|
| 4907 | #define VA_RENDER_MODE_LOCAL_OVERLAY       1 | 
|---|
| 4908 | #define VA_RENDER_MODE_LOCAL_GPU           2 | 
|---|
| 4909 | #define VA_RENDER_MODE_EXTERNAL_OVERLAY    4 | 
|---|
| 4910 | #define VA_RENDER_MODE_EXTERNAL_GPU        8 | 
|---|
| 4911 |  | 
|---|
| 4912 | /** Render device */ | 
|---|
| 4913 | #define VA_RENDER_DEVICE_UNDEFINED  0 | 
|---|
| 4914 | #define VA_RENDER_DEVICE_LOCAL      1 | 
|---|
| 4915 | #define VA_RENDER_DEVICE_EXTERNAL   2 | 
|---|
| 4916 |  | 
|---|
| 4917 | /**\brief sub device info | 
|---|
| 4918 | * Sub-device is the concept basing on the "device" behind "vaDisplay". | 
|---|
| 4919 | * If a device could be divided to several sub devices, the task of | 
|---|
| 4920 | * decode/encode/vpp could be assigned on one sub-device. So, application | 
|---|
| 4921 | * could choose the sub device before any other operations. After that, | 
|---|
| 4922 | * all of the task execution/resource allocation will be dispatched to | 
|---|
| 4923 | * the sub device. If application does not choose the sub device, driver | 
|---|
| 4924 | * will assign one as default. | 
|---|
| 4925 | * | 
|---|
| 4926 | * If the value == VA_ATTRIB_NOT_SUPPORTED, it mean that the attribute | 
|---|
| 4927 | * is unsupport or UNKNOWN. | 
|---|
| 4928 | */ | 
|---|
| 4929 |  | 
|---|
| 4930 | typedef union _VADisplayAttribValSubDevice { | 
|---|
| 4931 | struct { | 
|---|
| 4932 | /** \brief current sub device index, read - write */ | 
|---|
| 4933 | uint32_t current_sub_device     : 4; | 
|---|
| 4934 | /** \brief sub devices count, read - only */ | 
|---|
| 4935 | uint32_t sub_device_count       : 4; | 
|---|
| 4936 | /** \brief reserved bits for future, must be zero*/ | 
|---|
| 4937 | uint32_t reserved               : 8; | 
|---|
| 4938 | /** \brief bit mask to indicate which sub_device is available, read only | 
|---|
| 4939 | * \code | 
|---|
| 4940 | * VADisplayAttribValSubDevice reg; | 
|---|
| 4941 | * VADisplayAttribute reg_attr; | 
|---|
| 4942 | * reg_attr.type = VADisplayAttribSubDevice; | 
|---|
| 4943 | * vaGetDisplayAttributes(dpy, ®_attr, 1); | 
|---|
| 4944 | * reg.value = reg_attr.value; | 
|---|
| 4945 | * | 
|---|
| 4946 | * for(int i = 0; i < reg.bits.sub_device_count; i ++ ){ | 
|---|
| 4947 | *    if((1<<i) & reg.bits.sub_device_mask){ | 
|---|
| 4948 | *        printf("sub device  %d can be selected", i); | 
|---|
| 4949 | *    } | 
|---|
| 4950 | *} | 
|---|
| 4951 | * \endcode | 
|---|
| 4952 | */ | 
|---|
| 4953 | uint32_t sub_device_mask       : 16; | 
|---|
| 4954 | } bits; | 
|---|
| 4955 | uint32_t value; | 
|---|
| 4956 | } VADisplayAttribValSubDevice; | 
|---|
| 4957 |  | 
|---|
| 4958 | /** Currently defined display attribute types */ | 
|---|
| 4959 | typedef enum { | 
|---|
| 4960 | VADisplayAttribBrightness       = 0, | 
|---|
| 4961 | VADisplayAttribContrast     = 1, | 
|---|
| 4962 | VADisplayAttribHue          = 2, | 
|---|
| 4963 | VADisplayAttribSaturation       = 3, | 
|---|
| 4964 | /* client can specifiy a background color for the target window | 
|---|
| 4965 | * the new feature of video conference, | 
|---|
| 4966 | * the uncovered area of the surface is filled by this color | 
|---|
| 4967 | * also it will blend with the decoded video color | 
|---|
| 4968 | */ | 
|---|
| 4969 | VADisplayAttribBackgroundColor      = 4, | 
|---|
| 4970 | /* | 
|---|
| 4971 | * this is a gettable only attribute. For some implementations that use the | 
|---|
| 4972 | * hardware overlay, after PutSurface is called, the surface can not be | 
|---|
| 4973 | * re-used until after the subsequent PutSurface call. If this is the case | 
|---|
| 4974 | * then the value for this attribute will be set to 1 so that the client | 
|---|
| 4975 | * will not attempt to re-use the surface right after returning from a call | 
|---|
| 4976 | * to PutSurface. | 
|---|
| 4977 | * | 
|---|
| 4978 | * Don't use it, use flag VASurfaceDisplaying of vaQuerySurfaceStatus since | 
|---|
| 4979 | * driver may use overlay or GPU alternatively | 
|---|
| 4980 | */ | 
|---|
| 4981 | VADisplayAttribDirectSurface       = 5, | 
|---|
| 4982 | VADisplayAttribRotation            = 6, | 
|---|
| 4983 | VADisplayAttribOutofLoopDeblock    = 7, | 
|---|
| 4984 |  | 
|---|
| 4985 | /* PowerVR IEP Lite specific attributes */ | 
|---|
| 4986 | VADisplayAttribBLEBlackMode        = 8, | 
|---|
| 4987 | VADisplayAttribBLEWhiteMode        = 9, | 
|---|
| 4988 | VADisplayAttribBlueStretch         = 10, | 
|---|
| 4989 | VADisplayAttribSkinColorCorrection = 11, | 
|---|
| 4990 | /* | 
|---|
| 4991 | * For type VADisplayAttribCSCMatrix, "value" field is a pointer to the color | 
|---|
| 4992 | * conversion matrix. Each element in the matrix is float-point | 
|---|
| 4993 | */ | 
|---|
| 4994 | VADisplayAttribCSCMatrix           = 12, | 
|---|
| 4995 | /* specify the constant color used to blend with video surface | 
|---|
| 4996 | * Cd = Cv*Cc*Ac + Cb *(1 - Ac) C means the constant RGB | 
|---|
| 4997 | *      d: the final color to overwrite into the frame buffer | 
|---|
| 4998 | *      v: decoded video after color conversion, | 
|---|
| 4999 | *      c: video color specified by VADisplayAttribBlendColor | 
|---|
| 5000 | *      b: background color of the drawable | 
|---|
| 5001 | */ | 
|---|
| 5002 | VADisplayAttribBlendColor          = 13, | 
|---|
| 5003 | /* | 
|---|
| 5004 | * Indicate driver to skip painting color key or not. | 
|---|
| 5005 | * only applicable if the render is overlay | 
|---|
| 5006 | */ | 
|---|
| 5007 | VADisplayAttribOverlayAutoPaintColorKey   = 14, | 
|---|
| 5008 | /* | 
|---|
| 5009 | * customized overlay color key, the format is RGB888 | 
|---|
| 5010 | * [23:16] = Red, [15:08] = Green, [07:00] = Blue. | 
|---|
| 5011 | */ | 
|---|
| 5012 | VADisplayAttribOverlayColorKey  = 15, | 
|---|
| 5013 | /* | 
|---|
| 5014 | * The hint for the implementation of vaPutSurface | 
|---|
| 5015 | * normally, the driver could use an overlay or GPU to render the surface on the screen | 
|---|
| 5016 | * this flag provides APP the flexibity to switch the render dynamically | 
|---|
| 5017 | */ | 
|---|
| 5018 | VADisplayAttribRenderMode           = 16, | 
|---|
| 5019 | /* | 
|---|
| 5020 | * specify if vaPutSurface needs to render into specified monitors | 
|---|
| 5021 | * one example is that one external monitor (e.g. HDMI) is enabled, | 
|---|
| 5022 | * but the window manager is not aware of it, and there is no associated drawable | 
|---|
| 5023 | */ | 
|---|
| 5024 | VADisplayAttribRenderDevice        = 17, | 
|---|
| 5025 | /* | 
|---|
| 5026 | * specify vaPutSurface render area if there is no drawable on the monitor | 
|---|
| 5027 | */ | 
|---|
| 5028 | VADisplayAttribRenderRect          = 18, | 
|---|
| 5029 | /* | 
|---|
| 5030 | * HW attribute, read/write, specify the sub device configure | 
|---|
| 5031 | */ | 
|---|
| 5032 | VADisplayAttribSubDevice           = 19, | 
|---|
| 5033 | /* | 
|---|
| 5034 | * HW attribute. read only. specify whether vaCopy support on current HW | 
|---|
| 5035 | * The value of each bit should equal to 1 << VA_EXEC_MODE_XXX to represent | 
|---|
| 5036 | * modes of vaCopy | 
|---|
| 5037 | */ | 
|---|
| 5038 | VADisplayAttribCopy                 = 20, | 
|---|
| 5039 | } VADisplayAttribType; | 
|---|
| 5040 |  | 
|---|
| 5041 | /* flags for VADisplayAttribute */ | 
|---|
| 5042 | #define VA_DISPLAY_ATTRIB_NOT_SUPPORTED 0x0000 | 
|---|
| 5043 | #define VA_DISPLAY_ATTRIB_GETTABLE  0x0001 | 
|---|
| 5044 | #define VA_DISPLAY_ATTRIB_SETTABLE  0x0002 | 
|---|
| 5045 |  | 
|---|
| 5046 | typedef struct _VADisplayAttribute { | 
|---|
| 5047 | VADisplayAttribType type; | 
|---|
| 5048 | int32_t min_value; | 
|---|
| 5049 | int32_t max_value; | 
|---|
| 5050 | int32_t value;  /* used by the set/get attribute functions */ | 
|---|
| 5051 | /* flags can be VA_DISPLAY_ATTRIB_GETTABLE or VA_DISPLAY_ATTRIB_SETTABLE or OR'd together */ | 
|---|
| 5052 | uint32_t flags; | 
|---|
| 5053 |  | 
|---|
| 5054 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 5055 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 5056 | } VADisplayAttribute; | 
|---|
| 5057 |  | 
|---|
| 5058 | /** Get maximum number of display attributs supported by the implementation */ | 
|---|
| 5059 | int vaMaxNumDisplayAttributes( | 
|---|
| 5060 | VADisplay dpy | 
|---|
| 5061 | ); | 
|---|
| 5062 |  | 
|---|
| 5063 | /** | 
|---|
| 5064 | * Query display attributes | 
|---|
| 5065 | * The caller must provide a "attr_list" array that can hold at | 
|---|
| 5066 | * least vaMaxNumDisplayAttributes() entries. The actual number of attributes | 
|---|
| 5067 | * returned in "attr_list" is returned in "num_attributes". | 
|---|
| 5068 | */ | 
|---|
| 5069 | VAStatus vaQueryDisplayAttributes( | 
|---|
| 5070 | VADisplay dpy, | 
|---|
| 5071 | VADisplayAttribute *attr_list,  /* out */ | 
|---|
| 5072 | int *num_attributes         /* out */ | 
|---|
| 5073 | ); | 
|---|
| 5074 |  | 
|---|
| 5075 | /** | 
|---|
| 5076 | * Get display attributes | 
|---|
| 5077 | * This function returns the current attribute values in "attr_list". | 
|---|
| 5078 | * Only attributes returned with VA_DISPLAY_ATTRIB_GETTABLE set in the "flags" field | 
|---|
| 5079 | * from vaQueryDisplayAttributes() can have their values retrieved. | 
|---|
| 5080 | */ | 
|---|
| 5081 | VAStatus vaGetDisplayAttributes( | 
|---|
| 5082 | VADisplay dpy, | 
|---|
| 5083 | VADisplayAttribute *attr_list,  /* in/out */ | 
|---|
| 5084 | int num_attributes | 
|---|
| 5085 | ); | 
|---|
| 5086 |  | 
|---|
| 5087 | /** | 
|---|
| 5088 | * Set display attributes | 
|---|
| 5089 | * Only attributes returned with VA_DISPLAY_ATTRIB_SETTABLE set in the "flags" field | 
|---|
| 5090 | * from vaQueryDisplayAttributes() can be set.  If the attribute is not settable or | 
|---|
| 5091 | * the value is out of range, the function returns VA_STATUS_ERROR_ATTR_NOT_SUPPORTED | 
|---|
| 5092 | */ | 
|---|
| 5093 | VAStatus vaSetDisplayAttributes( | 
|---|
| 5094 | VADisplay dpy, | 
|---|
| 5095 | VADisplayAttribute *attr_list, | 
|---|
| 5096 | int num_attributes | 
|---|
| 5097 | ); | 
|---|
| 5098 |  | 
|---|
| 5099 | /**************************** | 
|---|
| 5100 | * HEVC data structures | 
|---|
| 5101 | ****************************/ | 
|---|
| 5102 | /** | 
|---|
| 5103 | * \brief Description of picture properties of those in DPB surfaces. | 
|---|
| 5104 | * | 
|---|
| 5105 | * If only progressive scan is supported, each surface contains one whole | 
|---|
| 5106 | * frame picture. | 
|---|
| 5107 | * Otherwise, each surface contains two fields of whole picture. | 
|---|
| 5108 | * In this case, two entries of ReferenceFrames[] may share same picture_id | 
|---|
| 5109 | * value. | 
|---|
| 5110 | */ | 
|---|
| 5111 | typedef struct _VAPictureHEVC { | 
|---|
| 5112 | /** \brief reconstructed picture buffer surface index | 
|---|
| 5113 | * invalid when taking value VA_INVALID_SURFACE. | 
|---|
| 5114 | */ | 
|---|
| 5115 | VASurfaceID             picture_id; | 
|---|
| 5116 | /** \brief picture order count. | 
|---|
| 5117 | * in HEVC, POCs for top and bottom fields of same picture should | 
|---|
| 5118 | * take different values. | 
|---|
| 5119 | */ | 
|---|
| 5120 | int32_t                 pic_order_cnt; | 
|---|
| 5121 | /* described below */ | 
|---|
| 5122 | uint32_t                flags; | 
|---|
| 5123 |  | 
|---|
| 5124 | /** \brief Reserved bytes for future use, must be zero */ | 
|---|
| 5125 | uint32_t                va_reserved[VA_PADDING_LOW]; | 
|---|
| 5126 | } VAPictureHEVC; | 
|---|
| 5127 |  | 
|---|
| 5128 | /* flags in VAPictureHEVC could be OR of the following */ | 
|---|
| 5129 | #define VA_PICTURE_HEVC_INVALID                 0x00000001 | 
|---|
| 5130 | /** \brief indication of interlace scan picture. | 
|---|
| 5131 | * should take same value for all the pictures in sequence. | 
|---|
| 5132 | */ | 
|---|
| 5133 | #define VA_PICTURE_HEVC_FIELD_PIC               0x00000002 | 
|---|
| 5134 | /** \brief polarity of the field picture. | 
|---|
| 5135 | * top field takes even lines of buffer surface. | 
|---|
| 5136 | * bottom field takes odd lines of buffer surface. | 
|---|
| 5137 | */ | 
|---|
| 5138 | #define VA_PICTURE_HEVC_BOTTOM_FIELD            0x00000004 | 
|---|
| 5139 | /** \brief Long term reference picture */ | 
|---|
| 5140 | #define VA_PICTURE_HEVC_LONG_TERM_REFERENCE     0x00000008 | 
|---|
| 5141 | /** | 
|---|
| 5142 | * VA_PICTURE_HEVC_RPS_ST_CURR_BEFORE, VA_PICTURE_HEVC_RPS_ST_CURR_AFTER | 
|---|
| 5143 | * and VA_PICTURE_HEVC_RPS_LT_CURR of any picture in ReferenceFrames[] should | 
|---|
| 5144 | * be exclusive. No more than one of them can be set for any picture. | 
|---|
| 5145 | * Sum of NumPocStCurrBefore, NumPocStCurrAfter and NumPocLtCurr | 
|---|
| 5146 | * equals NumPocTotalCurr, which should be equal to or smaller than 8. | 
|---|
| 5147 | * Application should provide valid values for both short format and long format. | 
|---|
| 5148 | * The pictures in DPB with any of these three flags turned on are referred by | 
|---|
| 5149 | * the current picture. | 
|---|
| 5150 | */ | 
|---|
| 5151 | /** \brief RefPicSetStCurrBefore of HEVC spec variable | 
|---|
| 5152 | * Number of ReferenceFrames[] entries with this bit set equals | 
|---|
| 5153 | * NumPocStCurrBefore. | 
|---|
| 5154 | */ | 
|---|
| 5155 | #define VA_PICTURE_HEVC_RPS_ST_CURR_BEFORE      0x00000010 | 
|---|
| 5156 | /** \brief RefPicSetStCurrAfter of HEVC spec variable | 
|---|
| 5157 | * Number of ReferenceFrames[] entries with this bit set equals | 
|---|
| 5158 | * NumPocStCurrAfter. | 
|---|
| 5159 | */ | 
|---|
| 5160 | #define VA_PICTURE_HEVC_RPS_ST_CURR_AFTER       0x00000020 | 
|---|
| 5161 | /** \brief RefPicSetLtCurr of HEVC spec variable | 
|---|
| 5162 | * Number of ReferenceFrames[] entries with this bit set equals | 
|---|
| 5163 | * NumPocLtCurr. | 
|---|
| 5164 | */ | 
|---|
| 5165 | #define VA_PICTURE_HEVC_RPS_LT_CURR             0x00000040 | 
|---|
| 5166 |  | 
|---|
| 5167 | typedef enum { | 
|---|
| 5168 | VACopyObjectSurface = 0, | 
|---|
| 5169 | VACopyObjectBuffer  = 1, | 
|---|
| 5170 | } VACopyObjectType; | 
|---|
| 5171 |  | 
|---|
| 5172 | typedef struct _VACopyObject { | 
|---|
| 5173 | VACopyObjectType  obj_type;    // type of object. | 
|---|
| 5174 | union { | 
|---|
| 5175 | VASurfaceID surface_id; | 
|---|
| 5176 | VABufferID  buffer_id; | 
|---|
| 5177 | } object; | 
|---|
| 5178 |  | 
|---|
| 5179 | uint32_t    va_reserved[VA_PADDING_MEDIUM]; | 
|---|
| 5180 | } VACopyObject; | 
|---|
| 5181 |  | 
|---|
| 5182 | typedef union _VACopyOption { | 
|---|
| 5183 | struct { | 
|---|
| 5184 | /** \brief va copy synchronization, the value should be /c VA_EXEC_SYNC or /c VA_EXEC_ASYNC */ | 
|---|
| 5185 | uint32_t va_copy_sync : 2; | 
|---|
| 5186 | /** \brief va copy mode, the value should be VA_EXEC_MODE_XXX */ | 
|---|
| 5187 | uint32_t va_copy_mode : 4; | 
|---|
| 5188 | uint32_t reserved     : 26; | 
|---|
| 5189 | } bits; | 
|---|
| 5190 | uint32_t value; | 
|---|
| 5191 | } VACopyOption; | 
|---|
| 5192 |  | 
|---|
| 5193 | /** \brief Copies an object. | 
|---|
| 5194 | * | 
|---|
| 5195 | * Copies specified object (surface or buffer). If non-blocking copy | 
|---|
| 5196 | * is requested (VA_COPY_NONBLOCK), then need vaSyncBuffer or vaSyncSurface/vaSyncSurface2 | 
|---|
| 5197 | * to sync the destination object. | 
|---|
| 5198 | * | 
|---|
| 5199 | * @param[in] dpy               the VA display | 
|---|
| 5200 | * @param[in] dst               Destination object to copy to | 
|---|
| 5201 | * @param[in] src               Source object to copy from | 
|---|
| 5202 | * @param[in] option            VA copy option | 
|---|
| 5203 | * @return VA_STATUS_SUCCESS if successful | 
|---|
| 5204 | */ | 
|---|
| 5205 | VAStatus vaCopy(VADisplay dpy, VACopyObject * dst, VACopyObject * src, VACopyOption option); | 
|---|
| 5206 |  | 
|---|
| 5207 | #include <va/va_dec_hevc.h> | 
|---|
| 5208 | #include <va/va_dec_jpeg.h> | 
|---|
| 5209 | #include <va/va_dec_vp8.h> | 
|---|
| 5210 | #include <va/va_dec_vp9.h> | 
|---|
| 5211 | #include <va/va_dec_av1.h> | 
|---|
| 5212 | #include <va/va_enc_hevc.h> | 
|---|
| 5213 | #include <va/va_fei_hevc.h> | 
|---|
| 5214 | #include <va/va_enc_h264.h> | 
|---|
| 5215 | #include <va/va_enc_jpeg.h> | 
|---|
| 5216 | #include <va/va_enc_mpeg2.h> | 
|---|
| 5217 | #include <va/va_enc_vp8.h> | 
|---|
| 5218 | #include <va/va_enc_vp9.h> | 
|---|
| 5219 | #include <va/va_enc_av1.h> | 
|---|
| 5220 | #include <va/va_fei.h> | 
|---|
| 5221 | #include <va/va_fei_h264.h> | 
|---|
| 5222 | #include <va/va_vpp.h> | 
|---|
| 5223 | #include <va/va_prot.h> | 
|---|
| 5224 |  | 
|---|
| 5225 | /**@}*/ | 
|---|
| 5226 |  | 
|---|
| 5227 | #ifdef __cplusplus | 
|---|
| 5228 | } | 
|---|
| 5229 | #endif | 
|---|
| 5230 |  | 
|---|
| 5231 | #endif /* _VA_H_ */ | 
|---|
| 5232 |  | 
|---|