-
Notifications
You must be signed in to change notification settings - Fork 304
/
Copy pathva.h
5444 lines (5088 loc) · 214 KB
/
va.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (c) 2007-2009 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* Video Acceleration (VA) API Specification
*
* Rev. 0.30
*
* Revision History:
* rev 0.10 (12/10/2006 Jonathan Bian) - Initial draft
* rev 0.11 (12/15/2006 Jonathan Bian) - Fixed some errors
* rev 0.12 (02/05/2007 Jonathan Bian) - Added VC-1 data structures for slice level decode
* rev 0.13 (02/28/2007 Jonathan Bian) - Added GetDisplay()
* rev 0.14 (04/13/2007 Jonathan Bian) - Fixed MPEG-2 PictureParameter structure, cleaned up a few funcs.
* rev 0.15 (04/20/2007 Jonathan Bian) - Overhauled buffer management
* rev 0.16 (05/02/2007 Jonathan Bian) - Added error codes and fixed some issues with configuration
* rev 0.17 (05/07/2007 Jonathan Bian) - Added H.264/AVC data structures for slice level decode.
* rev 0.18 (05/14/2007 Jonathan Bian) - Added data structures for MPEG-4 slice level decode
* and MPEG-2 motion compensation.
* rev 0.19 (08/06/2007 Jonathan Bian) - Removed extra type for bitplane data.
* rev 0.20 (08/08/2007 Jonathan Bian) - Added missing fields to VC-1 PictureParameter structure.
* rev 0.21 (08/20/2007 Jonathan Bian) - Added image and subpicture support.
* rev 0.22 (08/27/2007 Jonathan Bian) - Added support for chroma-keying and global alpha.
* rev 0.23 (09/11/2007 Jonathan Bian) - Fixed some issues with images and subpictures.
* rev 0.24 (09/18/2007 Jonathan Bian) - Added display attributes.
* rev 0.25 (10/18/2007 Jonathan Bian) - Changed to use IDs only for some types.
* rev 0.26 (11/07/2007 Waldo Bastian) - Change vaCreateBuffer semantics
* rev 0.27 (11/19/2007 Matt Sottek) - Added DeriveImage
* rev 0.28 (12/06/2007 Jonathan Bian) - Added new versions of PutImage and AssociateSubpicture
* to enable scaling
* rev 0.29 (02/07/2008 Jonathan Bian) - VC1 parameter fixes,
* added VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED
* rev 0.30 (03/01/2009 Jonathan Bian) - Added encoding support for H.264 BP and MPEG-4 SP and fixes
* for ISO C conformance.
* rev 0.31 (09/02/2009 Gwenole Beauchesne) - VC-1/H264 fields change for VDPAU and XvBA backend
* Application needs to relink with the new library.
*
* rev 0.31.1 (03/29/2009) - Data structure for JPEG encode
* rev 0.31.2 (01/13/2011 Anthony Pabon)- Added a flag to indicate Subpicture coordinates are screen
* screen relative rather than source video relative.
* rev 0.32.0 (01/13/2011 Xiang Haihao) - Add profile into VAPictureParameterBufferVC1
* update VAAPI to 0.32.0
*
* Acknowledgements:
* Some concepts borrowed from XvMC and XvImage.
* Waldo Bastian (Intel), Matt Sottek (Intel), Austin Yuan (Intel), and Gwenole Beauchesne (SDS)
* contributed to various aspects of the API.
*/
/**
* \file va.h
* \brief The Core API
*
* This file contains the \ref api_core "Core API".
*/
#ifndef _VA_H_
#define _VA_H_
#include <stddef.h>
#include <stdint.h>
#include <va/va_version.h>
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__GNUC__) && !defined(__COVERITY__)
#define va_deprecated __attribute__((deprecated))
#if __GNUC__ >= 6
#define va_deprecated_enum va_deprecated
#else
#define va_deprecated_enum
#endif
#else
#define va_deprecated
#define va_deprecated_enum
#endif
/**
* \mainpage Video Acceleration (VA) API
*
* \section intro Introduction
*
* The main motivation for VA-API (Video Acceleration API) is to
* enable hardware accelerated video decode and encode at various
* entry-points (VLD, IDCT, Motion Compensation etc.) for the
* prevailing coding standards today (MPEG-2, MPEG-4 ASP/H.263, MPEG-4
* AVC/H.264, VC-1/VMW3, and JPEG, HEVC/H265, VP8, VP9) and video pre/post
* processing
*
* VA-API is split into several modules:
* - \ref api_core
* - Encoder (H264, HEVC, JPEG, MPEG2, VP8, VP9)
* - \ref api_enc_h264
* - \ref api_enc_hevc
* - \ref api_enc_jpeg
* - \ref api_enc_mpeg2
* - \ref api_enc_vp8
* - \ref api_enc_vp9
* - \ref api_enc_av1
* - Decoder (HEVC, JPEG, VP8, VP9, AV1, VVC)
* - \ref api_dec_hevc
* - \ref api_dec_jpeg
* - \ref api_dec_vp8
* - \ref api_dec_vp9
* - \ref api_dec_av1
* - \ref api_dec_vvc
* - \ref api_vpp
* - \ref api_prot
* - FEI (H264, HEVC)
* - \ref api_fei
* - \ref api_fei_h264
* - \ref api_fei_hevc
*
* \section threading Multithreading Guide
* All VAAPI functions implemented in libva are thread-safe. For any VAAPI
* function that requires the implementation of a backend (e.g. hardware driver),
* the backend must ensure that its implementation is also thread-safe. If the
* backend implementation of a VAAPI function is not thread-safe then this should
* be considered as a bug against the backend implementation.
*
* It is assumed that none of the VAAPI functions will be called from signal
* handlers.
*
* Thread-safety in this context means that when VAAPI is being called by multiple
* concurrent threads, it will not crash or hang the OS, and VAAPI internal
* data structures will not be corrupted. When multiple threads are operating on
* the same VAAPI objects, it is the application's responsibility to synchronize
* these operations in order to generate the expected results. For example, using
* a single VAContext from multiple threads may generate unexpected results.
*
* Following pseudo code illustrates a multithreaded transcoding scenario, where
* one thread is handling the decoding operation and another thread is handling
* the encoding operation, while synchronizing the use of a common pool of
* surfaces.
*
* \code
* // Initialization
* dpy = vaGetDisplayDRM(fd);
* vaInitialize(dpy, ...);
*
* // Create surfaces required for decoding and subsequence encoding
* vaCreateSurfaces(dpy, VA_RT_FORMAT_YUV420, width, height, &surfaces[0], ...);
*
* // Set up a queue for the surfaces shared between decode and encode threads
* surface_queue = queue_create();
*
* // Create decode_thread
* pthread_create(&decode_thread, NULL, decode, ...);
*
* // Create encode_thread
* pthread_create(&encode_thread, NULL, encode, ...);
*
* // Decode thread function
* decode() {
* // Find the decode entrypoint for H.264
* vaQueryConfigEntrypoints(dpy, h264_profile, entrypoints, ...);
*
* // Create a config for H.264 decode
* vaCreateConfig(dpy, h264_profile, VAEntrypointVLD, ...);
*
* // Create a context for decode
* vaCreateContext(dpy, config, width, height, VA_PROGRESSIVE, surfaces,
* num_surfaces, &decode_context);
*
* // Decode frames in the bitstream
* for (;;) {
* // Parse one frame and decode
* vaBeginPicture(dpy, decode_context, surfaces[surface_index]);
* vaRenderPicture(dpy, decode_context, buf, ...);
* vaEndPicture(dpy, decode_context);
* // Poll the decoding status and enqueue the surface in display order after
* // decoding is complete
* vaQuerySurfaceStatus();
* enqueue(surface_queue, surface_index);
* }
* }
*
* // Encode thread function
* encode() {
* // Find the encode entrypoint for HEVC
* vaQueryConfigEntrypoints(dpy, hevc_profile, entrypoints, ...);
*
* // Create a config for HEVC encode
* vaCreateConfig(dpy, hevc_profile, VAEntrypointEncSlice, ...);
*
* // Create a context for encode
* vaCreateContext(dpy, config, width, height, VA_PROGRESSIVE, surfaces,
* num_surfaces, &encode_context);
*
* // Encode frames produced by the decoder
* for (;;) {
* // Dequeue the surface enqueued by the decoder
* surface_index = dequeue(surface_queue);
* // Encode using this surface as the source
* vaBeginPicture(dpy, encode_context, surfaces[surface_index]);
* vaRenderPicture(dpy, encode_context, buf, ...);
* vaEndPicture(dpy, encode_context);
* }
* }
* \endcode
*/
/**
* \defgroup api_core Core API
*
* @{
*/
/**
Overview
The VA API is intended to provide an interface between a video decode/encode/processing
application (client) and a hardware accelerator (server), to off-load
video decode/encode/processing operations from the host to the hardware accelerator at various
entry-points.
The basic operation steps are:
- Negotiate a mutually acceptable configuration with the server to lock
down profile, entrypoints, and other attributes that will not change on
a frame-by-frame basis.
- Create a video decode, encode or processing context which represents a
"virtualized" hardware device
- Get and fill the render buffers with the corresponding data (depending on
profiles and entrypoints)
- Pass the render buffers to the server to handle the current frame
Initialization & Configuration Management
- Find out supported profiles
- Find out entrypoints for a given profile
- Find out configuration attributes for a given profile/entrypoint pair
- Create a configuration for use by the application
*/
typedef void* VADisplay; /* window system dependent */
typedef int VAStatus; /** Return status type from functions */
/** Values for the return status */
#define VA_STATUS_SUCCESS 0x00000000
#define VA_STATUS_ERROR_OPERATION_FAILED 0x00000001
#define VA_STATUS_ERROR_ALLOCATION_FAILED 0x00000002
#define VA_STATUS_ERROR_INVALID_DISPLAY 0x00000003
#define VA_STATUS_ERROR_INVALID_CONFIG 0x00000004
#define VA_STATUS_ERROR_INVALID_CONTEXT 0x00000005
#define VA_STATUS_ERROR_INVALID_SURFACE 0x00000006
#define VA_STATUS_ERROR_INVALID_BUFFER 0x00000007
#define VA_STATUS_ERROR_INVALID_IMAGE 0x00000008
#define VA_STATUS_ERROR_INVALID_SUBPICTURE 0x00000009
#define VA_STATUS_ERROR_ATTR_NOT_SUPPORTED 0x0000000a
#define VA_STATUS_ERROR_MAX_NUM_EXCEEDED 0x0000000b
#define VA_STATUS_ERROR_UNSUPPORTED_PROFILE 0x0000000c
#define VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT 0x0000000d
#define VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT 0x0000000e
#define VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE 0x0000000f
#define VA_STATUS_ERROR_SURFACE_BUSY 0x00000010
#define VA_STATUS_ERROR_FLAG_NOT_SUPPORTED 0x00000011
#define VA_STATUS_ERROR_INVALID_PARAMETER 0x00000012
#define VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED 0x00000013
#define VA_STATUS_ERROR_UNIMPLEMENTED 0x00000014
#define VA_STATUS_ERROR_SURFACE_IN_DISPLAYING 0x00000015
#define VA_STATUS_ERROR_INVALID_IMAGE_FORMAT 0x00000016
#define VA_STATUS_ERROR_DECODING_ERROR 0x00000017
#define VA_STATUS_ERROR_ENCODING_ERROR 0x00000018
/**
* \brief An invalid/unsupported value was supplied.
*
* This is a catch-all error code for invalid or unsupported values.
* e.g. value exceeding the valid range, invalid type in the context
* of generic attribute values.
*/
#define VA_STATUS_ERROR_INVALID_VALUE 0x00000019
/** \brief An unsupported filter was supplied. */
#define VA_STATUS_ERROR_UNSUPPORTED_FILTER 0x00000020
/** \brief An invalid filter chain was supplied. */
#define VA_STATUS_ERROR_INVALID_FILTER_CHAIN 0x00000021
/** \brief Indicate HW busy (e.g. run multiple encoding simultaneously). */
#define VA_STATUS_ERROR_HW_BUSY 0x00000022
/** \brief An unsupported memory type was supplied. */
#define VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE 0x00000024
/** \brief Indicate allocated buffer size is not enough for input or output. */
#define VA_STATUS_ERROR_NOT_ENOUGH_BUFFER 0x00000025
/** \brief Indicate an operation isn't completed because time-out interval elapsed. */
#define VA_STATUS_ERROR_TIMEDOUT 0x00000026
#define VA_STATUS_ERROR_UNKNOWN 0xFFFFFFFF
/**
* 1. De-interlacing flags for vaPutSurface()
* 2. Surface sample type for input/output surface flag
* - Progressive: VA_FRAME_PICTURE
* - Interleaved: VA_TOP_FIELD_FIRST, VA_BOTTOM_FIELD_FIRST
* - Field: VA_TOP_FIELD, VA_BOTTOM_FIELD
*/
#define VA_FRAME_PICTURE 0x00000000
#define VA_TOP_FIELD 0x00000001
#define VA_BOTTOM_FIELD 0x00000002
#define VA_TOP_FIELD_FIRST 0x00000004
#define VA_BOTTOM_FIELD_FIRST 0x00000008
/**
* Enabled the positioning/cropping/blending feature:
* 1, specify the video playback position in the isurface
* 2, specify the cropping info for video playback
* 3, encoded video will blend with background color
*/
#define VA_ENABLE_BLEND 0x00000004 /* video area blend with the constant color */
/**
* Clears the drawable with background color.
* for hardware overlay based implementation this flag
* can be used to turn off the overlay
*/
#define VA_CLEAR_DRAWABLE 0x00000008
/** Color space conversion flags for vaPutSurface() */
#define VA_SRC_COLOR_MASK 0x000000f0
#define VA_SRC_BT601 0x00000010
#define VA_SRC_BT709 0x00000020
#define VA_SRC_SMPTE_240 0x00000040
/** Scaling flags for vaPutSurface() */
#define VA_FILTER_SCALING_DEFAULT 0x00000000
#define VA_FILTER_SCALING_FAST 0x00000100
#define VA_FILTER_SCALING_HQ 0x00000200
#define VA_FILTER_SCALING_NL_ANAMORPHIC 0x00000300
#define VA_FILTER_SCALING_MASK 0x00000f00
/** Interpolation method for scaling */
#define VA_FILTER_INTERPOLATION_DEFAULT 0x00000000
#define VA_FILTER_INTERPOLATION_NEAREST_NEIGHBOR 0x00001000
#define VA_FILTER_INTERPOLATION_BILINEAR 0x00002000
#define VA_FILTER_INTERPOLATION_ADVANCED 0x00003000
#define VA_FILTER_INTERPOLATION_MASK 0x0000f000
/** Padding size in 4-bytes */
#define VA_PADDING_LOW 4
#define VA_PADDING_MEDIUM 8
#define VA_PADDING_HIGH 16
#define VA_PADDING_LARGE 32
/** operation options */
/** synchronization, block call, output should be ready after execution function return*/
#define VA_EXEC_SYNC 0x0
/** asynchronization,application should call additonal sync operation to access output */
#define VA_EXEC_ASYNC 0x1
/** operation mode */
#define VA_EXEC_MODE_DEFAULT 0x0
#define VA_EXEC_MODE_POWER_SAVING 0x1
#define VA_EXEC_MODE_PERFORMANCE 0x2
/* Values used to describe device features. */
/** The feature is not supported by the device.
*
* Any corresponding feature flag must not be set.
*/
#define VA_FEATURE_NOT_SUPPORTED 0
/** The feature is supported by the device.
*
* The user may decide whether or not to use this feature.
*
* Note that support for a feature only indicates that the hardware
* is able to use it; whether it is actually a positive change to
* enable it in a given situation will depend on other factors
* including the input provided by the user.
*/
#define VA_FEATURE_SUPPORTED 1
/** The feature is required by the device.
*
* The device does not support not enabling this feature, so any
* corresponding feature flag must be set and any additional
* configuration needed by the feature must be supplied.
*/
#define VA_FEATURE_REQUIRED 2
/**
* Returns a short english description of error_status
*/
const char *vaErrorStr(VAStatus error_status);
/** \brief Structure to describe rectangle. */
typedef struct _VARectangle {
int16_t x;
int16_t y;
uint16_t width;
uint16_t height;
} VARectangle;
/** \brief Generic motion vector data structure. */
typedef struct _VAMotionVector {
/** \brief Past reference
*
* - \c [0]: horizontal motion vector for past reference
* - \c [1]: vertical motion vector for past reference
*/
int16_t mv0[2];
/** \brief Future reference
*
* - \c [0]: horizontal motion vector for future reference
* - \c [1]: vertical motion vector for future reference
*/
int16_t mv1[2];
} VAMotionVector;
/** Type of a message callback, used for both error and info log. */
typedef void (*VAMessageCallback)(void *user_context, const char *message);
/**
* Set the callback for error messages, or NULL for no logging.
* Returns the previous one, or NULL if it was disabled.
*/
VAMessageCallback vaSetErrorCallback(VADisplay dpy, VAMessageCallback callback, void *user_context);
/**
* Set the callback for info messages, or NULL for no logging.
* Returns the previous one, or NULL if it was disabled.
*/
VAMessageCallback vaSetInfoCallback(VADisplay dpy, VAMessageCallback callback, void *user_context);
/**
* Initialization:
* A display must be obtained by calling vaGetDisplay() before calling
* vaInitialize() and other functions. This connects the API to the
* native window system.
* For X Windows, native_dpy would be from XOpenDisplay()
*/
typedef void* VANativeDisplay; /* window system dependent */
int vaDisplayIsValid(VADisplay dpy);
/**
* Set the override driver name instead of queried driver driver.
*/
VAStatus vaSetDriverName(VADisplay dpy,
char *driver_name
);
/**
* Initialize the library
*/
VAStatus vaInitialize(
VADisplay dpy,
int *major_version, /* out */
int *minor_version /* out */
);
/**
* After this call, all library internal resources will be cleaned up
*/
VAStatus vaTerminate(
VADisplay dpy
);
/**
* vaQueryVendorString returns a pointer to a zero-terminated string
* describing some aspects of the VA implemenation on a specific
* hardware accelerator. The format of the returned string is vendor
* specific and at the discretion of the implementer.
* e.g. for the Intel GMA500 implementation, an example would be:
* "Intel GMA500 - 2.0.0.32L.0005"
*/
const char *vaQueryVendorString(
VADisplay dpy
);
typedef int (*VAPrivFunc)(void);
/**
* Return a function pointer given a function name in the library.
* This allows private interfaces into the library
*/
VAPrivFunc vaGetLibFunc(
VADisplay dpy,
const char *func
);
/** Currently defined profiles */
typedef enum {
/** \brief Profile ID used for video processing. */
VAProfileNone = -1,
VAProfileMPEG2Simple = 0,
VAProfileMPEG2Main = 1,
VAProfileMPEG4Simple = 2,
VAProfileMPEG4AdvancedSimple = 3,
VAProfileMPEG4Main = 4,
VAProfileH264Baseline va_deprecated_enum = 5,
VAProfileH264Main = 6,
VAProfileH264High = 7,
VAProfileVC1Simple = 8,
VAProfileVC1Main = 9,
VAProfileVC1Advanced = 10,
VAProfileH263Baseline = 11,
VAProfileJPEGBaseline = 12,
VAProfileH264ConstrainedBaseline = 13,
VAProfileVP8Version0_3 = 14,
VAProfileH264MultiviewHigh = 15,
VAProfileH264StereoHigh = 16,
VAProfileHEVCMain = 17,
VAProfileHEVCMain10 = 18,
VAProfileVP9Profile0 = 19,
VAProfileVP9Profile1 = 20,
VAProfileVP9Profile2 = 21,
VAProfileVP9Profile3 = 22,
VAProfileHEVCMain12 = 23,
VAProfileHEVCMain422_10 = 24,
VAProfileHEVCMain422_12 = 25,
VAProfileHEVCMain444 = 26,
VAProfileHEVCMain444_10 = 27,
VAProfileHEVCMain444_12 = 28,
VAProfileHEVCSccMain = 29,
VAProfileHEVCSccMain10 = 30,
VAProfileHEVCSccMain444 = 31,
VAProfileAV1Profile0 = 32,
VAProfileAV1Profile1 = 33,
VAProfileHEVCSccMain444_10 = 34,
/** \brief Profile ID used for protected video playback. */
VAProfileProtected = 35,
VAProfileH264High10 = 36,
VAProfileVVCMain10 = 37,
VAProfileVVCMultilayerMain10 = 38,
VAProfileAV1Profile2 = 39
} VAProfile;
/**
* Currently defined entrypoints
*/
typedef enum {
VAEntrypointVLD = 1,
VAEntrypointIZZ = 2,
VAEntrypointIDCT = 3,
VAEntrypointMoComp = 4,
VAEntrypointDeblocking = 5,
VAEntrypointEncSlice = 6, /* slice level encode */
VAEntrypointEncPicture = 7, /* pictuer encode, JPEG, etc */
/*
* For an implementation that supports a low power/high performance variant
* for slice level encode, it can choose to expose the
* VAEntrypointEncSliceLP entrypoint. Certain encoding tools may not be
* available with this entrypoint (e.g. interlace, MBAFF) and the
* application can query the encoding configuration attributes to find
* out more details if this entrypoint is supported.
*/
VAEntrypointEncSliceLP = 8,
VAEntrypointVideoProc = 10, /**< Video pre/post-processing. */
/**
* \brief VAEntrypointFEI
*
* The purpose of FEI (Flexible Encoding Infrastructure) is to allow applications to
* have more controls and trade off quality for speed with their own IPs.
* The application can optionally provide input to ENC for extra encode control
* and get the output from ENC. Application can chose to modify the ENC
* output/PAK input during encoding, but the performance impact is significant.
*
* On top of the existing buffers for normal encode, there will be
* one extra input buffer (VAEncMiscParameterFEIFrameControl) and
* three extra output buffers (VAEncFEIMVBufferType, VAEncFEIMBModeBufferType
* and VAEncFEIDistortionBufferType) for VAEntrypointFEI entry function.
* If separate PAK is set, two extra input buffers
* (VAEncFEIMVBufferType, VAEncFEIMBModeBufferType) are needed for PAK input.
**/
VAEntrypointFEI = 11,
/**
* \brief VAEntrypointStats
*
* A pre-processing function for getting some statistics and motion vectors is added,
* and some extra controls for Encode pipeline are provided. The application can
* optionally call the statistics function to get motion vectors and statistics like
* variances, distortions before calling Encode function via this entry point.
*
* Checking whether Statistics is supported can be performed with vaQueryConfigEntrypoints().
* If Statistics entry point is supported, then the list of returned entry-points will
* include #VAEntrypointStats. Supported pixel format, maximum resolution and statistics
* specific attributes can be obtained via normal attribute query. One input buffer
* (VAStatsStatisticsParameterBufferType) and one or two output buffers
* (VAStatsStatisticsBufferType, VAStatsStatisticsBottomFieldBufferType (for interlace only)
* and VAStatsMVBufferType) are needed for this entry point.
**/
VAEntrypointStats = 12,
/**
* \brief VAEntrypointProtectedTEEComm
*
* A function for communicating with TEE (Trusted Execution Environment).
**/
VAEntrypointProtectedTEEComm = 13,
/**
* \brief VAEntrypointProtectedContent
*
* A function for protected content to decrypt encrypted content.
**/
VAEntrypointProtectedContent = 14,
} VAEntrypoint;
/** Currently defined configuration attribute types */
typedef enum {
VAConfigAttribRTFormat = 0,
VAConfigAttribSpatialResidual = 1,
VAConfigAttribSpatialClipping = 2,
VAConfigAttribIntraResidual = 3,
VAConfigAttribEncryption = 4,
VAConfigAttribRateControl = 5,
/** @name Attributes for decoding */
/**@{*/
/**
* \brief Slice Decoding mode. Read/write.
*
* This attribute determines what mode the driver supports for slice
* decoding, through vaGetConfigAttributes(); and what mode the user
* will be providing to the driver, through vaCreateConfig(), if the
* driver supports those. If this attribute is not set by the user then
* it is assumed that VA_DEC_SLICE_MODE_NORMAL mode is used.
*
* See \c VA_DEC_SLICE_MODE_xxx for the list of slice decoding modes.
*/
VAConfigAttribDecSliceMode = 6,
/**
* \brief JPEG decoding attribute. Read-only.
*
* This attribute exposes a number of capabilities of the underlying
* JPEG implementation. The attribute value is partitioned into fields as defined in the
* VAConfigAttribValDecJPEG union.
*/
VAConfigAttribDecJPEG = 7,
/**
* \brief Decode processing support. Read/write.
*
* This attribute determines if the driver supports video processing
* with decoding using the decoding context in a single call, through
* vaGetConfigAttributes(); and if the user may use this feature,
* through vaCreateConfig(), if the driver supports the user scenario.
* The user will essentially create a regular decode VAContext. Therefore,
* the parameters of vaCreateContext() such as picture_width, picture_height
* and render_targets are in relation to the decode output parameters
* (not processing output parameters) as normal.
* If this attribute is not set by the user then it is assumed that no
* extra processing is done after decoding for this decode context.
*
* Since essentially the application is creating a decoder config and context,
* all function calls that take in the config (e.g. vaQuerySurfaceAttributes())
* or context are in relation to the decoder, except those video processing
* function specified in the next paragraph.
*
* Once the decode config and context are created, the user must further
* query the supported processing filters using vaQueryVideoProcFilters(),
* vaQueryVideoProcFilterCaps(), vaQueryVideoProcPipelineCaps() by specifying
* the created decode context. The user must provide processing information
* and extra processing output surfaces as "additional_outputs" to the driver
* through VAProcPipelineParameterBufferType. The render_target specified
* at vaBeginPicture() time refers to the decode output surface. The
* target surface for the output of processing needs to be a different
* surface since the decode process requires the original reconstructed buffer.
* The "surface" member of VAProcPipelineParameterBuffer should be set to the
* same as "render_target" set in vaBeginPicture(), but the driver may choose
* to ignore this parameter.
*/
VAConfigAttribDecProcessing = 8,
/** @name Attributes for encoding */
/**@{*/
/**
* \brief Packed headers mode. Read/write.
*
* This attribute determines what packed headers the driver supports,
* through vaGetConfigAttributes(); and what packed headers the user
* will be providing to the driver, through vaCreateConfig(), if the
* driver supports those.
*
* See \c VA_ENC_PACKED_HEADER_xxx for the list of packed headers.
*/
VAConfigAttribEncPackedHeaders = 10,
/**
* \brief Interlaced mode. Read/write.
*
* This attribute determines what kind of interlaced encoding mode
* the driver supports.
*
* See \c VA_ENC_INTERLACED_xxx for the list of interlaced modes.
*/
VAConfigAttribEncInterlaced = 11,
/**
* \brief Maximum number of reference frames. Read-only.
*
* This attribute determines the maximum number of reference
* frames supported for encoding.
*
* Note: for H.264 encoding, the value represents the maximum number
* of reference frames for both the reference picture list 0 (bottom
* 16 bits) and the reference picture list 1 (top 16 bits).
*/
VAConfigAttribEncMaxRefFrames = 13,
/**
* \brief Maximum number of slices per frame. Read-only.
*
* This attribute determines the maximum number of slices the
* driver can support to encode a single frame.
*/
VAConfigAttribEncMaxSlices = 14,
/**
* \brief Slice structure. Read-only.
*
* This attribute determines slice structures supported by the
* driver for encoding. This attribute is a hint to the user so
* that he can choose a suitable surface size and how to arrange
* the encoding process of multiple slices per frame.
*
* More specifically, for H.264 encoding, this attribute
* determines the range of accepted values to
* VAEncSliceParameterBufferH264::macroblock_address and
* VAEncSliceParameterBufferH264::num_macroblocks.
*
* See \c VA_ENC_SLICE_STRUCTURE_xxx for the supported slice
* structure types.
*/
VAConfigAttribEncSliceStructure = 15,
/**
* \brief Macroblock information. Read-only.
*
* This attribute determines whether the driver supports extra
* encoding information per-macroblock. e.g. QP.
*
* More specifically, for H.264 encoding, if the driver returns a non-zero
* value for this attribute, this means the application can create
* additional #VAEncMacroblockParameterBufferH264 buffers referenced
* through VAEncSliceParameterBufferH264::macroblock_info.
*/
VAConfigAttribEncMacroblockInfo = 16,
/**
* \brief Maximum picture width. Read-only.
*
* This attribute determines the maximum picture width the driver supports
* for a given configuration.
*/
VAConfigAttribMaxPictureWidth = 18,
/**
* \brief Maximum picture height. Read-only.
*
* This attribute determines the maximum picture height the driver supports
* for a given configuration.
*/
VAConfigAttribMaxPictureHeight = 19,
/**
* \brief JPEG encoding attribute. Read-only.
*
* This attribute exposes a number of capabilities of the underlying
* JPEG implementation. The attribute value is partitioned into fields as defined in the
* VAConfigAttribValEncJPEG union.
*/
VAConfigAttribEncJPEG = 20,
/**
* \brief Encoding quality range attribute. Read-only.
*
* This attribute conveys whether the driver supports different quality level settings
* for encoding. A value less than or equal to 1 means that the encoder only has a single
* quality setting, and a value greater than 1 represents the number of quality levels
* that can be configured. e.g. a value of 2 means there are two distinct quality levels.
*/
VAConfigAttribEncQualityRange = 21,
/**
* \brief Encoding quantization attribute. Read-only.
*
* This attribute conveys whether the driver supports certain types of quantization methods
* for encoding (e.g. trellis). See \c VA_ENC_QUANTIZATION_xxx for the list of quantization methods
*/
VAConfigAttribEncQuantization = 22,
/**
* \brief Encoding intra refresh attribute. Read-only.
*
* This attribute conveys whether the driver supports certain types of intra refresh methods
* for encoding (e.g. adaptive intra refresh or rolling intra refresh).
* See \c VA_ENC_INTRA_REFRESH_xxx for intra refresh methods
*/
VAConfigAttribEncIntraRefresh = 23,
/**
* \brief Encoding skip frame attribute. Read-only.
*
* This attribute conveys whether the driver supports sending skip frame parameters
* (VAEncMiscParameterTypeSkipFrame) to the encoder's rate control, when the user has
* externally skipped frames.
*/
VAConfigAttribEncSkipFrame = 24,
/**
* \brief Encoding region-of-interest (ROI) attribute. Read-only.
*
* This attribute conveys whether the driver supports region-of-interest (ROI) encoding,
* based on user provided ROI rectangles. The attribute value is partitioned into fields
* as defined in the VAConfigAttribValEncROI union.
*
* If ROI encoding is supported, the ROI information is passed to the driver using
* VAEncMiscParameterTypeROI.
*/
VAConfigAttribEncROI = 25,
/**
* \brief Encoding extended rate control attribute. Read-only.
*
* This attribute conveys whether the driver supports any extended rate control features
* The attribute value is partitioned into fields as defined in the
* VAConfigAttribValEncRateControlExt union.
*/
VAConfigAttribEncRateControlExt = 26,
/**
* \brief Processing rate reporting attribute. Read-only.
*
* This attribute conveys whether the driver supports reporting of
* encode/decode processing rate based on certain set of parameters
* (i.e. levels, I frame internvals) for a given configuration.
* If this is supported, vaQueryProcessingRate() can be used to get
* encode or decode processing rate.
* See \c VA_PROCESSING_RATE_xxx for encode/decode processing rate
*/
VAConfigAttribProcessingRate = 27,
/**
* \brief Encoding dirty rectangle. Read-only.
*
* This attribute conveys whether the driver supports dirty rectangle.
* encoding, based on user provided ROI rectangles which indicate the rectangular areas
* where the content has changed as compared to the previous picture. The regions of the
* picture that are not covered by dirty rect rectangles are assumed to have not changed
* compared to the previous picture. The encoder may do some optimizations based on
* this information. The attribute value returned indicates the number of regions that
* are supported. e.g. A value of 0 means dirty rect encoding is not supported. If dirty
* rect encoding is supported, the ROI information is passed to the driver using
* VAEncMiscParameterTypeDirtyRect.
*/
VAConfigAttribEncDirtyRect = 28,
/**
* \brief Parallel Rate Control (hierachical B) attribute. Read-only.
*
* This attribute conveys whether the encoder supports parallel rate control.
* It is a integer value 0 - unsupported, > 0 - maximum layer supported.
* This is the way when hireachical B frames are encoded, multiple independent B frames
* on the same layer may be processed at same time. If supported, app may enable it by
* setting enable_parallel_brc in VAEncMiscParameterRateControl,and the number of B frames
* per layer per GOP will be passed to driver through VAEncMiscParameterParallelRateControl
* structure.Currently three layers are defined.
*/
VAConfigAttribEncParallelRateControl = 29,
/**
* \brief Dynamic Scaling Attribute. Read-only.
*
* This attribute conveys whether encoder is capable to determine dynamic frame
* resolutions adaptive to bandwidth utilization and processing power, etc.
* It is a boolean value 0 - unsupported, 1 - supported.
* If it is supported,for VP9, suggested frame resolution can be retrieved from VACodedBufferVP9Status.
*/
VAConfigAttribEncDynamicScaling = 30,
/**
* \brief frame size tolerance support
* it indicates the tolerance of frame size
*/
VAConfigAttribFrameSizeToleranceSupport = 31,
/**
* \brief Encode function type for FEI.
*
* This attribute conveys whether the driver supports different function types for encode.
* It can be VA_FEI_FUNCTION_ENC, VA_FEI_FUNCTION_PAK, or VA_FEI_FUNCTION_ENC_PAK. Currently
* it is for FEI entry point only.
* Default is VA_FEI_FUNCTION_ENC_PAK.
*/
VAConfigAttribFEIFunctionType = 32,
/**
* \brief Maximum number of FEI MV predictors. Read-only.
*
* This attribute determines the maximum number of MV predictors the driver
* can support to encode a single frame. 0 means no MV predictor is supported.
* Currently it is for FEI entry point only.
*/
VAConfigAttribFEIMVPredictors = 33,
/**
* \brief Statistics attribute. Read-only.
*
* This attribute exposes a number of capabilities of the VAEntrypointStats entry
* point. The attribute value is partitioned into fields as defined in the
* VAConfigAttribValStats union. Currently it is for VAEntrypointStats only.
*/
VAConfigAttribStats = 34,
/**
* \brief Tile Support Attribute. Read-only.
*
* This attribute conveys whether encoder is capable to support tiles.
* If not supported, the tile related parameters sent to encoder, such as
* tiling structure, should be ignored. 0 - unsupported, 1 - supported.
*/
VAConfigAttribEncTileSupport = 35,
/**
* \brief whether accept rouding setting from application. Read-only.
* This attribute is for encode quality, if it is report,
* application can change the rounding setting by VAEncMiscParameterTypeCustomRoundingControl
*/
VAConfigAttribCustomRoundingControl = 36,
/**
* \brief Encoding QP info block size attribute. Read-only.
* This attribute conveys the block sizes that underlying driver
* support for QP info for buffer #VAEncQpBuffer.
*/
VAConfigAttribQPBlockSize = 37,
/**
* \brief encode max frame size attribute. Read-only
* attribute value \c VAConfigAttribValMaxFrameSize represent max frame size support
*/
VAConfigAttribMaxFrameSize = 38,
/** \brief inter frame prediction directrion attribute. Read-only.
* this attribute conveys the prediction direction (backward or forword) for specific config
* the value could be VA_PREDICTION_DIRECTION_XXXX. it can be combined with VAConfigAttribEncMaxRefFrames
* to describe reference list , and the prediction direction. if this attrib is not present,both direction
* should be supported, no restriction.
* for example: normal HEVC encoding , maximum reference frame number in reflist 0 and reflist 1 is deduced
* by VAConfigAttribEncMaxRefFrames. so there are typical P frame, B frame,
* if VAConfigAttribPredictionDirection is also present. it will stipulate prediction direction in both
* reference list. if only one prediction direction present(such as PREVIOUS),all reference frame should be
* previous frame (PoC < current).
*/
VAConfigAttribPredictionDirection = 39,
/** \brief combined submission of multiple frames from different streams, it is optimization for different HW
* implementation, multiple frames encode/decode can improve HW concurrency
*/
VAConfigAttribMultipleFrame = 40,
/** \brief priority setting for the context. Read-Write
* attribute value is \c VAConfigAttribValContextPriority
* this setting also could be update by \c VAContextParameterUpdateBuffer
*/
VAConfigAttribContextPriority = 41,
/** \brief AV1 decoding features. Read-only.
*
* This attribute describes the supported features of an
* AV1 decoder configuration. The value returned uses the
* VAConfigAttribValDecAV1Features type.
*/
VAConfigAttribDecAV1Features = 42,
/** \brief TEE could be any HW secure device. Read-only */
VAConfigAttribTEEType = 43,
/** \brief TEE type client is a specific module supporting specific functions in TEE. Read-only*/
VAConfigAttribTEETypeClient = 44,
/**
* \brief Cipher algorithm of the protected content session.
*
* This attribute specifies the cipher algorithm of the protected content session. It
* could be \c VA_PC_CIPHER_AES, etc....
*/
VAConfigAttribProtectedContentCipherAlgorithm = 45,
/**
* \brief Cipher block size of the protected content session.
*
* This attribute specifies the block size of the protected content session. It could be
* \c VA_PC_BLOCK_SIZE_128, \c VA_PC_BLOCK_SIZE_192, or \c VA_PC_BLOCK_SIZE_256, etc....
*/
VAConfigAttribProtectedContentCipherBlockSize = 46,
/**
* \brief Cipher mode of the protected content session.
*
* This attribute specifies the cipher mode of the protected content session. It could
* be \c VA_PC_CIPHER_MODE_ECB, \c VA_PC_CIPHER_MODE_CBC, \c VA_PC_CIPHER_MODE_CTR, etc...
*/
VAConfigAttribProtectedContentCipherMode = 47,
/**
* \brief Decryption sample type of the protected content session.
*
* This attribute specifies the decryption sample type of the protected content session.
* It could be \c VA_PC_SAMPLE_TYPE_FULLSAMPLE or \c VA_PC_SAMPLE_TYPE_SUBSAMPLE.
*/
VAConfigAttribProtectedContentCipherSampleType = 48,
/**
* \brief Special usage attribute of the protected session.
*
* The attribute specifies the flow for the protected session could be used. For
* example, it could be \c VA_PC_USAGE_DEFAULT, \c VA_PC_USAGE_WIDEVINE, etc....
*/
VAConfigAttribProtectedContentUsage = 49,
/** \brief HEVC/H.265 encoding features. Read-only.
*
* This attribute describes the supported features of an
* HEVC/H.265 encoder configuration. The value returned uses the
* VAConfigAttribValEncHEVCFeatures type.
*
* If this attribute is supported by a driver then it must also
* support the VAConfigAttribEncHEVCBlockSizes attribute.
*/