VA-API
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
va.h
Go to the documentation of this file.
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  * <jonathan.bian@intel.com>
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 
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 
140 typedef void* VADisplay; /* window system dependent */
141 
142 typedef int VAStatus;
144 #define VA_STATUS_SUCCESS 0x00000000
145 #define VA_STATUS_ERROR_OPERATION_FAILED 0x00000001
146 #define VA_STATUS_ERROR_ALLOCATION_FAILED 0x00000002
147 #define VA_STATUS_ERROR_INVALID_DISPLAY 0x00000003
148 #define VA_STATUS_ERROR_INVALID_CONFIG 0x00000004
149 #define VA_STATUS_ERROR_INVALID_CONTEXT 0x00000005
150 #define VA_STATUS_ERROR_INVALID_SURFACE 0x00000006
151 #define VA_STATUS_ERROR_INVALID_BUFFER 0x00000007
152 #define VA_STATUS_ERROR_INVALID_IMAGE 0x00000008
153 #define VA_STATUS_ERROR_INVALID_SUBPICTURE 0x00000009
154 #define VA_STATUS_ERROR_ATTR_NOT_SUPPORTED 0x0000000a
155 #define VA_STATUS_ERROR_MAX_NUM_EXCEEDED 0x0000000b
156 #define VA_STATUS_ERROR_UNSUPPORTED_PROFILE 0x0000000c
157 #define VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT 0x0000000d
158 #define VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT 0x0000000e
159 #define VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE 0x0000000f
160 #define VA_STATUS_ERROR_SURFACE_BUSY 0x00000010
161 #define VA_STATUS_ERROR_FLAG_NOT_SUPPORTED 0x00000011
162 #define VA_STATUS_ERROR_INVALID_PARAMETER 0x00000012
163 #define VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED 0x00000013
164 #define VA_STATUS_ERROR_UNIMPLEMENTED 0x00000014
165 #define VA_STATUS_ERROR_SURFACE_IN_DISPLAYING 0x00000015
166 #define VA_STATUS_ERROR_INVALID_IMAGE_FORMAT 0x00000016
167 #define VA_STATUS_ERROR_DECODING_ERROR 0x00000017
168 #define VA_STATUS_ERROR_ENCODING_ERROR 0x00000018
169 
176 #define VA_STATUS_ERROR_INVALID_VALUE 0x00000019
177 
178 #define VA_STATUS_ERROR_UNSUPPORTED_FILTER 0x00000020
179 
180 #define VA_STATUS_ERROR_INVALID_FILTER_CHAIN 0x00000021
181 
182 #define VA_STATUS_ERROR_HW_BUSY 0x00000022
183 
184 #define VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE 0x00000024
185 #define VA_STATUS_ERROR_UNKNOWN 0xFFFFFFFF
186 
188 #define VA_FRAME_PICTURE 0x00000000
189 #define VA_TOP_FIELD 0x00000001
190 #define VA_BOTTOM_FIELD 0x00000002
191 
198 #define VA_ENABLE_BLEND 0x00000004 /* video area blend with the constant color */
199 
205 #define VA_CLEAR_DRAWABLE 0x00000008
206 
208 #define VA_SRC_BT601 0x00000010
209 #define VA_SRC_BT709 0x00000020
210 #define VA_SRC_SMPTE_240 0x00000040
211 
213 #define VA_FILTER_SCALING_DEFAULT 0x00000000
214 #define VA_FILTER_SCALING_FAST 0x00000100
215 #define VA_FILTER_SCALING_HQ 0x00000200
216 #define VA_FILTER_SCALING_NL_ANAMORPHIC 0x00000300
217 #define VA_FILTER_SCALING_MASK 0x00000f00
218 
222 const char *vaErrorStr(VAStatus error_status);
223 
231 typedef void* VANativeDisplay; /* window system dependent */
232 
233 int vaDisplayIsValid(VADisplay dpy);
234 
238 VAStatus vaInitialize (
239  VADisplay dpy,
240  int *major_version, /* out */
241  int *minor_version /* out */
242 );
243 
247 VAStatus vaTerminate (
248  VADisplay dpy
249 );
250 
259 const char *vaQueryVendorString (
260  VADisplay dpy
261 );
262 
263 typedef int (*VAPrivFunc)();
264 
269 VAPrivFunc vaGetLibFunc (
270  VADisplay dpy,
271  const char *func
272 );
273 
275 typedef enum
276 {
279  VAProfileMPEG2Simple = 0,
280  VAProfileMPEG2Main = 1,
281  VAProfileMPEG4Simple = 2,
282  VAProfileMPEG4AdvancedSimple = 3,
283  VAProfileMPEG4Main = 4,
284  VAProfileH264Baseline = 5,
285  VAProfileH264Main = 6,
286  VAProfileH264High = 7,
287  VAProfileVC1Simple = 8,
288  VAProfileVC1Main = 9,
289  VAProfileVC1Advanced = 10,
290  VAProfileH263Baseline = 11,
291  VAProfileJPEGBaseline = 12,
292  VAProfileH264ConstrainedBaseline = 13,
293  VAProfileVP8Version0_3 = 14,
294  VAProfileH264MultiviewHigh = 15,
295  VAProfileH264StereoHigh = 16,
296  VAProfileHEVCMain = 17,
297  VAProfileHEVCMain10 = 18
298 } VAProfile;
299 
303 typedef enum
304 {
305  VAEntrypointVLD = 1,
306  VAEntrypointIZZ = 2,
307  VAEntrypointIDCT = 3,
308  VAEntrypointMoComp = 4,
309  VAEntrypointDeblocking = 5,
310  VAEntrypointEncSlice = 6, /* slice level encode */
311  VAEntrypointEncPicture = 7, /* pictuer encode, JPEG, etc */
313 } VAEntrypoint;
314 
316 typedef enum
317 {
318  VAConfigAttribRTFormat = 0,
319  VAConfigAttribSpatialResidual = 1,
320  VAConfigAttribSpatialClipping = 2,
321  VAConfigAttribIntraResidual = 3,
322  VAConfigAttribEncryption = 4,
323  VAConfigAttribRateControl = 5,
324 
412  VAConfigAttribTypeMax
414 
421 typedef struct _VAConfigAttrib {
422  VAConfigAttribType type;
423  unsigned int value; /* OR'd flags (bits) for this attribute */
425 
427 #define VA_RT_FORMAT_YUV420 0x00000001
428 #define VA_RT_FORMAT_YUV422 0x00000002
429 #define VA_RT_FORMAT_YUV444 0x00000004
430 #define VA_RT_FORMAT_YUV411 0x00000008
431 #define VA_RT_FORMAT_YUV400 0x00000010
432 #define VA_RT_FORMAT_RGB16 0x00010000
433 #define VA_RT_FORMAT_RGB32 0x00020000
434 /* RGBP covers RGBP and BGRP fourcc */
435 #define VA_RT_FORMAT_RGBP 0x00100000
436 #define VA_RT_FORMAT_PROTECTED 0x80000000
437 
441 #define VA_RC_NONE 0x00000001
442 
443 #define VA_RC_CBR 0x00000002
444 
445 #define VA_RC_VBR 0x00000004
446 
447 #define VA_RC_VCM 0x00000008
448 
449 #define VA_RC_CQP 0x00000010
450 
451 #define VA_RC_VBR_CONSTRAINED 0x00000020
452 
457 #define VA_ENC_PACKED_HEADER_NONE 0x00000000
458 
459 #define VA_ENC_PACKED_HEADER_SEQUENCE 0x00000001
460 
461 #define VA_ENC_PACKED_HEADER_PICTURE 0x00000002
462 
463 #define VA_ENC_PACKED_HEADER_SLICE 0x00000004
464 
465 #define VA_ENC_PACKED_HEADER_MISC 0x00000008
466 
467 #define VA_ENC_PACKED_HEADER_RAW_DATA 0x00000010
468 
473 #define VA_ENC_INTERLACED_NONE 0x00000000
474 
475 #define VA_ENC_INTERLACED_FRAME 0x00000001
476 
477 #define VA_ENC_INTERLACED_FIELD 0x00000002
478 
479 #define VA_ENC_INTERLACED_MBAFF 0x00000004
480 
481 #define VA_ENC_INTERLACED_PAFF 0x00000008
482 
487 #define VA_ENC_SLICE_STRUCTURE_ARBITRARY_ROWS 0x00000000
488 
489 #define VA_ENC_SLICE_STRUCTURE_POWER_OF_TWO_ROWS 0x00000001
490 
491 #define VA_ENC_SLICE_STRUCTURE_ARBITRARY_MACROBLOCKS 0x00000002
492 
495 typedef union _VAConfigAttribValEncJPEG {
496  struct {
498  unsigned int arithmatic_coding_mode : 1;
500  unsigned int progressive_dct_mode : 1;
502  unsigned int non_interleaved_mode : 1;
504  unsigned int differential_mode : 1;
505  unsigned int max_num_components : 3;
506  unsigned int max_num_scans : 4;
507  unsigned int max_num_huffman_tables : 3;
508  unsigned int max_num_quantization_tables : 3;
509  } bits;
510  unsigned int value;
512 
517 #define VA_ATTRIB_NOT_SUPPORTED 0x80000000
518 
520 int vaMaxNumProfiles (
521  VADisplay dpy
522 );
523 
526  VADisplay dpy
527 );
528 
531  VADisplay dpy
532 );
533 
540 VAStatus vaQueryConfigProfiles (
541  VADisplay dpy,
542  VAProfile *profile_list, /* out */
543  int *num_profiles /* out */
544 );
545 
552 VAStatus vaQueryConfigEntrypoints (
553  VADisplay dpy,
554  VAProfile profile,
555  VAEntrypoint *entrypoint_list, /* out */
556  int *num_entrypoints /* out */
557 );
558 
567 VAStatus vaGetConfigAttributes (
568  VADisplay dpy,
569  VAProfile profile,
570  VAEntrypoint entrypoint,
571  VAConfigAttrib *attrib_list, /* in/out */
572  int num_attribs
573 );
574 
576 typedef unsigned int VAGenericID;
577 
578 typedef VAGenericID VAConfigID;
579 
585 VAStatus vaCreateConfig (
586  VADisplay dpy,
587  VAProfile profile,
588  VAEntrypoint entrypoint,
589  VAConfigAttrib *attrib_list,
590  int num_attribs,
591  VAConfigID *config_id /* out */
592 );
593 
597 VAStatus vaDestroyConfig (
598  VADisplay dpy,
599  VAConfigID config_id
600 );
601 
610 VAStatus vaQueryConfigAttributes (
611  VADisplay dpy,
612  VAConfigID config_id,
613  VAProfile *profile, /* out */
614  VAEntrypoint *entrypoint, /* out */
615  VAConfigAttrib *attrib_list,/* out */
616  int *num_attribs /* out */
617 );
618 
619 
636 typedef VAGenericID VAContextID;
637 
638 typedef VAGenericID VASurfaceID;
639 
640 #define VA_INVALID_ID 0xffffffff
641 #define VA_INVALID_SURFACE VA_INVALID_ID
642 
644 typedef enum {
650 
652 typedef void (*VAGenericFunc)(void);
653 
655 typedef struct _VAGenericValue {
659  union {
661  int i;
663  float f;
665  void *p;
668  } value;
670 
674 #define VA_SURFACE_ATTRIB_NOT_SUPPORTED 0x00000000
675 
676 #define VA_SURFACE_ATTRIB_GETTABLE 0x00000001
677 
678 #define VA_SURFACE_ATTRIB_SETTABLE 0x00000002
679 
682 typedef enum {
683  VASurfaceAttribNone = 0,
713 
715 typedef struct _VASurfaceAttrib {
719  unsigned int flags;
723 
732 #define VA_SURFACE_ATTRIB_MEM_TYPE_VA 0x00000001
733 
734 #define VA_SURFACE_ATTRIB_MEM_TYPE_V4L2 0x00000002
735 
736 #define VA_SURFACE_ATTRIB_MEM_TYPE_USER_PTR 0x00000004
737 
743 typedef struct _VASurfaceAttribExternalBuffers {
745  unsigned int pixel_format;
747  unsigned int width;
749  unsigned int height;
751  unsigned int data_size;
753  unsigned int num_planes;
755  unsigned int pitches[4];
757  unsigned int offsets[4];
759  unsigned long *buffers;
761  unsigned int num_buffers;
763  unsigned int flags;
767 
771 #define VA_SURFACE_EXTBUF_DESC_ENABLE_TILING 0x00000001
772 
773 #define VA_SURFACE_EXTBUF_DESC_CACHED 0x00000002
774 
775 #define VA_SURFACE_EXTBUF_DESC_UNCACHED 0x00000004
776 
777 #define VA_SURFACE_EXTBUF_DESC_WC 0x00000008
778 
779 #define VA_SURFACE_EXTBUF_DESC_PROTECTED 0x80000000
780 
784 #define VA_SURFACE_ATTRIB_USAGE_HINT_GENERIC 0x00000000
785 
786 #define VA_SURFACE_ATTRIB_USAGE_HINT_DECODER 0x00000001
787 
788 #define VA_SURFACE_ATTRIB_USAGE_HINT_ENCODER 0x00000002
789 
790 #define VA_SURFACE_ATTRIB_USAGE_HINT_VPP_READ 0x00000004
791 
792 #define VA_SURFACE_ATTRIB_USAGE_HINT_VPP_WRITE 0x00000008
793 
794 #define VA_SURFACE_ATTRIB_USAGE_HINT_DISPLAY 0x00000010
795 
826 VAStatus
828  VADisplay dpy,
829  VAConfigID config,
830  VASurfaceAttrib *attrib_list,
831  unsigned int *num_attribs
832 );
833 
852 VAStatus
854  VADisplay dpy,
855  unsigned int format,
856  unsigned int width,
857  unsigned int height,
858  VASurfaceID *surfaces,
859  unsigned int num_surfaces,
860  VASurfaceAttrib *attrib_list,
861  unsigned int num_attribs
862 );
863 
872 VAStatus vaDestroySurfaces (
873  VADisplay dpy,
874  VASurfaceID *surfaces,
875  int num_surfaces
876 );
877 
878 #define VA_PROGRESSIVE 0x1
879 
891 VAStatus vaCreateContext (
892  VADisplay dpy,
893  VAConfigID config_id,
894  int picture_width,
895  int picture_height,
896  int flag,
897  VASurfaceID *render_targets,
898  int num_render_targets,
899  VAContextID *context /* out */
900 );
901 
907 VAStatus vaDestroyContext (
908  VADisplay dpy,
909  VAContextID context
910 );
911 
920 typedef VAGenericID VABufferID;
921 
922 typedef enum
923 {
924  VAPictureParameterBufferType = 0,
925  VAIQMatrixBufferType = 1,
926  VABitPlaneBufferType = 2,
927  VASliceGroupMapBufferType = 3,
928  VASliceParameterBufferType = 4,
929  VASliceDataBufferType = 5,
930  VAMacroblockParameterBufferType = 6,
931  VAResidualDataBufferType = 7,
932  VADeblockingParameterBufferType = 8,
933  VAImageBufferType = 9,
934  VAProtectedSliceDataBufferType = 10,
935  VAQMatrixBufferType = 11,
936  VAHuffmanTableBufferType = 12,
937  VAProbabilityBufferType = 13,
938 
939 /* Following are encode buffer types */
940  VAEncCodedBufferType = 21,
941  VAEncSequenceParameterBufferType = 22,
942  VAEncPictureParameterBufferType = 23,
943  VAEncSliceParameterBufferType = 24,
944  VAEncPackedHeaderParameterBufferType = 25,
945  VAEncPackedHeaderDataBufferType = 26,
946  VAEncMiscParameterBufferType = 27,
947  VAEncMacroblockParameterBufferType = 28,
948  VAEncMacroblockMapBufferType = 29,
949 /* Following are video processing buffer types */
970  VABufferTypeMax
971 } VABufferType;
972 
973 typedef enum
974 {
975  VAEncMiscParameterTypeFrameRate = 0,
976  VAEncMiscParameterTypeRateControl = 1,
977  VAEncMiscParameterTypeMaxSliceSize = 2,
978  VAEncMiscParameterTypeAIR = 3,
983  VAEncMiscParameterTypeQualityLevel = 6,
985 
987 typedef enum {
1006 
1008 typedef struct _VAEncPackedHeaderParameterBuffer {
1010  unsigned int type;
1012  unsigned int bit_length;
1014  unsigned char has_emulation_bytes;
1016 
1034 typedef struct _VAEncMiscParameterBuffer
1035 {
1037  unsigned int data[0];
1039 
1040 
1042 typedef struct _VAEncMiscParameterRateControl
1043 {
1044  /* this is the maximum bit-rate to be constrained by the rate control implementation */
1045  unsigned int bits_per_second;
1046  /* this is the bit-rate the rate control is targeting, as a percentage of the maximum
1047  * bit-rate for example if target_percentage is 95 then the rate control will target
1048  * a bit-rate that is 95% of the maximum bit-rate
1049  */
1050  unsigned int target_percentage;
1051  /* windows size in milliseconds. For example if this is set to 500,
1052  * then the rate control will guarantee the target bit-rate over a 500 ms window
1053  */
1054  unsigned int window_size;
1055  /* initial QP at I frames */
1056  unsigned int initial_qp;
1057  unsigned int min_qp;
1058  unsigned int basic_unit_size;
1059  union
1060  {
1061  struct
1062  {
1063  unsigned int reset : 1;
1064  unsigned int disable_frame_skip : 1; /* Disable frame skip in rate control mode */
1065  unsigned int disable_bit_stuffing : 1; /* Disable bit stuffing in rate control mode */
1066  } bits;
1067  unsigned int value;
1068  } rc_flags;
1070 
1071 typedef struct _VAEncMiscParameterFrameRate
1072 {
1073  unsigned int framerate;
1074 } VAEncMiscParameterFrameRate;
1075 
1081 typedef struct _VAEncMiscParameterMaxSliceSize
1082 {
1083  unsigned int max_slice_size;
1085 
1086 typedef struct _VAEncMiscParameterAIR
1087 {
1088  unsigned int air_num_mbs;
1089  unsigned int air_threshold;
1090  unsigned int air_auto; /* if set to 1 then hardware auto-tune the AIR threshold */
1091 } VAEncMiscParameterAIR;
1092 
1093 typedef struct _VAEncMiscParameterHRD
1094 {
1095  unsigned int initial_buffer_fullness; /* in bits */
1096  unsigned int buffer_size; /* in bits */
1097 } VAEncMiscParameterHRD;
1098 
1108 typedef struct _VAEncMiscParameterBufferMaxFrameSize {
1112  unsigned int max_frame_size;
1114 
1126 typedef struct _VAEncMiscParameterBufferQualityLevel {
1130  unsigned int quality_level;
1132 
1133 /*
1134  * There will be cases where the bitstream buffer will not have enough room to hold
1135  * the data for the entire slice, and the following flags will be used in the slice
1136  * parameter to signal to the server for the possible cases.
1137  * If a slice parameter buffer and slice data buffer pair is sent to the server with
1138  * the slice data partially in the slice data buffer (BEGIN and MIDDLE cases below),
1139  * then a slice parameter and data buffer needs to be sent again to complete this slice.
1140  */
1141 #define VA_SLICE_DATA_FLAG_ALL 0x00 /* whole slice is in the buffer */
1142 #define VA_SLICE_DATA_FLAG_BEGIN 0x01 /* The beginning of the slice is in the buffer but the end if not */
1143 #define VA_SLICE_DATA_FLAG_MIDDLE 0x02 /* Neither beginning nor end of the slice is in the buffer */
1144 #define VA_SLICE_DATA_FLAG_END 0x04 /* end of the slice is in the buffer */
1145 
1146 /* Codec-independent Slice Parameter Buffer base */
1147 typedef struct _VASliceParameterBufferBase
1148 {
1149  unsigned int slice_data_size; /* number of bytes in the slice data buffer for this slice */
1150  unsigned int slice_data_offset; /* the offset to the first byte of slice data */
1151  unsigned int slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX definitions */
1152 } VASliceParameterBufferBase;
1153 
1154 #include <va/va_dec_jpeg.h>
1155 
1156 /****************************
1157  * MPEG-2 data structures
1158  ****************************/
1159 
1160 /* MPEG-2 Picture Parameter Buffer */
1161 /*
1162  * For each frame or field, and before any slice data, a single
1163  * picture parameter buffer must be send.
1164  */
1165 typedef struct _VAPictureParameterBufferMPEG2
1166 {
1167  unsigned short horizontal_size;
1168  unsigned short vertical_size;
1169  VASurfaceID forward_reference_picture;
1170  VASurfaceID backward_reference_picture;
1171  /* meanings of the following fields are the same as in the standard */
1172  int picture_coding_type;
1173  int f_code; /* pack all four fcode into this */
1174  union {
1175  struct {
1176  unsigned int intra_dc_precision : 2;
1177  unsigned int picture_structure : 2;
1178  unsigned int top_field_first : 1;
1179  unsigned int frame_pred_frame_dct : 1;
1180  unsigned int concealment_motion_vectors : 1;
1181  unsigned int q_scale_type : 1;
1182  unsigned int intra_vlc_format : 1;
1183  unsigned int alternate_scan : 1;
1184  unsigned int repeat_first_field : 1;
1185  unsigned int progressive_frame : 1;
1186  unsigned int is_first_field : 1; /* indicate whether the current field
1187  * is the first field for field picture
1188  */
1189  } bits;
1190  unsigned int value;
1191  } picture_coding_extension;
1192 } VAPictureParameterBufferMPEG2;
1193 
1195 typedef struct _VAIQMatrixBufferMPEG2
1196 {
1206  unsigned char intra_quantiser_matrix[64];
1208  unsigned char non_intra_quantiser_matrix[64];
1210  unsigned char chroma_intra_quantiser_matrix[64];
1212  unsigned char chroma_non_intra_quantiser_matrix[64];
1214 
1216 typedef struct _VASliceParameterBufferMPEG2
1217 {
1218  unsigned int slice_data_size;/* number of bytes in the slice data buffer for this slice */
1219  unsigned int slice_data_offset;/* the offset to the first byte of slice data */
1220  unsigned int slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */
1221  unsigned int macroblock_offset;/* the offset to the first bit of MB from the first byte of slice data */
1222  unsigned int slice_horizontal_position;
1223  unsigned int slice_vertical_position;
1224  int quantiser_scale_code;
1225  int intra_slice_flag;
1227 
1229 typedef struct _VAMacroblockParameterBufferMPEG2
1230 {
1231  unsigned short macroblock_address;
1232  /*
1233  * macroblock_address (in raster scan order)
1234  * top-left: 0
1235  * bottom-right: picture-height-in-mb*picture-width-in-mb - 1
1236  */
1237  unsigned char macroblock_type; /* see definition below */
1238  union {
1239  struct {
1240  unsigned int frame_motion_type : 2;
1241  unsigned int field_motion_type : 2;
1242  unsigned int dct_type : 1;
1243  } bits;
1244  unsigned int value;
1245  } macroblock_modes;
1246  unsigned char motion_vertical_field_select;
1247  /*
1248  * motion_vertical_field_select:
1249  * see section 6.3.17.2 in the spec
1250  * only the lower 4 bits are used
1251  * bit 0: first vector forward
1252  * bit 1: first vector backward
1253  * bit 2: second vector forward
1254  * bit 3: second vector backward
1255  */
1256  short PMV[2][2][2]; /* see Table 7-7 in the spec */
1257  unsigned short coded_block_pattern;
1258  /*
1259  * The bitplanes for coded_block_pattern are described
1260  * in Figure 6.10-12 in the spec
1261  */
1262 
1263  /* Number of skipped macroblocks after this macroblock */
1264  unsigned short num_skipped_macroblocks;
1266 
1267 /*
1268  * OR'd flags for macroblock_type (section 6.3.17.1 in the spec)
1269  */
1270 #define VA_MB_TYPE_MOTION_FORWARD 0x02
1271 #define VA_MB_TYPE_MOTION_BACKWARD 0x04
1272 #define VA_MB_TYPE_MOTION_PATTERN 0x08
1273 #define VA_MB_TYPE_MOTION_INTRA 0x10
1274 
1281 /****************************
1282  * MPEG-4 Part 2 data structures
1283  ****************************/
1284 
1285 /* MPEG-4 Picture Parameter Buffer */
1286 /*
1287  * For each frame or field, and before any slice data, a single
1288  * picture parameter buffer must be send.
1289  */
1290 typedef struct _VAPictureParameterBufferMPEG4
1291 {
1292  unsigned short vop_width;
1293  unsigned short vop_height;
1294  VASurfaceID forward_reference_picture;
1295  VASurfaceID backward_reference_picture;
1296  union {
1297  struct {
1298  unsigned int short_video_header : 1;
1299  unsigned int chroma_format : 2;
1300  unsigned int interlaced : 1;
1301  unsigned int obmc_disable : 1;
1302  unsigned int sprite_enable : 2;
1303  unsigned int sprite_warping_accuracy : 2;
1304  unsigned int quant_type : 1;
1305  unsigned int quarter_sample : 1;
1306  unsigned int data_partitioned : 1;
1307  unsigned int reversible_vlc : 1;
1308  unsigned int resync_marker_disable : 1;
1309  } bits;
1310  unsigned int value;
1311  } vol_fields;
1312  unsigned char no_of_sprite_warping_points;
1313  short sprite_trajectory_du[3];
1314  short sprite_trajectory_dv[3];
1315  unsigned char quant_precision;
1316  union {
1317  struct {
1318  unsigned int vop_coding_type : 2;
1319  unsigned int backward_reference_vop_coding_type : 2;
1320  unsigned int vop_rounding_type : 1;
1321  unsigned int intra_dc_vlc_thr : 3;
1322  unsigned int top_field_first : 1;
1323  unsigned int alternate_vertical_scan_flag : 1;
1324  } bits;
1325  unsigned int value;
1326  } vop_fields;
1327  unsigned char vop_fcode_forward;
1328  unsigned char vop_fcode_backward;
1329  unsigned short vop_time_increment_resolution;
1330  /* short header related */
1331  unsigned char num_gobs_in_vop;
1332  unsigned char num_macroblocks_in_gob;
1333  /* for direct mode prediction */
1334  short TRB;
1335  short TRD;
1337 
1339 typedef struct _VAIQMatrixBufferMPEG4
1340 {
1346  unsigned char intra_quant_mat[64];
1348  unsigned char non_intra_quant_mat[64];
1350 
1352 typedef struct _VASliceParameterBufferMPEG4
1353 {
1354  unsigned int slice_data_size;/* number of bytes in the slice data buffer for this slice */
1355  unsigned int slice_data_offset;/* the offset to the first byte of slice data */
1356  unsigned int slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */
1357  unsigned int macroblock_offset;/* the offset to the first bit of MB from the first byte of slice data */
1358  unsigned int macroblock_number;
1359  int quant_scale;
1361 
1366 typedef enum /* see 7.1.1.32 */
1367 {
1368  VAMvMode1Mv = 0,
1369  VAMvMode1MvHalfPel = 1,
1370  VAMvMode1MvHalfPelBilinear = 2,
1371  VAMvModeMixedMv = 3,
1372  VAMvModeIntensityCompensation = 4
1373 } VAMvModeVC1;
1374 
1376 /*
1377  * For each picture, and before any slice data, a picture parameter
1378  * buffer must be send. Multiple picture parameter buffers may be
1379  * sent for a single picture. In that case picture parameters will
1380  * apply to all slice data that follow it until a new picture
1381  * parameter buffer is sent.
1382  *
1383  * Notes:
1384  * pic_quantizer_type should be set to the applicable quantizer
1385  * type as defined by QUANTIZER (J.1.19) and either
1386  * PQUANTIZER (7.1.1.8) or PQINDEX (7.1.1.6)
1387  */
1388 typedef struct _VAPictureParameterBufferVC1
1389 {
1390  VASurfaceID forward_reference_picture;
1391  VASurfaceID backward_reference_picture;
1392  /* if out-of-loop post-processing is done on the render
1393  target, then we need to keep the in-loop decoded
1394  picture as a reference picture */
1395  VASurfaceID inloop_decoded_picture;
1396 
1397  /* sequence layer for AP or meta data for SP and MP */
1398  union {
1399  struct {
1400  unsigned int pulldown : 1; /* SEQUENCE_LAYER::PULLDOWN */
1401  unsigned int interlace : 1; /* SEQUENCE_LAYER::INTERLACE */
1402  unsigned int tfcntrflag : 1; /* SEQUENCE_LAYER::TFCNTRFLAG */
1403  unsigned int finterpflag : 1; /* SEQUENCE_LAYER::FINTERPFLAG */
1404  unsigned int psf : 1; /* SEQUENCE_LAYER::PSF */
1405  unsigned int multires : 1; /* METADATA::MULTIRES */
1406  unsigned int overlap : 1; /* METADATA::OVERLAP */
1407  unsigned int syncmarker : 1; /* METADATA::SYNCMARKER */
1408  unsigned int rangered : 1; /* METADATA::RANGERED */
1409  unsigned int max_b_frames : 3; /* METADATA::MAXBFRAMES */
1410  unsigned int profile : 2; /* SEQUENCE_LAYER::PROFILE or The MSB of METADATA::PROFILE */
1411  } bits;
1412  unsigned int value;
1413  } sequence_fields;
1414 
1415  unsigned short coded_width; /* ENTRY_POINT_LAYER::CODED_WIDTH */
1416  unsigned short coded_height; /* ENTRY_POINT_LAYER::CODED_HEIGHT */
1417  union {
1418  struct {
1419  unsigned int broken_link : 1; /* ENTRY_POINT_LAYER::BROKEN_LINK */
1420  unsigned int closed_entry : 1; /* ENTRY_POINT_LAYER::CLOSED_ENTRY */
1421  unsigned int panscan_flag : 1; /* ENTRY_POINT_LAYER::PANSCAN_FLAG */
1422  unsigned int loopfilter : 1; /* ENTRY_POINT_LAYER::LOOPFILTER */
1423  } bits;
1424  unsigned int value;
1425  } entrypoint_fields;
1426  unsigned char conditional_overlap_flag; /* ENTRY_POINT_LAYER::CONDOVER */
1427  unsigned char fast_uvmc_flag; /* ENTRY_POINT_LAYER::FASTUVMC */
1428  union {
1429  struct {
1430  unsigned int luma_flag : 1; /* ENTRY_POINT_LAYER::RANGE_MAPY_FLAG */
1431  unsigned int luma : 3; /* ENTRY_POINT_LAYER::RANGE_MAPY */
1432  unsigned int chroma_flag : 1; /* ENTRY_POINT_LAYER::RANGE_MAPUV_FLAG */
1433  unsigned int chroma : 3; /* ENTRY_POINT_LAYER::RANGE_MAPUV */
1434  } bits;
1435  unsigned int value;
1436  } range_mapping_fields;
1437 
1438  unsigned char b_picture_fraction; /* PICTURE_LAYER::BFRACTION */
1439  unsigned char cbp_table; /* PICTURE_LAYER::CBPTAB/ICBPTAB */
1440  unsigned char mb_mode_table; /* PICTURE_LAYER::MBMODETAB */
1441  unsigned char range_reduction_frame;/* PICTURE_LAYER::RANGEREDFRM */
1442  unsigned char rounding_control; /* PICTURE_LAYER::RNDCTRL */
1443  unsigned char post_processing; /* PICTURE_LAYER::POSTPROC */
1444  unsigned char picture_resolution_index; /* PICTURE_LAYER::RESPIC */
1445  unsigned char luma_scale; /* PICTURE_LAYER::LUMSCALE */
1446  unsigned char luma_shift; /* PICTURE_LAYER::LUMSHIFT */
1447  union {
1448  struct {
1449  unsigned int picture_type : 3; /* PICTURE_LAYER::PTYPE */
1450  unsigned int frame_coding_mode : 3; /* PICTURE_LAYER::FCM */
1451  unsigned int top_field_first : 1; /* PICTURE_LAYER::TFF */
1452  unsigned int is_first_field : 1; /* set to 1 if it is the first field */
1453  unsigned int intensity_compensation : 1; /* PICTURE_LAYER::INTCOMP */
1454  } bits;
1455  unsigned int value;
1456  } picture_fields;
1457  union {
1458  struct {
1459  unsigned int mv_type_mb : 1; /* PICTURE::MVTYPEMB */
1460  unsigned int direct_mb : 1; /* PICTURE::DIRECTMB */
1461  unsigned int skip_mb : 1; /* PICTURE::SKIPMB */
1462  unsigned int field_tx : 1; /* PICTURE::FIELDTX */
1463  unsigned int forward_mb : 1; /* PICTURE::FORWARDMB */
1464  unsigned int ac_pred : 1; /* PICTURE::ACPRED */
1465  unsigned int overflags : 1; /* PICTURE::OVERFLAGS */
1466  } flags;
1467  unsigned int value;
1468  } raw_coding;
1469  union {
1470  struct {
1471  unsigned int bp_mv_type_mb : 1; /* PICTURE::MVTYPEMB */
1472  unsigned int bp_direct_mb : 1; /* PICTURE::DIRECTMB */
1473  unsigned int bp_skip_mb : 1; /* PICTURE::SKIPMB */
1474  unsigned int bp_field_tx : 1; /* PICTURE::FIELDTX */
1475  unsigned int bp_forward_mb : 1; /* PICTURE::FORWARDMB */
1476  unsigned int bp_ac_pred : 1; /* PICTURE::ACPRED */
1477  unsigned int bp_overflags : 1; /* PICTURE::OVERFLAGS */
1478  } flags;
1479  unsigned int value;
1480  } bitplane_present; /* signal what bitplane is being passed via the bitplane buffer */
1481  union {
1482  struct {
1483  unsigned int reference_distance_flag : 1;/* PICTURE_LAYER::REFDIST_FLAG */
1484  unsigned int reference_distance : 5;/* PICTURE_LAYER::REFDIST */
1485  unsigned int num_reference_pictures: 1;/* PICTURE_LAYER::NUMREF */
1486  unsigned int reference_field_pic_indicator : 1;/* PICTURE_LAYER::REFFIELD */
1487  } bits;
1488  unsigned int value;
1489  } reference_fields;
1490  union {
1491  struct {
1492  unsigned int mv_mode : 3; /* PICTURE_LAYER::MVMODE */
1493  unsigned int mv_mode2 : 3; /* PICTURE_LAYER::MVMODE2 */
1494  unsigned int mv_table : 3; /* PICTURE_LAYER::MVTAB/IMVTAB */
1495  unsigned int two_mv_block_pattern_table: 2; /* PICTURE_LAYER::2MVBPTAB */
1496  unsigned int four_mv_switch : 1; /* PICTURE_LAYER::4MVSWITCH */
1497  unsigned int four_mv_block_pattern_table : 2; /* PICTURE_LAYER::4MVBPTAB */
1498  unsigned int extended_mv_flag : 1; /* ENTRY_POINT_LAYER::EXTENDED_MV */
1499  unsigned int extended_mv_range : 2; /* PICTURE_LAYER::MVRANGE */
1500  unsigned int extended_dmv_flag : 1; /* ENTRY_POINT_LAYER::EXTENDED_DMV */
1501  unsigned int extended_dmv_range : 2; /* PICTURE_LAYER::DMVRANGE */
1502  } bits;
1503  unsigned int value;
1504  } mv_fields;
1505  union {
1506  struct {
1507  unsigned int dquant : 2; /* ENTRY_POINT_LAYER::DQUANT */
1508  unsigned int quantizer : 2; /* ENTRY_POINT_LAYER::QUANTIZER */
1509  unsigned int half_qp : 1; /* PICTURE_LAYER::HALFQP */
1510  unsigned int pic_quantizer_scale : 5;/* PICTURE_LAYER::PQUANT */
1511  unsigned int pic_quantizer_type : 1;/* PICTURE_LAYER::PQUANTIZER */
1512  unsigned int dq_frame : 1; /* VOPDQUANT::DQUANTFRM */
1513  unsigned int dq_profile : 2; /* VOPDQUANT::DQPROFILE */
1514  unsigned int dq_sb_edge : 2; /* VOPDQUANT::DQSBEDGE */
1515  unsigned int dq_db_edge : 2; /* VOPDQUANT::DQDBEDGE */
1516  unsigned int dq_binary_level : 1; /* VOPDQUANT::DQBILEVEL */
1517  unsigned int alt_pic_quantizer : 5;/* VOPDQUANT::ALTPQUANT */
1518  } bits;
1519  unsigned int value;
1520  } pic_quantizer_fields;
1521  union {
1522  struct {
1523  unsigned int variable_sized_transform_flag : 1;/* ENTRY_POINT_LAYER::VSTRANSFORM */
1524  unsigned int mb_level_transform_type_flag : 1;/* PICTURE_LAYER::TTMBF */
1525  unsigned int frame_level_transform_type : 2;/* PICTURE_LAYER::TTFRM */
1526  unsigned int transform_ac_codingset_idx1 : 2;/* PICTURE_LAYER::TRANSACFRM */
1527  unsigned int transform_ac_codingset_idx2 : 2;/* PICTURE_LAYER::TRANSACFRM2 */
1528  unsigned int intra_transform_dc_table : 1;/* PICTURE_LAYER::TRANSDCTAB */
1529  } bits;
1530  unsigned int value;
1531  } transform_fields;
1533 
1552 /* VC-1 Slice Parameter Buffer */
1553 typedef struct _VASliceParameterBufferVC1
1554 {
1555  unsigned int slice_data_size;/* number of bytes in the slice data buffer for this slice */
1556  unsigned int slice_data_offset;/* the offset to the first byte of slice data */
1557  unsigned int slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */
1558  unsigned int macroblock_offset;/* the offset to the first bit of MB from the first byte of slice data */
1559  unsigned int slice_vertical_position;
1561 
1562 /* VC-1 Slice Data Buffer */
1563 /*
1564 This is simplely a buffer containing raw bit-stream bytes
1565 */
1566 
1567 /****************************
1568  * H.264/AVC data structures
1569  ****************************/
1570 
1571 typedef struct _VAPictureH264
1572 {
1573  VASurfaceID picture_id;
1574  unsigned int frame_idx;
1575  unsigned int flags;
1576  signed int TopFieldOrderCnt;
1577  signed int BottomFieldOrderCnt;
1578 } VAPictureH264;
1579 /* flags in VAPictureH264 could be OR of the following */
1580 #define VA_PICTURE_H264_INVALID 0x00000001
1581 #define VA_PICTURE_H264_TOP_FIELD 0x00000002
1582 #define VA_PICTURE_H264_BOTTOM_FIELD 0x00000004
1583 #define VA_PICTURE_H264_SHORT_TERM_REFERENCE 0x00000008
1584 #define VA_PICTURE_H264_LONG_TERM_REFERENCE 0x00000010
1585 
1587 /*
1588  * For each picture, and before any slice data, a single
1589  * picture parameter buffer must be send.
1590  */
1591 typedef struct _VAPictureParameterBufferH264
1592 {
1593  VAPictureH264 CurrPic;
1594  VAPictureH264 ReferenceFrames[16]; /* in DPB */
1595  unsigned short picture_width_in_mbs_minus1;
1596  unsigned short picture_height_in_mbs_minus1;
1597  unsigned char bit_depth_luma_minus8;
1598  unsigned char bit_depth_chroma_minus8;
1599  unsigned char num_ref_frames;
1600  union {
1601  struct {
1602  unsigned int chroma_format_idc : 2;
1603  unsigned int residual_colour_transform_flag : 1;
1604  unsigned int gaps_in_frame_num_value_allowed_flag : 1;
1605  unsigned int frame_mbs_only_flag : 1;
1606  unsigned int mb_adaptive_frame_field_flag : 1;
1607  unsigned int direct_8x8_inference_flag : 1;
1608  unsigned int MinLumaBiPredSize8x8 : 1; /* see A.3.3.2 */
1609  unsigned int log2_max_frame_num_minus4 : 4;
1610  unsigned int pic_order_cnt_type : 2;
1611  unsigned int log2_max_pic_order_cnt_lsb_minus4 : 4;
1612  unsigned int delta_pic_order_always_zero_flag : 1;
1613  } bits;
1614  unsigned int value;
1615  } seq_fields;
1616  unsigned char num_slice_groups_minus1;
1617  unsigned char slice_group_map_type;
1618  unsigned short slice_group_change_rate_minus1;
1619  signed char pic_init_qp_minus26;
1620  signed char pic_init_qs_minus26;
1621  signed char chroma_qp_index_offset;
1622  signed char second_chroma_qp_index_offset;
1623  union {
1624  struct {
1625  unsigned int entropy_coding_mode_flag : 1;
1626  unsigned int weighted_pred_flag : 1;
1627  unsigned int weighted_bipred_idc : 2;
1628  unsigned int transform_8x8_mode_flag : 1;
1629  unsigned int field_pic_flag : 1;
1630  unsigned int constrained_intra_pred_flag : 1;
1631  unsigned int pic_order_present_flag : 1;
1632  unsigned int deblocking_filter_control_present_flag : 1;
1633  unsigned int redundant_pic_cnt_present_flag : 1;
1634  unsigned int reference_pic_flag : 1; /* nal_ref_idc != 0 */
1635  } bits;
1636  unsigned int value;
1637  } pic_fields;
1638  unsigned short frame_num;
1640 
1642 typedef struct _VAIQMatrixBufferH264
1643 {
1645  unsigned char ScalingList4x4[6][16];
1647  unsigned char ScalingList8x8[2][64];
1649 
1661 typedef struct _VASliceParameterBufferH264
1662 {
1663  unsigned int slice_data_size;/* number of bytes in the slice data buffer for this slice */
1665  unsigned int slice_data_offset;
1666  unsigned int slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */
1677  unsigned short slice_data_bit_offset;
1678  unsigned short first_mb_in_slice;
1679  unsigned char slice_type;
1680  unsigned char direct_spatial_mv_pred_flag;
1681  unsigned char num_ref_idx_l0_active_minus1;
1682  unsigned char num_ref_idx_l1_active_minus1;
1683  unsigned char cabac_init_idc;
1684  char slice_qp_delta;
1685  unsigned char disable_deblocking_filter_idc;
1686  char slice_alpha_c0_offset_div2;
1687  char slice_beta_offset_div2;
1688  VAPictureH264 RefPicList0[32]; /* See 8.2.4.2 */
1689  VAPictureH264 RefPicList1[32]; /* See 8.2.4.2 */
1690  unsigned char luma_log2_weight_denom;
1691  unsigned char chroma_log2_weight_denom;
1692  unsigned char luma_weight_l0_flag;
1693  short luma_weight_l0[32];
1694  short luma_offset_l0[32];
1695  unsigned char chroma_weight_l0_flag;
1696  short chroma_weight_l0[32][2];
1697  short chroma_offset_l0[32][2];
1698  unsigned char luma_weight_l1_flag;
1699  short luma_weight_l1[32];
1700  short luma_offset_l1[32];
1701  unsigned char chroma_weight_l1_flag;
1702  short chroma_weight_l1[32][2];
1703  short chroma_offset_l1[32][2];
1705 
1706 /****************************
1707  * Common encode data structures
1708  ****************************/
1709 typedef enum
1710 {
1711  VAEncPictureTypeIntra = 0,
1712  VAEncPictureTypePredictive = 1,
1713  VAEncPictureTypeBidirectional = 2,
1714 } VAEncPictureType;
1715 
1716 /* Encode Slice Parameter Buffer */
1717 typedef struct _VAEncSliceParameterBuffer
1718 {
1719  unsigned int start_row_number; /* starting MB row number for this slice */
1720  unsigned int slice_height; /* slice height measured in MB */
1721  union {
1722  struct {
1723  unsigned int is_intra : 1;
1724  unsigned int disable_deblocking_filter_idc : 2;
1725  unsigned int uses_long_term_ref :1;
1726  unsigned int is_long_term_ref :1;
1727  } bits;
1728  unsigned int value;
1729  } slice_flags;
1730 } VAEncSliceParameterBuffer;
1731 
1732 
1733 /****************************
1734  * H.263 specific encode data structures
1735  ****************************/
1736 
1737 typedef struct _VAEncSequenceParameterBufferH263
1738 {
1739  unsigned int intra_period;
1740  unsigned int bits_per_second;
1741  unsigned int frame_rate;
1742  unsigned int initial_qp;
1743  unsigned int min_qp;
1744 } VAEncSequenceParameterBufferH263;
1745 
1746 typedef struct _VAEncPictureParameterBufferH263
1747 {
1748  VASurfaceID reference_picture;
1749  VASurfaceID reconstructed_picture;
1750  VABufferID coded_buf;
1751  unsigned short picture_width;
1752  unsigned short picture_height;
1753  VAEncPictureType picture_type;
1754 } VAEncPictureParameterBufferH263;
1755 
1756 /****************************
1757  * MPEG-4 specific encode data structures
1758  ****************************/
1759 
1760 typedef struct _VAEncSequenceParameterBufferMPEG4
1761 {
1762  unsigned char profile_and_level_indication;
1763  unsigned int intra_period;
1764  unsigned int video_object_layer_width;
1765  unsigned int video_object_layer_height;
1766  unsigned int vop_time_increment_resolution;
1767  unsigned int fixed_vop_rate;
1768  unsigned int fixed_vop_time_increment;
1769  unsigned int bits_per_second;
1770  unsigned int frame_rate;
1771  unsigned int initial_qp;
1772  unsigned int min_qp;
1773 } VAEncSequenceParameterBufferMPEG4;
1774 
1775 typedef struct _VAEncPictureParameterBufferMPEG4
1776 {
1777  VASurfaceID reference_picture;
1778  VASurfaceID reconstructed_picture;
1779  VABufferID coded_buf;
1780  unsigned short picture_width;
1781  unsigned short picture_height;
1782  unsigned int modulo_time_base; /* number of 1s */
1783  unsigned int vop_time_increment;
1784  VAEncPictureType picture_type;
1785 } VAEncPictureParameterBufferMPEG4;
1786 
1787 
1788 
1805 VAStatus vaCreateBuffer (
1806  VADisplay dpy,
1807  VAContextID context,
1808  VABufferType type, /* in */
1809  unsigned int size, /* in */
1810  unsigned int num_elements, /* in */
1811  void *data, /* in */
1812  VABufferID *buf_id /* out */
1813 );
1814 
1821 VAStatus vaBufferSetNumElements (
1822  VADisplay dpy,
1823  VABufferID buf_id, /* in */
1824  unsigned int num_elements /* in */
1825 );
1826 
1827 
1832 /*
1833  * FICTURE_AVE_QP(bit7-0): The average Qp value used during this frame
1834  * LARGE_SLICE(bit8):At least one slice in the current frame was large
1835  * enough for the encoder to attempt to limit its size.
1836  * SLICE_OVERFLOW(bit9): At least one slice in the current frame has
1837  * exceeded the maximum slice size specified.
1838  * BITRATE_OVERFLOW(bit10): The peak bitrate was exceeded for this frame.
1839  * BITRATE_HIGH(bit11): The frame size got within the safety margin of the maximum size (VCM only)
1840  * AIR_MB_OVER_THRESHOLD: the number of MBs adapted to Intra MB
1841  */
1842 #define VA_CODED_BUF_STATUS_PICTURE_AVE_QP_MASK 0xff
1843 #define VA_CODED_BUF_STATUS_LARGE_SLICE_MASK 0x100
1844 #define VA_CODED_BUF_STATUS_SLICE_OVERFLOW_MASK 0x200
1845 #define VA_CODED_BUF_STATUS_BITRATE_OVERFLOW 0x400
1846 #define VA_CODED_BUF_STATUS_BITRATE_HIGH 0x800
1847 
1854 #define VA_CODED_BUF_STATUS_FRAME_SIZE_OVERFLOW 0x1000
1855 #define VA_CODED_BUF_STATUS_AIR_MB_OVER_THRESHOLD 0xff0000
1856 
1864 #define VA_CODED_BUF_STATUS_SINGLE_NALU 0x10000000
1865 
1876 typedef struct _VACodedBufferSegment {
1880  unsigned int size;
1882  unsigned int bit_offset;
1884  unsigned int status;
1886  unsigned int reserved;
1888  void *buf;
1893  void *next;
1895 
1904 VAStatus vaMapBuffer (
1905  VADisplay dpy,
1906  VABufferID buf_id, /* in */
1907  void **pbuf /* out */
1908 );
1909 
1915 VAStatus vaUnmapBuffer (
1916  VADisplay dpy,
1917  VABufferID buf_id /* in */
1918 );
1919 
1924 VAStatus vaDestroyBuffer (
1925  VADisplay dpy,
1926  VABufferID buffer_id
1927 );
1928 
1930 typedef struct {
1932  uintptr_t handle;
1934  uint32_t type;
1943  uint32_t mem_type;
1945  size_t mem_size;
1946 } VABufferInfo;
1947 
1995 VAStatus
1996 vaAcquireBufferHandle(VADisplay dpy, VABufferID buf_id, VABufferInfo *buf_info);
1997 
2028 VAStatus
2029 vaReleaseBufferHandle(VADisplay dpy, VABufferID buf_id);
2030 
2031 /*
2032 Render (Decode) Pictures
2033 
2034 A picture represents either a frame or a field.
2035 
2036 The Begin/Render/End sequence sends the decode buffers to the server
2037 */
2038 
2042 VAStatus vaBeginPicture (
2043  VADisplay dpy,
2044  VAContextID context,
2045  VASurfaceID render_target
2046 );
2047 
2052 VAStatus vaRenderPicture (
2053  VADisplay dpy,
2054  VAContextID context,
2055  VABufferID *buffers,
2056  int num_buffers
2057 );
2058 
2065 VAStatus vaEndPicture (
2066  VADisplay dpy,
2067  VAContextID context
2068 );
2069 
2070 /*
2071 
2072 Synchronization
2073 
2074 */
2075 
2081 VAStatus vaSyncSurface (
2082  VADisplay dpy,
2083  VASurfaceID render_target
2084 );
2085 
2086 typedef enum
2087 {
2088  VASurfaceRendering = 1, /* Rendering in progress */
2089  VASurfaceDisplaying = 2, /* Displaying in progress (not safe to render into it) */
2090  /* this status is useful if surface is used as the source */
2091  /* of an overlay */
2092  VASurfaceReady = 4, /* not being rendered or displayed */
2093  VASurfaceSkipped = 8 /* Indicate a skipped frame during encode */
2094 } VASurfaceStatus;
2095 
2099 VAStatus vaQuerySurfaceStatus (
2100  VADisplay dpy,
2101  VASurfaceID render_target,
2102  VASurfaceStatus *status /* out */
2103 );
2104 
2105 typedef enum
2106 {
2107  VADecodeSliceMissing = 0,
2108  VADecodeMBError = 1,
2109 } VADecodeErrorType;
2110 
2115 typedef struct _VASurfaceDecodeMBErrors
2116 {
2117  int status; /* 1 if hardware has returned detailed info below, -1 means this record is invalid */
2118  unsigned int start_mb; /* start mb address with errors */
2119  unsigned int end_mb; /* end mb address with errors */
2120  VADecodeErrorType decode_error_type;
2122 
2131 VAStatus vaQuerySurfaceError(
2132  VADisplay dpy,
2133  VASurfaceID surface,
2134  VAStatus error_status,
2135  void **error_info
2136 );
2137 
2145 #define VA_FOURCC(ch0, ch1, ch2, ch3) \
2146  ((unsigned long)(unsigned char) (ch0) | ((unsigned long)(unsigned char) (ch1) << 8) | \
2147  ((unsigned long)(unsigned char) (ch2) << 16) | ((unsigned long)(unsigned char) (ch3) << 24 ))
2148 
2149 /*
2150  * Pre-defined fourcc codes
2151  */
2152 #define VA_FOURCC_NV12 0x3231564E
2153 #define VA_FOURCC_AI44 0x34344149
2154 #define VA_FOURCC_RGBA 0x41424752
2155 #define VA_FOURCC_RGBX 0x58424752
2156 #define VA_FOURCC_BGRA 0x41524742
2157 #define VA_FOURCC_BGRX 0x58524742
2158 #define VA_FOURCC_ARGB 0x42475241
2159 #define VA_FOURCC_XRGB 0x42475258
2160 #define VA_FOURCC_ABGR 0x52474241
2161 #define VA_FOURCC_XBGR 0x52474258
2162 #define VA_FOURCC_UYVY 0x59565955
2163 #define VA_FOURCC_YUY2 0x32595559
2164 #define VA_FOURCC_AYUV 0x56555941
2165 #define VA_FOURCC_NV11 0x3131564e
2166 #define VA_FOURCC_YV12 0x32315659
2167 #define VA_FOURCC_P208 0x38303250
2168 #define VA_FOURCC_IYUV 0x56555949
2169 #define VA_FOURCC_YV24 0x34325659
2170 #define VA_FOURCC_YV32 0x32335659
2171 #define VA_FOURCC_Y800 0x30303859
2172 #define VA_FOURCC_IMC3 0x33434D49
2173 #define VA_FOURCC_411P 0x50313134
2174 #define VA_FOURCC_422H 0x48323234
2175 #define VA_FOURCC_422V 0x56323234
2176 #define VA_FOURCC_444P 0x50343434
2177 #define VA_FOURCC_RGBP 0x50424752
2178 #define VA_FOURCC_BGRP 0x50524742
2179 #define VA_FOURCC_411R 0x52313134 /* rotated 411P */
2180 
2181 /* byte order */
2182 #define VA_LSB_FIRST 1
2183 #define VA_MSB_FIRST 2
2184 
2185 typedef struct _VAImageFormat
2186 {
2187  unsigned int fourcc;
2188  unsigned int byte_order; /* VA_LSB_FIRST, VA_MSB_FIRST */
2189  unsigned int bits_per_pixel;
2190  /* for RGB formats */
2191  unsigned int depth; /* significant bits per pixel */
2192  unsigned int red_mask;
2193  unsigned int green_mask;
2194  unsigned int blue_mask;
2195  unsigned int alpha_mask;
2196 } VAImageFormat;
2197 
2198 typedef VAGenericID VAImageID;
2199 
2200 typedef struct _VAImage
2201 {
2202  VAImageID image_id; /* uniquely identify this image */
2203  VAImageFormat format;
2204  VABufferID buf; /* image data buffer */
2205  /*
2206  * Image data will be stored in a buffer of type VAImageBufferType to facilitate
2207  * data store on the server side for optimal performance. The buffer will be
2208  * created by the CreateImage function, and proper storage allocated based on the image
2209  * size and format. This buffer is managed by the library implementation, and
2210  * accessed by the client through the buffer Map/Unmap functions.
2211  */
2212  unsigned short width;
2213  unsigned short height;
2214  unsigned int data_size;
2215  unsigned int num_planes; /* can not be greater than 3 */
2216  /*
2217  * An array indicating the scanline pitch in bytes for each plane.
2218  * Each plane may have a different pitch. Maximum 3 planes for planar formats
2219  */
2220  unsigned int pitches[3];
2221  /*
2222  * An array indicating the byte offset from the beginning of the image data
2223  * to the start of each plane.
2224  */
2225  unsigned int offsets[3];
2226 
2227  /* The following fields are only needed for paletted formats */
2228  int num_palette_entries; /* set to zero for non-palette images */
2229  /*
2230  * Each component is one byte and entry_bytes indicates the number of components in
2231  * each entry (eg. 3 for YUV palette entries). set to zero for non-palette images
2232  */
2233  int entry_bytes;
2234  /*
2235  * An array of ascii characters describing the order of the components within the bytes.
2236  * Only entry_bytes characters of the string are used.
2237  */
2238  char component_order[4];
2239 } VAImage;
2240 
2243  VADisplay dpy
2244 );
2245 
2252 VAStatus vaQueryImageFormats (
2253  VADisplay dpy,
2254  VAImageFormat *format_list, /* out */
2255  int *num_formats /* out */
2256 );
2257 
2265 VAStatus vaCreateImage (
2266  VADisplay dpy,
2267  VAImageFormat *format,
2268  int width,
2269  int height,
2270  VAImage *image /* out */
2271 );
2272 
2276 VAStatus vaDestroyImage (
2277  VADisplay dpy,
2278  VAImageID image
2279 );
2280 
2281 VAStatus vaSetImagePalette (
2282  VADisplay dpy,
2283  VAImageID image,
2284  /*
2285  * pointer to an array holding the palette data. The size of the array is
2286  * num_palette_entries * entry_bytes in size. The order of the components
2287  * in the palette is described by the component_order in VAImage struct
2288  */
2289  unsigned char *palette
2290 );
2291 
2296 VAStatus vaGetImage (
2297  VADisplay dpy,
2298  VASurfaceID surface,
2299  int x, /* coordinates of the upper left source pixel */
2300  int y,
2301  unsigned int width, /* width and height of the region */
2302  unsigned int height,
2303  VAImageID image
2304 );
2305 
2312 VAStatus vaPutImage (
2313  VADisplay dpy,
2314  VASurfaceID surface,
2315  VAImageID image,
2316  int src_x,
2317  int src_y,
2318  unsigned int src_width,
2319  unsigned int src_height,
2320  int dest_x,
2321  int dest_y,
2322  unsigned int dest_width,
2323  unsigned int dest_height
2324 );
2325 
2357 VAStatus vaDeriveImage (
2358  VADisplay dpy,
2359  VASurfaceID surface,
2360  VAImage *image /* out */
2361 );
2362 
2370 typedef VAGenericID VASubpictureID;
2371 
2374  VADisplay dpy
2375 );
2376 
2378 #define VA_SUBPICTURE_CHROMA_KEYING 0x0001
2379 #define VA_SUBPICTURE_GLOBAL_ALPHA 0x0002
2380 #define VA_SUBPICTURE_DESTINATION_IS_SCREEN_COORD 0x0004
2381 
2393 VAStatus vaQuerySubpictureFormats (
2394  VADisplay dpy,
2395  VAImageFormat *format_list, /* out */
2396  unsigned int *flags, /* out */
2397  unsigned int *num_formats /* out */
2398 );
2399 
2403 VAStatus vaCreateSubpicture (
2404  VADisplay dpy,
2405  VAImageID image,
2406  VASubpictureID *subpicture /* out */
2407 );
2408 
2412 VAStatus vaDestroySubpicture (
2413  VADisplay dpy,
2414  VASubpictureID subpicture
2415 );
2416 
2421 VAStatus vaSetSubpictureImage (
2422  VADisplay dpy,
2423  VASubpictureID subpicture,
2424  VAImageID image
2425 );
2426 
2436 VAStatus vaSetSubpictureChromakey (
2437  VADisplay dpy,
2438  VASubpictureID subpicture,
2439  unsigned int chromakey_min,
2440  unsigned int chromakey_max,
2441  unsigned int chromakey_mask
2442 );
2443 
2449 VAStatus vaSetSubpictureGlobalAlpha (
2450  VADisplay dpy,
2451  VASubpictureID subpicture,
2452  float global_alpha
2453 );
2454 
2462 VAStatus vaAssociateSubpicture (
2463  VADisplay dpy,
2464  VASubpictureID subpicture,
2465  VASurfaceID *target_surfaces,
2466  int num_surfaces,
2467  short src_x, /* upper left offset in subpicture */
2468  short src_y,
2469  unsigned short src_width,
2470  unsigned short src_height,
2471  short dest_x, /* upper left offset in surface */
2472  short dest_y,
2473  unsigned short dest_width,
2474  unsigned short dest_height,
2475  /*
2476  * whether to enable chroma-keying, global-alpha, or screen relative mode
2477  * see VA_SUBPICTURE_XXX values
2478  */
2479  unsigned int flags
2480 );
2481 
2485 VAStatus vaDeassociateSubpicture (
2486  VADisplay dpy,
2487  VASubpictureID subpicture,
2488  VASurfaceID *target_surfaces,
2489  int num_surfaces
2490 );
2491 
2492 typedef struct _VARectangle
2493 {
2494  short x;
2495  short y;
2496  unsigned short width;
2497  unsigned short height;
2498 } VARectangle;
2499 
2507 /* PowerVR IEP Lite attributes */
2508 typedef enum
2509 {
2510  VADISPLAYATTRIB_BLE_OFF = 0x00,
2511  VADISPLAYATTRIB_BLE_LOW,
2512  VADISPLAYATTRIB_BLE_MEDIUM,
2513  VADISPLAYATTRIB_BLE_HIGH,
2514  VADISPLAYATTRIB_BLE_NONE,
2516 
2518 #define VA_ROTATION_NONE 0x00000000
2519 #define VA_ROTATION_90 0x00000001
2520 #define VA_ROTATION_180 0x00000002
2521 #define VA_ROTATION_270 0x00000003
2522 
2524 #define VA_OOL_DEBLOCKING_FALSE 0x00000000
2525 #define VA_OOL_DEBLOCKING_TRUE 0x00000001
2526 
2528 #define VA_RENDER_MODE_UNDEFINED 0
2529 #define VA_RENDER_MODE_LOCAL_OVERLAY 1
2530 #define VA_RENDER_MODE_LOCAL_GPU 2
2531 #define VA_RENDER_MODE_EXTERNAL_OVERLAY 4
2532 #define VA_RENDER_MODE_EXTERNAL_GPU 8
2533 
2535 #define VA_RENDER_DEVICE_UNDEFINED 0
2536 #define VA_RENDER_DEVICE_LOCAL 1
2537 #define VA_RENDER_DEVICE_EXTERNAL 2
2538 
2540 typedef enum
2541 {
2542  VADisplayAttribBrightness = 0,
2543  VADisplayAttribContrast = 1,
2544  VADisplayAttribHue = 2,
2545  VADisplayAttribSaturation = 3,
2546  /* client can specifiy a background color for the target window
2547  * the new feature of video conference,
2548  * the uncovered area of the surface is filled by this color
2549  * also it will blend with the decoded video color
2550  */
2551  VADisplayAttribBackgroundColor = 4,
2552  /*
2553  * this is a gettable only attribute. For some implementations that use the
2554  * hardware overlay, after PutSurface is called, the surface can not be
2555  * re-used until after the subsequent PutSurface call. If this is the case
2556  * then the value for this attribute will be set to 1 so that the client
2557  * will not attempt to re-use the surface right after returning from a call
2558  * to PutSurface.
2559  *
2560  * Don't use it, use flag VASurfaceDisplaying of vaQuerySurfaceStatus since
2561  * driver may use overlay or GPU alternatively
2562  */
2563  VADisplayAttribDirectSurface = 5,
2564  VADisplayAttribRotation = 6,
2565  VADisplayAttribOutofLoopDeblock = 7,
2566 
2567  /* PowerVR IEP Lite specific attributes */
2568  VADisplayAttribBLEBlackMode = 8,
2569  VADisplayAttribBLEWhiteMode = 9,
2570  VADisplayAttribBlueStretch = 10,
2571  VADisplayAttribSkinColorCorrection = 11,
2572  /*
2573  * For type VADisplayAttribCSCMatrix, "value" field is a pointer to the color
2574  * conversion matrix. Each element in the matrix is float-point
2575  */
2576  VADisplayAttribCSCMatrix = 12,
2577  /* specify the constant color used to blend with video surface
2578  * Cd = Cv*Cc*Ac + Cb *(1 - Ac) C means the constant RGB
2579  * d: the final color to overwrite into the frame buffer
2580  * v: decoded video after color conversion,
2581  * c: video color specified by VADisplayAttribBlendColor
2582  * b: background color of the drawable
2583  */
2584  VADisplayAttribBlendColor = 13,
2585  /*
2586  * Indicate driver to skip painting color key or not.
2587  * only applicable if the render is overlay
2588  */
2589  VADisplayAttribOverlayAutoPaintColorKey = 14,
2590  /*
2591  * customized overlay color key, the format is RGB888
2592  * [23:16] = Red, [15:08] = Green, [07:00] = Blue.
2593  */
2594  VADisplayAttribOverlayColorKey = 15,
2595  /*
2596  * The hint for the implementation of vaPutSurface
2597  * normally, the driver could use an overlay or GPU to render the surface on the screen
2598  * this flag provides APP the flexibity to switch the render dynamically
2599  */
2600  VADisplayAttribRenderMode = 16,
2601  /*
2602  * specify if vaPutSurface needs to render into specified monitors
2603  * one example is that one external monitor (e.g. HDMI) is enabled,
2604  * but the window manager is not aware of it, and there is no associated drawable
2605  */
2606  VADisplayAttribRenderDevice = 17,
2607  /*
2608  * specify vaPutSurface render area if there is no drawable on the monitor
2609  */
2610  VADisplayAttribRenderRect = 18,
2612 
2613 /* flags for VADisplayAttribute */
2614 #define VA_DISPLAY_ATTRIB_NOT_SUPPORTED 0x0000
2615 #define VA_DISPLAY_ATTRIB_GETTABLE 0x0001
2616 #define VA_DISPLAY_ATTRIB_SETTABLE 0x0002
2617 
2618 typedef struct _VADisplayAttribute
2619 {
2620  VADisplayAttribType type;
2621  int min_value;
2622  int max_value;
2623  int value; /* used by the set/get attribute functions */
2624 /* flags can be VA_DISPLAY_ATTRIB_GETTABLE or VA_DISPLAY_ATTRIB_SETTABLE or OR'd together */
2625  unsigned int flags;
2626 } VADisplayAttribute;
2627 
2630  VADisplay dpy
2631 );
2632 
2639 VAStatus vaQueryDisplayAttributes (
2640  VADisplay dpy,
2641  VADisplayAttribute *attr_list, /* out */
2642  int *num_attributes /* out */
2643 );
2644 
2651 VAStatus vaGetDisplayAttributes (
2652  VADisplay dpy,
2653  VADisplayAttribute *attr_list, /* in/out */
2654  int num_attributes
2655 );
2656 
2663 VAStatus vaSetDisplayAttributes (
2664  VADisplay dpy,
2665  VADisplayAttribute *attr_list,
2666  int num_attributes
2667 );
2668 
2669 /****************************
2670  * HEVC data structures
2671  ****************************/
2681 typedef struct _VAPictureHEVC
2682 {
2686  VASurfaceID picture_id;
2691  int32_t pic_order_cnt;
2692  /* described below */
2693  uint32_t flags;
2694 } VAPictureHEVC;
2695 
2696 /* flags in VAPictureHEVC could be OR of the following */
2697 #define VA_PICTURE_HEVC_INVALID 0x00000001
2698 
2701 #define VA_PICTURE_HEVC_FIELD_PIC 0x00000002
2702 
2706 #define VA_PICTURE_HEVC_BOTTOM_FIELD 0x00000004
2707 
2708 #define VA_PICTURE_HEVC_LONG_TERM_REFERENCE 0x00000008
2709 
2723 #define VA_PICTURE_HEVC_RPS_ST_CURR_BEFORE 0x00000010
2724 
2728 #define VA_PICTURE_HEVC_RPS_ST_CURR_AFTER 0x00000020
2729 
2733 #define VA_PICTURE_HEVC_RPS_LT_CURR 0x00000040
2734 
2737 #ifdef __cplusplus
2738 }
2739 #endif
2740 
2741 #endif /* _VA_H_ */
VAStatus vaQueryConfigAttributes(VADisplay dpy, VAConfigID config_id, VAProfile *profile, VAEntrypoint *entrypoint, VAConfigAttrib *attrib_list, int *num_attribs)
void(* VAGenericFunc)(void)
Generic function type.
Definition: va.h:652
VAStatus vaBeginPicture(VADisplay dpy, VAContextID context, VASurfaceID render_target)
VAStatus vaSetDisplayAttributes(VADisplay dpy, VADisplayAttribute *attr_list, int num_attributes)
Video processing pipeline parameter buffer.
Definition: va.h:956
Buffer type used for HRD parameters.
Definition: va.h:982
Definition: va.h:312
Number of surface attributes.
Definition: va.h:711
int load_non_intra_quant_mat
Definition: va.h:1344
Surface attribute.
Definition: va.h:715
unsigned int bit_length
Size of the #VAEncPackedHeaderDataBuffer in bits.
Definition: va.h:1012
int vaMaxNumImageFormats(VADisplay dpy)
Definition: va.h:647
VAMvModeVC1
Definition: va.h:1366
VAGenericID VAContextID
Definition: va.h:636
Misc packed header. See codec-specific definitions.
Definition: va.h:1004
VAStatus vaQuerySurfaceError(VADisplay dpy, VASurfaceID surface, VAStatus error_status, void **error_info)
void * private_data
reserved for passing private data
Definition: va.h:765
VAStatus vaDestroySurfaces(VADisplay dpy, VASurfaceID *surfaces, int num_surfaces)
VAStatus vaTerminate(VADisplay dpy)
VAStatus vaSyncSurface(VADisplay dpy, VASurfaceID render_target)
VAStatus vaSetSubpictureGlobalAlpha(VADisplay dpy, VASubpictureID subpicture, float global_alpha)
VAStatus vaPutImage(VADisplay dpy, VASurfaceID surface, VAImageID image, int src_x, int src_y, unsigned int src_width, unsigned int src_height, int dest_x, int dest_y, unsigned int dest_width, unsigned int dest_height)
unsigned int pixel_format
pixel format in fourcc.
Definition: va.h:745
int vaMaxNumEntrypoints(VADisplay dpy)
Rate control parameters.
Definition: va.h:1042
unsigned short slice_data_bit_offset
Bit offset from NAL Header Unit to the begining of slice_data().
Definition: va.h:1677
VAStatus vaSetSubpictureImage(VADisplay dpy, VASubpictureID subpicture, VAImageID image)
int load_non_intra_quantiser_matrix
Same as the MPEG-2 bitstream syntax element.
Definition: va.h:1200
VAStatus vaCreateContext(VADisplay dpy, VAConfigID config_id, int picture_width, int picture_height, int flag, VASurfaceID *render_targets, int num_render_targets, VAContextID *context)
VAStatus vaAssociateSubpicture(VADisplay dpy, VASubpictureID subpicture, VASurfaceID *target_surfaces, int num_surfaces, short src_x, short src_y, unsigned short src_width, unsigned short src_height, short dest_x, short dest_y, unsigned short dest_width, unsigned short dest_height, unsigned int flags)
Definition: va.h:1661
VA buffer information.
Definition: va.h:1930
Packed headers mode. Read/write.
Definition: va.h:337
Slice structure. Read-only.
Definition: va.h:381
const char * vaErrorStr(VAStatus error_status)
VAStatus vaQueryImageFormats(VADisplay dpy, VAImageFormat *format_list, int *num_formats)
VAEncMiscParameterType
Definition: va.h:973
JPEG encoding attribute. Read-only.
Definition: va.h:401
Definition: va.h:1081
Defines a maximum frame size (in bits).
Definition: va.h:1108
Definition: va.h:1553
VAStatus vaGetConfigAttributes(VADisplay dpy, VAProfile profile, VAEntrypoint entrypoint, VAConfigAttrib *attrib_list, int num_attribs)
size_t mem_size
Size of the underlying buffer.
Definition: va.h:1945
VAStatus vaQuerySurfaceAttributes(VADisplay dpy, VAConfigID config, VASurfaceAttrib *attrib_list, unsigned int *num_attribs)
Queries surface attributes for the supplied config.
Encoding quality range attribute. Read-only.
Definition: va.h:410
VAStatus vaEndPicture(VADisplay dpy, VAContextID context)
unsigned int height
height in pixels.
Definition: va.h:749
unsigned int slice_data_offset
Byte offset to the NAL Header Unit for this slice.
Definition: va.h:1665
VADisplayAttribType
Definition: va.h:2540
VAProfile
Definition: va.h:275
int i
32-bit signed integer.
Definition: va.h:661
VAStatus vaSetSubpictureChromakey(VADisplay dpy, VASubpictureID subpicture, unsigned int chromakey_min, unsigned int chromakey_max, unsigned int chromakey_mask)
unsigned int max_frame_size
Maximum size of a frame (in bits).
Definition: va.h:1112
VAStatus vaCreateConfig(VADisplay dpy, VAProfile profile, VAEntrypoint entrypoint, VAConfigAttrib *attrib_list, int num_attribs, VAConfigID *config_id)
int load_intra_quantiser_matrix
Same as the MPEG-2 bitstream syntax element.
Definition: va.h:1198
const char * vaQueryVendorString(VADisplay dpy)
unsigned int type
Definition: va.h:1010
VAEntrypoint
Definition: va.h:303
VABufferType
Definition: va.h:922
Definition: va.h:1216
VAStatus vaCreateImage(VADisplay dpy, VAImageFormat *format, int width, int height, VAImage *image)
Definition: va.h:1352
unsigned int quality_level
Encoding quality level setting. When set to 0, default quality level is used.
Definition: va.h:1130
Definition: va.h:645
Packed picture header.
Definition: va.h:991
VAGenericID VABufferID
Definition: va.h:920
int32_t pic_order_cnt
picture order count. in HEVC, POCs for top and bottom fields of same picture should take different va...
Definition: va.h:2691
VAStatus vaQueryDisplayAttributes(VADisplay dpy, VADisplayAttribute *attr_list, int *num_attributes)
VAStatus vaDestroyImage(VADisplay dpy, VAImageID image)
Buffer type used to express a maximum frame size (in bits).
Definition: va.h:980
int vaMaxNumSubpictureFormats(VADisplay dpy)
Minimal height in pixels (int, read-only).
Definition: va.h:700
void * buf
Pointer to the start of the data buffer.
Definition: va.h:1888
uint32_t type
Buffer type (See VABufferType).
Definition: va.h:1934
VAStatus vaAcquireBufferHandle(VADisplay dpy, VABufferID buf_id, VABufferInfo *buf_info)
Acquires buffer handle for external API usage.
VAStatus vaDestroySubpicture(VADisplay dpy, VASubpictureID subpicture)
unsigned int width
width in pixels.
Definition: va.h:747
uintptr_t handle
Buffer handle.
Definition: va.h:1932
VADisplayAttribBLEMode
Definition: va.h:2508
VAPrivFunc vaGetLibFunc(VADisplay dpy, const char *func)
unsigned char has_emulation_bytes
Flag: buffer contains start code emulation prevention bytes?
Definition: va.h:1014
VAStatus vaDestroyContext(VADisplay dpy, VAContextID context)
unsigned long * buffers
buffer handles or user pointers
Definition: va.h:759
VAStatus vaMapBuffer(VADisplay dpy, VABufferID buf_id, void **pbuf)
VAGenericID VASubpictureID
Definition: va.h:2370
VAStatus vaQueryConfigProfiles(VADisplay dpy, VAProfile *profile_list, int *num_profiles)
VAStatus vaCreateSubpicture(VADisplay dpy, VAImageID image, VASubpictureID *subpicture)
VASurfaceAttribType
Surface attribute types.
Definition: va.h:682
VAGenericValue value
Value. See "Surface attribute types" for the expected types.
Definition: va.h:721
Maximum number of slices per frame. Read-only.
Definition: va.h:364
VAStatus vaRenderPicture(VADisplay dpy, VAContextID context, VABufferID *buffers, int num_buffers)
Maximum number of reference frames. Read-only.
Definition: va.h:357
VAStatus vaBufferSetNumElements(VADisplay dpy, VABufferID buf_id, unsigned int num_elements)
VAStatus vaInitialize(VADisplay dpy, int *major_version, int *minor_version)
uint32_t mem_type
Buffer memory type (See VASurfaceAttribMemoryType).
Definition: va.h:1943
VAStatus vaGetImage(VADisplay dpy, VASurfaceID surface, int x, int y, unsigned int width, unsigned int height, VAImageID image)
Profile ID used for video processing.
Definition: va.h:278
VAGenericFunc fn
Pointer to function.
Definition: va.h:667
Video filter parameter buffer.
Definition: va.h:969
int vaMaxNumDisplayAttributes(VADisplay dpy)
Maximal width in pixels (int, read-only).
Definition: va.h:698
VAGenericValueType
Generic value types.
Definition: va.h:644
VASurfaceID picture_id
reconstructed picture buffer surface index invalid when taking value VA_INVALID_SURFACE.
Definition: va.h:2686
VAStatus vaDestroyConfig(VADisplay dpy, VAConfigID config_id)
VAStatus vaCreateSurfaces(VADisplay dpy, unsigned int format, unsigned int width, unsigned int height, VASurfaceID *surfaces, unsigned int num_surfaces, VASurfaceAttrib *attrib_list, unsigned int num_attribs)
Creates an array of surfaces.
Packed sequence header.
Definition: va.h:989
Encoding quality level.
Definition: va.h:1126
Definition: va.h:1591
Macroblock information. Read-only.
Definition: va.h:393
int vaMaxNumProfiles(VADisplay dpy)
VASurfaceAttribType type
Type.
Definition: va.h:717
unsigned int reserved
Reserved for future use.
Definition: va.h:1886
unsigned int flags
Flags. See "Surface attribute flags".
Definition: va.h:719
VAStatus vaCreateBuffer(VADisplay dpy, VAContextID context, VABufferType type, unsigned int size, unsigned int num_elements, void *data, VABufferID *buf_id)
Surface usage hint, gives the driver a hint of intended usage to optimize allocation (e...
Definition: va.h:709
Definition: va.h:1290
VAStatus vaReleaseBufferHandle(VADisplay dpy, VABufferID buf_id)
Releases buffer after usage from external API.
int load_chroma_intra_quantiser_matrix
Same as the MPEG-2 bitstream syntax element.
Definition: va.h:1202
void * next
Pointer to the next VACodedBufferSegment element, or NULL if there is none.
Definition: va.h:1893
VAStatus vaGetDisplayAttributes(VADisplay dpy, VADisplayAttribute *attr_list, int num_attributes)
int load_intra_quant_mat
Definition: va.h:1342
void * VANativeDisplay
Definition: va.h:231
unsigned int data_size
total size of the buffer in bytes.
Definition: va.h:751
Interlaced mode. Read/write.
Definition: va.h:346
int load_chroma_non_intra_quantiser_matrix
Same as the MPEG-2 bitstream syntax element.
Definition: va.h:1204
unsigned int size
Size of the data buffer in this segment (in bytes).
Definition: va.h:1880
Definition: va.h:646
Packed raw header.
Definition: va.h:1002
Definition: va.h:2115
float f
32-bit float.
Definition: va.h:663
Pixel format (fourcc).
Definition: va.h:694
VAStatus vaDestroyBuffer(VADisplay dpy, VABufferID buffer_id)
unsigned int VAGenericID
Definition: va.h:576
VAEncPackedHeaderType
Packed header type.
Definition: va.h:987
unsigned int num_buffers
number of elements in the "buffers" array
Definition: va.h:761
VAConfigAttribType
Definition: va.h:316
Definition: va.h:1388
void * VADisplay
Definition: va.h:140
unsigned int num_planes
number of planes for planar layout
Definition: va.h:753
VAGenericValueType type
Value type. See VAGenericValueType.
Definition: va.h:657
Definition: va.h:648
VAStatus vaQueryConfigEntrypoints(VADisplay dpy, VAProfile profile, VAEntrypoint *entrypoint_list, int *num_entrypoints)
Definition: va.h:1034
int vaMaxNumConfigAttributes(VADisplay dpy)
Attribute value for VAConfigAttribEncJPEG.
Definition: va.h:495
unsigned int status
Status set by the driver. See VA_CODED_BUF_STATUS_*.
Definition: va.h:1884
VAStatus vaDeriveImage(VADisplay dpy, VASurfaceID surface, VAImage *image)
Definition: va.h:1195
unsigned int bit_offset
Bit offset into the data buffer where the video data starts.
Definition: va.h:1882
Generic value.
Definition: va.h:655
VAStatus vaDeassociateSubpicture(VADisplay dpy, VASubpictureID subpicture, VASurfaceID *target_surfaces, int num_surfaces)
VAStatus vaQuerySubpictureFormats(VADisplay dpy, VAImageFormat *format_list, unsigned int *flags, unsigned int *num_formats)
Minimal width in pixels (int, read-only).
Definition: va.h:696
Definition: va.h:421
unsigned int flags
flags. See "Surface external buffer descriptor flags".
Definition: va.h:763
Definition: va.h:1642
Surface memory type expressed in bit fields (int, read/write).
Definition: va.h:704
VAEncMiscParameterType type
Type. Shall be set to VAEncMiscParameterTypeMaxFrameSize.
Definition: va.h:1110
Coded buffer segment.
Definition: va.h:1876
void * p
Generic pointer.
Definition: va.h:665
External buffer descriptor (pointer, write).
Definition: va.h:706
Description of picture properties of those in DPB surfaces.
Definition: va.h:2681
Maximal height in pixels (int, read-only).
Definition: va.h:702
VAStatus vaQuerySurfaceStatus(VADisplay dpy, VASurfaceID render_target, VASurfaceStatus *status)
Packed slice header.
Definition: va.h:993
VAStatus vaUnmapBuffer(VADisplay dpy, VABufferID buf_id)
Packed header parameter.
Definition: va.h:1008
VASurfaceAttribExternalBuffers structure for the VASurfaceAttribExternalBufferDescriptor attribute...
Definition: va.h:743
Definition: va.h:1339