OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2007-2009 Intel Corporation. All Rights Reserved. | 2 * Copyright (c) 2007-2009 Intel Corporation. All Rights Reserved. |
3 * | 3 * |
4 * Permission is hereby granted, free of charge, to any person obtaining a | 4 * Permission is hereby granted, free of charge, to any person obtaining a |
5 * copy of this software and associated documentation files (the | 5 * copy of this software and associated documentation files (the |
6 * "Software"), to deal in the Software without restriction, including | 6 * "Software"), to deal in the Software without restriction, including |
7 * without limitation the rights to use, copy, modify, merge, publish, | 7 * without limitation the rights to use, copy, modify, merge, publish, |
8 * distribute, sub license, and/or sell copies of the Software, and to | 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 | 9 * permit persons to whom the Software is furnished to do so, subject to |
10 * the following conditions: | 10 * the following conditions: |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 * screen relative rather than source vid
eo relative. | 61 * screen relative rather than source vid
eo relative. |
62 * rev 0.32.0 (01/13/2011 Xiang Haihao) - Add profile into VAPictureParameterBuf
ferVC1 | 62 * rev 0.32.0 (01/13/2011 Xiang Haihao) - Add profile into VAPictureParameterBuf
ferVC1 |
63 * update VAAPI to 0.32.0 | 63 * update VAAPI to 0.32.0 |
64 * | 64 * |
65 * Acknowledgements: | 65 * Acknowledgements: |
66 * Some concepts borrowed from XvMC and XvImage. | 66 * Some concepts borrowed from XvMC and XvImage. |
67 * Waldo Bastian (Intel), Matt Sottek (Intel), Austin Yuan (Intel), and Gwenol
e Beauchesne (SDS) | 67 * Waldo Bastian (Intel), Matt Sottek (Intel), Austin Yuan (Intel), and Gwenol
e Beauchesne (SDS) |
68 * contributed to various aspects of the API. | 68 * contributed to various aspects of the API. |
69 */ | 69 */ |
70 | 70 |
| 71 /** |
| 72 * \file va.h |
| 73 * \brief The Core API |
| 74 * |
| 75 * This file contains the \ref api_core "Core API". |
| 76 */ |
| 77 |
71 #ifndef _VA_H_ | 78 #ifndef _VA_H_ |
72 #define _VA_H_ | 79 #define _VA_H_ |
73 | 80 |
74 #include <va/va_version.h> | 81 #include <va/va_version.h> |
75 | 82 |
76 #ifdef __cplusplus | 83 #ifdef __cplusplus |
77 extern "C" { | 84 extern "C" { |
78 #endif | 85 #endif |
79 | 86 |
| 87 /** |
| 88 * \mainpage Video Acceleration (VA) API |
| 89 * |
| 90 * \section intro Introduction |
| 91 * |
| 92 * The main motivation for VA-API (Video Acceleration API) is to |
| 93 * enable hardware accelerated video decode and encode at various |
| 94 * entry-points (VLD, IDCT, Motion Compensation etc.) for the |
| 95 * prevailing coding standards today (MPEG-2, MPEG-4 ASP/H.263, MPEG-4 |
| 96 * AVC/H.264, VC-1/VMW3, and JPEG). |
| 97 * |
| 98 * VA-API is split into several modules: |
| 99 * - \ref api_core |
| 100 * - \ref api_enc_core |
| 101 * - \ref api_enc_h264 |
| 102 * - \ref api_vpp |
| 103 */ |
| 104 |
| 105 /** |
| 106 * \defgroup api_core Core API |
| 107 * |
| 108 * @{ |
| 109 */ |
| 110 |
80 /* | 111 /* |
81 Overview | 112 Overview |
82 | 113 |
83 The VA API is intended to provide an interface between a video decode/encode/dis
play | 114 The VA API is intended to provide an interface between a video decode/encode/dis
play |
84 application (client) and a hardware accelerator (server), to off-load | 115 application (client) and a hardware accelerator (server), to off-load |
85 video decode/encode/display operations from the host to the hardware accelerator
at various | 116 video decode/encode/display operations from the host to the hardware accelerator
at various |
86 entry-points. | 117 entry-points. |
87 | 118 |
88 The basic operation steps are: | 119 The basic operation steps are: |
89 | 120 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 #define VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE 0x0000000f | 158 #define VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE 0x0000000f |
128 #define VA_STATUS_ERROR_SURFACE_BUSY 0x00000010 | 159 #define VA_STATUS_ERROR_SURFACE_BUSY 0x00000010 |
129 #define VA_STATUS_ERROR_FLAG_NOT_SUPPORTED 0x00000011 | 160 #define VA_STATUS_ERROR_FLAG_NOT_SUPPORTED 0x00000011 |
130 #define VA_STATUS_ERROR_INVALID_PARAMETER 0x00000012 | 161 #define VA_STATUS_ERROR_INVALID_PARAMETER 0x00000012 |
131 #define VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED 0x00000013 | 162 #define VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED 0x00000013 |
132 #define VA_STATUS_ERROR_UNIMPLEMENTED 0x00000014 | 163 #define VA_STATUS_ERROR_UNIMPLEMENTED 0x00000014 |
133 #define VA_STATUS_ERROR_SURFACE_IN_DISPLAYING 0x00000015 | 164 #define VA_STATUS_ERROR_SURFACE_IN_DISPLAYING 0x00000015 |
134 #define VA_STATUS_ERROR_INVALID_IMAGE_FORMAT 0x00000016 | 165 #define VA_STATUS_ERROR_INVALID_IMAGE_FORMAT 0x00000016 |
135 #define VA_STATUS_ERROR_DECODING_ERROR 0x00000017 | 166 #define VA_STATUS_ERROR_DECODING_ERROR 0x00000017 |
136 #define VA_STATUS_ERROR_ENCODING_ERROR 0x00000018 | 167 #define VA_STATUS_ERROR_ENCODING_ERROR 0x00000018 |
| 168 /** |
| 169 * \brief An invalid/unsupported value was supplied. |
| 170 * |
| 171 * This is a catch-all error code for invalid or unsupported values. |
| 172 * e.g. value exceeding the valid range, invalid type in the context |
| 173 * of generic attribute values. |
| 174 */ |
| 175 #define VA_STATUS_ERROR_INVALID_VALUE 0x00000019 |
| 176 /** \brief An unsupported filter was supplied. */ |
| 177 #define VA_STATUS_ERROR_UNSUPPORTED_FILTER 0x00000020 |
| 178 /** \brief An invalid filter chain was supplied. */ |
| 179 #define VA_STATUS_ERROR_INVALID_FILTER_CHAIN 0x00000021 |
| 180 /** \brief Indicate HW busy (e.g. run multiple encoding simultaneously). */ |
| 181 #define VA_STATUS_ERROR_HW_BUSY 0x00000022 |
137 #define VA_STATUS_ERROR_UNKNOWN 0xFFFFFFFF | 182 #define VA_STATUS_ERROR_UNKNOWN 0xFFFFFFFF |
138 | 183 |
139 /* De-interlacing flags for vaPutSurface() */ | 184 /* De-interlacing flags for vaPutSurface() */ |
140 #define VA_FRAME_PICTURE 0x00000000 | 185 #define VA_FRAME_PICTURE 0x00000000 |
141 #define VA_TOP_FIELD 0x00000001 | 186 #define VA_TOP_FIELD 0x00000001 |
142 #define VA_BOTTOM_FIELD 0x00000002 | 187 #define VA_BOTTOM_FIELD 0x00000002 |
143 | 188 |
144 /* | 189 /* |
145 * Enabled the positioning/cropping/blending feature: | 190 * Enabled the positioning/cropping/blending feature: |
146 * 1, specify the video playback position in the isurface | 191 * 1, specify the video playback position in the isurface |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 * This allows private interfaces into the library | 264 * This allows private interfaces into the library |
220 */ | 265 */ |
221 VAPrivFunc vaGetLibFunc ( | 266 VAPrivFunc vaGetLibFunc ( |
222 VADisplay dpy, | 267 VADisplay dpy, |
223 const char *func | 268 const char *func |
224 ); | 269 ); |
225 | 270 |
226 /* Currently defined profiles */ | 271 /* Currently defined profiles */ |
227 typedef enum | 272 typedef enum |
228 { | 273 { |
| 274 /** \brief Profile ID used for video processing. */ |
| 275 VAProfileNone = -1, |
229 VAProfileMPEG2Simple = 0, | 276 VAProfileMPEG2Simple = 0, |
230 VAProfileMPEG2Main = 1, | 277 VAProfileMPEG2Main = 1, |
231 VAProfileMPEG4Simple = 2, | 278 VAProfileMPEG4Simple = 2, |
232 VAProfileMPEG4AdvancedSimple = 3, | 279 VAProfileMPEG4AdvancedSimple = 3, |
233 VAProfileMPEG4Main = 4, | 280 VAProfileMPEG4Main = 4, |
234 VAProfileH264Baseline = 5, | 281 VAProfileH264Baseline = 5, |
235 VAProfileH264Main = 6, | 282 VAProfileH264Main = 6, |
236 VAProfileH264High = 7, | 283 VAProfileH264High = 7, |
237 VAProfileVC1Simple = 8, | 284 VAProfileVC1Simple = 8, |
238 VAProfileVC1Main = 9, | 285 VAProfileVC1Main = 9, |
239 VAProfileVC1Advanced = 10, | 286 VAProfileVC1Advanced = 10, |
240 VAProfileH263Baseline = 11, | 287 VAProfileH263Baseline = 11, |
241 VAProfileJPEGBaseline = 12, | 288 VAProfileJPEGBaseline = 12, |
242 VAProfileH264ConstrainedBaseline = 13 | 289 VAProfileH264ConstrainedBaseline = 13 |
243 } VAProfile; | 290 } VAProfile; |
244 | 291 |
245 /* | 292 /* |
246 * Currently defined entrypoints | 293 * Currently defined entrypoints |
247 */ | 294 */ |
248 typedef enum | 295 typedef enum |
249 { | 296 { |
250 VAEntrypointVLD = 1, | 297 VAEntrypointVLD = 1, |
251 VAEntrypointIZZ = 2, | 298 VAEntrypointIZZ = 2, |
252 VAEntrypointIDCT = 3, | 299 VAEntrypointIDCT = 3, |
253 VAEntrypointMoComp = 4, | 300 VAEntrypointMoComp = 4, |
254 VAEntrypointDeblocking = 5, | 301 VAEntrypointDeblocking = 5, |
255 VAEntrypointEncSlice = 6, /* slice level encode */ | 302 VAEntrypointEncSlice = 6, /* slice level encode */ |
256 VAEntrypointEncPicture » = 7» /* pictuer encode, JPEG, etc */ | 303 VAEntrypointEncPicture » = 7,» /* pictuer encode, JPEG, etc */ |
| 304 VAEntrypointVideoProc = 10, /**< Video pre/post-processing. */ |
| 305 VAEntrypointMax |
257 } VAEntrypoint; | 306 } VAEntrypoint; |
258 | 307 |
259 /* Currently defined configuration attribute types */ | 308 /* Currently defined configuration attribute types */ |
260 typedef enum | 309 typedef enum |
261 { | 310 { |
262 VAConfigAttribRTFormat = 0, | 311 VAConfigAttribRTFormat = 0, |
263 VAConfigAttribSpatialResidual = 1, | 312 VAConfigAttribSpatialResidual = 1, |
264 VAConfigAttribSpatialClipping = 2, | 313 VAConfigAttribSpatialClipping = 2, |
265 VAConfigAttribIntraResidual = 3, | 314 VAConfigAttribIntraResidual = 3, |
266 VAConfigAttribEncryption = 4, | 315 VAConfigAttribEncryption = 4, |
267 VAConfigAttribRateControl» » = 5 | 316 VAConfigAttribRateControl» » = 5, |
| 317 |
| 318 /** @name Attributes for encoding */ |
| 319 /**@{*/ |
| 320 /** |
| 321 * \brief Packed headers mode. Read/write. |
| 322 * |
| 323 * This attribute determines what packed headers the driver supports, |
| 324 * through vaGetConfigAttributes(); and what packed headers the user |
| 325 * will be providing to the driver, through vaCreateConfig(), if the |
| 326 * driver supports those. |
| 327 * |
| 328 * See \c VA_ENC_PACKED_HEADER_xxx for the list of packed headers. |
| 329 */ |
| 330 VAConfigAttribEncPackedHeaders = 10, |
| 331 /** |
| 332 * \brief Interlaced mode. Read/write. |
| 333 * |
| 334 * This attribute determines what kind of interlaced encoding mode |
| 335 * the driver supports. |
| 336 * |
| 337 * See \c VA_ENC_INTERLACED_xxx for the list of interlaced modes. |
| 338 */ |
| 339 VAConfigAttribEncInterlaced = 11, |
| 340 /** |
| 341 * \brief Maximum number of reference frames. Read-only. |
| 342 * |
| 343 * This attribute determines the maximum number of reference |
| 344 * frames supported for encoding. |
| 345 * |
| 346 * Note: for H.264 encoding, the value represents the maximum number |
| 347 * of reference frames for both the reference picture list 0 (bottom |
| 348 * 16 bits) and the reference picture list 1 (top 16 bits). |
| 349 */ |
| 350 VAConfigAttribEncMaxRefFrames = 13, |
| 351 /** |
| 352 * \brief Maximum number of slices per frame. Read-only. |
| 353 * |
| 354 * This attribute determines the maximum number of slices the |
| 355 * driver can support to encode a single frame. |
| 356 */ |
| 357 VAConfigAttribEncMaxSlices = 14, |
| 358 /** |
| 359 * \brief Slice structure. Read-only. |
| 360 * |
| 361 * This attribute determines slice structures supported by the |
| 362 * driver for encoding. This attribute is a hint to the user so |
| 363 * that he can choose a suitable surface size and how to arrange |
| 364 * the encoding process of multiple slices per frame. |
| 365 * |
| 366 * More specifically, for H.264 encoding, this attribute |
| 367 * determines the range of accepted values to |
| 368 * VAEncSliceParameterBufferH264::macroblock_address and |
| 369 * VAEncSliceParameterBufferH264::num_macroblocks. |
| 370 * |
| 371 * See \c VA_ENC_SLICE_STRUCTURE_xxx for the supported slice |
| 372 * structure types. |
| 373 */ |
| 374 VAConfigAttribEncSliceStructure = 15, |
| 375 /** |
| 376 * \brief Macroblock information. Read-only. |
| 377 * |
| 378 * This attribute determines whether the driver supports extra |
| 379 * encoding information per-macroblock. e.g. QP. |
| 380 * |
| 381 * More specifically, for H.264 encoding, if the driver returns a non-zero |
| 382 * value for this attribute, this means the application can create |
| 383 * additional #VAEncMacroblockParameterBufferH264 buffers referenced |
| 384 * through VAEncSliceParameterBufferH264::macroblock_info. |
| 385 */ |
| 386 VAConfigAttribEncMacroblockInfo = 16, |
| 387 /**@}*/ |
| 388 VAConfigAttribTypeMax |
268 } VAConfigAttribType; | 389 } VAConfigAttribType; |
269 | 390 |
270 /* | 391 /* |
271 * Configuration attributes | 392 * Configuration attributes |
272 * If there is more than one value for an attribute, a default | 393 * If there is more than one value for an attribute, a default |
273 * value will be assigned to the attribute if the client does not | 394 * value will be assigned to the attribute if the client does not |
274 * specify the attribute when creating a configuration | 395 * specify the attribute when creating a configuration |
275 */ | 396 */ |
276 typedef struct _VAConfigAttrib { | 397 typedef struct _VAConfigAttrib { |
277 VAConfigAttribType type; | 398 VAConfigAttribType type; |
278 unsigned int value; /* OR'd flags (bits) for this attribute */ | 399 unsigned int value; /* OR'd flags (bits) for this attribute */ |
279 } VAConfigAttrib; | 400 } VAConfigAttrib; |
280 | 401 |
281 /* attribute value for VAConfigAttribRTFormat */ | 402 /* attribute value for VAConfigAttribRTFormat */ |
282 #define VA_RT_FORMAT_YUV420 0x00000001 | 403 #define VA_RT_FORMAT_YUV420 0x00000001 |
283 #define VA_RT_FORMAT_YUV422 0x00000002 | 404 #define VA_RT_FORMAT_YUV422 0x00000002 |
284 #define VA_RT_FORMAT_YUV444 0x00000004 | 405 #define VA_RT_FORMAT_YUV444 0x00000004 |
| 406 #define VA_RT_FORMAT_YUV411 0x00000008 |
| 407 #define VA_RT_FORMAT_YUV400 0x00000010 |
| 408 #define VA_RT_FORMAT_RGB16 0x00010000 |
| 409 #define VA_RT_FORMAT_RGB32 0x00020000 |
| 410 /* RGBP covers RGBP and BGRP fourcc */ |
| 411 #define VA_RT_FORMAT_RGBP 0x00100000 |
285 #define VA_RT_FORMAT_PROTECTED 0x80000000 | 412 #define VA_RT_FORMAT_PROTECTED 0x80000000 |
286 | 413 |
287 /* attribute value for VAConfigAttribRateControl */ | 414 /** @name Attribute values for VAConfigAttribRateControl */ |
288 #define VA_RC_NONE» 0x00000001» | 415 /**@{*/ |
289 #define VA_RC_CBR» 0x00000002» | 416 /** \brief Driver does not support any form of rate control. */ |
290 #define VA_RC_VBR» 0x00000004» | 417 #define VA_RC_NONE 0x00000001 |
291 #define VA_RC_VCM» 0x00000008 /* video conference mode */ | 418 /** \brief Constant bitrate. */ |
| 419 #define VA_RC_CBR 0x00000002 |
| 420 /** \brief Variable bitrate. */ |
| 421 #define VA_RC_VBR 0x00000004 |
| 422 /** \brief Video conference mode. */ |
| 423 #define VA_RC_VCM 0x00000008 |
| 424 /** \brief Constant QP. */ |
| 425 #define VA_RC_CQP 0x00000010 |
| 426 /** \brief Variable bitrate with peak rate higher than average bitrate. */ |
| 427 #define VA_RC_VBR_CONSTRAINED 0x00000020 |
| 428 /**@}*/ |
| 429 |
| 430 /** @name Attribute values for VAConfigAttribEncPackedHeaders */ |
| 431 /**@{*/ |
| 432 /** \brief Driver does not support any packed headers mode. */ |
| 433 #define VA_ENC_PACKED_HEADER_NONE 0x00000000 |
| 434 /** \brief Driver supports packed sequence headers. e.g. SPS for H.264. */ |
| 435 #define VA_ENC_PACKED_HEADER_SEQUENCE 0x00000001 |
| 436 /** \brief Driver supports packed picture headers. e.g. PPS for H.264. */ |
| 437 #define VA_ENC_PACKED_HEADER_PICTURE 0x00000002 |
| 438 /** \brief Driver supports packed slice headers. e.g. \c slice_header() for H.26
4. */ |
| 439 #define VA_ENC_PACKED_HEADER_SLICE 0x00000004 |
| 440 /** \brief Driver supports misc packed headers. e.g. SEI for H.264. */ |
| 441 #define VA_ENC_PACKED_HEADER_MISC 0x00000008 |
| 442 /** \brief Driver supports raw packed header, see VAEncPackedHeaderRawData */ |
| 443 #define VA_ENC_PACKED_HEADER_RAW_DATA 0x0000000C |
| 444 /**@}*/ |
| 445 |
| 446 /** @name Attribute values for VAConfigAttribEncInterlaced */ |
| 447 /**@{*/ |
| 448 /** \brief Driver does not support interlaced coding. */ |
| 449 #define VA_ENC_INTERLACED_NONE 0x00000000 |
| 450 /** \brief Driver supports interlaced frame coding. */ |
| 451 #define VA_ENC_INTERLACED_FRAME 0x00000001 |
| 452 /** \brief Driver supports interlaced field coding. */ |
| 453 #define VA_ENC_INTERLACED_FIELD 0x00000002 |
| 454 /** \brief Driver supports macroblock adaptive frame field coding. */ |
| 455 #define VA_ENC_INTERLACED_MBAFF 0x00000004 |
| 456 /** \brief Driver supports picture adaptive frame field coding. */ |
| 457 #define VA_ENC_INTERLACED_PAFF 0x00000008 |
| 458 /**@}*/ |
| 459 |
| 460 /** @name Attribute values for VAConfigAttribEncSliceStructure */ |
| 461 /**@{*/ |
| 462 /** \brief Driver supports an arbitrary number of rows per slice. */ |
| 463 #define VA_ENC_SLICE_STRUCTURE_ARBITRARY_ROWS 0x00000000 |
| 464 /** \brief Driver supports a power-of-two number of rows per slice. */ |
| 465 #define VA_ENC_SLICE_STRUCTURE_POWER_OF_TWO_ROWS 0x00000001 |
| 466 /** \brief Driver supports an arbitrary number of rows per slice. */ |
| 467 #define VA_ENC_SLICE_STRUCTURE_ARBITRARY_MACROBLOCKS 0x00000002 |
| 468 /**@}*/ |
292 | 469 |
293 /* | 470 /* |
294 * if an attribute is not applicable for a given | 471 * if an attribute is not applicable for a given |
295 * profile/entrypoint pair, then set the value to the following | 472 * profile/entrypoint pair, then set the value to the following |
296 */ | 473 */ |
297 #define VA_ATTRIB_NOT_SUPPORTED 0x80000000 | 474 #define VA_ATTRIB_NOT_SUPPORTED 0x80000000 |
298 | 475 |
299 /* Get maximum number of profiles supported by the implementation */ | 476 /* Get maximum number of profiles supported by the implementation */ |
300 int vaMaxNumProfiles ( | 477 int vaMaxNumProfiles ( |
301 VADisplay dpy | 478 VADisplay dpy |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 * implementation specific internals are kept opaque to the clients | 590 * implementation specific internals are kept opaque to the clients |
414 */ | 591 */ |
415 | 592 |
416 typedef VAGenericID VAContextID; | 593 typedef VAGenericID VAContextID; |
417 | 594 |
418 typedef VAGenericID VASurfaceID; | 595 typedef VAGenericID VASurfaceID; |
419 | 596 |
420 #define VA_INVALID_ID 0xffffffff | 597 #define VA_INVALID_ID 0xffffffff |
421 #define VA_INVALID_SURFACE VA_INVALID_ID | 598 #define VA_INVALID_SURFACE VA_INVALID_ID |
422 | 599 |
423 /* | 600 /** \brief Generic value types. */ |
424 * vaCreateSurfaces - Create an array of surfaces used for decode and display | 601 typedef enum { |
425 * dpy: display | 602 VAGenericValueTypeInteger = 1, /**< 32-bit signed integer. */ |
426 * width: surface width | 603 VAGenericValueTypeFloat, /**< 32-bit floating-point value. */ |
427 * height: surface height | 604 VAGenericValueTypePointer, /**< Generic pointer type */ |
428 * format: VA_RT_FORMAT_YUV420, VA_RT_FORMAT_YUV422 or VA_RT_FORMAT_YUV444 | 605 VAGenericValueTypeFunc /**< Pointer to function */ |
429 * num_surfaces: number of surfaces to be created | 606 } VAGenericValueType; |
430 * surfaces: array of surfaces created upon return | 607 |
431 */ | 608 /** \brief Generic function type. */ |
432 VAStatus vaCreateSurfaces ( | 609 typedef void (*VAGenericFunc)(void); |
433 VADisplay dpy, | 610 |
434 int width, | 611 /** \brief Generic value. */ |
435 int height, | 612 typedef struct _VAGenericValue { |
436 int format, | 613 /** \brief Value type. See #VAGenericValueType. */ |
437 int num_surfaces, | 614 VAGenericValueType type; |
438 VASurfaceID *surfaces» /* out */ | 615 /** \brief Value holder. */ |
| 616 union { |
| 617 /** \brief 32-bit signed integer. */ |
| 618 int i; |
| 619 /** \brief 32-bit float. */ |
| 620 float f; |
| 621 /** \brief Generic pointer. */ |
| 622 void *p; |
| 623 /** \brief Pointer to function. */ |
| 624 VAGenericFunc fn; |
| 625 } value; |
| 626 } VAGenericValue; |
| 627 |
| 628 /** @name Surface attribute flags */ |
| 629 /**@{*/ |
| 630 /** \brief Surface attribute is not supported. */ |
| 631 #define VA_SURFACE_ATTRIB_NOT_SUPPORTED 0x00000000 |
| 632 /** \brief Surface attribute can be got through vaQuerySurfaceAttributes(). */ |
| 633 #define VA_SURFACE_ATTRIB_GETTABLE 0x00000001 |
| 634 /** \brief Surface attribute can be set through vaCreateSurfaces(). */ |
| 635 #define VA_SURFACE_ATTRIB_SETTABLE 0x00000002 |
| 636 /**@}*/ |
| 637 |
| 638 /** \brief Surface attribute types. */ |
| 639 typedef enum { |
| 640 VASurfaceAttribNone = 0, |
| 641 /** |
| 642 * \brief Pixel format (fourcc). |
| 643 * |
| 644 * The value is meaningful as input to vaQuerySurfaceAttributes(). |
| 645 * If zero, the driver returns the optimal pixel format for the |
| 646 * specified config. Otherwise, if non-zero, the value represents |
| 647 * a pixel format (FOURCC) that is kept as is on output, if the |
| 648 * driver supports it. Otherwise, the driver sets the value to |
| 649 * zero and drops the \c VA_SURFACE_ATTRIB_SETTABLE flag. |
| 650 */ |
| 651 VASurfaceAttribPixelFormat, |
| 652 /** \brief Minimal width in pixels (int, read-only). */ |
| 653 VASurfaceAttribMinWidth, |
| 654 /** \brief Maximal width in pixels (int, read-only). */ |
| 655 VASurfaceAttribMaxWidth, |
| 656 /** \brief Minimal height in pixels (int, read-only). */ |
| 657 VASurfaceAttribMinHeight, |
| 658 /** \brief Maximal height in pixels (int, read-only). */ |
| 659 VASurfaceAttribMaxHeight, |
| 660 /** \brief Surface memory type expressed in bit fields (int, read/write). */ |
| 661 VASurfaceAttribMemoryType, |
| 662 /** \brief External buffer descriptor (pointer, write). */ |
| 663 VASurfaceAttribExternalBufferDescriptor, |
| 664 /** \brief Number of surface attributes. */ |
| 665 VASurfaceAttribCount |
| 666 } VASurfaceAttribType; |
| 667 |
| 668 /** \brief Surface attribute. */ |
| 669 typedef struct _VASurfaceAttrib { |
| 670 /** \brief Type. */ |
| 671 VASurfaceAttribType type; |
| 672 /** \brief Flags. See "Surface attribute flags". */ |
| 673 unsigned int flags; |
| 674 /** \brief Value. See "Surface attribute types" for the expected types. */ |
| 675 VAGenericValue value; |
| 676 } VASurfaceAttrib; |
| 677 |
| 678 /** |
| 679 * @name VASurfaceAttribMemoryType values in bit fields. |
| 680 * Bit 0:7 are reserved for generic types, Bit 31:28 are reserved for |
| 681 * Linux DRM, Bit 23:20 are reserved for Android. DRM and Android specific |
| 682 * types are defined in DRM and Android header files. |
| 683 */ |
| 684 /**@{*/ |
| 685 /** \brief VA memory type (default) is supported. */ |
| 686 #define VA_SURFACE_ATTRIB_MEM_TYPE_VA» » » 0x00000001 |
| 687 /** \brief V4L2 buffer memory type is supported. */ |
| 688 #define VA_SURFACE_ATTRIB_MEM_TYPE_V4L2»» » 0x00000002 |
| 689 /** \brief User pointer memory type is supported. */ |
| 690 #define VA_SURFACE_ATTRIB_MEM_TYPE_USER_PTR» » 0x00000004 |
| 691 /**@}*/ |
| 692 |
| 693 /** |
| 694 * \brief VASurfaceAttribExternalBuffers structure for |
| 695 * the VASurfaceAttribExternalBufferDescriptor attribute. |
| 696 */ |
| 697 typedef struct _VASurfaceAttribExternalBuffers { |
| 698 /** \brief pixel format in fourcc. */ |
| 699 unsigned int pixel_format; |
| 700 /** \brief width in pixels. */ |
| 701 unsigned int width; |
| 702 /** \brief height in pixels. */ |
| 703 unsigned int height; |
| 704 /** \brief total size of the buffer in bytes. */ |
| 705 unsigned int data_size; |
| 706 /** \brief number of planes for planar layout */ |
| 707 unsigned int num_planes; |
| 708 /** \brief pitch for each plane in bytes */ |
| 709 unsigned int pitches[4]; |
| 710 /** \brief offset for each plane in bytes */ |
| 711 unsigned int offsets[4]; |
| 712 /** \brief buffer handles or user pointers */ |
| 713 unsigned long *buffers; |
| 714 /** \brief number of elements in the "buffers" array */ |
| 715 unsigned int num_buffers; |
| 716 /** \brief flags. See "Surface external buffer descriptor flags". */ |
| 717 unsigned int flags; |
| 718 /** \brief reserved for passing private data */ |
| 719 void *private_data; |
| 720 } VASurfaceAttribExternalBuffers; |
| 721 |
| 722 /** @name VASurfaceAttribExternalBuffers flags */ |
| 723 /**@{*/ |
| 724 /** \brief Enable memory tiling */ |
| 725 #define VA_SURFACE_EXTBUF_DESC_ENABLE_TILING» 0x00000001 |
| 726 /** \brief Memory is cacheable */ |
| 727 #define VA_SURFACE_EXTBUF_DESC_CACHED» » 0x00000002 |
| 728 /** \brief Memory is non-cacheable */ |
| 729 #define VA_SURFACE_EXTBUF_DESC_UNCACHED»» 0x00000004 |
| 730 /** \brief Memory is write-combined */ |
| 731 #define VA_SURFACE_EXTBUF_DESC_WC» » 0x00000008 |
| 732 /** \brief Memory is protected */ |
| 733 #define VA_SURFACE_EXTBUF_DESC_PROTECTED 0x80000000 |
| 734 |
| 735 /**@}*/ |
| 736 |
| 737 /** |
| 738 * \brief Queries surface attributes for the supplied config. |
| 739 * |
| 740 * Unlike vaGetSurfaceAttributes(), this function queries for all |
| 741 * supported attributes for the supplied VA @config. In particular, if |
| 742 * the underlying hardware supports the creation of VA surfaces in |
| 743 * various formats, then this function will enumerate all pixel |
| 744 * formats that are supported. |
| 745 * |
| 746 * The \c attrib_list array is allocated by the user and \c |
| 747 * num_attribs shall be initialized to the number of allocated |
| 748 * elements in that array. Upon successful return, the actual number |
| 749 * of attributes will be overwritten into \c num_attribs. Otherwise, |
| 750 * \c VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned and \c num_attribs |
| 751 * is adjusted to the number of elements that would be returned if |
| 752 * enough space was available. |
| 753 * |
| 754 * Note: it is perfectly valid to pass NULL to the \c attrib_list |
| 755 * argument when vaQuerySurfaceAttributes() is used to determine the |
| 756 * actual number of elements that need to be allocated. |
| 757 * |
| 758 * @param[in] dpy the VA display |
| 759 * @param[in] config the config identifying a codec or a video |
| 760 * processing pipeline |
| 761 * @param[out] attrib_list the output array of #VASurfaceAttrib elements |
| 762 * @param[in,out] num_attribs the number of elements allocated on |
| 763 * input, the number of elements actually filled in output |
| 764 */ |
| 765 VAStatus |
| 766 vaQuerySurfaceAttributes( |
| 767 VADisplay dpy, |
| 768 VAConfigID config, |
| 769 VASurfaceAttrib *attrib_list, |
| 770 unsigned int *num_attribs |
439 ); | 771 ); |
440 | 772 |
| 773 /** |
| 774 * \brief Creates an array of surfaces |
| 775 * |
| 776 * Creates an array of surfaces. The optional list of attributes shall |
| 777 * be constructed and validated through vaGetSurfaceAttributes() or |
| 778 * constructed based based on what the underlying hardware could |
| 779 * expose through vaQuerySurfaceAttributes(). |
| 780 * |
| 781 * @param[in] dpy the VA display |
| 782 * @param[in] format the desired surface format. See \c VA_RT_FORMAT_
* |
| 783 * @param[in] width the surface width |
| 784 * @param[in] height the surface height |
| 785 * @param[out] surfaces the array of newly created surfaces |
| 786 * @param[in] num_surfaces the number of surfaces to create |
| 787 * @param[in] attrib_list the list of (optional) attributes, or \c NULL |
| 788 * @param[in] num_attribs the number of attributes supplied in |
| 789 * \c attrib_list, or zero |
| 790 */ |
| 791 VAStatus |
| 792 vaCreateSurfaces( |
| 793 VADisplay dpy, |
| 794 unsigned int format, |
| 795 unsigned int width, |
| 796 unsigned int height, |
| 797 VASurfaceID *surfaces, |
| 798 unsigned int num_surfaces, |
| 799 VASurfaceAttrib *attrib_list, |
| 800 unsigned int num_attribs |
| 801 ); |
441 | 802 |
442 /* | 803 /* |
443 * vaDestroySurfaces - Destroy resources associated with surfaces. | 804 * vaDestroySurfaces - Destroy resources associated with surfaces. |
444 * Surfaces can only be destroyed after the context associated has been | 805 * Surfaces can only be destroyed after the context associated has been |
445 * destroyed. | 806 * destroyed. |
446 * dpy: display | 807 * dpy: display |
447 * surfaces: array of surfaces to destroy | 808 * surfaces: array of surfaces to destroy |
448 * num_surfaces: number of surfaces in the array to be destroyed. | 809 * num_surfaces: number of surfaces in the array to be destroyed. |
449 */ | 810 */ |
450 VAStatus vaDestroySurfaces ( | 811 VAStatus vaDestroySurfaces ( |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 VAImageBufferType = 9, | 872 VAImageBufferType = 9, |
512 VAProtectedSliceDataBufferType = 10, | 873 VAProtectedSliceDataBufferType = 10, |
513 VAQMatrixBufferType = 11, | 874 VAQMatrixBufferType = 11, |
514 VAHuffmanTableBufferType = 12, | 875 VAHuffmanTableBufferType = 12, |
515 | 876 |
516 /* Following are encode buffer types */ | 877 /* Following are encode buffer types */ |
517 VAEncCodedBufferType = 21, | 878 VAEncCodedBufferType = 21, |
518 VAEncSequenceParameterBufferType = 22, | 879 VAEncSequenceParameterBufferType = 22, |
519 VAEncPictureParameterBufferType = 23, | 880 VAEncPictureParameterBufferType = 23, |
520 VAEncSliceParameterBufferType = 24, | 881 VAEncSliceParameterBufferType = 24, |
521 VAEncH264VUIBufferType» » = 25, | 882 VAEncPackedHeaderParameterBufferType = 25, |
522 VAEncH264SEIBufferType» » = 26, | 883 VAEncPackedHeaderDataBufferType = 26, |
523 VAEncMiscParameterBufferType = 27, | 884 VAEncMiscParameterBufferType = 27, |
524 VABufferTypeMax = 0xff | 885 VAEncMacroblockParameterBufferType» = 28, |
| 886 /* Following are video processing buffer types */ |
| 887 /** |
| 888 * \brief Video processing pipeline parameter buffer. |
| 889 * |
| 890 * This buffer describes the video processing pipeline. See |
| 891 * #VAProcPipelineParameterBuffer for details. |
| 892 */ |
| 893 VAProcPipelineParameterBufferType = 41, |
| 894 /** |
| 895 * \brief Video filter parameter buffer. |
| 896 * |
| 897 * This buffer describes the video filter parameters. All buffers |
| 898 * inherit from #VAProcFilterParameterBufferBase, thus including |
| 899 * a unique filter buffer type. |
| 900 * |
| 901 * The default buffer used by most filters is #VAProcFilterParameterBuffer. |
| 902 * Filters requiring advanced parameters include, but are not limited to, |
| 903 * deinterlacing (#VAProcFilterParameterBufferDeinterlacing), |
| 904 * color balance (#VAProcFilterParameterBufferColorBalance), etc. |
| 905 */ |
| 906 VAProcFilterParameterBufferType = 42, |
| 907 VABufferTypeMax |
525 } VABufferType; | 908 } VABufferType; |
526 | 909 |
527 typedef enum | 910 typedef enum |
528 { | 911 { |
529 VAEncMiscParameterTypeFrameRate = 0, | 912 VAEncMiscParameterTypeFrameRate = 0, |
530 VAEncMiscParameterTypeRateControl = 1, | 913 VAEncMiscParameterTypeRateControl = 1, |
531 VAEncMiscParameterTypeMaxSliceSize = 2, | 914 VAEncMiscParameterTypeMaxSliceSize = 2, |
532 VAEncMiscParameterTypeAIR = 3, | 915 VAEncMiscParameterTypeAIR = 3, |
| 916 /** \brief Buffer type used to express a maximum frame size (in bits). */ |
| 917 VAEncMiscParameterTypeMaxFrameSize = 4, |
| 918 /** \brief Buffer type used for HRD parameters. */ |
| 919 VAEncMiscParameterTypeHRD = 5, |
533 } VAEncMiscParameterType; | 920 } VAEncMiscParameterType; |
534 | 921 |
| 922 /** \brief Packed header type. */ |
| 923 typedef enum { |
| 924 /** \brief Packed sequence header. */ |
| 925 VAEncPackedHeaderSequence = 1, |
| 926 /** \brief Packed picture header. */ |
| 927 VAEncPackedHeaderPicture = 2, |
| 928 /** \brief Packed slice header. */ |
| 929 VAEncPackedHeaderSlice = 3, |
| 930 /** |
| 931 * \brief Packed raw header. |
| 932 * |
| 933 * Packed raw data header can be used by the client to insert a header |
| 934 * into the bitstream data buffer at the point it is passed, the driver |
| 935 * will handle the raw packed header based on "has_emulation_bytes" field |
| 936 * in the packed header parameter structure. |
| 937 */ |
| 938 VAEncPackedHeaderRawData = 4, |
| 939 /** \brief Misc packed header. See codec-specific definitions. */ |
| 940 VAEncPackedHeaderMiscMask = 0x80000000, |
| 941 } VAEncPackedHeaderType; |
| 942 |
| 943 /** \brief Packed header parameter. */ |
| 944 typedef struct _VAEncPackedHeaderParameterBuffer { |
| 945 /** Type of the packed header buffer. See #VAEncPackedHeaderType. */ |
| 946 unsigned int type; |
| 947 /** \brief Size of the #VAEncPackedHeaderDataBuffer in bits. */ |
| 948 unsigned int bit_length; |
| 949 /** \brief Flag: buffer contains start code emulation prevention bytes? */ |
| 950 unsigned char has_emulation_bytes; |
| 951 } VAEncPackedHeaderParameterBuffer; |
| 952 |
535 /* | 953 /* |
536 * For application, e.g. set a new bitrate | 954 * For application, e.g. set a new bitrate |
537 * VABufferID buf_id; | 955 * VABufferID buf_id; |
538 * VAEncMiscParameterBuffer *misc_param; | 956 * VAEncMiscParameterBuffer *misc_param; |
539 * VAEncMiscParameterRateControl *misc_rate_ctrl; | 957 * VAEncMiscParameterRateControl *misc_rate_ctrl; |
540 * | 958 * |
541 * vaCreateBuffer(dpy, context, VAEncMiscParameterBufferType, | 959 * vaCreateBuffer(dpy, context, VAEncMiscParameterBufferType, |
542 * sizeof(VAEncMiscParameterBuffer) + sizeof(VAEncMiscParameterRate
Control), | 960 * sizeof(VAEncMiscParameterBuffer) + sizeof(VAEncMiscParameterRate
Control), |
543 * 1, NULL, &buf_id); | 961 * 1, NULL, &buf_id); |
544 * | 962 * |
545 * vaMapBuffer(dpy,buf_id,(void **)&misc_param); | 963 * vaMapBuffer(dpy,buf_id,(void **)&misc_param); |
546 * misc_param->type = VAEncMiscParameterTypeRateControl; | 964 * misc_param->type = VAEncMiscParameterTypeRateControl; |
547 * misc_rate_ctrl= (VAEncMiscParameterRateControl *)misc_param->data; | 965 * misc_rate_ctrl= (VAEncMiscParameterRateControl *)misc_param->data; |
548 * misc_rate_ctrl->bits_per_second = 6400000; | 966 * misc_rate_ctrl->bits_per_second = 6400000; |
549 * vaUnmapBuffer(dpy, buf_id); | 967 * vaUnmapBuffer(dpy, buf_id); |
550 * vaRenderPicture(dpy, context, &buf_id, 1); | 968 * vaRenderPicture(dpy, context, &buf_id, 1); |
551 */ | 969 */ |
552 typedef struct _VAEncMiscParameterBuffer | 970 typedef struct _VAEncMiscParameterBuffer |
553 { | 971 { |
554 VAEncMiscParameterType type; | 972 VAEncMiscParameterType type; |
555 unsigned int data[0]; | 973 unsigned int data[0]; |
556 } VAEncMiscParameterBuffer; | 974 } VAEncMiscParameterBuffer; |
557 | 975 |
| 976 |
| 977 /** \brief Rate control parameters */ |
558 typedef struct _VAEncMiscParameterRateControl | 978 typedef struct _VAEncMiscParameterRateControl |
559 { | 979 { |
560 unsigned int bits_per_second; /* this is the maximum bit-rate to be constrai
ned by the rate control implementation */ | 980 /* this is the maximum bit-rate to be constrained by the rate control implem
entation */ |
561 unsigned int target_percentage; /* this is the bit-rate the rate control is
targeting, as a percentage of the maximum bit-rate */ | 981 unsigned int bits_per_second; |
562 /* for example if target_percentage is 95 th
en the rate control will target a bit-rate that is */ | 982 /* this is the bit-rate the rate control is targeting, as a percentage of th
e maximum |
563 /* 95% of the maximum bit-rate */ | 983 * bit-rate for example if target_percentage is 95 then the rate control wil
l target |
564 unsigned int window_size; /* windows size in milliseconds. For example if th
is is set to 500, then the rate control will guarantee the */ | 984 * a bit-rate that is 95% of the maximum bit-rate |
565 /* target bit-rate over a 500 ms window */ | 985 */ |
566 unsigned int initial_qp; /* initial QP at I frames */ | 986 unsigned int target_percentage; |
567 unsigned int min_qp; | 987 /* windows size in milliseconds. For example if this is set to 500, |
| 988 * then the rate control will guarantee the target bit-rate over a 500 ms wi
ndow |
| 989 */ |
| 990 unsigned int window_size; |
| 991 /* initial QP at I frames */ |
| 992 unsigned int initial_qp; |
| 993 unsigned int min_qp; |
| 994 unsigned int basic_unit_size; |
| 995 union |
| 996 { |
| 997 struct |
| 998 { |
| 999 unsigned int reset : 1; |
| 1000 unsigned int disable_frame_skip : 1; /* Disable frame skip in rate c
ontrol mode */ |
| 1001 unsigned int disable_bit_stuffing : 1; /* Disable bit stuffing in ra
te control mode */ |
| 1002 } bits; |
| 1003 unsigned int value; |
| 1004 } rc_flags; |
568 } VAEncMiscParameterRateControl; | 1005 } VAEncMiscParameterRateControl; |
569 | 1006 |
570 typedef struct _VAEncMiscParameterFrameRate | 1007 typedef struct _VAEncMiscParameterFrameRate |
571 { | 1008 { |
572 unsigned int framerate; | 1009 unsigned int framerate; |
573 } VAEncMiscParameterFrameRate; | 1010 } VAEncMiscParameterFrameRate; |
574 | 1011 |
575 /* | 1012 /* |
576 * Allow a maximum slice size to be specified (in bits). | 1013 * Allow a maximum slice size to be specified (in bits). |
577 * The encoder will attempt to make sure that individual slices do not exceed th
is size | 1014 * The encoder will attempt to make sure that individual slices do not exceed th
is size |
578 * Or to signal applicate if the slice size exceed this size, see "status" of VA
CodedBufferSegment | 1015 * Or to signal applicate if the slice size exceed this size, see "status" of VA
CodedBufferSegment |
579 */ | 1016 */ |
580 typedef struct _VAEncMiscParameterMaxSliceSize | 1017 typedef struct _VAEncMiscParameterMaxSliceSize |
581 { | 1018 { |
582 unsigned int max_slice_size; | 1019 unsigned int max_slice_size; |
583 } VAEncMiscParameterMaxSliceSize; | 1020 } VAEncMiscParameterMaxSliceSize; |
584 | 1021 |
585 typedef struct _VAEncMiscParameterAIR | 1022 typedef struct _VAEncMiscParameterAIR |
586 { | 1023 { |
587 unsigned int air_num_mbs; | 1024 unsigned int air_num_mbs; |
588 unsigned int air_threshold; | 1025 unsigned int air_threshold; |
589 unsigned int air_auto; /* if set to 1 then hardware auto-tune the AIR thresh
old */ | 1026 unsigned int air_auto; /* if set to 1 then hardware auto-tune the AIR thresh
old */ |
590 } VAEncMiscParameterAIR; | 1027 } VAEncMiscParameterAIR; |
591 | 1028 |
| 1029 typedef struct _VAEncMiscParameterHRD |
| 1030 { |
| 1031 unsigned int initial_buffer_fullness; /* in bits */ |
| 1032 unsigned int buffer_size; /* in bits */ |
| 1033 } VAEncMiscParameterHRD; |
| 1034 |
| 1035 /** |
| 1036 * \brief Defines a maximum frame size (in bits). |
| 1037 * |
| 1038 * This misc parameter buffer defines the maximum size of a frame (in |
| 1039 * bits). The encoder will try to make sure that each frame does not |
| 1040 * exceed this size. Otherwise, if the frame size exceeds this size, |
| 1041 * the \c status flag of #VACodedBufferSegment will contain |
| 1042 * #VA_CODED_BUF_STATUS_FRAME_SIZE_OVERFLOW. |
| 1043 */ |
| 1044 typedef struct _VAEncMiscParameterBufferMaxFrameSize { |
| 1045 /** \brief Type. Shall be set to #VAEncMiscParameterTypeMaxFrameSize. */ |
| 1046 VAEncMiscParameterType type; |
| 1047 /** \brief Maximum size of a frame (in bits). */ |
| 1048 unsigned int max_frame_size; |
| 1049 } VAEncMiscParameterBufferMaxFrameSize; |
592 | 1050 |
593 /* | 1051 /* |
594 * There will be cases where the bitstream buffer will not have enough room to h
old | 1052 * There will be cases where the bitstream buffer will not have enough room to h
old |
595 * the data for the entire slice, and the following flags will be used in the sl
ice | 1053 * the data for the entire slice, and the following flags will be used in the sl
ice |
596 * parameter to signal to the server for the possible cases. | 1054 * parameter to signal to the server for the possible cases. |
597 * If a slice parameter buffer and slice data buffer pair is sent to the server
with | 1055 * If a slice parameter buffer and slice data buffer pair is sent to the server
with |
598 * the slice data partially in the slice data buffer (BEGIN and MIDDLE cases bel
ow), | 1056 * the slice data partially in the slice data buffer (BEGIN and MIDDLE cases bel
ow), |
599 * then a slice parameter and data buffer needs to be sent again to complete thi
s slice. | 1057 * then a slice parameter and data buffer needs to be sent again to complete thi
s slice. |
600 */ | 1058 */ |
601 #define VA_SLICE_DATA_FLAG_ALL 0x00 /* whole slice is in the buffer
*/ | 1059 #define VA_SLICE_DATA_FLAG_ALL 0x00 /* whole slice is in the buffer
*/ |
(...skipping 22 matching lines...) Expand all Loading... |
624 } VAQMatrixBufferJPEG; | 1082 } VAQMatrixBufferJPEG; |
625 | 1083 |
626 typedef struct _VAEncPictureParameterBufferJPEG | 1084 typedef struct _VAEncPictureParameterBufferJPEG |
627 { | 1085 { |
628 VASurfaceID reconstructed_picture; | 1086 VASurfaceID reconstructed_picture; |
629 unsigned short picture_width; | 1087 unsigned short picture_width; |
630 unsigned short picture_height; | 1088 unsigned short picture_height; |
631 VABufferID coded_buf; | 1089 VABufferID coded_buf; |
632 } VAEncPictureParameterBufferJPEG; | 1090 } VAEncPictureParameterBufferJPEG; |
633 | 1091 |
634 /* data struct for JPEG decoding */ | 1092 #include <va/va_dec_jpeg.h> |
635 | |
636 /* Quantization table */ | |
637 typedef struct _VAIQMatrixBufferJPEG | |
638 { | |
639 int precision[4]; /* valid value: 0(8-bits) , 1(16
-bits), precision[Tq](Tq=0,1,2,3) | |
640 * specifies precision for desti
nation Tq | |
641 */ | |
642 unsigned char quantiser_matrix[4][128]; /* quantiser_matrix[Tq](Tq=0,1,2
,3) specifies a | |
643 * quantization table for destin
ation Tq in zig-zag | |
644 * scan order. Only the first 64
bytes are valid for each | |
645 * table if precision is 0(8-bit
s). | |
646 */ | |
647 } VAIQMatrixBufferJPEG; | |
648 | |
649 #define VA_JPEG_SOF0 0xC0 | |
650 #define VA_JPEG_SOF1 0xC1 | |
651 #define VA_JPEG_SOF2 0xC2 | |
652 #define VA_JPEG_SOF3 0xC3 | |
653 #define VA_JPEG_SOF5 0xC5 | |
654 #define VA_JPEG_SOF6 0xC6 | |
655 #define VA_JPEG_SOF7 0xC7 | |
656 #define VA_JPEG_SOF9 0xC9 | |
657 #define VA_JPEG_SOF10 0xCA | |
658 #define VA_JPEG_SOF11 0xCB | |
659 #define VA_JPEG_SOF13 0xCD | |
660 #define VA_JPEG_SOF14 0xCE | |
661 | |
662 /* JPEG Picture Parameter Buffer */ | |
663 typedef struct _VAPictureParameterBufferJPEG | |
664 { | |
665 unsigned int type; /* SOFn */ | |
666 unsigned int sample_precision; | |
667 unsigned int image_width; | |
668 unsigned int image_height; | |
669 unsigned int num_components; | |
670 struct { | |
671 unsigned char component_id; /* Ci, the range is 0-255, see B
.2.2 */ | |
672 unsigned char h_sampling_factor; | |
673 unsigned char v_sampling_factor; | |
674 unsigned char quantiser_table_selector; /* Tqi, quantization table desti
nation selector */ | |
675 } components[4]; | |
676 | |
677 /* ROI (region of interest), for JPEG2000 */ | |
678 struct { | |
679 int enabled; | |
680 int start_x; | |
681 int start_y; | |
682 int end_x; | |
683 int end_y; | |
684 } roi; | |
685 | |
686 int rotation; | |
687 } VAPictureParameterBufferJPEG; | |
688 | |
689 typedef struct _VAHuffmanTableBufferJPEG | |
690 { | |
691 struct { | |
692 unsigned char dc_bits[16]; /* Number of Huffman codes of length i f
or DC */ | |
693 unsigned char dc_huffval[20]; /* Value associated with each Huffman co
de for DC */ | |
694 unsigned char ac_bits[16]; /* Number of Huffman codes of length i f
or AC */ | |
695 unsigned char ac_huffval[256]; /* Value associated with each Huffman co
de for AC */ | |
696 } huffman_table[4]; /* Up to 4 huffman tables, huffman_table
[Th](Th=0,1,2,3) | |
697 * specifies a buffman table for destina
tion Th. | |
698 */ | |
699 | |
700 } VAHuffmanTableBufferJPEG; | |
701 | |
702 /* JPEG Scan Parameter Buffer, The Scan of is similar to | |
703 * the Slice of other codecs */ | |
704 typedef struct _VASliceParameterBufferJPEG | |
705 { | |
706 unsigned int slice_data_size;» /* number of bytes in the slice data buf
fer for this slice */ | |
707 unsigned int slice_data_offset;» /* the offset to the first byte of slice
data */ | |
708 unsigned int slice_data_flag;» /* see VA_SLICE_DATA_FLAG_XXX definition
s */ | |
709 unsigned int slice_horizontal_position; | |
710 unsigned int slice_vertical_position; | |
711 | |
712 unsigned int num_components; | |
713 struct { | |
714 int component_id; /* Csj, it must match one of component_i
ds specified in VAPictureParameterBufferJPEG */ | |
715 int dc_selector; /* Tdj(0,1,2,3) */ | |
716 int ac_selector; /* Taj(0,1,2,3) */ | |
717 } components[4]; | |
718 | |
719 int restart_interval; /* specifies the number of MCUs in restart interval, d
efined in DRI marker */ | |
720 int num_mcus; /* indicates the number of MCUs in a scan */ | |
721 } VASliceParameterBufferJPEG; | |
722 | 1093 |
723 /**************************** | 1094 /**************************** |
724 * MPEG-2 data structures | 1095 * MPEG-2 data structures |
725 ****************************/ | 1096 ****************************/ |
726 | 1097 |
727 /* MPEG-2 Picture Parameter Buffer */ | 1098 /* MPEG-2 Picture Parameter Buffer */ |
728 /* | 1099 /* |
729 * For each frame or field, and before any slice data, a single | 1100 * For each frame or field, and before any slice data, a single |
730 * picture parameter buffer must be send. | 1101 * picture parameter buffer must be send. |
731 */ | 1102 */ |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1275 struct { | 1646 struct { |
1276 unsigned int is_intra : 1; | 1647 unsigned int is_intra : 1; |
1277 unsigned int disable_deblocking_filter_idc : 2; | 1648 unsigned int disable_deblocking_filter_idc : 2; |
1278 unsigned int uses_long_term_ref :1; | 1649 unsigned int uses_long_term_ref :1; |
1279 unsigned int is_long_term_ref :1; | 1650 unsigned int is_long_term_ref :1; |
1280 } bits; | 1651 } bits; |
1281 unsigned int value; | 1652 unsigned int value; |
1282 } slice_flags; | 1653 } slice_flags; |
1283 } VAEncSliceParameterBuffer; | 1654 } VAEncSliceParameterBuffer; |
1284 | 1655 |
1285 /**************************** | |
1286 * H.264 specific encode data structures | |
1287 ****************************/ | |
1288 | |
1289 typedef struct _VAEncSequenceParameterBufferH264 | |
1290 { | |
1291 unsigned char seq_parameter_set_id; | |
1292 unsigned char level_idc; | |
1293 unsigned int intra_period; | |
1294 unsigned int intra_idr_period; | |
1295 unsigned int max_num_ref_frames; | |
1296 unsigned int picture_width_in_mbs; | |
1297 unsigned int picture_height_in_mbs; | |
1298 unsigned int bits_per_second; | |
1299 unsigned int frame_rate; | |
1300 unsigned int initial_qp; | |
1301 unsigned int min_qp; | |
1302 unsigned int basic_unit_size; | |
1303 unsigned char vui_flag; | |
1304 } VAEncSequenceParameterBufferH264; | |
1305 | |
1306 #define H264_LAST_PICTURE_EOSEQ 0x01 /* the last picture in the sequence */ | |
1307 #define H264_LAST_PICTURE_EOSTREAM 0x02 /* the last picture in the stream */ | |
1308 typedef struct _VAEncPictureParameterBufferH264 | |
1309 { | |
1310 VASurfaceID reference_picture; | |
1311 VASurfaceID reconstructed_picture; | |
1312 VABufferID coded_buf; | |
1313 unsigned short picture_width; | |
1314 unsigned short picture_height; | |
1315 unsigned char last_picture; | |
1316 } VAEncPictureParameterBufferH264; | |
1317 | 1656 |
1318 /**************************** | 1657 /**************************** |
1319 * H.263 specific encode data structures | 1658 * H.263 specific encode data structures |
1320 ****************************/ | 1659 ****************************/ |
1321 | 1660 |
1322 typedef struct _VAEncSequenceParameterBufferH263 | 1661 typedef struct _VAEncSequenceParameterBufferH263 |
1323 { | 1662 { |
1324 unsigned int intra_period; | 1663 unsigned int intra_period; |
1325 unsigned int bits_per_second; | 1664 unsigned int bits_per_second; |
1326 unsigned int frame_rate; | 1665 unsigned int frame_rate; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1422 * exceeded the maximum slice size specified. | 1761 * exceeded the maximum slice size specified. |
1423 * BITRATE_OVERFLOW(bit10): The peak bitrate was exceeded for this frame. | 1762 * BITRATE_OVERFLOW(bit10): The peak bitrate was exceeded for this frame. |
1424 * BITRATE_HIGH(bit11): The frame size got within the safety margin of the maxim
um size (VCM only) | 1763 * BITRATE_HIGH(bit11): The frame size got within the safety margin of the maxim
um size (VCM only) |
1425 * AIR_MB_OVER_THRESHOLD: the number of MBs adapted to Intra MB | 1764 * AIR_MB_OVER_THRESHOLD: the number of MBs adapted to Intra MB |
1426 */ | 1765 */ |
1427 #define VA_CODED_BUF_STATUS_PICTURE_AVE_QP_MASK 0xff | 1766 #define VA_CODED_BUF_STATUS_PICTURE_AVE_QP_MASK 0xff |
1428 #define VA_CODED_BUF_STATUS_LARGE_SLICE_MASK 0x100 | 1767 #define VA_CODED_BUF_STATUS_LARGE_SLICE_MASK 0x100 |
1429 #define VA_CODED_BUF_STATUS_SLICE_OVERFLOW_MASK 0x200 | 1768 #define VA_CODED_BUF_STATUS_SLICE_OVERFLOW_MASK 0x200 |
1430 #define VA_CODED_BUF_STATUS_BITRATE_OVERFLOW 0x400 | 1769 #define VA_CODED_BUF_STATUS_BITRATE_OVERFLOW 0x400 |
1431 #define VA_CODED_BUF_STATUS_BITRATE_HIGH 0x800 | 1770 #define VA_CODED_BUF_STATUS_BITRATE_HIGH 0x800 |
| 1771 /** |
| 1772 * \brief The frame has exceeded the maximum requested size. |
| 1773 * |
| 1774 * This flag indicates that the encoded frame size exceeds the value |
| 1775 * specified through a misc parameter buffer of type |
| 1776 * #VAEncMiscParameterTypeMaxFrameSize. |
| 1777 */ |
| 1778 #define VA_CODED_BUF_STATUS_FRAME_SIZE_OVERFLOW 0x1000 |
1432 #define VA_CODED_BUF_STATUS_AIR_MB_OVER_THRESHOLD 0xff0000 | 1779 #define VA_CODED_BUF_STATUS_AIR_MB_OVER_THRESHOLD 0xff0000 |
1433 | 1780 |
1434 /* | 1781 /** |
1435 * device independent data structure for codedbuffer | 1782 * \brief The coded buffer segment contains a single NAL unit. |
| 1783 * |
| 1784 * This flag indicates that the coded buffer segment contains a |
| 1785 * single NAL unit. This flag might be useful to the user for |
| 1786 * processing the coded buffer. |
| 1787 */ |
| 1788 #define VA_CODED_BUF_STATUS_SINGLE_NALU 0x10000000» |
| 1789 |
| 1790 /** |
| 1791 * \brief Coded buffer segment. |
| 1792 * |
| 1793 * #VACodedBufferSegment is an element of a linked list describing |
| 1794 * some information on the coded buffer. The coded buffer segment |
| 1795 * could contain either a single NAL unit, or more than one NAL unit. |
| 1796 * It is recommended (but not required) to return a single NAL unit |
| 1797 * in a coded buffer segment, and the implementation should set the |
| 1798 * VA_CODED_BUF_STATUS_SINGLE_NALU status flag if that is the case. |
1436 */ | 1799 */ |
1437 typedef struct _VACodedBufferSegment { | 1800 typedef struct _VACodedBufferSegment { |
1438 unsigned int size;/* size of the data buffer in the coded buffer segment, in
bytes */ | 1801 /** |
1439 unsigned int bit_offset; /* bit offset into the data buffer where valid bits
tream data begins */ | 1802 * \brief Size of the data buffer in this segment (in bytes). |
1440 unsigned int status; /* status set by the driver on the coded buffer*/ | 1803 */ |
1441 unsigned int reserved; /* for future use */ | 1804 unsigned int size; |
1442 void *buf; /* pointer to the beginning of the data buffer in the coded buffe
r segment */ | 1805 /** \brief Bit offset into the data buffer where the video data starts. */ |
1443 void *next; /* pointer to the next VACodedBufferSegment */ | 1806 unsigned int bit_offset; |
| 1807 /** \brief Status set by the driver. See \c VA_CODED_BUF_STATUS_*. */ |
| 1808 unsigned int status; |
| 1809 /** \brief Reserved for future use. */ |
| 1810 unsigned int reserved; |
| 1811 /** \brief Pointer to the start of the data buffer. */ |
| 1812 void *buf; |
| 1813 /** |
| 1814 * \brief Pointer to the next #VACodedBufferSegment element, |
| 1815 * or \c NULL if there is none. |
| 1816 */ |
| 1817 void *next; |
1444 } VACodedBufferSegment; | 1818 } VACodedBufferSegment; |
1445 | 1819 |
1446 /* | 1820 /* |
1447 * Map data store of the buffer into the client's address space | 1821 * Map data store of the buffer into the client's address space |
1448 * vaCreateBuffer() needs to be called with "data" set to NULL before | 1822 * vaCreateBuffer() needs to be called with "data" set to NULL before |
1449 * calling vaMapBuffer() | 1823 * calling vaMapBuffer() |
1450 * | 1824 * |
1451 * if buffer type is VAEncCodedBufferType, pbuf points to link-list of | 1825 * if buffer type is VAEncCodedBufferType, pbuf points to link-list of |
1452 * VACodedBufferSegment, and the list is terminated if "next" is NULL | 1826 * VACodedBufferSegment, and the list is terminated if "next" is NULL |
1453 */ | 1827 */ |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1587 * Images and Subpictures | 1961 * Images and Subpictures |
1588 * VAImage is used to either get the surface data to client memory, or | 1962 * VAImage is used to either get the surface data to client memory, or |
1589 * to copy image data in client memory to a surface. | 1963 * to copy image data in client memory to a surface. |
1590 * Both images, subpictures and surfaces follow the same 2D coordinate system wh
ere origin | 1964 * Both images, subpictures and surfaces follow the same 2D coordinate system wh
ere origin |
1591 * is at the upper left corner with positive X to the right and positive Y down | 1965 * is at the upper left corner with positive X to the right and positive Y down |
1592 */ | 1966 */ |
1593 #define VA_FOURCC(ch0, ch1, ch2, ch3) \ | 1967 #define VA_FOURCC(ch0, ch1, ch2, ch3) \ |
1594 ((unsigned long)(unsigned char) (ch0) | ((unsigned long)(unsigned char) (ch1
) << 8) | \ | 1968 ((unsigned long)(unsigned char) (ch0) | ((unsigned long)(unsigned char) (ch1
) << 8) | \ |
1595 ((unsigned long)(unsigned char) (ch2) << 16) | ((unsigned long)(unsigned cha
r) (ch3) << 24 )) | 1969 ((unsigned long)(unsigned char) (ch2) << 16) | ((unsigned long)(unsigned cha
r) (ch3) << 24 )) |
1596 | 1970 |
1597 /* a few common FourCCs */ | 1971 /* |
| 1972 * Pre-defined fourcc codes |
| 1973 */ |
1598 #define VA_FOURCC_NV12 0x3231564E | 1974 #define VA_FOURCC_NV12 0x3231564E |
1599 #define VA_FOURCC_AI44 0x34344149 | 1975 #define VA_FOURCC_AI44 0x34344149 |
1600 #define VA_FOURCC_RGBA 0x41424752 | 1976 #define VA_FOURCC_RGBA 0x41424752 |
| 1977 #define VA_FOURCC_RGBX 0x58424752 |
1601 #define VA_FOURCC_BGRA 0x41524742 | 1978 #define VA_FOURCC_BGRA 0x41524742 |
| 1979 #define VA_FOURCC_BGRX 0x58524742 |
| 1980 #define VA_FOURCC_ARGB 0x42475241 |
| 1981 #define VA_FOURCC_XRGB 0x42475258 |
1602 #define VA_FOURCC_UYVY 0x59565955 | 1982 #define VA_FOURCC_UYVY 0x59565955 |
1603 #define VA_FOURCC_YUY2 0x32595559 | 1983 #define VA_FOURCC_YUY2 0x32595559 |
1604 #define VA_FOURCC_AYUV 0x56555941 | 1984 #define VA_FOURCC_AYUV 0x56555941 |
1605 #define VA_FOURCC_NV11 0x3131564e | 1985 #define VA_FOURCC_NV11 0x3131564e |
1606 #define VA_FOURCC_YV12 0x32315659 | 1986 #define VA_FOURCC_YV12 0x32315659 |
1607 #define VA_FOURCC_P208 0x38303250 | 1987 #define VA_FOURCC_P208 0x38303250 |
1608 #define VA_FOURCC_IYUV 0x56555949 | 1988 #define VA_FOURCC_IYUV 0x56555949 |
| 1989 #define VA_FOURCC_YV24 0x34325659 |
| 1990 #define VA_FOURCC_YV32 0x32335659 |
| 1991 #define VA_FOURCC_Y800 0x30303859 |
| 1992 #define VA_FOURCC_IMC3 0x33434D49 |
| 1993 #define VA_FOURCC_411P 0x50313134 |
| 1994 #define VA_FOURCC_422H 0x48323234 |
| 1995 #define VA_FOURCC_422V 0x56323234 |
| 1996 #define VA_FOURCC_444P 0x50343434 |
| 1997 #define VA_FOURCC_RGBP 0x50424752 |
| 1998 #define VA_FOURCC_BGRP 0x50524742 |
| 1999 #define VA_FOURCC_411R 0x52313134 /* rotated 411P */ |
1609 | 2000 |
1610 /* byte order */ | 2001 /* byte order */ |
1611 #define VA_LSB_FIRST 1 | 2002 #define VA_LSB_FIRST 1 |
1612 #define VA_MSB_FIRST 2 | 2003 #define VA_MSB_FIRST 2 |
1613 | 2004 |
1614 typedef struct _VAImageFormat | 2005 typedef struct _VAImageFormat |
1615 { | 2006 { |
1616 unsigned int fourcc; | 2007 unsigned int fourcc; |
1617 unsigned int byte_order; /* VA_LSB_FIRST, VA_MSB_FIRST */ | 2008 unsigned int byte_order; /* VA_LSB_FIRST, VA_MSB_FIRST */ |
1618 unsigned int bits_per_pixel; | 2009 unsigned int bits_per_pixel; |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2088 * Only attributes returned with VA_DISPLAY_ATTRIB_SETTABLE set in the "flags" f
ield | 2479 * Only attributes returned with VA_DISPLAY_ATTRIB_SETTABLE set in the "flags" f
ield |
2089 * from vaQueryDisplayAttributes() can be set. If the attribute is not settable
or | 2480 * from vaQueryDisplayAttributes() can be set. If the attribute is not settable
or |
2090 * the value is out of range, the function returns VA_STATUS_ERROR_ATTR_NOT_SUPP
ORTED | 2481 * the value is out of range, the function returns VA_STATUS_ERROR_ATTR_NOT_SUPP
ORTED |
2091 */ | 2482 */ |
2092 VAStatus vaSetDisplayAttributes ( | 2483 VAStatus vaSetDisplayAttributes ( |
2093 VADisplay dpy, | 2484 VADisplay dpy, |
2094 VADisplayAttribute *attr_list, | 2485 VADisplayAttribute *attr_list, |
2095 int num_attributes | 2486 int num_attributes |
2096 ); | 2487 ); |
2097 | 2488 |
| 2489 /**@}*/ |
| 2490 |
2098 #ifdef __cplusplus | 2491 #ifdef __cplusplus |
2099 } | 2492 } |
2100 #endif | 2493 #endif |
2101 | 2494 |
2102 #endif /* _VA_H_ */ | 2495 #endif /* _VA_H_ */ |
OLD | NEW |