vdpau.h 187 KB
Newer Older
Aaron Plattner's avatar
Aaron Plattner committed
1
2
3
4
5
6
7
8
/*
 * This source file is documented using Doxygen markup.
 * See http://www.stack.nl/~dimitri/doxygen/
 */

/*
 * This copyright notice applies to this header file:
 *
9
 * Copyright (c) 2008-2015 NVIDIA Corporation
10
 *
Aaron Plattner's avatar
Aaron Plattner committed
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 * 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, sublicense, 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 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
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS 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.
 */

/**
 * \mainpage Video Decode and Presentation API for Unix
35
 *
Aaron Plattner's avatar
Aaron Plattner committed
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
 * \section intro Introduction
 *
 * The Video Decode and Presentation API for Unix (VDPAU) provides
 * a complete solution for decoding, post-processing, compositing,
 * and displaying compressed or uncompressed video streams. These
 * video streams may be combined (composited) with bitmap content,
 * to implement OSDs and other application user interfaces.
 *
 * \section api_partitioning API Partitioning
 *
 * VDPAU is split into two distinct modules:
 * - \ref api_core
 * - \ref api_winsys
 *
 * The intent is that most VDPAU functionality exists and
 * operates identically across all possible Windowing Systems.
 * This functionality is the \ref api_core.
 *
 * However, a small amount of functionality must be included that
 * is tightly coupled to the underlying Windowing System. This
 * functionality is the \ref api_winsys. Possibly examples
 * include:
 * - Creation of the initial VDPAU \ref VdpDevice "VdpDevice"
 *   handle, since this act requires intimate knowledge of the
 *   underlying Window System, such as specific display handle or
 *   driver identification.
 * - Conversion of VDPAU surfaces to/from underlying Window
 *   System surface types, e.g. to allow manipulation of
 *   VDPAU-generated surfaces via native Window System APIs.
 *
 * \section objects Object Types
 *
 * VDPAU is roughly object oriented; most functionality is
 * exposed by creating an object (handle) of a certain class
 * (type), then executing various functions against that handle.
 * The set of object classes supported, and their purpose, is
 * discussed below.
 *
 * \subsection device_type Device Type
 *
 * A \ref VdpDevice "VdpDevice" is the root object in VDPAU's
 * object system. The \ref api_winsys allows creation of a \ref
 * VdpDevice "VdpDevice" object handle, from which all other API
 * entry points can be retrieved and invoked.
 *
 * \subsection surface_types Surface Types
 *
 * A surface stores pixel information. Various types of surfaces
 * existing for different purposes:
 *
86
 * - \ref VdpVideoSurface "VdpVideoSurface"s store decompressed
Aaron Plattner's avatar
Aaron Plattner committed
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
 *   YCbCr video frames in an implementation-defined internal
 *   format.
 * - \ref VdpOutputSurface "VdpOutputSurface"s store RGB 4:4:4
 *   data. They are legal render targets for video
 *   post-processing and compositing operations.
 * - \ref VdpBitmapSurface "VdpBitmapSurface"s store RGB 4:4:4
 *   data. These surfaces are designed to contain read-only
 *   bitmap data, to be used for OSD or application UI
 *   compositing.
 *
 * \subsection transfer_types Transfer Types
 *
 * A data transfer object reads data from a surface (or
 * surfaces), processes it, and writes the result to another
 * surface. Various types of processing are possible:
 *
 * - \ref VdpDecoder "VdpDecoder" objects process compressed video
 *   data, and generate decompressed images.
 * - \ref VdpOutputSurface "VdpOutputSurface"s have their own \ref
 *   VdpOutputSurfaceRender "rendering functionality".
 * - \ref VdpVideoMixer "VdpVideoMixer" objects perform video
 *   post-processing, de-interlacing, and compositing.
 * - \ref VdpPresentationQueue "VdpPresentationQueue" is
 *   responsible for timestamp-based display of surfaces.
 *
 * \section data_flow Data Flow
 *
 * Compressed video data originates in the application's memory
 * space. This memory is typically obtained using \c malloc, and
 * filled via regular file or network read system calls.
 * Alternatively, the application may \c mmap a file.
 *
 * The compressed data is then processed using a \ref VdpDecoder
 * "VdpDecoder", which will decompress the field or frame,
 * and write the result into a \ref VdpVideoSurface
 * "VdpVideoSurface". This action may require reading pixel data
 * from some number of other \ref VdpVideoSurface "VdpVideoSurface"
 * objects, depending on the type of compressed data and
 * field/frame in question.
 *
 * If the application wishes to display any form of OSD or
 * user-interface, this must be created in a \ref
 * VdpOutputSurface "VdpOutputSurface".
 *
 * This process begins with the creation of \ref VdpBitmapSurface
 * "VdpBitmapSurface" objects to contain the OSD/UI's static data,
 * such as individual glyphs.
 *
 * \ref VdpOutputSurface "VdpOutputSurface" \ref
 * VdpOutputSurfaceRender "rendering functionality" may be used
 * to composite together various \ref VdpBitmapSurface
 * "VdpBitmapSurface"s and \ref VdpOutputSurface
 * "VdpOutputSurface"s, into another VdpOutputSurface
 * "VdpOutputSurface".
 *
 * Once video has been decoded, it must be post-processed. This
 * involves various steps such as color space conversion,
 * de-interlacing, and other video adjustments. This step is
 * performed using an \ref VdpVideoMixer "VdpVideoMixer" object.
 * This object can not only perform the aforementioned video
 * post-processing, but also composite the video with a number of
 * \ref VdpOutputSurface "VdpOutputSurface"s, thus allowing complex
 * user interfaces to be built. The final result is written into
 * another \ref VdpOutputSurface "VdpOutputSurface".
 *
 * Note that at this point, the resultant \ref VdpOutputSurface
 * "VdpOutputSurface" may be fed back through the above path,
 * either using \ref VdpOutputSurface "VdpOutputSurface" \ref
 * VdpOutputSurfaceRender "rendering functionality",
 * or as input to the \ref VdpVideoMixer "VdpVideoMixer" object.
 *
 * Finally, the resultant \ref VdpOutputSurface
 * "VdpOutputSurface" must be displayed on screen. This is the job
 * of the \ref VdpPresentationQueue "VdpPresentationQueue" object.
 *
 * \image html vdpau_data_flow.png
 *
 * \section entry_point_retrieval Entry Point Retrieval
 *
 * VDPAU is designed so that multiple implementations can be
 * used without application changes. For example, VDPAU could be
168
 * hosted on X11, or via direct GPU access.
Aaron Plattner's avatar
Aaron Plattner committed
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
 *
 * The key technology behind this is the use of function
 * pointers and a "get proc address" style API for all entry
 * points. Put another way, functions are not called directly
 * via global symbols set up by the linker, but rather through
 * pointers.
 *
 * In practical terms, the \ref api_winsys provides factory
 * functions which not only create and return \ref VdpDevice
 * "VdpDevice" objects, but also a function pointer to a \ref
 * VdpGetProcAddress function, through which all entry point
 * function pointers will be retrieved.
 *
 * \subsection entry_point_philosophy Philosophy
 *
 * It is entirely possible to envisage a simpler scheme whereby
 * such function pointers are hidden. That is, the application
 * would link against a wrapper library that exposed "real"
 * functions. The application would then call such functions
 * directly, by symbol, like any other function. The wrapper
 * library would handle loading the appropriate back-end, and
 * implementing a similar "get proc address" scheme internally.
 *
192
193
 * However, the above scheme does not work well in the context
 * of separated \ref api_core and \ref api_winsys. In this
Aaron Plattner's avatar
Aaron Plattner committed
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
 * scenario, one would require a separate wrapper library per
 * Window System, since each Window System would have a
 * different function name and prototype for the main factory
 * function. If an application then wanted to be Window System
 * agnostic (making final determination at run-time via some
 * form of plugin), it may then need to link against two
 * wrapper libraries, which would cause conflicts for all
 * symbols other than the main factory function.
 *
 * Another disadvantage of the wrapper library approach is the
 * extra level of function call required; the wrapper library
 * would internally implement the existing "get proc address"
 * and "function pointer" style dispatch anyway. Exposing this
 * directly to the application is slightly more efficient.
 *
 * \section threading Multi-threading
 *
211
 * All VDPAU functionality is fully thread-safe; any number of
Aaron Plattner's avatar
Aaron Plattner committed
212
213
 * threads may call into any VDPAU functions at any time. VDPAU
 * may not be called from signal-handlers.
214
215
216
 *
 * Note, however, that this simply guarantees that internal
 * VDPAU state will not be corrupted by thread usage, and that
Aaron Plattner's avatar
Aaron Plattner committed
217
218
219
220
 * crashes and deadlocks will not occur. Completely arbitrary
 * thread usage may not generate the results that an application
 * desires. In particular, care must be taken when multiple
 * threads are performing operations on the same VDPAU objects.
221
222
223
 *
 * VDPAU implementations guarantee correct flow of surface
 * content through the rendering pipeline, but only when
Aaron Plattner's avatar
Aaron Plattner committed
224
225
226
227
 * function calls that read from or write to a surface return to
 * the caller prior to any thread calling any other function(s)
 * that read from or write to the surface. Invoking multiple
 * reads from a surface in parallel is OK.
228
229
230
231
232
233
234
235
236
237
238
239
 *
 * Note that this restriction is placed upon VDPAU function
 * invocations, and specifically not upon any back-end
 * hardware's physical rendering operations. VDPAU
 * implementations are expected to internally synchronize such
 * hardware operations.
 *
 * In a single-threaded application, the above restriction comes
 * naturally; each function call completes before it is possible
 * to begin a new function call.
 *
 * In a multi-threaded application, threads may need to be
Aaron Plattner's avatar
Aaron Plattner committed
240
 * synchronized. For example, consider the situation where:
241
242
 *
 * - Thread 1 is parsing compressed video data, passing them
Aaron Plattner's avatar
Aaron Plattner committed
243
244
 *   through a \ref VdpDecoder "VdpDecoder" object, and filling a
 *   ring-buffer of \ref VdpVideoSurface "VdpVideoSurface"s
245
 * - Thread 2 is consuming those \ref VdpVideoSurface
Aaron Plattner's avatar
Aaron Plattner committed
246
247
 *   "VdpVideoSurface"s, and using a \ref VdpVideoMixer
 *   "VdpVideoMixer" to process them and composite them with UI.
248
249
250
251
252
253
254
 *
 * In this case, the threads must synchronize to ensure that
 * thread 1's call to \ref VdpDecoderRender has returned prior to
 * thread 2's call(s) to \ref VdpVideoMixerRender that use that
 * specific surface. This could be achieved using the following
 * pseudo-code:
 *
Aaron Plattner's avatar
Aaron Plattner committed
255
 * \code
256
257
258
259
 * Queue<VdpVideoSurface> q_full_surfaces;
 * Queue<VdpVideoSurface> q_empty_surfaces;
 *
 * thread_1() {
Aaron Plattner's avatar
Aaron Plattner committed
260
261
262
263
264
265
 *     for (;;) {
 *         VdpVideoSurface s = q_empty_surfaces.get();
 *         // Parse compressed stream here
 *         VdpDecoderRender(s, ...);
 *         q_full_surfaces.put(s);
 *     }
266
267
 * }
 *
Aaron Plattner's avatar
Aaron Plattner committed
268
269
270
 * // This would need to be more complex if
 * // VdpVideoMixerRender were to be provided with more
 * // than one field/frame at a time.
271
 * thread_2() {
Aaron Plattner's avatar
Aaron Plattner committed
272
273
274
275
276
277
278
279
280
281
282
283
284
 *     for (;;) {
 *         // Possibly, other rendering operations to mixer
 *         // layer surfaces here.
 *         VdpOutputSurface t = ...;
 *         VdpPresentationQueueBlockUntilSurfaceIdle(t);
 *         VdpVideoSurface s = q_full_surfaces.get();
 *         VdpVideoMixerRender(s, t, ...);
 *         q_empty_surfaces.put(s);
 *         // Possibly, other rendering operations to "t" here
 *         VdpPresentationQueueDisplay(t, ...);
 *     }
 * }
 * \endcode
285
 *
Aaron Plattner's avatar
Aaron Plattner committed
286
287
288
289
290
 * Finally, note that VDPAU makes no guarantees regarding any
 * level of parallelism in any given implementation. Put another
 * way, use of multi-threading is not guaranteed to yield any
 * performance gain, and in theory could even slightly reduce
 * performance due to threading/synchronization overhead.
291
 *
Aaron Plattner's avatar
Aaron Plattner committed
292
 * However, the intent of the threading requirements is to allow
293
294
295
296
297
 * for e.g. video decoding and video mixer operations to proceed
 * in parallel in hardware. Given a (presumably multi-threaded)
 * application that kept each portion of the hardware busy, this
 * would yield a performance increase.
 *
Aaron Plattner's avatar
Aaron Plattner committed
298
299
 * \section endianness Surface Endianness
 *
300
301
302
303
304
 * When dealing with surface content, i.e. the input/output of
 * Put/GetBits functions, applications must take care to access
 * memory in the correct fashion, so as to avoid endianness
 * issues.
 *
Aaron Plattner's avatar
Aaron Plattner committed
305
306
307
308
309
310
311
312
313
 * By established convention in the 3D graphics world, RGBA data
 * is defined to be an array of 32-bit pixels containing packed
 * RGBA components, not as an array of bytes or interleaved RGBA
 * components. VDPAU follows this convention. As such,
 * applications are expected to access such surfaces as arrays
 * of 32-bit components (i.e. using a 32-bit pointer), and not
 * as interleaved arrays of 8-bit components (i.e. using an
 * 8-bit pointer.) Deviation from this convention will lead to
 * endianness issues, unless appropriate care is taken.
314
 *
Aaron Plattner's avatar
Aaron Plattner committed
315
316
317
318
 * The same convention is followed for some packed YCbCr formats
 * such as \ref VDP_YCBCR_FORMAT_Y8U8V8A8; i.e. they are
 * considered arrays of 32-bit pixels, and hence should be
 * accessed as such.
319
 *
Aaron Plattner's avatar
Aaron Plattner committed
320
 * For YCbCr formats with chroma decimation and/or planar
321
 * formats, however, this convention is awkward. Therefore,
Aaron Plattner's avatar
Aaron Plattner committed
322
323
324
325
 * formats such as \ref VDP_YCBCR_FORMAT_NV12 are defined as
 * arrays of (potentially interleaved) byte-sized components.
 * Hence, applications should manipulate such data 8-bits at a
 * time, using 8-bit pointers.
326
 *
Aaron Plattner's avatar
Aaron Plattner committed
327
328
329
330
331
332
 * Note that one common usage for the input/output of
 * Put/GetBits APIs is file I/O. Typical file I/O APIs treat all
 * memory as a simple array of 8-bit values. This violates the
 * rule requiring surface data to be accessed in its true native
 * format. As such, applications may be required to solve
 * endianness issues. Possible solutions include:
333
 *
Aaron Plattner's avatar
Aaron Plattner committed
334
335
336
337
 * - Authoring static UI data files according to the endianness
 *   of the target execution platform.
 * - Conditionally byte-swapping Put/GetBits data buffers at
 *   run-time based on execution platform.
338
339
340
341
342
 *
 * Note: Complete details regarding each surface format's
 * precise pixel layout is included with the documentation of
 * each surface type. For example, see \ref
 * VDP_RGBA_FORMAT_B8G8R8A8.
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
 *
 * \section video_decoder_usage Video Decoder Usage
 *
 * VDPAU is a slice-level API. Put another way, VDPAU implementations accept
 * "slice" data from the bitstream, and perform all required processing of
 * those slices (e.g VLD decoding, IDCT, motion compensation, in-loop
 * deblocking, etc.).
 *
 * The client application is responsible for:
 *
 * - Extracting the slices from the bitstream (e.g. parsing/demultiplexing
 *   container formats, scanning the data to determine slice start positions
 *   and slice sizes).
 * - Parsing various bitstream headers/structures (e.g. sequence header,
 *   sequence parameter set, picture parameter set, entry point structures,
 *   etc.) Various fields from the parsed header structures needs to be
 *   provided to VDPAU alongside the slice bitstream in a "picture info"
 *   structure.
 * - Surface management (e.g. H.264 DPB processing, display re-ordering)
 *
 * It is recommended that applications pass solely the slice data to VDPAU;
 * specifically that any header data structures be excluded from the portion
 * of the bitstream passed to VDPAU. VDPAU implementations must operate
 * correctly if non-slice data is included, at least for formats employing
 * start codes to delimit slice data. However, any extra data may need
 * to be uploaded to hardware for parsing thus lowering performance, and/or,
 * in the worst case, may even overflow internal buffers that are sized solely
 * for slice data.
 *
 * The exact data that should be passed to VDPAU is detailed below for each
 * supported format:
 *
375
 * \subsection bitstream_mpeg1_mpeg2 MPEG-1 and MPEG-2
376
377
378
379
 *
 * Include all slices beginning with start codes 0x00000101 through
 * 0x000001AF. The slice start code must be included for all slices.
 *
380
 * \subsection bitstream_h264 H.264
381
382
383
384
385
386
387
388
389
390
391
 *
 * Include all NALs with nal_unit_type of 1 or 5 (coded slice of non-IDR/IDR
 * picture respectively). The complete slice start code (including 0x000001
 * prefix) must be included for all slices, even when the prefix is not
 * included in the bitstream.
 *
 * Note that if desired:
 *
 * - The slice start code prefix may be included in a separate bitstream
 *   buffer array entry to the actual slice data extracted from the bitstream.
 * - Multiple bitstream buffer array entries (e.g. one per slice) may point at
392
 *   the same physical data storage for the slice start code prefix.
393
 *
394
 * \subsection bitstream_vc1_sp_mp VC-1 Simple and Main Profile
395
396
397
398
399
400
401
402
403
404
405
406
407
 *
 * VC-1 simple/main profile bitstreams always consist of a single slice per
 * picture, and do not use start codes to delimit pictures. Instead, the
 * container format must indicate where each picture begins/ends.
 *
 * As such, no slice start codes should be included in the data passed to
 * VDPAU; simply pass in the exact data from the bitstream.
 *
 * Header information contained in the bitstream should be parsed by the
 * application and passed to VDPAU using the "picture info" data structure;
 * this header information explicitly must not be included in the bitstream
 * data passed to VDPAU for this encoding format.
 *
408
 * \subsection bitstream_vc1_ap VC-1 Advanced Profile
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
 *
 * Include all slices beginning with start codes 0x0000010D (frame),
 * 0x0000010C (field) or 0x0000010B (slice). The slice start code should be
 * included in all cases.
 *
 * Some VC-1 advanced profile streams do not contain slice start codes; again,
 * the container format must indicate where picture data begins and ends. In
 * this case, pictures are assumed to be progressive and to contain a single
 * slice. It is highly recommended that applications detect this condition,
 * and add the missing start codes to the bitstream passed to VDPAU. However,
 * VDPAU implementations must allow bitstreams with missing start codes, and
 * act as if a 0x0000010D (frame) start code had been present.
 *
 * Note that pictures containing multiple slices, or interlace streams, must
 * contain a complete set of slice start codes in the original bitstream;
 * without them, it is not possible to correctly parse and decode the stream.
 *
 * The bitstream passed to VDPAU should contain all original emulation
 * prevention bytes present in the original bitstream; do not remove these
 * from the bitstream.
 *
430
431
432
433
434
 * \subsection bitstream_mpeg4part2 MPEG-4 Part 2 and DivX
 *
 * Include all slices beginning with start codes 0x000001B6. The slice start
 * code must be included for all slices.
 *
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
 * \subsection bitstream_hevc H.265/HEVC - High Efficiency Video Codec
 *
 * Include all video coding layer (VCL) NAL units, with nal_unit_type values
 * of 0 (TRAIL_N) through 31 (RSV_VCL31) inclusive. In addition to parsing
 * and providing NAL units, an H.265/HEVC decoder application using VDPAU
 * for decoding must parse certain values of the first slice segment header
 * in a VCL NAL unit and provide it through VdpPictureInfoHEVC. Please see
 * the documentation for VdpPictureInfoHEVC below for further details.
 *
 * The complete slice start code (including the 0x000001 prefix) must be
 * included for all slices, even when the prefix is not included in the
 * bitstream.
 *
 * Note that if desired:
 *
 * - The slice start code prefix may be included in a separate bitstream
 *   buffer array entry to the actual slice data extracted from the bitstream.
 * - Multiple bitstream buffer array entries (e.g. one per slice) may point at
 *   the same physical data storage for the slice start code prefix.
 *
Aaron Plattner's avatar
Aaron Plattner committed
455
 * \section video_mixer_usage Video Mixer Usage
456
457
458
 *
 * \subsection video_surface_content VdpVideoSurface Content
 *
459
460
 * Each \ref VdpVideoSurface "VdpVideoSurface" is expected to contain an
 * entire frame's-worth of data, irrespective of whether an interlaced of
461
462
 * progressive sequence is being decoded.
 *
463
464
465
466
467
468
469
 * Depending on the exact encoding structure of the compressed video stream,
 * the application may need to call \ref VdpDecoderRender twice to fill a
 * single \ref VdpVideoSurface "VdpVideoSurface". When the stream contains an
 * encoded progressive frame, or a "frame coded" interlaced field-pair, a
 * single \ref VdpDecoderRender call will fill the entire surface. When the
 * stream contains separately encoded interlaced fields, two
 * \ref VdpDecoderRender calls will be required; one for the top field, and
470
471
 * one for the bottom field.
 *
472
473
 * Implementation note: When \ref VdpDecoderRender renders an interlaced
 * field, this operation must not disturb the content of the other field in
474
475
 * the surface.
 *
476
477
478
479
480
481
482
 * \subsection vm_surf_list VdpVideoMixer Surface List
 *
 * An video stream is logically composed of a sequence of fields. An
 * example is shown below, in display order, assuming top field first:
 *
 * <pre>t0 b0 t1 b1 t2 b2 t3 b3 t4 b4 t5 b5 t6 b6 t7 b7 t8 b8 t9 b9</pre>
 *
483
 * The canonical usage is to call \ref VdpVideoMixerRender once for decoded
484
485
 * field, in display order, to yield one post-processed frame for display.
 *
486
487
 * For each call to \ref VdpVideoMixerRender, the field to be processed should
 * be provided as the \b video_surface_current parameter.
488
489
490
491
492
493
494
495
496
 *
 * To enable operation of advanced de-interlacing algorithms and/or
 * post-processing algorithms, some past and/or future surfaces should be
 * provided as context. These are provided in the \b video_surface_past and
 * \b video_surface_future lists. In general, these lists may contain any
 * number of surfaces. Specific implementations may have specific requirements
 * determining the minimum required number of surfaces for optimal operation,
 * and the maximum number of useful surfaces, beyond which surfaces are not
 * used. It is recommended that in all cases other than plain bob/weave, at
497
 * least 2 past and 1 future field be provided.
498
499
500
501
502
503
 *
 * Note that it is entirely possible, in general, for any of the
 * \ref VdpVideoMixer "VdpVideoMixer" post-processing steps other than
 * de-interlacing to require access to multiple input fields/frames. For
 * example, an motion-sensitive noise-reduction algorithm.
 *
504
505
506
 * For example, when processing field t4, the \ref VdpVideoMixerRender
 * parameters may contain the following values, if the application chose to
 * provide 3 fields of context for both the past and future:
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
 *
 * <pre>
 * current_picture_structure: VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD
 * past:    [b3, t3, b2]
 * current: t4
 * future:  [b4, t5, b5]
 * </pre>
 *
 * Note that for both the past/future lists, array index 0 represents the
 * field temporally closest to current, in display order.
 *
 * The \ref VdpVideoMixerRender parameter \b current_picture_structure applies
 * to \b video_surface_current. The picture structure for the other surfaces
 * will be automatically derived from that for the current picture. The
 * derivation algorithm is extremely simple; the concatenated list
 * past/current/future is simply assumed to have an alternating top/bottom
 * pattern throughout.
 *
 * Continuing the example above, subsequent calls to \ref VdpVideoMixerRender
 * would provide the following sets of parameters:
 *
 * <pre>
 * current_picture_structure: VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD
 * past:    [t4, b3, t3]
 * current: b4
 * future:  [t5, b5, t6]
 * </pre>
 *
 * then:
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
 * <pre>
 * current_picture_structure: VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD
 * past:    [b4, t4, b3]
 * current: t5
 * future:  [b5, t6, b7]
 * </pre>
 *
 * In other words, the concatenated list of past/current/future frames simply
 * forms a window that slides through the sequence of decoded fields.
 *
 * It is syntactically legal for an application to choose not to provide a
 * particular entry in the past or future lists. In this case, the "slot" in
 * the surface list must be filled with the special value
 * \ref VDP_INVALID_HANDLE, to explicitly indicate that the picture is
 * missing; do not simply shuffle other surfaces together to fill in the gap.
 * Note that entries should only be omitted under special circumstances, such
 * as failed decode due to bitstream error during picture header parsing,
 * since missing entries will typically cause advanced de-interlacing
 * algorithms to experience significantly degraded operation.
 *
 * Specific examples for different de-interlacing types are presented below.
 *
 * \subsection deint_weave Weave De-interlacing
 *
 * Weave de-interlacing is the act of interleaving the lines of two temporally
 * adjacent fields to form a frame for display.
 *
 * To disable de-interlacing for progressive streams, simply specify
 * \b current_picture_structure as \ref VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME;
 * no de-interlacing will be applied.
 *
 * Weave de-interlacing for interlaced streams is identical to disabling
 * de-interlacing, as describe immediately above, because each
 * \ref VdpVideoSurface already contains an entire frame's worth (i.e. two
 * fields) of picture data.
 *
 * Inverse telecine is disabled when using weave de-interlacing.
 *
 * Weave de-interlacing produces one output frame for each input frame. The
 * application should make one \ref VdpVideoMixerRender call per pair of
 * decoded fields, or per decoded frame.
 *
 * Weave de-interlacing requires no entries in the past/future lists.
 *
 * All implementations must support weave de-interlacing.
 *
 * \subsection deint_bob Bob De-interlacing
 *
 * Bob de-interlacing is the act of vertically scaling a single field to the
 * size of a single frame.
 *
 * To achieve bob de-interlacing, simply provide a single field as
 * \b video_surface_current, and set \b current_picture_structure
 * appropriately, to indicate whether a top or bottom field was provided.
 *
 * Inverse telecine is disabled when using bob de-interlacing.
 *
 * Bob de-interlacing produces one output frame for each input field. The
 * application should make one \ref VdpVideoMixerRender call per decoded
 * field.
 *
 * Bob de-interlacing requires no entries in the past/future lists.
 *
 * Bob de-interlacing is the default when no advanced method is requested and
 * enabled. Advanced de-interlacing algorithms may fall back to bob e.g. when
 * required past/future fields are missing.
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
 * All implementations must support bob de-interlacing.
 *
 * \subsection deint_adv Advanced De-interlacing
 *
 * Operation of both temporal and temporal-spatial de-interlacing is
 * identical; the only difference is the internal processing the algorithm
 * performs in generating the output frame.
 *
 * These algorithms use various advanced processing on the pixels of both the
 * current and various past/future fields in order to determine how best to
 * de-interlacing individual portions of the image.
 *
 * Inverse telecine may be enabled when using advanced de-interlacing.
 *
 * Advanced de-interlacing produces one output frame for each input field. The
 * application should make one \ref VdpVideoMixerRender call per decoded
 * field.
 *
 * Advanced de-interlacing requires entries in the past/future lists.
 *
 * Availability of advanced de-interlacing algorithms is implementation
 * dependent.
 *
 * \subsection deint_rate De-interlacing Rate
 *
 * For all de-interlacing algorithms except weave, a choice may be made to
 * call \ref VdpVideoMixerRender for either each decoded field, or every
 * second decoded field.
 *
 * If \ref VdpVideoMixerRender is called for every decoded field, the
 * generated post-processed frame rate is equal to the decoded field rate.
 * Put another way, the generated post-processed nominal field rate is equal
 * to 2x the decoded field rate. This is standard practice.
 *
 * If \ref VdpVideoMixerRender is called for every second decoded field (say
 * every top field), the generated post-processed frame rate is half to the
 * decoded field rate. This mode of operation is thus referred to as
 * "half-rate".
 *
643
644
645
 * Implementations may choose whether to support half-rate de-interlacing
 * or not. Regular full-rate de-interlacing should be supported by any
 * supported advanced de-interlacing algorithm.
646
647
648
 *
 * The descriptions of de-interlacing algorithms above assume that regular
 * (not half-rate) operation is being performed, when detailing the number of
649
 * VdpVideoMixerRender calls.
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
 *
 * Recall that the concatenation of past/current/future surface lists simply
 * forms a window into the stream of decoded fields. To achieve standard
 * de-interlacing, the window is slid through the list of decoded fields one
 * field at a time, and a call is made to \ref VdpVideoMixerRender for each
 * movement of the window. To achieve half-rate de-interlacing, the window is
 * slid through the* list of decoded fields two fields at a time, and a
 * call is made to \ref VdpVideoMixerRender for each movement of the window.
 *
 * \subsection invtc Inverse Telecine
 *
 * Assuming the implementation supports it, inverse telecine may be enabled
 * alongside any advanced de-interlacing algorithm. Inverse telecine is never
 * active for bob or weave.
 *
 * Operation of \ref VdpVideoMixerRender with inverse telecine active is
 * identical to the basic operation mechanisms describe above in every way;
 * all inverse telecine processing is performed internally to the
 * \ref VdpVideoMixer "VdpVideoMixer".
 *
 * In particular, there is no provision way for \ref VdpVideoMixerRender to
 * indicate when identical input fields have been observed, and consequently
 * identical output frames may have been produced.
 *
 * De-interlacing (and inverse telecine) may be applied to streams that are
 * marked as being progressive. This will allow detection of, and correct
 * de-interlacing of, mixed interlace/progressive streams, bad edits, etc.
 * To implement de-interlacing/inverse-telecine on progressive material,
 * simply treat the stream of decoded frames as a stream of decoded fields,
 * apply any telecine flags (see the next section), and then apply
 * de-interlacing to those fields as described above.
 *
 * Implementations are free to determine whether inverse telecine operates
 * in conjunction with half-rate de-interlacing or not. It should always
 * operate with regular de-interlacing, when advertized.
 *
 * \subsection tcflags Telecine (Pull-Down) Flags
 *
 * Some media delivery formats, e.g. DVD-Video, include flags that are
 * intended to modify the decoded field sequence before display. This allows
 * e.g. 24p content to be encoded at 48i, which saves space relative to a 60i
 * encoded stream, but still displayed at 60i, to match target consumer
 * display equipment.
 *
 * If the inverse telecine option is not activated in the
 * \ref VdpVideoMixer "VdpVideoMixer", these flags should be ignored, and the
 * decoded fields passed directly to \ref VdpVideoMixerRender as detailed
 * above.
 *
 * However, to make full use of the inverse telecine feature, these flags
 * should be applied to the field stream, yielding another field stream with
 * some repeated fields, before passing the field stream to
 * \ref VdpVideoMixerRender. In this scenario, the sliding window mentioned
 * in the descriptions above applies to the field stream after application of
 * flags.
 *
706
707
 * \section extending Extending the API
 *
Aaron Plattner's avatar
Aaron Plattner committed
708
 * \subsection extend_enums Enumerations and Other Constants
709
 *
Aaron Plattner's avatar
Aaron Plattner committed
710
 * VDPAU defines a number of enumeration types.
711
 *
Aaron Plattner's avatar
Aaron Plattner committed
712
713
714
 * When modifying VDPAU, existing enumeration constants must
 * continue to exist (although they may be deprecated), and do
 * so in the existing order.
715
716
717
718
 *
 * The above discussion naturally applies to "manually" defined
 * enumerations, using pre-processor macros, too.
 *
Aaron Plattner's avatar
Aaron Plattner committed
719
 * \subsection extend_structs Structures
720
 *
Aaron Plattner's avatar
Aaron Plattner committed
721
722
 * In most case, VDPAU includes no provision for modifying existing
 * structure definitions, although they may be deprecated.
723
 *
Aaron Plattner's avatar
Aaron Plattner committed
724
 * New structures may be created, together with new API entry
725
726
 * points or feature/attribute/parameter values, to expose new
 * functionality.
Aaron Plattner's avatar
Aaron Plattner committed
727
728
729
 *
 * A few structures are considered plausible candidates for future extension.
 * Such structures include a version number as the first field, indicating the
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
 * exact layout of the client-provided data. When changing such structures, the
 * old structure must be preserved and a new structure created. This allows
 * applications built against the old version of the structure to continue to
 * interoperate. For example, to extend the VdpProcamp structure, define a new
 * VdpProcamp1 and update VdpGenerateCSCMatrix to take the new structure as an
 * argument. Document in a comment that the caller must fill the struct_version
 * field with the value 1. VDPAU implementations should use the struct_version
 * field to determine which version of the structure the application was built
 * against.  Note that you cannot simply increment the value of
 * VDP_PROCAMP_VERSION because applications recompiled against a newer version
 * of vdpau.h but that have not been updated to use the new structure must still
 * report that they're using version 0.
 *
 * Note that the layouts of VdpPictureInfo structures are defined by their
 * corresponding VdpDecoderProfile numbers, so no struct_version field is
 * needed for them. This layout includes the size of the structure, so new
 * profiles that extend existing functionality may incorporate the old
 * VdpPictureInfo as a substructure, but may not modify existing VdpPictureInfo
 * structures.
749
 *
Aaron Plattner's avatar
Aaron Plattner committed
750
 * \subsection extend_functions Functions
751
 *
Aaron Plattner's avatar
Aaron Plattner committed
752
753
 * Existing functions may not be modified, although they may be
 * deprecated.
754
 *
Aaron Plattner's avatar
Aaron Plattner committed
755
756
757
 * New functions may be added at will. Note the enumeration
 * requirements when modifying the enumeration that defines the
 * list of entry points.
758
759
760
761
762
763
 *
 * \section preemption_note Display Preemption
 *
 * Please note that the display may be preempted away from
 * VDPAU at any time. See \ref display_preemption for more
 * details.
Aaron Plattner's avatar
Aaron Plattner committed
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
 *
 * \subsection trademarks Trademarks
 *
 * VDPAU is a trademark of NVIDIA Corporation. You may freely use the
 * VDPAU trademark, as long as trademark ownership is attributed to
 * NVIDIA Corporation.
 */

/**
 * \file vdpau.h
 * \brief The Core API
 *
 * This file contains the \ref api_core "Core API".
 */

#ifndef _VDPAU_H
#define _VDPAU_H

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * \defgroup api_core Core API
 *
 * The core API encompasses all VDPAU functionality that operates
 * in the same fashion across all Window Systems.
 *
 * @{
 */

/**
 * \defgroup base_types Basic Types
799
 *
Aaron Plattner's avatar
Aaron Plattner committed
800
801
802
803
804
805
806
807
808
 * VDPAU primarily uses ISO C99 types from \c stdint.h.
 *
 * @{
 */

/** \brief A true \ref VdpBool value */
#define VDP_TRUE 1
/** \brief A false \ref VdpBool value */
#define VDP_FALSE 0
809
810
/**
 * \brief A boolean value, holding \ref VDP_TRUE or \ref
Aaron Plattner's avatar
Aaron Plattner committed
811
812
813
814
 * VDP_FALSE.
 */
typedef int VdpBool;

815
/** @} */
Aaron Plattner's avatar
Aaron Plattner committed
816
817
818
819
820
821
822
823

/**
 * \defgroup misc_types Miscellaneous Types
 *
 * @{
 */

/**
824
825
826
827
828
829
830
831
 * \brief An invalid object handle value.
 *
 * This value may be used to represent an invalid, or
 * non-existent, object (\ref VdpDevice "VdpDevice",
 * \ref VdpVideoSurface "VdpVideoSurface", etc.)
 *
 * Note that most APIs require valid object handles in all
 * cases, and will fail when presented with this value.
Aaron Plattner's avatar
Aaron Plattner committed
832
833
834
835
836
837
838
839
840
 */
#define VDP_INVALID_HANDLE 0xffffffffU

/**
 * \brief The set of all chroma formats for \ref VdpVideoSurface
 * "VdpVideoSurface"s.
 */
typedef uint32_t VdpChromaType;

841
842
843
844
845
846
847
848
/** \hideinitializer \brief 4:2:0 chroma format. Undefined field/frame based
 *  Video surfaces allocated with this chroma type have undefined
 *  field/frame structure. The implementation is free to internally morph
 *  the surface between frame/field(NV12/NV24) as required by
 *  VdpVideoDecoder operation. Interop with OpenGL allows registration
 *  of these surfaces for either field- or frame-based interop. But, an implicit
 *  field/frame structure conversion may be performed.
 */
849
#define VDP_CHROMA_TYPE_420 ((VdpChromaType)0)
850
851
852
853
854
855
856
857
/** \hideinitializer \brief 4:2:2 chroma format. Undefined field/frame based
 *  Video surfaces allocated with this chroma type have undefined
 *  field/frame structure. The implementation is free to internally morph
 *  the surface between frame/field(NV12/NV24) as required by
 *  VdpVideoDecoder operation. Interop with OpenGL allows registration
 *  of these surfaces for either field- or frame-based interop. But, an implicit
 *  field/frame structure conversion may be performed.
 */
858
#define VDP_CHROMA_TYPE_422 ((VdpChromaType)1)
859
860
861
862
863
864
865
866
/** \hideinitializer \brief 4:4:4 chroma format. Undefined field/frame based
 *  Video surfaces allocated with this chroma type have undefined
 *  field/frame structure. The implementation is free to internally morph
 *  the surface between frame/field(NV12/NV24) as required by
 *  VdpVideoDecoder operation. Interop with OpenGL allows registration
 *  of these surfaces for either field- or frame-based interop. But, an implicit
 *  field/frame structure conversion may be performed.
 */
867
#define VDP_CHROMA_TYPE_444 ((VdpChromaType)2)
Aaron Plattner's avatar
Aaron Plattner committed
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
/** \hideinitializer \brief 4:2:0 chroma format. Field based.
 *  Video surfaces allocated with this chroma type can only be
 *  interoped with OpenGL if the matching field/frame structure is
 *  specified in the OpenGL API */
#define VDP_CHROMA_TYPE_420_FIELD ((VdpChromaType)3)
/** \hideinitializer \brief 4:2:2 chroma format. Field based.
 *  Video surfaces allocated with this chroma type can only be
 *  interoped with OpenGL if the matching field/frame structure is
 *  specified in the OpenGL API */
#define VDP_CHROMA_TYPE_422_FIELD ((VdpChromaType)4)
/** \hideinitializer \brief 4:4:4 chroma format. Field based.
 *  Video surfaces allocated with this chroma type can only be
 *  interoped with OpenGL if the matching field/frame structure is
 *  specified in the OpenGL API */
#define VDP_CHROMA_TYPE_444_FIELD ((VdpChromaType)5)

/** \hideinitializer \brief 4:2:0 chroma format. Frame based.
 *  Video surfaces allocated with this chroma type can only be
 *  interoped with OpenGL if the matching field/frame structure is
 *  specified in the OpenGL API */
#define VDP_CHROMA_TYPE_420_FRAME ((VdpChromaType)6)
/** \hideinitializer \brief 4:2:2 chroma format. Frame based.
 *  Video surfaces allocated with this chroma type can only be
 *  interoped with OpenGL if the matching field/frame structure is
 *  specified in the OpenGL API */
#define VDP_CHROMA_TYPE_422_FRAME ((VdpChromaType)7)
/** \hideinitializer \brief 4:4:4 chroma format. Frame based.
 *  Video surfaces allocated with this chroma type can only be
 *  interoped with OpenGL if the matching field/frame structure is
 *  specified in the OpenGL API */
#define VDP_CHROMA_TYPE_444_FRAME ((VdpChromaType)8)
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
/** \hideinitializer \brief 4:2:0 chroma format. Undefined field/frame based
 *  Video surfaces allocated with this chroma type have undefined
 *  field/frame structure. The implementation is free to internally morph
 *  the surface between frame/field as required by VdpVideoDecoder operation.
 *  Interop with OpenGL allows registration of these surfaces for either
 *  field- or frame-based interop. But, an implicit field/frame structure
 *  conversion may be performed.
 */
#define VDP_CHROMA_TYPE_420_16 ((VdpChromaType)9)
/** \hideinitializer \brief 4:2:2 chroma format. Undefined field/frame based
 *  Video surfaces allocated with this chroma type have undefined
 *  field/frame structure. The implementation is free to internally morph
 *  the surface between frame/field as required by VdpVideoDecoder operation.
 *  Interop with OpenGL allows registration of these surfaces for either
 *  field- or frame-based interop. But, an implicit field/frame structure
 *  conversion may be performed.
 */
#define VDP_CHROMA_TYPE_422_16 ((VdpChromaType)10)
/** \hideinitializer \brief 4:4:4 chroma format. Undefined field/frame based
 *  Video surfaces allocated with this chroma type have undefined
 *  field/frame structure. The implementation is free to internally morph
 *  the surface between frame/field as required by VdpVideoDecoder operation.
 *  Interop with OpenGL allows registration of these surfaces for either
 *  field- or frame-based interop. But, an implicit field/frame structure
 *  conversion may be performed.
 */
#define VDP_CHROMA_TYPE_444_16 ((VdpChromaType)11)

/** \hideinitializer \brief 4:2:0 chroma format. Field based.
 *  Video surfaces allocated with this chroma type can only be
 *  interoped with OpenGL if the matching field/frame structure is
 *  specified in the OpenGL API */
#define VDP_CHROMA_TYPE_420_FIELD_16 ((VdpChromaType)12)
/** \hideinitializer \brief 4:2:2 chroma format. Field based.
 *  Video surfaces allocated with this chroma type can only be
 *  interoped with OpenGL if the matching field/frame structure is
 *  specified in the OpenGL API */
#define VDP_CHROMA_TYPE_422_FIELD_16 ((VdpChromaType)13)
/** \hideinitializer \brief 4:4:4 chroma format. Field based.
 *  Video surfaces allocated with this chroma type can only be
 *  interoped with OpenGL if the matching field/frame structure is
 *  specified in the OpenGL API */
#define VDP_CHROMA_TYPE_444_FIELD_16 ((VdpChromaType)14)

/** \hideinitializer \brief 4:2:0 chroma format. Frame based.
 *  Video surfaces allocated with this chroma type can only be
 *  interoped with OpenGL if the matching field/frame structure is
 *  specified in the OpenGL API */
#define VDP_CHROMA_TYPE_420_FRAME_16 ((VdpChromaType)15)
/** \hideinitializer \brief 4:2:2 chroma format. Frame based.
 *  Video surfaces allocated with this chroma type can only be
 *  interoped with OpenGL if the matching field/frame structure is
 *  specified in the OpenGL API */
#define VDP_CHROMA_TYPE_422_FRAME_16 ((VdpChromaType)16)
/** \hideinitializer \brief 4:4:4 chroma format. Frame based.
 *  Video surfaces allocated with this chroma type can only be
 *  interoped with OpenGL if the matching field/frame structure is
 *  specified in the OpenGL API */
#define VDP_CHROMA_TYPE_444_FRAME_16 ((VdpChromaType)17)
959

Aaron Plattner's avatar
Aaron Plattner committed
960
961
962
963
964
/**
 * \brief The set of all known YCbCr surface formats.
 */
typedef uint32_t VdpYCbCrFormat;

965
966
967
968
969
970
971
972
973
974
975
976
977
/**
 * \hideinitializer
 * \brief The "NV12" YCbCr surface format.
 *
 * This format has a two planes, a Y plane and a UV plane.
 *
 * The Y plane is an array of byte-sized Y components.
 * Applications should access this data via a uint8_t pointer.
 *
 * The UV plane is an array of interleaved byte-sized U and V
 * components, in the order U, V, U, V. Applications should
 * access this data via a uint8_t pointer.
 */
978
#define VDP_YCBCR_FORMAT_NV12     ((VdpYCbCrFormat)0)
979
980
981
982
/**
 * \hideinitializer
 * \brief The "YV12" YCbCr surface format.
 *
Stephen Warren's avatar
Stephen Warren committed
983
 * This format has a three planes, a Y plane, a V plane, and a U
984
985
986
987
988
989
 * plane.
 *
 * Each of the planes is an array of byte-sized components.
 *
 * Applications should access this data via a uint8_t pointer.
 */
990
#define VDP_YCBCR_FORMAT_YV12     ((VdpYCbCrFormat)1)
991
992
993
994
995
996
997
998
999
1000
1001
/**
 * \hideinitializer
 * \brief The "UYVY" YCbCr surface format.
 *
 * This format may also be known as Y422, UYNV, HDYC.
 *
 * This format has a single plane.
 *
 * This plane is an array of interleaved byte-sized Y, U, and V
 * components, in the order U, Y, V, Y, U, Y, V, Y.
 *
Aaron Plattner's avatar
Aaron Plattner committed
1002
 * Applications should access this data via a uint8_t pointer.
1003
 */
1004
#define VDP_YCBCR_FORMAT_UYVY     ((VdpYCbCrFormat)2)
1005
1006
1007
1008
/**
 * \hideinitializer
 * \brief The "YUYV" YCbCr surface format.
 *
Aaron Plattner's avatar
Aaron Plattner committed
1009
 * This format may also be known as YUY2, YUNV, V422.
1010
1011
1012
1013
1014
1015
 *
 * This format has a single plane.
 *
 * This plane is an array of interleaved byte-sized Y, U, and V
 * components, in the order Y, U, Y, V, Y, U, Y, V.
 *
Aaron Plattner's avatar
Aaron Plattner committed
1016
 * Applications should access this data via a uint8_t pointer.
1017
 */
1018
#define VDP_YCBCR_FORMAT_YUYV     ((VdpYCbCrFormat)3)
1019
1020
/**
 * \hideinitializer
Aaron Plattner's avatar
Aaron Plattner committed
1021
 * \brief A packed YCbCr format.
1022
1023
1024
1025
1026
1027
1028
 *
 * This format has a single plane.
 *
 * This plane is an array packed 32-bit pixel data. Within each
 * 32-bit pixel, bits [31:24] contain A, bits [23:16] contain V,
 * bits [15:8] contain U, and bits [7:0] contain Y.
 *
Aaron Plattner's avatar
Aaron Plattner committed
1029
 * Applications should access this data via a uint32_t pointer.
1030
 */
1031
#define VDP_YCBCR_FORMAT_Y8U8V8A8 ((VdpYCbCrFormat)4)
1032
1033
/**
 * \hideinitializer
Aaron Plattner's avatar
Aaron Plattner committed
1034
 * \brief A packed YCbCr format.
1035
1036
1037
1038
 *
 * This format has a single plane.
 *
 * This plane is an array packed 32-bit pixel data. Within each
Aaron Plattner's avatar
Aaron Plattner committed
1039
 * 32-bit pixel, bits [31:24] contain A, bits [23:16] contain Y,
1040
1041
 * bits [15:8] contain U, and bits [7:0] contain V.
 *
Aaron Plattner's avatar
Aaron Plattner committed
1042
 * Applications should access this data via a uint32_t pointer.
1043
 */
1044
#define VDP_YCBCR_FORMAT_V8U8Y8A8 ((VdpYCbCrFormat)5)
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
/**
 * \hideinitializer
 * \brief The "Y_UV_444" YCbCr surface format.
 *
 * This format has two planes, a Y plane and a UV plane.
 *
 * The Y plane is an array of byte-sized Y components.
 * Applications should access this data via a uint8_t pointer.
 *
 * The UV plane is an array of interleaved byte-sized U and V
 * components, in the order U, V, U, V. Applications should
 * access this data via a uint8_t pointer.
 */
#define VDP_YCBCR_FORMAT_Y_UV_444     ((VdpYCbCrFormat)6)
/**
 * \hideinitializer
 * \brief The "Y_U_V_444" YCbCr surface format.
 *
 * This format has three planes, a Y plane, a V plane, and a U
 * plane.
 *
 * Each of the planes is an array of byte-sized components.
 *
 * Applications should access this data via a uint8_t pointer.
 */
#define VDP_YCBCR_FORMAT_Y_U_V_444     ((VdpYCbCrFormat)7)
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
/**
 * \hideinitializer
 * \brief The P010 surface format.
 *
 * This format has two planes, a Y plane and a UV plane.
 *
 * The Y plane is an array of two byte sized Y components.
 * Applications should access this data via a uint16_t pointer.
 *
 * The UV plane is an array of interleaved two byte sized U and V
 * components, in the order U, V, U, V. Applications should
 * access this data via a uint8_t pointer.
 *
 * Note that the P010 surface format has an identical memory
 * layout as the P016 surface format, with bits 0 through 5
 * set to zero.
 */
#define VDP_YCBCR_FORMAT_P010           ((VdpYCbCrFormat)8)
/**
 * \hideinitializer
 * \brief The P016 surface format.
 *
 * This format has two planes, a Y plane and a UV plane.
 *
 * The Y plane is an array of two byte sized Y components.
 * Applications should access this data via a uint16_t pointer.
 *
 * The UV plane is an array of interleaved two byte sized U and V
 * components, in the order U, V, U, V. Applications should
 * access this data via a uint8_t pointer.
 */
#define VDP_YCBCR_FORMAT_P016           ((VdpYCbCrFormat)9)
 /**
  * \hideinitializer
  * \brief The "Y_U_V_444_16" YCbCr surface format.
  *
  * This format has three planes, a Y plane, a V plane, and a U
  * plane.
  *
  * Each of the planes is an array of two byte-sized components.
  *
  * Applications should access this data via a uint16_t pointer.
  */
 #define VDP_YCBCR_FORMAT_Y_U_V_444_16     ((VdpYCbCrFormat)11)
Aaron Plattner's avatar
Aaron Plattner committed
1115
1116
1117
1118
1119
1120

/**
 * \brief  The set of all known RGB surface formats.
 */
typedef uint32_t VdpRGBAFormat;

1121
1122
/**
 * \hideinitializer
Aaron Plattner's avatar
Aaron Plattner committed
1123
 * \brief A packed RGB format.
1124
1125
1126
1127
 *
 * This format has a single plane.
 *
 * This plane is an array packed 32-bit pixel data. Within each
Aaron Plattner's avatar
Aaron Plattner committed
1128
 * 32-bit pixel, bits [31:24] contain A, bits [23:16] contain R,
1129
1130
 * bits [15:8] contain G, and bits [7:0] contain B.
 *
Aaron Plattner's avatar
Aaron Plattner committed
1131
 * Applications should access this data via a uint32_t pointer.
1132
 */
1133
#define VDP_RGBA_FORMAT_B8G8R8A8    ((VdpRGBAFormat)0)
1134
1135
/**
 * \hideinitializer
Aaron Plattner's avatar
Aaron Plattner committed
1136
 * \brief A packed RGB format.
1137
1138
1139
1140
 *
 * This format has a single plane.
 *
 * This plane is an array packed 32-bit pixel data. Within each
Aaron Plattner's avatar
Aaron Plattner committed
1141
 * 32-bit pixel, bits [31:24] contain A, bits [23:16] contain B,
1142
1143
 * bits [15:8] contain G, and bits [7:0] contain R.
 *
Aaron Plattner's avatar
Aaron Plattner committed
1144
 * Applications should access this data via a uint32_t pointer.
1145
 */
1146
#define VDP_RGBA_FORMAT_R8G8B8A8    ((VdpRGBAFormat)1)
1147
1148
/**
 * \hideinitializer
Aaron Plattner's avatar
Aaron Plattner committed
1149
 * \brief A packed RGB format.
1150
1151
1152
1153
 *
 * This format has a single plane.
 *
 * This plane is an array packed 32-bit pixel data. Within each
Aaron Plattner's avatar
Aaron Plattner committed
1154
 * 32-bit pixel, bits [31:30] contain A, bits [29:20] contain B,
1155
1156
1157
1158
 * bits [19:10] contain G, and bits [9:0] contain R.
 *
 * Applications should access this data via a uint32_t pointer.
 */
1159
#define VDP_RGBA_FORMAT_R10G10B10A2 ((VdpRGBAFormat)2)
1160
1161
/**
 * \hideinitializer
Aaron Plattner's avatar
Aaron Plattner committed
1162
 * \brief A packed RGB format.
1163
1164
1165
1166
 *
 * This format has a single plane.
 *
 * This plane is an array packed 32-bit pixel data. Within each
Aaron Plattner's avatar
Aaron Plattner committed
1167
 * 32-bit pixel, bits [31:30] contain A, bits [29:20] contain R,
1168
1169
1170
1171
 * bits [19:10] contain G, and bits [9:0] contain B.
 *
 * Applications should access this data via a uint32_t pointer.
 */
1172
#define VDP_RGBA_FORMAT_B10G10R10A2 ((VdpRGBAFormat)3)
1173
1174
1175
1176
1177
1178
/**
 * \hideinitializer
 * \brief An alpha-only surface format.
 *
 * This format has a single plane.
 *
Aaron Plattner's avatar
Aaron Plattner committed
1179
 * This plane is an array of byte-sized components.
1180
1181
1182
 *
 * Applications should access this data via a uint8_t pointer.
 */
1183
#define VDP_RGBA_FORMAT_A8          ((VdpRGBAFormat)4)
Aaron Plattner's avatar
Aaron Plattner committed
1184
1185
1186
1187
1188
1189

/**
 * \brief  The set of all known indexed surface formats.
 */
typedef uint32_t VdpIndexedFormat;

1190
1191
1192
1193
1194
1195
1196
/**
 * \hideinitializer
 * \brief A 4-bit indexed format, with alpha.
 *
 * This format has a single plane.
 *
 * This plane is an array of byte-sized components. Within each
Aaron Plattner's avatar
Aaron Plattner committed
1197
 * byte, bits [7:4] contain I (index), and bits [3:0] contain A.
1198
1199
1200
 *
 * Applications should access this data via a uint8_t pointer.
 */
1201
#define VDP_INDEXED_FORMAT_A4I4 ((VdpIndexedFormat)0)
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
/**
 * \hideinitializer
 * \brief A 4-bit indexed format, with alpha.
 *
 * This format has a single plane.
 *
 * This plane is an array of byte-sized components. Within each
 * byte, bits [7:4] contain A, and bits [3:0] contain I (index).
 *
 * Applications should access this data via a uint8_t pointer.
 */
1213
#define VDP_INDEXED_FORMAT_I4A4 ((VdpIndexedFormat)1)
1214
1215
1216
1217
1218
1219
1220
1221
1222
/**
 * \hideinitializer
 * \brief A 8-bit indexed format, with alpha.
 *
 * This format has a single plane.
 *
 * This plane is an array of interleaved byte-sized A and I
 * (index) components, in the order A, I, A, I.
 *
Aaron Plattner's avatar
Aaron Plattner committed
1223
 * Applications should access this data via a uint8_t pointer.
1224
 */
1225
#define VDP_INDEXED_FORMAT_A8I8 ((VdpIndexedFormat)2)
1226
1227
1228
1229
1230
1231
1232
1233
1234
/**
 * \hideinitializer
 * \brief A 8-bit indexed format, with alpha.
 *
 * This format has a single plane.
 *
 * This plane is an array of interleaved byte-sized A and I
 * (index) components, in the order I, A, I, A.
 *
Aaron Plattner's avatar
Aaron Plattner committed
1235
 * Applications should access this data via a uint8_t pointer.
1236
 */
1237
#define VDP_INDEXED_FORMAT_I8A8 ((VdpIndexedFormat)3)
Aaron Plattner's avatar
Aaron Plattner committed
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288

/**
 * \brief A location within a surface.
 *
 * The VDPAU co-ordinate system has its origin at the top-left
 * of a surface, with x and y components increasing right and
 * down.
 */
typedef struct {
    /** X co-ordinate. */
    uint32_t x;
    /** Y co-ordinate. */
    uint32_t y;
} VdpPoint;

/**
 * \brief A rectangular region of a surface.
 *
 * The co-ordinates are top-left inclusive, bottom-right
 * exclusive.
 *
 * The VDPAU co-ordinate system has its origin at the top-left
 * of a surface, with x and y components increasing right and
 * down.
 */
typedef struct {
    /** Left X co-ordinate. Inclusive. */
    uint32_t x0;
    /** Top Y co-ordinate. Inclusive. */
    uint32_t y0;
    /** Right X co-ordinate. Exclusive. */
    uint32_t x1;
    /** Bottom Y co-ordinate. Exclusive. */
    uint32_t y1;
} VdpRect;

/**
 * A constant RGBA color.
 *
 * Note that the components are stored as float values in the
 * range 0.0...1.0 rather than format-specific integer values.
 * This allows VdpColor values to be independent from the exact
 * surface format(s) in use.
 */
typedef struct {
    float red;
    float green;
    float blue;
    float alpha;
} VdpColor;

1289
/** @} */
Aaron Plattner's avatar
Aaron Plattner committed
1290
1291
1292
1293
1294
1295
1296
1297

/**
 * \defgroup error_handling Error Handling
 *
 * @{
 */

/**
1298
 * \hideinitializer
Aaron Plattner's avatar
Aaron Plattner committed
1299
1300
1301
1302
1303
1304
1305
1306
1307
 * \brief The set of all possible error codes.
 */
typedef enum {
    /** The operation completed successfully; no error. */
    VDP_STATUS_OK = 0,
    /**
     * No backend implementation could be loaded.
     */
    VDP_STATUS_NO_IMPLEMENTATION,
1308
    /**
Aaron Plattner's avatar
Aaron Plattner committed
1309
1310
     * The display was preempted, or a fatal error occurred.
     *
1311
     * The application must re-initialize VDPAU.
Aaron Plattner's avatar
Aaron Plattner committed
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
     */
    VDP_STATUS_DISPLAY_PREEMPTED,
    /**
     * An invalid handle value was provided.
     *
     * Either the handle does not exist at all, or refers to an object of an
     * incorrect type.
     */
    VDP_STATUS_INVALID_HANDLE,
    /**
     * An invalid pointer was provided.
     *
     * Typically, this means that a NULL pointer was provided for an "output"
     * parameter.
     */
    VDP_STATUS_INVALID_POINTER,
    /**
     * An invalid/unsupported \ref VdpChromaType value was supplied.
     */
    VDP_STATUS_INVALID_CHROMA_TYPE,
    /**
     * An invalid/unsupported \ref VdpYCbCrFormat value was supplied.
     */
    VDP_STATUS_INVALID_Y_CB_CR_FORMAT,
    /**
     * An invalid/unsupported \ref VdpRGBAFormat value was supplied.
     */
    VDP_STATUS_INVALID_RGBA_FORMAT,
    /**
     * An invalid/unsupported \ref VdpIndexedFormat value was supplied.
     */
    VDP_STATUS_INVALID_INDEXED_FORMAT,
    /**
     * An invalid/unsupported \ref VdpColorStandard value was supplied.
     */
    VDP_STATUS_INVALID_COLOR_STANDARD,
    /**
     * An invalid/unsupported \ref VdpColorTableFormat value was supplied.
     */
    VDP_STATUS_INVALID_COLOR_TABLE_FORMAT,
    /**
     * An invalid/unsupported \ref VdpOutputSurfaceRenderBlendFactor value was
     * supplied.
     */
    VDP_STATUS_INVALID_BLEND_FACTOR,
    /**
     * An invalid/unsupported \ref VdpOutputSurfaceRenderBlendEquation value
     * was supplied.
     */
    VDP_STATUS_INVALID_BLEND_EQUATION,
    /**
     * An invalid/unsupported flag value/combination was supplied.
     */
    VDP_STATUS_INVALID_FLAG,
    /**
     * An invalid/unsupported \ref VdpDecoderProfile value was supplied.
     */
    VDP_STATUS_INVALID_DECODER_PROFILE,
    /**
     * An invalid/unsupported \ref VdpVideoMixerFeature value was supplied.
     */
    VDP_STATUS_INVALID_VIDEO_MIXER_FEATURE,
    /**
     * An invalid/unsupported \ref VdpVideoMixerParameter value was supplied.
     */
    VDP_STATUS_INVALID_VIDEO_MIXER_PARAMETER,
    /**
     * An invalid/unsupported \ref VdpVideoMixerAttribute value was supplied.
     */
    VDP_STATUS_INVALID_VIDEO_MIXER_ATTRIBUTE,
    /**
     * An invalid/unsupported \ref VdpVideoMixerPictureStructure value was
     * supplied.
     */
    VDP_STATUS_INVALID_VIDEO_MIXER_PICTURE_STRUCTURE,
    /**
     * An invalid/unsupported \ref VdpFuncId value was supplied.
     */
    VDP_STATUS_INVALID_FUNC_ID,
    /**
     * The size of a supplied object does not match the object it is being
     * used with.
     *
     * For example, a \ref VdpVideoMixer "VdpVideoMixer" is configured to
     * process \ref VdpVideoSurface "VdpVideoSurface" objects of a specific
     * size. If presented with a \ref VdpVideoSurface "VdpVideoSurface" of a
     * different size, this error will be raised.
     */
    VDP_STATUS_INVALID_SIZE,
    /**
     * An invalid/unsupported value was supplied.
     *
     * This is a catch-all error code for values of type other than those
     * with a specific error code.
     */
    VDP_STATUS_INVALID_VALUE,
    /**
     * An invalid/unsupported structure version was specified in a versioned
     * structure. This implies that the implementation is older than the
     * header file the application was built against.
     */
    VDP_STATUS_INVALID_STRUCT_VERSION,
    /**
     * The system does not have enough resources to complete the requested
     * operation at this time.
     */
    VDP_STATUS_RESOURCES,
    /**
     * The set of handles supplied are not all related to the same VdpDevice.
     *
     * When performing operations that operate on multiple surfaces, such as
     * \ref  VdpOutputSurfaceRenderOutputSurface or \ref VdpVideoMixerRender,
     * all supplied surfaces must have been created within the context of the
     * same \ref VdpDevice "VdpDevice" object. This error is raised if they were
     * not.
     */
    VDP_STATUS_HANDLE_DEVICE_MISMATCH,
    /**
     * A catch-all error, used when no other error code applies.
     */
    VDP_STATUS_ERROR,
} VdpStatus;

/**
 * \brief Retrieve a string describing an error code.
 * \param[in] status The error code.
1438
 * \return A pointer to the string. Note that this is a
Aaron Plattner's avatar
Aaron Plattner committed
1439
1440
1441
1442
1443
1444
1445
1446
1447
 *       statically allocated read-only string. As such, the
 *       application must not free the returned pointer. The
 *       pointer is valid as long as the VDPAU implementation is
 *       present within the application's address space.
 */
typedef char const * VdpGetErrorString(
    VdpStatus status
);

1448
/** @} */
Aaron Plattner's avatar
Aaron Plattner committed
1449

1450
1451
1452
1453
1454
1455
/**
 * \defgroup versioning Versioning
 *
 *
 * @{
 */
Aaron Plattner's avatar
Aaron Plattner committed
1456

1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
/**
 * \brief The VDPAU interface version described by this header file.
 *
 * This version will only increase if a major incompatible change is made.
 * For example, if the parameters passed to an existing function are modified,
 * rather than simply adding new functions/enumerations), or if the mechanism
 * used to load the backend driver is modified incompatibly. Such changes are
 * unlikely.
 *
 * This value also represents the DSO version of VDPAU-related
 * shared-libraries.
 *
 * VDPAU version numbers are simple integers that increase monotonically
 * (typically by value 1).
 */
#define VDPAU_INTERFACE_VERSION 1

1474
1475
1476
/**
 * \brief The VDPAU version described by this header file.
 *
1477
1478
1479
1480
1481
1482
1483
 * This version will increase whenever any non-documentation change is made to
 * vdpau.h, or related header files such as vdpau_x11.h. Such changes
 * typically involve the addition of new functions, constants, or features.
 * Such changes are expected to be completely backwards-compatible.
 *
 * VDPAU version numbers are simple integers that increase monotonically
 * (typically by value 1).
Aaron Plattner's avatar
Aaron Plattner committed
1484
 */
1485
#define VDPAU_VERSION 1
Aaron Plattner's avatar
Aaron Plattner committed
1486
1487

/**
1488
 * \brief Retrieve the VDPAU version implemented by the backend.
Aaron Plattner's avatar
Aaron Plattner committed
1489
1490
1491
1492
1493
1494
1495
1496
1497
 * \param[out] api_version The API version.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpGetApiVersion(
    /* output parameters follow */
    uint32_t * api_version
);

/**
1498
 * \brief Retrieve an implementation-specific string description
Aaron Plattner's avatar
Aaron Plattner committed
1499
1500
1501
1502
1503
1504
1505
1506
 *        of the implementation. This typically includes detailed version
 *        information.
 * \param[out] information_string A pointer to the information
 *       string. Note that this is a statically allocated
 *       read-only string. As such, the application must not
 *       free the returned pointer. The pointer is valid as long
 *       as the implementation is present within the
 *       application's address space.
1507
1508
1509
1510
1511
1512
 * \return VdpStatus The completion status of the operation.
 *
 * Note that the returned string is useful for information
 * reporting. It is not intended that the application should
 * parse this string in order to determine any information about
 * the implementation.
Aaron Plattner's avatar
Aaron Plattner committed
1513
1514
1515
1516
1517
1518
 */
typedef VdpStatus VdpGetInformationString(
    /* output parameters follow */
    char const * * information_string
);

1519
/** @} */
Aaron Plattner's avatar
Aaron Plattner committed
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548

/**
 * \defgroup VdpDevice VdpDevice; Primary API object
 *
 * The VdpDevice is the root of the VDPAU object system. Using a
 * VdpDevice object, all other object types may be created. See
 * the sections describing those other object types for details
 * on object creation.
 *
 * Note that VdpDevice objects are created using the \ref
 * api_winsys.
 *
 * @{
 */

/**
 * \brief  An opaque handle representing a VdpDevice object.
 */
typedef uint32_t VdpDevice;

/**
 * \brief Destroy a VdpDevice.
 * \param[in] device The device to destroy.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpDeviceDestroy(
    VdpDevice device
);

1549
/** @} */
Aaron Plattner's avatar
Aaron Plattner committed
1550
1551
1552
1553
1554

/**
 * \defgroup VdpCSCMatrix VdpCSCMatrix; CSC Matrix Manipulation
 *
 * When converting from YCbCr to RGB data formats, a color space
1555
1556
 * conversion operation must be performed. This operation is
 * parameterized using a "color space conversion matrix". The
Aaron Plattner's avatar
Aaron Plattner committed
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
 * VdpCSCMatrix is a data structure representing this
 * information.
 *
 * @{
 */

/**
 * \brief Storage for a color space conversion matrix.
 *
 * Note that the application may choose to construct the matrix
 * content by either:
 * - Directly filling in the fields of the CSC matrix
 * - Using the \ref VdpGenerateCSCMatrix helper function.
 *
 * The color space conversion equation is as follows:
 *
 * \f[
 * \left( \begin{array}{c} R \\ G \\ B \end{array} \right)
 * =
 * \left( \begin{array}{cccc}
 * m_{0,0} & m_{0,1} & m_{0,2} & m_{0,3} \\
 * m_{1,0} & m_{1,1} & m_{1,2} & m_{1,3} \\
 * m_{2,0} & m_{2,1} & m_{2,2} & m_{2,3}
 * \end{array}
 * \right)
 * *
 * \left( \begin{array}{c} Y \\ Cb \\ Cr \\ 1.0 \end{array}
 *      \right)
 * \f]
 */
typedef float VdpCSCMatrix[3][4];

#define VDP_PROCAMP_VERSION 0

/**
 * \brief Procamp operation parameterization data.
 *
 * When performing a color space conversion operation, various
 * adjustments can be performed at the same time, such as
 * brightness and contrast. This structure defines the level of
 * adjustments to make.
 */
typedef struct {
    /**
     * This field must be filled with VDP_PROCAMP_VERSION
     */
    uint32_t struct_version;
    /**
     * Brightness adjustment amount. A value clamped between
     * -1.0 and 1.0. 0.0 represents no modification.
     */
    float brightness;
    /**
     * Contrast adjustment amount. A value clamped between
     * 0.0 and 10.0. 1.0 represents no modification.
     */
    float contrast;
    /**
     * Saturation adjustment amount. A value clamped between 0.0 and
1616
     * 10.0. 1.0 represents no modification.
Aaron Plattner's avatar
Aaron Plattner committed
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
     */
    float saturation;
    /**
     * Hue adjustment amount. A value clamped between
     * -PI and PI. 0.0 represents no modification.
     */
    float hue;
} VdpProcamp;

/**
 * \brief YCbCr color space specification.
 *
 * A number of YCbCr color spaces exist. This enumeration
 * defines the specifications known to VDPAU.
 */
typedef uint32_t VdpColorStandard;

/** \hideinitializer \brief ITU-R BT.601 */
1635
#define VDP_COLOR_STANDARD_ITUR_BT_601 ((VdpColorStandard)0)
Aaron Plattner's avatar
Aaron Plattner committed
1636
/** \hideinitializer \brief ITU-R BT.709 */
1637
#define VDP_COLOR_STANDARD_ITUR_BT_709 ((VdpColorStandard)1)
Aaron Plattner's avatar
Aaron Plattner committed
1638
/** \hideinitializer \brief SMPTE-240M */
1639
#define VDP_COLOR_STANDARD_SMPTE_240M  ((VdpColorStandard)2)
Aaron Plattner's avatar
Aaron Plattner committed
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655

/**
 * \brief Generate a color space conversion matrix
 * \param[in] procamp The procamp adjustments to make. If NULL,
 *        no adjustments will be made.
 * \param[in] standard The YCbCr color space to convert from.
 * \param[out] csc_matrix The CSC matrix to initialize.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpGenerateCSCMatrix(
    VdpProcamp *     procamp,
    VdpColorStandard standard,
    /* output parameters follow */
    VdpCSCMatrix *   csc_matrix
);

1656
/** @} */
Aaron Plattner's avatar
Aaron Plattner committed
1657
1658
1659
1660
1661

/**
 * \defgroup VdpVideoSurface VdpVideoSurface; Video Surface object
 *
 * A VdpVideoSurface stores YCbCr data in an internal format,
1662
 * with a variety of possible chroma sub-sampling options.
Aaron Plattner's avatar
Aaron Plattner committed
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
 *
 * A VdpVideoSurface may be filled with:
 * - Data provided by the CPU via \ref
 *   VdpVideoSurfacePutBitsYCbCr (i.e. software decode.)
 * - The result of applying a \ref VdpDecoder "VdpDecoder" to
 *   compressed video data.
 *
 * VdpVideoSurface content may be accessed by:
 * - The application via \ref VdpVideoSurfaceGetBitsYCbCr
 * - The Hardware that implements \ref VdpOutputSurface
 *   "VdpOutputSurface" \ref VdpOutputSurfaceRender
 *   "rendering functionality".
 * - The Hardware the implements \ref VdpVideoMixer
 *   "VdpVideoMixer" functionality.
 *
 * VdpVideoSurfaces are not directly displayable. They must be
 * converted into a displayable format using \ref VdpVideoMixer
 * "VdpVideoMixer" objects.
 *
 * See \ref video_mixer_usage for additional information.
 *
 * @{
 */

/**
 * \brief Query the implementation's VdpVideoSurface
 *        capabilities.
 * \param[in] device The device to query.
 * \param[in] surface_chroma_type The type of chroma type for
 *       which information is requested.
 * \param[out] is_supported Is this chroma type supported?
 * \param[out] max_width The maximum supported surface width for
 *       this chroma type.
 * \param[out] max_height The maximum supported surface height
 *       for this chroma type.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpVideoSurfaceQueryCapabilities(
    VdpDevice     device,
    VdpChromaType surface_chroma_type,
    /* output parameters follow */
    VdpBool *     is_supported,
    uint32_t *    max_width,
    uint32_t *    max_height
);

/**
 * \brief Query the implementation's VdpVideoSurface
 *        GetBits/PutBits capabilities.
 * \param[in] device The device to query.
 * \param[in] surface_chroma_type The type of chroma type for
 *       which information is requested.
 * \param[in] bits_ycbcr_format The format of application "bits"
 *       buffer for which information is requested.
 * \param[out] is_supported Is this chroma type supported?
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities(
    VdpDevice      device,
    VdpChromaType  surface_chroma_type,
    VdpYCbCrFormat bits_ycbcr_format,
    /* output parameters follow */
    VdpBool *      is_supported
);

/**
 * \brief An opaque handle representing a VdpVideoSurface
 *        object.
 */
typedef uint32_t VdpVideoSurface;

/**
 * \brief Create a VdpVideoSurface.
 * \param[in] device The device that will contain the surface.
 * \param[in] chroma_type The chroma type of the new surface.
 * \param[in] width The width of the new surface.
 * \param[in] height The height of the new surface.
 * \param[out] surface The new surface's handle.
1741
1742
 * \return VdpStatus The completion status of the operation.
 *
Aaron Plattner's avatar
Aaron Plattner committed
1743
 * The memory backing the surface may not be initialized during
1744
1745
1746
 * creation. Applications are expected to initialize any region
 * that they use, via \ref VdpDecoderRender or \ref
 * VdpVideoSurfacePutBitsYCbCr.
Stephen Warren's avatar
Stephen Warren committed
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
 *
 * Note that certain widths/heights are impossible for specific values of
 * chroma_type. For example, the definition of VDP_CHROMA_TYPE_420 implies
 * that the width must be even, since each single chroma sample covers two
 * luma samples horizontally. A similar argument applies to surface heights,
 * although doubly so, since interlaced pictures must be supported; each
 * field's height must itself be a multiple of 2. Hence the overall surface's
 * height must be a multiple of 4.
 *
 * Similar rules apply to other chroma_type values.
 *
 * Implementations may also impose additional restrictions on the surface
 * sizes they support, potentially requiring additional rounding of actual
 * surface sizes.
 *
 * In most cases, this is not an issue, since:
 * - Video streams are encoded as an array of macro-blocks, which typically
 *   have larger size alignment requirements than video surfaces do.
 * - APIs such as \ref VdpVideoMixerRender allow specification of a sub-region
 *   of the surface to read, which allows the padding data to be clipped away.
 *
 * However, other APIs such as \ref VdpVideoSurfaceGetBitsYCbCr and
 * \ref VdpVideoSurfacePutBitsYCbCr do not allow a sub-region to be specified,
 * and always operate on surface size that was actually allocated, rather
 * than the surface size that was requested. In this case, applications need
 * to be aware of the actual surface size, in order to allocate appropriately
 * sized buffers for the get-/put-bits operations.
 *
 * For this reason, applications may need to call
 * \ref VdpVideoSurfaceGetParameters after creation, in order to retrieve the
 * actual surface size.
Aaron Plattner's avatar
Aaron Plattner committed
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
 */
typedef VdpStatus VdpVideoSurfaceCreate(
    VdpDevice         device,
    VdpChromaType     chroma_type,
    uint32_t          width,
    uint32_t          height,
    /* output parameters follow */
    VdpVideoSurface * surface
);

/**
 * \brief Destroy a VdpVideoSurface.
 * \param[in] surface The surface's handle.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpVideoSurfaceDestroy(
    VdpVideoSurface surface
);

/**
 * \brief Retrieve the parameters used to create a
 *        VdpVideoSurface.
 * \param[in] surface The surface's handle.
 * \param[out] chroma_type The chroma type of the surface.
 * \param[out] width The width of the surface.
 * \param[out] height The height of the surface.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpVideoSurfaceGetParameters(
    VdpVideoSurface surface,
    /* output parameters follow */
    VdpChromaType * chroma_type,
    uint32_t *      width,
    uint32_t *      height
);

/**
 * \brief Copy image data from a VdpVideoSurface to application
 *        memory in a specified YCbCr format.
 * \param[in] surface The surface's handle.
 * \param[in] destination_ycbcr_format The format of the
 *       application's data buffers.
 * \param[in] destination_data Pointers to the application data
 *       buffers into which the image data will be written. Note
 *       that this is an array of pointers, one per plane. The
 *       destination_format parameter will define how many
 *       planes are required.
 * \param[in] destination_pitches Pointers to the pitch values
 *       for the application data buffers. Note that this is an
 *       array of pointers, one per plane. The
 *       destination_format parameter will define how many
 *       planes are required.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpVideoSurfaceGetBitsYCbCr(
    VdpVideoSurface  surface,
    VdpYCbCrFormat   destination_ycbcr_format,
    void * const *   destination_data,
    uint32_t const * destination_pitches
);

/**
 * \brief Copy image data from application memory in a specific
 *        YCbCr format to a VdpVideoSurface.
 * \param[in] surface The surface's handle.
 * \param[in] source_ycbcr_format The format of the
 *       application's data buffers.
 * \param[in] source_data Pointers to the application data
 *       buffers from which the image data will be copied. Note
 *       that this is an array of pointers, one per plane. The
 *       source_format parameter will define how many
 *       planes are required.
 * \param[in] source_pitches Pointers to the pitch values
 *       for the application data buffers. Note that this is an
 *       array of pointers, one per plane. The
 *       source_format parameter will define how many
 *       planes are required.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpVideoSurfacePutBitsYCbCr(
    VdpVideoSurface      surface,
    VdpYCbCrFormat       source_ycbcr_format,
    void const * const * source_data,
    uint32_t const *     source_pitches
);

1864
/** @} */
Aaron Plattner's avatar
Aaron Plattner committed
1865
1866

/**
1867
 * \defgroup VdpOutputSurface VdpOutputSurface; Output Surface object
Aaron Plattner's avatar
Aaron Plattner committed
1868
 *
1869
 * A VdpOutputSurface stores RGBA data in a defined format.
Aaron Plattner's avatar
Aaron Plattner committed
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
 *
 * A VdpOutputSurface may be filled with:
 * - Data provided by the CPU via the various
 *   VdpOutputSurfacePutBits functions.
 * - Using the VdpOutputSurface \ref VdpOutputSurfaceRender
 *   "rendering functionality".
 * - Using a \ref VdpVideoMixer "VdpVideoMixer" object.
 *
 * VdpOutputSurface content may be accessed by:
 * - The application via the various VdpOutputSurfaceGetBits
 *   functions.
 * - The Hardware that implements VdpOutputSurface
 *   \ref VdpOutputSurfaceRender "rendering functionality".
 * - The Hardware the implements \ref VdpVideoMixer
 *   "VdpVideoMixer" functionality.
 * - The Hardware that implements \ref VdpPresentationQueue
 *   "VdpPresentationQueue" functionality,
 *
1888
 * VdpOutputSurfaces are directly displayable using a \ref
Aaron Plattner's avatar
Aaron Plattner committed
1889
1890
1891
1892
1893
1894
 * VdpPresentationQueue "VdpPresentationQueue" object.
 *
 * @{
 */

/**
1895
 * \brief The set of all known color table formats, for use with
Aaron Plattner's avatar
Aaron Plattner committed
1896
1897
1898
1899
 * \ref VdpOutputSurfacePutBitsIndexed.
 */
typedef uint32_t VdpColorTableFormat;

1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
/**
 * \hideinitializer
 * \brief 8-bit per component packed into 32-bits
 *
 * This format is an array of packed 32-bit RGB color values.
 * Bits [31:24] are unused, bits [23:16] contain R, bits [15:8]
 * contain G, and bits [7:0] contain B. Note: The format is
 * physically an array of uint32_t values, and should be accessed
 * as such by the application in order to avoid endianness
 * issues.
 */
1911
#define VDP_COLOR_TABLE_FORMAT_B8G8R8X8 ((VdpColorTableFormat)0)
Aaron Plattner's avatar
Aaron Plattner committed
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960

/**
 * \brief Query the implementation's VdpOutputSurface
 *        capabilities.
 * \param[in] device The device to query.
 * \param[in] surface_rgba_format The surface format for
 *       which information is requested.
 * \param[out] is_supported Is this surface format supported?
 * \param[out] max_width The maximum supported surface width for
 *       this chroma type.
 * \param[out] max_height The maximum supported surface height
 *       for this chroma type.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpOutputSurfaceQueryCapabilities(
    VdpDevice     device,
    VdpRGBAFormat surface_rgba_format,
    /* output parameters follow */
    VdpBool *     is_supported,
    uint32_t *    max_width,
    uint32_t *    max_height
);

/**
 * \brief Query the implementation's capability to perform a
 *        PutBits operation using application data matching the
 *        surface's format.
 * \param[in] device The device to query.
 * \param[in] surface_rgba_format The surface format for
 *       which information is requested.
 * \param[out] is_supported Is this surface format supported?
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpOutputSurfaceQueryGetPutBitsNativeCapabilities(
    VdpDevice     device,
    VdpRGBAFormat surface_rgba_format,
    /* output parameters follow */
    VdpBool *     is_supported
);

/**
 * \brief Query the implementation's capability to perform a
 *        PutBits operation using application data in a specific
 *        indexed format.
 * \param[in] device The device to query.
 * \param[in] surface_rgba_format The surface format for
 *       which information is requested.
 * \param[in] bits_indexed_format The format of the application
 *       data buffer.
1961
 * \param[in] color_table_format The format of the color lookup
Aaron Plattner's avatar
Aaron Plattner committed
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
 *       table.
 * \param[out] is_supported Is this surface format supported?
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpOutputSurfaceQueryPutBitsIndexedCapabilities(
    VdpDevice           device,
    VdpRGBAFormat       surface_rgba_format,
    VdpIndexedFormat    bits_indexed_format,
    VdpColorTableFormat color_table_format,
    /* output parameters follow */
    VdpBool *           is_supported
);

/**
 * \brief Query the implementation's capability to perform a
 *        PutBits operation using application data in a specific
 *        YCbCr/YUB format.
 * \param[in] device The device to query.
 * \param[in] surface_rgba_format The surface format for which
 *       information is requested.
 * \param[in] bits_ycbcr_format The format of the application
 *       data buffer.
 * \param[out] is_supported Is this surface format supported?
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpOutputSurfaceQueryPutBitsYCbCrCapabilities(
    VdpDevice      device,
    VdpRGBAFormat  surface_rgba_format,
    VdpYCbCrFormat bits_ycbcr_format,
    /* output parameters follow */
    VdpBool *      is_supported
);

/**
 * \brief An opaque handle representing a VdpOutputSurface
 *        object.
 */
typedef uint32_t VdpOutputSurface;

/**
 * \brief Create a VdpOutputSurface.
 * \param[in] device The device that will contain the surface.
 * \param[in] rgba_format The format of the new surface.
 * \param[in] width The width of the new surface.
 * \param[in] height The height of the new surface.
 * \param[out] surface The new surface's handle.
2008
2009
 * \return VdpStatus The completion status of the operation.
 *
Aaron Plattner's avatar
Aaron Plattner committed
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
 * The memory backing the surface will be initialized to 0 color
 * and 0 alpha (i.e. black.)
 */
typedef VdpStatus VdpOutputSurfaceCreate(
    VdpDevice          device,
    VdpRGBAFormat      rgba_format,
    uint32_t           width,
    uint32_t           height,
    /* output parameters follow */
    VdpOutputSurface * surface
);

/**
 * \brief Destroy a VdpOutputSurface.
 * \param[in] surface The surface's handle.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpOutputSurfaceDestroy(
    VdpOutputSurface surface
);

/**
 * \brief Retrieve the parameters used to create a
 *        VdpOutputSurface.
 * \param[in] surface The surface's handle.
 * \param[out] rgba_format The format of the surface.
 * \param[out] width The width of the surface.
 * \param[out] height The height of the surface.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpOutputSurfaceGetParameters(
    VdpOutputSurface surface,
    /* output parameters follow */
    VdpRGBAFormat *  rgba_format,
    uint32_t *       width,
    uint32_t *       height
);

/**
 * \brief Copy image data from a VdpOutputSurface to application
 *        memory in the surface's native format.
 * \param[in] surface The surface's handle.
 * \param[in] source_rect The sub-rectangle of the source
 *       surface to copy. If NULL, the entire surface will be
 *       retrieved.
 * \param[in] destination_data Pointers to the application data
 *       buffers into which the image data will be written. Note
 *       that this is an array of pointers, one per plane. The
 *       destination_format parameter will define how many
 *       planes are required.
 * \param[in] destination_pitches Pointers to the pitch values
 *       for the application data buffers. Note that this is an
 *       array of pointers, one per plane. The
 *       destination_format parameter will define how many
 *       planes are required.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpOutputSurfaceGetBitsNative(
    VdpOutputSurface surface,
    VdpRect const *  source_rect,
    void * const *   destination_data,
    uint32_t const * destination_pitches
);

/**
 * \brief Copy image data from application memory in the
 *        surface's native format to a VdpOutputSurface.
 * \param[in] surface The surface's handle.
 * \param[in] source_data Pointers to the application data
 *       buffers from which the image data will be copied. Note
 *       that this is an array of pointers, one per plane. The
 *       source_format parameter will define how many
 *       planes are required.
 * \param[in] source_pitches Pointers to the pitch values
 *       for the application data buffers. Note that this is an
 *       array of pointers, one per plane. The
 *       source_format parameter will define how many
 *       planes are required.
 * \param[in] destination_rect The sub-rectangle of the surface
 *       to fill with application data. If NULL, the entire
 *       surface will be updated.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpOutputSurfacePutBitsNative(
    VdpOutputSurface     surface,
    void const * const * source_data,
    uint32_t const *     source_pitches,
    VdpRect const *      destination_rect
);

/**
 * \brief Copy image data from application memory in a specific
 *        indexed format to a VdpOutputSurface.
 * \param[in] surface The surface's handle.
 * \param[in] source_indexed_format The format of the
 *       application's data buffers.
 * \param[in] source_data Pointers to the application data
 *       buffers from which the image data will be copied. Note
 *       that this is an array of pointers, one per plane. The
 *       source_indexed_format parameter will define how many
 *       planes are required.
 * \param[in] source_pitches Pointers to the pitch values
 *       for the application data buffers. Note that this is an
 *       array of pointers, one per plane. The
 *       source_indexed_format parameter will define how many
 *       planes are required.
 * \param[in] destination_rect The sub-rectangle of the surface
 *       to fill with application data. If NULL, the entire
 *       surface will be updated.
2119
 * \param[in] color_table_format The format of the color_table.
Aaron Plattner's avatar
Aaron Plattner committed
2120
2121
 * \param[in] color_table A table that maps between source index
 *       and target color data. See \ref VdpColorTableFormat for
2122
 *       details regarding the memory layout.
Aaron Plattner's avatar
Aaron Plattner committed
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpOutputSurfacePutBitsIndexed(
    VdpOutputSurface     surface,
    VdpIndexedFormat     source_indexed_format,
    void const * const * source_data,
    uint32_t const *     source_pitch,
    VdpRect const *      destination_rect,
    VdpColorTableFormat  color_table_format,
    void const *         color_table
);

/**
 * \brief Copy image data from application memory in a specific
 *        YCbCr format to a VdpOutputSurface.
 * \param[in] surface The surface's handle.
 * \param[in] source_ycbcr_format The format of the
 *       application's data buffers.
 * \param[in] source_data Pointers to the application data
 *       buffers from which the image data will be copied. Note
 *       that this is an array of pointers, one per plane. The
 *       source_ycbcr_format parameter will define how many
 *       planes are required.
 * \param[in] source_pitches Pointers to the pitch values
 *       for the application data buffers. Note that this is an
 *       array of pointers, one per plane. The
 *       source_ycbcr_format parameter will define how many
 *       planes are required.
 * \param[in] destination_rect The sub-rectangle of the surface
 *       to fill with application data. If NULL, the entire
 *       surface will be updated.
 * \param[in] csc_matrix The color space conversion matrix used
 *       by the copy operation. If NULL, a default matrix will
 *       be used internally. Th default matrix is equivalent to
 *       ITU-R BT.601 with no procamp changes.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpOutputSurfacePutBitsYCbCr(
    VdpOutputSurface     surface,
    VdpYCbCrFormat       source_ycbcr_format,
    void const * const * source_data,
    uint32_t const *     source_pitches,
    VdpRect const *      destination_rect,
    VdpCSCMatrix const * csc_matrix
);

2169
/** @} */
Aaron Plattner's avatar
Aaron Plattner committed
2170
2171

/**
2172
 * \defgroup VdpBitmapSurface VdpBitmapSurface; Bitmap Surface object
Aaron Plattner's avatar
Aaron Plattner committed
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
 *
 * A VdpBitmapSurface stores RGBA data in a defined format.
 *
 * A VdpBitmapSurface may be filled with:
 * - Data provided by the CPU via the \ref
 *   VdpBitmapSurfacePutBitsNative function.
 *
 * VdpBitmapSurface content may be accessed by:
 * - The Hardware that implements \ref VdpOutputSurface
 *   "VdpOutputSurface" \ref VdpOutputSurfaceRender
 *   "rendering functionality"
 *
 * VdpBitmapSurface objects are intended to store static read-only data, such
 * as font glyphs, and the bitmaps used to compose an applications'
 * user-interface.
 *
 * The primary differences between VdpBitmapSurfaces and
 * \ref VdpOutputSurface "VdpOutputSurface"s are:
 *
 * - You cannot render to a VdpBitmapSurface, just upload native data via
 *   the PutBits API.
 *
 * - The read-only nature of a VdpBitmapSurface gives the implementation more
 *   flexibility in its choice of data storage location for the bitmap data.
 *   For example, some implementations may choose to store some/all
 *   VdpBitmapSurface objects in system memory to relieve GPU memory pressure.
 *
 * - VdpBitmapSurface and VdpOutputSurface may support different subsets of all
 *   known RGBA formats.
 *
 * @{
 */

/**
 * \brief Query the implementation's VdpBitmapSurface
 *        capabilities.
 * \param[in] device The device to query.
 * \param[in] surface_rgba_format The surface format for
 *       which information is requested.
 * \param[out] is_supported Is this surface format supported?
 * \param[out] max_width The maximum supported surface width for
 *       this chroma type.
 * \param[out] max_height The maximum supported surface height
 *       for this chroma type.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpBitmapSurfaceQueryCapabilities(
    VdpDevice     device,
    VdpRGBAFormat surface_rgba_format,
    /* output parameters follow */
    VdpBool *     is_supported,
    uint32_t *    max_width,
    uint32_t *    max_height
);

/**
 * \brief An opaque handle representing a VdpBitmapSurface
 *        object.
 */
typedef uint32_t VdpBitmapSurface;

/**
 * \brief Create a VdpBitmapSurface.
 * \param[in] device The device that will contain the surface.
 * \param[in] rgba_format The format of the new surface.
 * \param[in] width The width of the new surface.
 * \param[in] height The height of the new surface.
 * \param[in] frequently_accessed Is this bitmap used
 *       frequently, or infrequently, by compositing options?
 *       Implementations may use this as a hint to determine how
 *       to allocate the underlying storage for the surface.
 * \param[out] surface The new surface's handle.
2245
2246
2247
2248
 * \return VdpStatus The completion status of the operation.
 *
 * The memory backing the surface may not be initialized
 * during creation. Applications are expected initialize any
Aaron Plattner's avatar
Aaron Plattner committed
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
 * region that they use, via \ref VdpBitmapSurfacePutBitsNative.
 */
typedef VdpStatus VdpBitmapSurfaceCreate(
    VdpDevice          device,
    VdpRGBAFormat      rgba_format,
    uint32_t           width,
    uint32_t           height,
    VdpBool            frequently_accessed,
    /* output parameters follow */
    VdpBitmapSurface * surface
);

/**
 * \brief Destroy a VdpBitmapSurface.
 * \param[in] surface The surface's handle.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpBitmapSurfaceDestroy(
    VdpBitmapSurface surface
);

/**
 * \brief Retrieve the parameters used to create a
 *        VdpBitmapSurface.
 * \param[in] surface The surface's handle.
 * \param[out] rgba_format The format of the surface.
 * \param[out] width The width of the surface.
 * \param[out] height The height of the surface.
 * \param[out] frequently_accessed The frequently_accessed state
 *       of the surface.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpBitmapSurfaceGetParameters(
    VdpBitmapSurface surface,
    /* output parameters follow */
    VdpRGBAFormat *  rgba_format,
    uint32_t *       width,
    uint32_t *       height,
    VdpBool *        frequently_accessed
);

/**
 * \brief Copy image data from application memory in the
 *        surface's native format to a VdpBitmapSurface.
 * \param[in] surface The surface's handle.
 * \param[in] source_data Pointers to the application data
 *       buffers from which the image data will be copied. Note
 *       that this is an array of pointers, one per plane. The
 *       source_format parameter will define how many
 *       planes are required.
 * \param[in] source_pitches Pointers to the pitch values
 *       for the application data buffers. Note that this is an
 *       array of pointers, one per plane. The
 *       source_format parameter will define how many
 *       planes are required.
 * \param[in] destination_rect The sub-rectangle of the surface
 *       to fill with application data. If NULL, the entire
 *       surface will be updated.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpBitmapSurfacePutBitsNative(
    VdpBitmapSurface     surface,
    void const * const * source_data,
    uint32_t const *     source_pitches,
    VdpRect const *      destination_rect
);

2316
/** @} */
Aaron Plattner's avatar
Aaron Plattner committed
2317
2318

/**
2319
 * \defgroup VdpOutputSurfaceRender VdpOutputSurface Rendering Functionality
Aaron Plattner's avatar
Aaron Plattner committed
2320
2321
2322
2323
2324
2325
2326
2327
 *
 * \ref VdpOutputSurface "VdpOutputSurface" objects
 * directly provide some rendering/compositing operations. These
 * are described below.
 *
 * @{
 */

2328
2329
/**
 * \hideinitializer
Aaron Plattner's avatar
Aaron Plattner committed
2330
 * \brief The blending equation factors.
2331
 */
Aaron Plattner's avatar
Aaron Plattner committed
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
typedef enum {
    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ZERO                     = 0,
    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE                      = 1,
    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_COLOR                = 2,
    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_COLOR      = 3,
    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA                = 4,
    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA      = 5,
    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_DST_ALPHA                = 6,
    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_DST_ALPHA      = 7,
    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_DST_COLOR                = 8,
    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_DST_COLOR      = 9,
    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA_SATURATE       = 10,
    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_CONSTANT_COLOR           = 11,
    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR = 12,
    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_CONSTANT_ALPHA           = 13,
    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA = 14,
} VdpOutputSurfaceRenderBlendFactor;

2350
2351
/**
 * \hideinitializer
Aaron Plattner's avatar
Aaron Plattner committed
2352
 * \brief The blending equations.
2353
 */
Aaron Plattner's avatar
Aaron Plattner committed
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
typedef enum {
    VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_SUBTRACT         = 0,
    VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_REVERSE_SUBTRACT = 1,
    VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD              = 2,
    VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_MIN              = 3,
    VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_MAX              = 4,
} VdpOutputSurfaceRenderBlendEquation;

#define VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSION 0

/**
 * \brief Complete blending operation definition.
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
 *
 * A "blend state" operation controls the math behind certain rendering
 * operations.
 *
 * The blend math is the familiar OpenGL blend math:
 *     \f[
 *     dst.a = equation(blendFactorDstAlpha*dst.a,
 *     blendFactorSrcAlpha*src.a);
 *     \f]
 *     \f[
 *     dst.rgb = equation(blendFactorDstColor*dst.rgb,
 *     blendFactorSrcColor*src.rgb);
 *     \f]
 *
 * Note that when equation is MIN or MAX, the blend factors and constants
 * are ignored, and are treated as if they were 1.0.
Aaron Plattner's avatar
Aaron Plattner committed
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
 */
typedef struct {
    /**
     * This field must be filled with VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSIION
     */
    uint32_t struct_version;
    VdpOutputSurfaceRenderBlendFactor   blend_factor_source_color;
    VdpOutputSurfaceRenderBlendFactor   blend_factor_destination_color;
    VdpOutputSurfaceRenderBlendFactor   blend_factor_source_alpha;
    VdpOutputSurfaceRenderBlendFactor   blend_factor_destination_alpha;
    VdpOutputSurfaceRenderBlendEquation blend_equation_color;
    VdpOutputSurfaceRenderBlendEquation blend_equation_alpha;
    VdpColor                            blend_constant;
} VdpOutputSurfaceRenderBlendState;

2397
2398
/**
 * \hideinitializer
Aaron Plattner's avatar
Aaron Plattner committed
2399
2400
2401
2402
2403
 * \brief Do not rotate source_surface prior to compositing.
 */
#define VDP_OUTPUT_SURFACE_RENDER_ROTATE_0   0

/**
2404
 * \hideinitializer
Aaron Plattner's avatar
Aaron Plattner committed
2405
2406
2407
2408
2409
2410
 * \brief Rotate source_surface 90 degrees clockwise prior to
 *        compositing.
 */
#define VDP_OUTPUT_SURFACE_RENDER_ROTATE_90  1

/**
2411
 * \hideinitializer
Aaron Plattner's avatar
Aaron Plattner committed
2412
2413
2414
2415
2416
2417
 * \brief Rotate source_surface 180 degrees prior to
 *        compositing.
 */
#define VDP_OUTPUT_SURFACE_RENDER_ROTATE_180 2

/**
2418
 * \hideinitializer
Aaron Plattner's avatar
Aaron Plattner committed
2419
2420
2421
2422
2423
2424
 * \brief Rotate source_surface 270 degrees clockwise prior to
 *        compositing.
 */
#define VDP_OUTPUT_SURFACE_RENDER_ROTATE_270 3

/**
2425
 * \hideinitializer
Aaron Plattner's avatar
Aaron Plattner committed
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
 * \brief A separate color is used for each vertex of the
 *        smooth-shaded quad. Hence, colors array contains 4
 *        elements rather than 1. See description of colors
 *        array.
 */
#define VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX (1 << 2)

/**
 * \brief Composite a sub-rectangle of a \ref VdpOutputSurface
 *        "VdpOutputSurface" into a sub-rectangle of another
 *        \ref VdpOutputSurface VdpOutputSurface.
 * \param[in] destination_surface The destination surface of the
 *       compositing operation.
 * \param[in] destination_rect The sub-rectangle of the
 *       destination surface to update. If NULL, the entire
 *       destination surface will be updated.
 * \param[in] source_surface The source surface for the
 *       compositing operation. The surface is treated as having
 *       four components: red, green, blue and alpha. Any
 *       missing components are treated as 1.0. For example, for
 *       an A8 VdpOutputSurface, alpha will come from the surface
 *       but red, green and blue will be treated as 1.0. If
2448
2449
 *       source_surface is VDP_INVALID_HANDLE, all components will
 *       be treated as 1.0. Note that destination_surface and
Aaron Plattner's avatar
Aaron Plattner committed
2450
2451
2452
2453
 *       source_surface must have been allocated via the same
 *       \ref VdpDevice "VdpDevice".
 * \param[in] source_rect The sub-rectangle of the source
 *       surface to read from. If NULL, the entire
Stephen Warren's avatar
Stephen Warren committed
2454
 *       source_surface will be read. Left/right and/or top/bottom
Aaron Plattner's avatar
Aaron Plattner committed
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
 *       co-ordinates may be swapped to flip the source. Any
 *       flip occurs prior to any requested rotation. Values
 *       from outside the source surface are valid and samples
 *       at those locations will be taken from the nearest edge.
 * \param[in] colors A pointer to an array of \ref VdpColor
 *      "VdpColor" objects. If the flag
 *      VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX is set,
 *      VDPAU will four entries from the array, and treat them
 *      as the colors corresponding to the upper-left,
 *      upper-right, lower-right and lower-left corners of the
 *      post-rotation source (i.e. indices 0, 1, 2 and 3 run
 *      clockwise from the upper left corner). If the flag
 *      VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX is not
 *      set, VDPAU will use the single VdpColor for all four
 *      corners. If colors is NULL then red, green, blue and
 *      alpha values of 1.0 will be used.
 * \param[in] blend_state If a blend state is provided, the
 *     blend state will be used for the composite operation. If
 *     NULL, blending is effectively disabled, which is
 *     equivalent to a blend equation of ADD, source blend
2475
2476
2477
 *     factors of ONE and destination blend factors of ZERO.
 *     See \ref VdpOutputSurfaceRenderBlendState for details
 *     regarding the mathematics of the blending operation.
Aaron Plattner's avatar
Aaron Plattner committed
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
 * \param[in] flags A set of flags influencing how the
 *       compositing operation works.
 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_0
 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_90
 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_180
 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_270
 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX
 * \return VdpStatus The completion status of the operation.
 *
 * The general compositing pipeline is as follows.
 *
 * -# Extract source_rect from source_surface.
 *
 * -# The extracted source is rotated 0, 90, 180 or 270 degrees
Stephen Warren's avatar
Stephen Warren committed
2492
 *    according to the flags.
Aaron Plattner's avatar
Aaron Plattner committed
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
 *
 * -# The rotated source is component-wise multiplied by a
 *    smooth-shaded quad with a (potentially) different color at
 *    each vertex.
 *
 * -# The resulting rotated, smooth-shaded quad is scaled to the
 *    size of destination_rect and composited with
 *    destination_surface using the provided blend state.
 *
 */
typedef VdpStatus VdpOutputSurfaceRenderOutputSurface(
    VdpOutputSurface                         destination_surface,
    VdpRect const *                          destination_rect,
    VdpOutputSurface                         source_surface,
    VdpRect const *                          source_rect,
    VdpColor const *                         colors,
    VdpOutputSurfaceRenderBlendState const * blend_state,
    uint32_t                                 flags
);

/**
2514
2515
 * \brief Composite a sub-rectangle of a \ref VdpBitmapSurface
 *        "VdpBitmapSurface" into a sub-rectangle of a
Aaron Plattner's avatar
Aaron Plattner committed
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
 *        \ref VdpOutputSurface VdpOutputSurface.
 * \param[in] destination_surface The destination surface of the
 *       compositing operation.
 * \param[in] destination_rect The sub-rectangle of the
 *       destination surface to update. If NULL, the entire
 *       destination surface will be updated.
 * \param[in] source_surface The source surface for the
 *       compositing operation. The surface is treated as having
 *       four components: red, green, blue and alpha. Any
 *       missing components are treated as 1.0. For example, for
 *       an A8 VdpBitmapSurface, alpha will come from the surface
 *       but red, green and blue will be treated as 1.0. If
2528
2529
 *       source_surface is VDP_INVALID_HANDLE, all components will
 *       be treated as 1.0. Note that destination_surface and
Aaron Plattner's avatar
Aaron Plattner committed
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
 *       source_surface must have been allocated via the same
 *       \ref VdpDevice "VdpDevice".
 * \param[in] source_rect The sub-rectangle of the source
 *       surface to read from. If NULL, the entire
 *       source_surface will be read. Left/right ot top/bottom
 *       co-ordinates may be swapped to flip the source. Any
 *       flip occurs prior to any requested rotation. Values
 *       from outside the source surface are valid and samples
 *       at those locations will be taken from the nearest edge.
 * \param[in] colors A pointer to an array of \ref VdpColor
 *      "VdpColor" objects. If the flag
 *      VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX is set,
 *      VDPAU will four entries from the array, and treat them
 *      as the colors corresponding to the upper-left,
 *      upper-right, lower-right and lower-left corners of the
 *      post-rotation source (i.e. indices 0, 1, 2 and 3 run
 *      clockwise from the upper left corner). If the flag
 *      VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX is not
 *      set, VDPAU will use the single VdpColor for all four
 *      corners. If colors is NULL then red, green, blue and
 *      alpha values of 1.0 will be used.
 * \param[in] blend_state If a blend state is provided, the
 *     blend state will be used for the composite operation. If
 *     NULL, blending is effectively disabled, which is
 *     equivalent to a blend equation of ADD, source blend
2555
2556
2557
 *     factors of ONE and destination blend factors of ZERO.
 *     See \ref VdpOutputSurfaceRenderBlendState for details
 *     regarding the mathematics of the blending operation.
Aaron Plattner's avatar
Aaron Plattner committed
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
 * \param[in] flags A set of flags influencing how the
 *       compositing operation works.
 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_0
 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_90
 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_180
 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_270
 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX
 * \return VdpStatus The completion status of the operation.
 *
 * The general compositing pipeline is as follows.
 *
 * -# Extract source_rect from source_surface.
 *
 * -# The extracted source is rotated 0, 90, 180 or 270 degrees
 *   according to the flags.
 *
 * -# The rotated source is component-wise multiplied by a
 *    smooth-shaded quad with a (potentially) different color at
 *    each vertex.
 *
 * -# The resulting rotated, smooth-shaded quad is scaled to the
 *    size of destination_rect and composited with
 *    destination_surface using the provided blend state.
 *
 */
typedef VdpStatus VdpOutputSurfaceRenderBitmapSurface(
    VdpOutputSurface                         destination_surface,
    VdpRect const *                          destination_rect,
    VdpBitmapSurface                         source_surface,
    VdpRect const *                          source_rect,
    VdpColor const *                         colors,
    VdpOutputSurfaceRenderBlendState const * blend_state,
    uint32_t                                 flags
);

2593
/** @} */
Aaron Plattner's avatar
Aaron Plattner committed
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615

/**
 * \defgroup VdpDecoder VdpDecoder; Video Decoding object
 *
 * The VdpDecoder object decodes compressed video data, writing
 * the results to a \ref VdpVideoSurface "VdpVideoSurface".
 *
 * A specific VDPAU implementation may support decoding multiple
 * types of compressed video data. However, VdpDecoder objects
 * are able to decode a specific type of compressed video data.
 * This type must be specified during creation.
 *
 * @{
 */

/**
 * \brief The set of all known compressed video formats, and
 *        associated profiles, that may be decoded.
 */
typedef uint32_t VdpDecoderProfile;

/** \hideinitializer */
2616
#define VDP_DECODER_PROFILE_MPEG1                       ((VdpDecoderProfile)0)
Aaron Plattner's avatar
Aaron Plattner committed
2617
/** \hideinitializer */
2618
#define VDP_DECODER_PROFILE_MPEG2_SIMPLE                ((VdpDecoderProfile)1)
Aaron Plattner's avatar
Aaron Plattner committed
2619
/** \hideinitializer */
2620
#define VDP_DECODER_PROFILE_MPEG2_MAIN                  ((VdpDecoderProfile)2)
Aaron Plattner's avatar
Aaron Plattner committed
2621
2622
/** \hideinitializer */
/** \brief MPEG 4 part 10 == H.264 == AVC */
2623
#define VDP_DECODER_PROFILE_H264_BASELINE               ((VdpDecoderProfile)6)
Aaron Plattner's avatar
Aaron Plattner committed
2624
/** \hideinitializer */
2625
#define VDP_DECODER_PROFILE_H264_MAIN                   ((VdpDecoderProfile)7)
Aaron Plattner's avatar
Aaron Plattner committed
2626
/** \hideinitializer */
2627
#define VDP_DECODER_PROFILE_H264_HIGH                   ((VdpDecoderProfile)8)
Aaron Plattner's avatar
Aaron Plattner committed
2628
/** \hideinitializer */
2629
#define VDP_DECODER_PROFILE_VC1_SIMPLE                  ((VdpDecoderProfile)9)
Aaron Plattner's avatar
Aaron Plattner committed
2630
/** \hideinitializer */
2631
#define VDP_DECODER_PROFILE_VC1_MAIN                    ((VdpDecoderProfile)10)
Aaron Plattner's avatar
Aaron Plattner committed
2632
/** \hideinitializer */
2633
#define VDP_DECODER_PROFILE_VC1_ADVANCED                ((VdpDecoderProfile)11)
2634
/** \hideinitializer */
2635
#define VDP_DECODER_PROFILE_MPEG4_PART2_SP              ((VdpDecoderProfile)12)
2636
/** \hideinitializer */
2637
#define VDP_DECODER_PROFILE_MPEG4_PART2_ASP             ((VdpDecoderProfile)13)
2638
/** \hideinitializer */
2639
#define VDP_DECODER_PROFILE_DIVX4_QMOBILE               ((VdpDecoderProfile)14)
2640
/** \hideinitializer */
2641
#define VDP_DECODER_PROFILE_DIVX4_MOBILE                ((VdpDecoderProfile)15)
2642
/** \hideinitializer */
2643
#define VDP_DECODER_PROFILE_DIVX4_HOME_THEATER          ((VdpDecoderProfile)16)
2644
/** \hideinitializer */
2645
#define VDP_DECODER_PROFILE_DIVX4_HD_1080P              ((VdpDecoderProfile)17)
2646
/** \hideinitializer */
2647
#define VDP_DECODER_PROFILE_DIVX5_QMOBILE               ((VdpDecoderProfile)18)
2648
/** \hideinitializer */
2649
#define VDP_DECODER_PROFILE_DIVX5_MOBILE                ((VdpDecoderProfile)19)
2650
/** \hideinitializer */
2651
#define VDP_DECODER_PROFILE_DIVX5_HOME_THEATER          ((VdpDecoderProfile)20)
2652
/** \hideinitializer */
2653
#define VDP_DECODER_PROFILE_DIVX5_HD_1080P              ((VdpDecoderProfile)21)
2654
2655
2656
2657
2658
2659
2660
2661
/** \hideinitializer */
#define VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE   ((VdpDecoderProfile)22)
/** \hideinitializer */
#define VDP_DECODER_PROFILE_H264_EXTENDED               ((VdpDecoderProfile)23)
/** \hideinitializer */
#define VDP_DECODER_PROFILE_H264_PROGRESSIVE_HIGH       ((VdpDecoderProfile)24)
/** \hideinitializer */
#define VDP_DECODER_PROFILE_H264_CONSTRAINED_HIGH       ((VdpDecoderProfile)25)
2662
2663
2664
/** \hideinitializer */
/** \brief Support for 8 bit depth only */
#define VDP_DECODER_PROFILE_H264_HIGH_444_PREDICTIVE    ((VdpDecoderProfile)26)
2665
/** \hideinitializer */
2666
2667
2668
2669
2670
2671
2672
2673
#define VDP_DECODER_PROFILE_VP9_PROFILE_0               ((VdpDecoderProfile)27)
/** \hideinitializer */
#define VDP_DECODER_PROFILE_VP9_PROFILE_1               ((VdpDecoderProfile)28)
/** \hideinitializer */
#define VDP_DECODER_PROFILE_VP9_PROFILE_2               ((VdpDecoderProfile)29)
/** \hideinitializer */
#define VDP_DECODER_PROFILE_VP9_PROFILE_3               ((VdpDecoderProfile)30)
/** \hideinitializer */
2674
/** \brief MPEG-H Part 2 == H.265 == HEVC */
2675
#define VDP_DECODER_PROFILE_HEVC_MAIN                   ((VdpDecoderProfile)100)
2676
/** \hideinitializer */
2677
#define VDP_DECODER_PROFILE_HEVC_MAIN_10                ((VdpDecoderProfile)101)
2678
/** \hideinitializer */
2679
#define VDP_DECODER_PROFILE_HEVC_MAIN_STILL             ((VdpDecoderProfile)102)
2680
/** \hideinitializer */
2681
#define VDP_DECODER_PROFILE_HEVC_MAIN_12                ((VdpDecoderProfile)103)
2682
/** \hideinitializer */
2683
#define VDP_DECODER_PROFILE_HEVC_MAIN_444               ((VdpDecoderProfile)104)
2684
2685
2686
2687
/** \hideinitializer */
#define VDP_DECODER_PROFILE_HEVC_MAIN_444_10            ((VdpDecoderProfile)105)
/** \hideinitializer */
#define VDP_DECODER_PROFILE_HEVC_MAIN_444_12            ((VdpDecoderProfile)106)
Aaron Plattner's avatar
Aaron Plattner committed
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756

/** \hideinitializer */
#define VDP_DECODER_LEVEL_MPEG1_NA 0

/** \hideinitializer */
#define VDP_DECODER_LEVEL_MPEG2_LL   0
/** \hideinitializer */
#define VDP_DECODER_LEVEL_MPEG2_ML   1
/** \hideinitializer */
#define VDP_DECODER_LEVEL_MPEG2_HL14 2
/** \hideinitializer */
#define VDP_DECODER_LEVEL_MPEG2_HL   3

/** \hideinitializer */
#define VDP_DECODER_LEVEL_H264_1     10
/** \hideinitializer */
#define VDP_DECODER_LEVEL_H264_1b    9
/** \hideinitializer */
#define VDP_DECODER_LEVEL_H264_1_1   11
/** \hideinitializer */
#define VDP_DECODER_LEVEL_H264_1_2   12
/** \hideinitializer */
#define VDP_DECODER_LEVEL_H264_1_3   13
/** \hideinitializer */
#define VDP_DECODER_LEVEL_H264_2     20
/** \hideinitializer */
#define VDP_DECODER_LEVEL_H264_2_1   21
/** \hideinitializer */
#define VDP_DECODER_LEVEL_H264_2_2   22
/** \hideinitializer */
#define VDP_DECODER_LEVEL_H264_3     30
/** \hideinitializer */
#define VDP_DECODER_LEVEL_H264_3_1   31
/** \hideinitializer */
#define VDP_DECODER_LEVEL_H264_3_2   32
/** \hideinitializer */
#define VDP_DECODER_LEVEL_H264_4     40
/** \hideinitializer */
#define VDP_DECODER_LEVEL_H264_4_1   41
/** \hideinitializer */
#define VDP_DECODER_LEVEL_H264_4_2   42
/** \hideinitializer */
#define VDP_DECODER_LEVEL_H264_5     50
/** \hideinitializer */
#define VDP_DECODER_LEVEL_H264_5_1   51

/** \hideinitializer */
#define VDP_DECODER_LEVEL_VC1_SIMPLE_LOW    0
/** \hideinitializer */
#define VDP_DECODER_LEVEL_VC1_SIMPLE_MEDIUM 1

/** \hideinitializer */
#define VDP_DECODER_LEVEL_VC1_MAIN_LOW    0
/** \hideinitializer */
#define VDP_DECODER_LEVEL_VC1_MAIN_MEDIUM 1
/** \hideinitializer */
#define VDP_DECODER_LEVEL_VC1_MAIN_HIGH   2

/** \hideinitializer */
#define VDP_DECODER_LEVEL_VC1_ADVANCED_L0 0
/** \hideinitializer */
#define VDP_DECODER_LEVEL_VC1_ADVANCED_L1 1
/** \hideinitializer */
#define VDP_DECODER_LEVEL_VC1_ADVANCED_L2 2
/** \hideinitializer */
#define VDP_DECODER_LEVEL_VC1_ADVANCED_L3 3
/** \hideinitializer */
#define VDP_DECODER_LEVEL_VC1_ADVANCED_L4 4

2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
/** \hideinitializer */
#define VDP_DECODER_LEVEL_MPEG4_PART2_SP_L0 0
/** \hideinitializer */
#define VDP_DECODER_LEVEL_MPEG4_PART2_SP_L1 1
/** \hideinitializer */
#define VDP_DECODER_LEVEL_MPEG4_PART2_SP_L2 2
/** \hideinitializer */
#define VDP_DECODER_LEVEL_MPEG4_PART2_SP_L3 3

/** \hideinitializer */
#define VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L0 0
/** \hideinitializer */
#define VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L1 1
/** \hideinitializer */
#define VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L2 2
/** \hideinitializer */
#define VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L3 3
/** \hideinitializer */
#define VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L4 4
/** \hideinitializer */
#define VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L5 5

/** \hideinitializer */
#define VDP_DECODER_LEVEL_DIVX_NA 0

2782
2783
2784
/** \hideinitializer */
#define VDP_DECODER_LEVEL_VP9_L1 1

2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
/**
 * The VDPAU H.265/HEVC decoder levels correspond to the values of
 * general_level_idc as described in the H.265 Specification, Annex A,
 * Table A.1. The enumeration values are equal to thirty times the level
 * number.
 */
#define VDP_DECODER_LEVEL_HEVC_1         30
/** \hideinitializer */
#define VDP_DECODER_LEVEL_HEVC_2         60
/** \hideinitializer */
#define VDP_DECODER_LEVEL_HEVC_2_1       63
/** \hideinitializer */
#define VDP_DECODER_LEVEL_HEVC_3         90
/** \hideinitializer */
#define VDP_DECODER_LEVEL_HEVC_3_1       93
/** \hideinitializer */
#define VDP_DECODER_LEVEL_HEVC_4        120
/** \hideinitializer */
#define VDP_DECODER_LEVEL_HEVC_4_1      123
/** \hideinitializer */
#define VDP_DECODER_LEVEL_HEVC_5        150
/** \hideinitializer */
#define VDP_DECODER_LEVEL_HEVC_5_1      153
/** \hideinitializer */
#define VDP_DECODER_LEVEL_HEVC_5_2      156
/** \hideinitializer */
#define VDP_DECODER_LEVEL_HEVC_6        180
/** \hideinitializer */
#define VDP_DECODER_LEVEL_HEVC_6_1      183
/** \hideinitializer */
#define VDP_DECODER_LEVEL_HEVC_6_2      186

2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
typedef enum {
    VDP_VIDEO_SURFACE_FIELD_STRUCTURE         = (1 << 0),
    VDP_VIDEO_SURFACE_FRAME_STRUCTURE         = (1 << 1)
} VdpVideoSurfaceSupportedPictureStructure;

typedef enum {
    VDP_DECODER_PROFILE_MAX_LEVEL                      = 0,
    VDP_DECODER_PROFILE_MAX_MACROBLOCKS                = 1,
    VDP_DECODER_PROFILE_MAX_WIDTH                      = 2,
    VDP_DECODER_PROFILE_MAX_HEIGHT                     = 3,
2827
2828
2829
2830
2831
2832
2833
2834
2835
    VDP_DECODER_PROFILE_SUPPORTED_PICTURE_STRUCTURE    = 4,
    /**
     * A list of supported chroma types, stored as a bitmask of 1 shifted
     * by each supported VdpChromaType value.  E.g.,
     *   (1 << VDP_CHROMA_TYPE_420) |
     *   (1 << VDP_CHROMA_TYPE_422) |
     *   (1 << VDP_CHROMA_TYPE_444)
     */
    VDP_DECODER_PROFILE_SUPPORTED_CHROMA_TYPES         = 5
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
} VdpDecoderCapability;

/**
  * \brief Query the supported value of the requested capability, for
  *       the specified profile on the specified device.
  * \param[in] device The device to query.
  * \param[in] profile The decoder profile for which information is requested.
  * \param[in] capability The decoder profile capability for which the value
  *       is requested.
  * \param[out] capability_value The value of the requested capability.
  * \return VdpStatus The completion status of the operation.
  */

typedef VdpStatus VdpDecoderQueryProfileCapability(
    VdpDevice                   device,
    VdpDecoderProfile           profile,
    /* output parameters follow */
2853
    VdpDecoderCapability        capability,
2854
2855
2856
    void *                      capability_value
);

Aaron Plattner's avatar
Aaron Plattner committed
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
/**
 * \brief Query the implementation's VdpDecoder capabilities.
 * \param[in] device The device to query.
 * \param[in] profile The decoder profile for which information is requested.
 * \param[out] is_supported Is this profile supported?
 * \param[out] max_level The maximum specification level supported for this
 *       profile.
 * \param[out] max_macroblocks The maximum supported surface size in
 *       macroblocks. Note that this could be greater than that dictated by
 *       the maximum level.
 * \param[out] max_width The maximum supported surface width for this profile.
 *       Note that this could be greater than that dictated by the maximum
 *       level.
 * \param[out] max_height The maximum supported surface height for this
 *       profile. Note that this could be greater than that dictated by the
 *       maximum level.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpDecoderQueryCapabilities(
    VdpDevice         device,
    VdpDecoderProfile profile,
    /* output parameters follow */
    VdpBool *         is_supported,
    uint32_t *        max_level,
    uint32_t *        max_macroblocks,
    uint32_t *        max_width,
    uint32_t *        max_height
);

/**
 * \brief An opaque handle representing a VdpDecoder object.
 */
typedef uint32_t VdpDecoder;

/**
 * \brief Create a VdpDecoder.
 * \param[in] device The device that will contain the surface.
 * \param[in] profile The video format the decoder will decode.
 * \param[in] width The width of the new surface.
 * \param[in] height The height of the new surface.
 * \param[in] max_references The maximum number of references that may be
 *       used by a single frame in the stream to be decoded. This parameter
 *       exists mainly for formats such as H.264, where different streams
 *       may use a different number of references. Requesting too many
 *       references may waste memory, but decoding should still operate
 *       correctly. Requesting too few references will cause decoding to
 *       fail.
 * \param[out] decoder The new decoder's handle.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpDecoderCreate(
    VdpDevice         device,
    VdpDecoderProfile profile,
    uint32_t          width,
    uint32_t          height,
    uint32_t          max_references,
    /* output parameters follow */
    VdpDecoder *      decoder
);

/**
 * \brief Destroy a VdpDecoder.
 * \param[in] surface The decoder's handle.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpDecoderDestroy(
    VdpDecoder decoder
);

/**
 * \brief Retrieve the parameters used to create a
 *        VdpDecoder.
 * \param[in] surface The surface's handle.
 * \param[out] profile The video format used to create the
 *       decoder.
 * \param[out] width The width of surfaces decode by the
 *       decoder.
 * \param[out] height The height of surfaces decode by the
 *       decoder
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpDecoderGetParameters(
    VdpDecoder          decoder,
    /* output parameters follow */
    VdpDecoderProfile * profile,
    uint32_t *          width,
    uint32_t *          height
);

#define VDP_BITSTREAM_BUFFER_VERSION 0

/**
 * \brief Application data buffer containing compressed video
 *        data.
 */
typedef struct {
    /**
     * This field must be filled with VDP_BITSTREAM_BUFFER_VERSION
     */
    uint32_t     struct_version;
    /** A pointer to the bitstream data bytes */
    void const * bitstream;
    /** The number of data bytes */
    uint32_t     bitstream_bytes;
} VdpBitstreamBuffer;

/**
2964
 * \brief A generic "picture information" type.
2965
2966
2967
2968
2969
2970
2971
 *
 * This type serves solely to document the expected usage of a
 * generic (void *) function parameter. In actual usage, the
 * application is expected to physically provide a pointer to an
 * instance of one of the "real" VdpPictureInfo* structures,
 * picking the type appropriate for the decoder object in
 * question.
Aaron Plattner's avatar
Aaron Plattner committed
2972
 */
2973
typedef void VdpPictureInfo;
Aaron Plattner's avatar
Aaron Plattner committed
2974
2975
2976
2977
2978

/**
 * \brief Picture parameter information for an MPEG 1 or MPEG 2
 *        picture.
 *
2979
2980
2981
 * Note: References to bitstream fields below may refer to data literally parsed
 * from the bitstream, or derived from the bitstream using a mechanism described
 * in the specification.
Aaron Plattner's avatar
Aaron Plattner committed
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
 */
typedef struct {
    /**
     * Reference used by B and P frames.
     * Set to VDP_INVALID_HANDLE when not used.
     */
    VdpVideoSurface forward_reference;
    /**
     * Reference used by B frames.
     * Set to VDP_INVALID_HANDLE when not used.
     */
    VdpVideoSurface backward_reference;
    /** Number of slices in the bitstream provided. */
    uint32_t        slice_count;

2997
2998
2999
3000
    /** \name MPEG bitstream
     *
     * Copies of the MPEG bitstream fields.
     * @{ */
Aaron Plattner's avatar
Aaron Plattner committed
3001
3002
3003
3004
3005
3006
3007
3008
3009
    uint8_t picture_structure;
    uint8_t picture_coding_type;
    uint8_t intra_dc_precision;
    uint8_t frame_pred_frame_dct;
    uint8_t concealment_motion_vectors;
    uint8_t intra_vlc_format;
    uint8_t alternate_scan;
    uint8_t q_scale_type;
    uint8_t top_field_first;
3010
    /** MPEG-1 only. For MPEG-2, set to 0. */
Aaron Plattner's avatar
Aaron Plattner committed
3011
    uint8_t full_pel_forward_vector;
3012
    /** MPEG-1 only. For MPEG-2, set to 0. */
Aaron Plattner's avatar
Aaron Plattner committed
3013
    uint8_t full_pel_backward_vector;
3014
    /** For MPEG-1, fill both horizontal and vertical entries. */
Aaron Plattner's avatar
Aaron Plattner committed
3015
    uint8_t f_code[2][2];
3016
    /** Convert to raster order. */
Aaron Plattner's avatar
Aaron Plattner committed
3017
    uint8_t intra_quantizer_matrix[64];
3018
    /** Convert to raster order. */
Aaron Plattner's avatar
Aaron Plattner committed
3019
    uint8_t non_intra_quantizer_matrix[64];
3020
    /** @} */
Aaron Plattner's avatar
Aaron Plattner committed
3021
3022
3023
3024
3025
} VdpPictureInfoMPEG1Or2;

/**
 * \brief Information about an H.264 reference frame
 *
3026
3027
3028
 * Note: References to bitstream fields below may refer to data literally parsed
 * from the bitstream, or derived from the bitstream using a mechanism described
 * in the specification.
Aaron Plattner's avatar
Aaron Plattner committed
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
 */
typedef struct {
    /**
     * The surface that contains the reference image.
     * Set to VDP_INVALID_HANDLE for unused entries.
     */
    VdpVideoSurface surface;
    /** Is this a long term reference (else short term). */
    VdpBool         is_long_term;
    /**
     * Is the top field used as a reference.
     * Set to VDP_FALSE for unused entries.
     */
    VdpBool         top_is_reference;
    /**
     * Is the bottom field used as a reference.
     * Set to VDP_FALSE for unused entries.
     */
    VdpBool         bottom_is_reference;
    /** [0]: top, [1]: bottom */
    int32_t         field_order_cnt[2];
    /**
     * Copy of the H.264 bitstream field:
     * frame_num from slice_header for short-term references,
     * LongTermPicNum from decoding algorithm for long-term references.
     */
    uint16_t        frame_idx;
} VdpReferenceFrameH264;

/**
 * \brief Picture parameter information for an H.264 picture.
 *
 * Note: The \ref referenceFrames array must contain the "DPB" as
 * defined by the H.264 specification. In particular, once a
 * reference frame has been decoded to a surface, that surface must
 * continue to appear in the DPB until no longer required to predict
 * any future frame. Once a surface is removed from the DPB, it can
 * no longer be used as a reference, unless decoded again.
 *
 * Also note that only surfaces previously generated using \ref
 * VdpDecoderRender may be used as reference frames. In particular,
 * surfaces filled using any "put bits" API will not work.
 *
3072
3073
3074
 * Note: References to bitstream fields below may refer to data literally parsed
 * from the bitstream, or derived from the bitstream using a mechanism described
 * in the specification.
3075
3076
3077
3078
 *
 * Note: VDPAU clients must use VdpPictureInfoH264Predictive to describe the
 * attributes of a frame being decoded with
 * VDP_DECODER_PROFILE_H264_HIGH_444_PREDICTIVE.
Aaron Plattner's avatar
Aaron Plattner committed
3079
3080
3081
3082
3083
3084
3085
3086
3087
 */
typedef struct {
    /** Number of slices in the bitstream provided. */
    uint32_t slice_count;
    /** [0]: top, [1]: bottom */
    int32_t  field_order_cnt[2];
    /** Will the decoded frame be used as a reference later. */
    VdpBool  is_reference;

3088
3089
3090
3091
    /** \name H.264 bitstream
     *
     * Copies of the H.264 bitstream fields.
     * @{ */
Aaron Plattner's avatar
Aaron Plattner committed
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
    uint16_t frame_num;
    uint8_t  field_pic_flag;
    uint8_t  bottom_field_flag;
    uint8_t  num_ref_frames;
    uint8_t  mb_adaptive_frame_field_flag;
    uint8_t  constrained_intra_pred_flag;
    uint8_t  weighted_pred_flag;
    uint8_t  weighted_bipred_idc;
    uint8_t  frame_mbs_only_flag;
    uint8_t  transform_8x8_mode_flag;
    int8_t   chroma_qp_index_offset;
    int8_t   second_chroma_qp_index_offset;
    int8_t   pic_init_qp_minus26;
    uint8_t  num_ref_idx_l0_active_minus1;
    uint8_t  num_ref_idx_l1_active_minus1;
    uint8_t  log2_max_frame_num_minus4;
    uint8_t  pic_order_cnt_type;
    uint8_t  log2_max_pic_order_cnt_lsb_minus4;
    uint8_t  delta_pic_order_always_zero_flag;
    uint8_t  direct_8x8_inference_flag;
    uint8_t  entropy_coding_mode_flag;
    uint8_t  pic_order_present_flag;
    uint8_t  deblocking_filter_control_present_flag;
    uint8_t  redundant_pic_cnt_present_flag;
3116
    /** Convert to raster order. */
Aaron Plattner's avatar
Aaron Plattner committed
3117
    uint8_t scaling_lists_4x4[6][16];
3118
    /** Convert to raster order. */
Aaron Plattner's avatar
Aaron Plattner committed
3119
    uint8_t scaling_lists_8x8[2][64];
3120
    /** @} */
Aaron Plattner's avatar
Aaron Plattner committed
3121
3122
3123
3124
3125

    /** See \ref VdpPictureInfoH264 for instructions regarding this field. */
    VdpReferenceFrameH264 referenceFrames[16];
} VdpPictureInfoH264;

3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
/**
 * \brief Picture parameter information for an H.264 Hi444PP picture.
 *
 * Note: VDPAU clients must use VdpPictureInfoH264Predictive to describe the
 * attributes of a frame being decoded with
 * VDP_DECODER_PROFILE_H264_HIGH_444_PREDICTIVE.
 *
 * Note: software drivers may choose to honor values of
 * qpprime_y_zero_transform_bypass_flag greater than 1 for internal use.
 */
typedef struct {
    /** \ref VdpPictureInfoH264 struct. */
    VdpPictureInfoH264 pictureInfo;
3139
3140

    /** \name H.264 bitstream
3141
     *
3142
3143
3144
     * Copies of the H.264 bitstream fields.
     * @{ */
    /**
3145
3146
3147
3148
     *  0 - lossless disabled
     *  1 - lossless enabled
     */
    uint8_t qpprime_y_zero_transform_bypass_flag;
3149
    /**
3150
3151
3152
3153
     *  0 - disabled
     *  1 - enabled
     */
    uint8_t separate_colour_plane_flag;
3154
    /** @} */
3155
3156
} VdpPictureInfoH264Predictive;

Aaron Plattner's avatar
Aaron Plattner committed
3157
3158
3159
/**
 * \brief Picture parameter information for a VC1 picture.
 *
3160
3161
3162
 * Note: References to bitstream fields below may refer to data literally parsed
 * from the bitstream, or derived from the bitstream using a mechanism described
 * in the specification.
Aaron Plattner's avatar
Aaron Plattner committed
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
 */
typedef struct {
    /**
     * Reference used by B and P frames.
     * Set to VDP_INVALID_HANDLE when not used.
     */
    VdpVideoSurface forward_reference;
    /**
     * Reference used by B frames.
     * Set to VDP_INVALID_HANDLE when not used.
     */
    VdpVideoSurface backward_reference;

    /** Number of slices in the bitstream provided. */
    uint32_t slice_count;
    /** I=0, P=1, B=3, BI=4  from 7.1.1.4. */
    uint8_t  picture_type;
    /** Progressive=0, Frame-interlace=2, Field-interlace=3; see VC-1 7.1.1.15. */
    uint8_t  frame_coding_mode;

3183
3184
3185
3186
3187
    /** \name VC-1 bitstream
     *
     * Copies of the VC-1 bitstream fields.
     * @{ */
    /** See VC-1 6.1.5. */
Aaron Plattner's avatar
Aaron Plattner committed
3188
    uint8_t postprocflag;
3189
    /** See VC-1 6.1.8. */
Aaron Plattner's avatar
Aaron Plattner committed
3190
    uint8_t pulldown;
3191
    /** See VC-1 6.1.9. */
Aaron Plattner's avatar
Aaron Plattner committed
3192
    uint8_t interlace;
3193
    /** See VC-1 6.1.10. */
Aaron Plattner's avatar
Aaron Plattner committed
3194
    uint8_t tfcntrflag;
3195
    /** See VC-1 6.1.11. */
Aaron Plattner's avatar
Aaron Plattner committed
3196
    uint8_t finterpflag;
3197
    /** See VC-1 6.1.3. */
Aaron Plattner's avatar
Aaron Plattner committed
3198
    uint8_t psf;
3199
    /** See VC-1 6.2.8. */
Aaron Plattner's avatar
Aaron Plattner committed
3200
    uint8_t dquant;
3201
    /** See VC-1 6.2.3. */
Aaron Plattner's avatar
Aaron Plattner committed
3202
    uint8_t panscan_flag;
3203
    /** See VC-1 6.2.4. */
Aaron Plattner's avatar
Aaron Plattner committed
3204
    uint8_t refdist_flag;
3205
    /** See VC-1 6.2.11. */
Aaron Plattner's avatar
Aaron Plattner committed
3206
    uint8_t quantizer;
3207
    /** See VC-1 6.2.7. */
Aaron Plattner's avatar
Aaron Plattner committed
3208
    uint8_t extended_mv;
3209
    /** See VC-1 6.2.14. */
Aaron Plattner's avatar
Aaron Plattner committed
3210
    uint8_t extended_dmv;
3211
    /** See VC-1 6.2.10. */
Aaron Plattner's avatar
Aaron Plattner committed
3212
    uint8_t overlap;
3213
    /** See VC-1 6.2.9. */
Aaron Plattner's avatar
Aaron Plattner committed
3214
    uint8_t vstransform;
3215
    /** See VC-1 6.2.5. */
Aaron Plattner's avatar
Aaron Plattner committed
3216
    uint8_t loopfilter;
3217
    /** See VC-1 6.2.6. */
Aaron Plattner's avatar
Aaron Plattner committed
3218
    uint8_t fastuvmc;
3219
    /** See VC-1 6.12.15. */
Aaron Plattner's avatar
Aaron Plattner committed
3220
3221
    uint8_t range_mapy_flag;
    uint8_t range_mapy;
3222
    /** See VC-1 6.2.16. */
Aaron Plattner's avatar
Aaron Plattner committed
3223
3224
3225
3226
    uint8_t range_mapuv_flag;
    uint8_t range_mapuv;

    /**
3227
     * See VC-1 J.1.10.
Aaron Plattner's avatar
Aaron Plattner committed
3228
3229
3230
3231
     * Only used by simple and main profiles.
     */
    uint8_t multires;
    /**
3232
     * See VC-1 J.1.16.
Aaron Plattner's avatar
Aaron Plattner committed
3233
3234
3235
3236
     * Only used by simple and main profiles.
     */
    uint8_t syncmarker;
    /**
3237
     * VC-1 SP/MP range reduction control.
Aaron Plattner's avatar
Aaron Plattner committed
3238
     * Only used by simple and main profiles.
3239
3240
     * Bit 0: Copy of rangered VC-1 bitstream field; See VC-1 J.1.17.
     * Bit 1: Copy of rangeredfrm VC-1 bitstream fiels; See VC-1 7.1.13.
Aaron Plattner's avatar
Aaron Plattner committed
3241
3242
3243
     */
    uint8_t rangered;
    /**
3244
     * See VC-1 J.1.17.
Aaron Plattner's avatar
Aaron Plattner committed
3245
3246
3247
     * Only used by simple and main profiles.
     */
    uint8_t maxbframes;
3248
    /** @} */
Aaron Plattner's avatar
Aaron Plattner committed
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263

    /**
     * Out-of-loop deblocking enable.
     * Bit 0 of POSTPROC from VC-1 7.1.1.27
     * Note that bit 1 of POSTPROC (dering enable) should not be included.
     */
    uint8_t deblockEnable;
    /**
     * Parameter used by VC-1 Annex H deblocking algorithm. Note that VDPAU
     * implementations may choose which deblocking algorithm to use.
     * See VC-1 7.1.1.6
     */
    uint8_t pquant;
} VdpPictureInfoVC1;

3264
3265
3266
/**
 * \brief Picture parameter information for an MPEG-4 Part 2 picture.
 *
3267
3268
3269
 * Note: References to bitstream fields below may refer to data literally parsed
 * from the bitstream, or derived from the bitstream using a mechanism described
 * in the specification.
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
 */
typedef struct {
    /**
     * Reference used by B and P frames.
     * Set to VDP_INVALID_HANDLE when not used.
     */
    VdpVideoSurface forward_reference;
    /**
     * Reference used by B frames.
     * Set to VDP_INVALID_HANDLE when not used.
     */
    VdpVideoSurface backward_reference;

3283
3284
3285
3286
    /** \name MPEG 4 part 2 bitstream
     *
     * Copies of the MPEG 4 part 2 bitstream fields.
     * @{ */
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
    int32_t trd[2];
    int32_t trb[2];
    uint16_t vop_time_increment_resolution;
    uint8_t vop_coding_type;
    uint8_t vop_fcode_forward;
    uint8_t vop_fcode_backward;
    uint8_t resync_marker_disable;
    uint8_t interlaced;
    uint8_t quant_type;
    uint8_t quarter_sample;
    uint8_t short_video_header;
    /** Derived from vop_rounding_type bitstream field. */
    uint8_t rounding_control;
    uint8_t alternate_vertical_scan_flag;
    uint8_t top_field_first;
    uint8_t intra_quantizer_matrix[64];
    uint8_t non_intra_quantizer_matrix[64];
3304
    /** @} */
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
} VdpPictureInfoMPEG4Part2;

/**
 * \brief Picture parameter information for a DivX 4 picture.
 *
 * Due to similarites between MPEG-4 Part 2 and DivX 4, the picture
 * parameter structure is re-used.
 */
typedef VdpPictureInfoMPEG4Part2 VdpPictureInfoDivX4;

/**
 * \brief Picture parameter information for a DivX 5 picture.
 *
 * Due to similarites between MPEG-4 Part 2 and DivX 5, the picture
 * parameter structure is re-used.
 */
typedef VdpPictureInfoMPEG4Part2 VdpPictureInfoDivX5;

3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
typedef struct
{
    unsigned int width;
    unsigned int height;

    //Frame Indices
    VdpVideoSurface lastReference;
    VdpVideoSurface goldenReference;
    VdpVideoSurface altReference;

    unsigned char colorSpace;

    unsigned short profile;
    unsigned short frameContextIdx;
    unsigned short keyFrame;
    unsigned short showFrame;
    unsigned short errorResilient;
    unsigned short frameParallelDecoding;
    unsigned short subSamplingX;
    unsigned short subSamplingY;
    unsigned short intraOnly;
    unsigned short allowHighPrecisionMv;
    unsigned short refreshEntropyProbs;

    unsigned char  refFrameSignBias[4];

    unsigned char bitDepthMinus8Luma;
    unsigned char bitDepthMinus8Chroma;
    unsigned char loopFilterLevel;
    unsigned char loopFilterSharpness;

    unsigned char modeRefLfEnabled;
    unsigned char log2TileColumns;
    unsigned char log2TileRows;

    unsigned char segmentEnabled;
    unsigned char segmentMapUpdate;
    unsigned char segmentMapTemporalUpdate;
    unsigned char segmentFeatureMode;

    unsigned char segmentFeatureEnable[8][4];
    short         segmentFeatureData[8][4];
    unsigned char mbSegmentTreeProbs[7];
    unsigned char segmentPredProbs[3];
    unsigned char reservedSegment16Bits[2];

    int qpYAc;
    int qpYDc;
    int qpChDc;
    int qpChAc;

    unsigned int activeRefIdx[3];
    unsigned int resetFrameContext;
    unsigned int mcompFilterType;
    unsigned int mbRefLfDelta[4];
    unsigned int mbModeLfDelta[2];
    unsigned int uncompressedHeaderSize;
    unsigned int compressedHeaderSize;
} VdpPictureInfoVP9;

3383
3384
3385
/**
 * \brief Picture parameter information for an H.265/HEVC picture.
 *
3386
3387
3388
3389
 * References to bitsream fields below may refer to data literally parsed from
 * the bitstream, or derived from the bitstream using a mechanism described in
 * Rec. ITU-T H.265 (04/2013), hereafter referred to as "the H.265/HEVC
 * Specification".
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
 *
 * VDPAU H.265/HEVC implementations implement the portion of the decoding
 * process described by clauses 8.4, 8.5, 8.6 and 8.7 of the the
 * H.265/HEVC Specification. VdpPictureInfoHEVC provides enough data
 * to complete this portion of the decoding process, plus additional
 * information not defined in the H.265/HEVC Specification that may be
 * useful to particular implementations.
 *
 * Client applications must supply every field in this struct.
 */
typedef struct {
3401
3402
3403
3404
    /** \name HEVC Sequence Parameter Set
     *
     * Copies of the HEVC Sequence Parameter Set bitstream fields.
     * @{ */
3405
    uint8_t chroma_format_idc;
3406
    /** Only valid if chroma_format_idc == 3. Ignored otherwise.*/
3407
3408
3409
3410
3411
3412
    uint8_t separate_colour_plane_flag;
    uint32_t pic_width_in_luma_samples;
    uint32_t pic_height_in_luma_samples;
    uint8_t bit_depth_luma_minus8;
    uint8_t bit_depth_chroma_minus8;
    uint8_t log2_max_pic_order_cnt_lsb_minus4;
3413
    /** Provides the value corresponding to the nuh_temporal_id of the frame
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
        to be decoded. */
    uint8_t sps_max_dec_pic_buffering_minus1;
    uint8_t log2_min_luma_coding_block_size_minus3;
    uint8_t log2_diff_max_min_luma_coding_block_size;
    uint8_t log2_min_transform_block_size_minus2;
    uint8_t log2_diff_max_min_transform_block_size;
    uint8_t max_transform_hierarchy_depth_inter;
    uint8_t max_transform_hierarchy_depth_intra;
    uint8_t scaling_list_enabled_flag;
    /** Scaling lists, in diagonal order, to be used for this frame. */
    /** Scaling List for 4x4 quantization matrix,
       indexed as ScalingList4x4[matrixId][i]. */
    uint8_t ScalingList4x4[6][16];
    /** Scaling List for 8x8 quantization matrix,
       indexed as ScalingList8x8[matrixId][i]. */
    uint8_t ScalingList8x8[6][64];
    /** Scaling List for 16x16 quantization matrix,
       indexed as ScalingList16x16[matrixId][i]. */
    uint8_t ScalingList16x16[6][64];
    /** Scaling List for 32x32 quantization matrix,
       indexed as ScalingList32x32[matrixId][i]. */
    uint8_t ScalingList32x32[2][64];
    /** Scaling List DC Coefficients for 16x16,
       indexed as ScalingListDCCoeff16x16[matrixId]. */
    uint8_t ScalingListDCCoeff16x16[6];
    /** Scaling List DC Coefficients for 32x32,
       indexed as ScalingListDCCoeff32x32[matrixId]. */
    uint8_t ScalingListDCCoeff32x32[2];
    uint8_t amp_enabled_flag;
    uint8_t sample_adaptive_offset_enabled_flag;
    uint8_t pcm_enabled_flag;
3445
    /** Only needs to be set if pcm_enabled_flag is set. Ignored otherwise. */
3446
    uint8_t pcm_sample_bit_depth_luma_minus1;
3447
    /** Only needs to be set if pcm_enabled_flag is set. Ignored otherwise. */
3448
    uint8_t pcm_sample_bit_depth_chroma_minus1;
3449
    /** Only needs to be set if pcm_enabled_flag is set. Ignored otherwise. */
3450
    uint8_t log2_min_pcm_luma_coding_block_size_minus3;
3451
    /** Only needs to be set if pcm_enabled_flag is set. Ignored otherwise. */
3452
    uint8_t log2_diff_max_min_pcm_luma_coding_block_size;
3453
    /** Only needs to be set if pcm_enabled_flag is set. Ignored otherwise. */
3454
    uint8_t pcm_loop_filter_disabled_flag;
3455
    /** Per spec, when zero, assume short_term_ref_pic_set_sps_flag
3456
3457
3458
        is also zero. */
    uint8_t num_short_term_ref_pic_sets;
    uint8_t long_term_ref_pics_present_flag;
3459
    /** Only needed if long_term_ref_pics_present_flag is set. Ignored
3460
3461
3462
3463
        otherwise. */
    uint8_t num_long_term_ref_pics_sps;
    uint8_t sps_temporal_mvp_enabled_flag;
    uint8_t strong_intra_smoothing_enabled_flag;
3464
    /** @} */
3465

3466
3467
3468
3469
    /** \name HEVC Picture Parameter Set
     *
     * Copies of the HEVC Picture Parameter Set bitstream fields.
     * @{ */
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
    uint8_t dependent_slice_segments_enabled_flag;
    uint8_t output_flag_present_flag;
    uint8_t num_extra_slice_header_bits;
    uint8_t sign_data_hiding_enabled_flag;
    uint8_t cabac_init_present_flag;
    uint8_t num_ref_idx_l0_default_active_minus1;
    uint8_t num_ref_idx_l1_default_active_minus1;
    int8_t init_qp_minus26;
    uint8_t constrained_intra_pred_flag;
    uint8_t transform_skip_enabled_flag;
    uint8_t cu_qp_delta_enabled_flag;
3481
    /** Only needed if cu_qp_delta_enabled_flag is set. Ignored otherwise. */
3482
3483
3484
3485
3486
3487
3488
3489
3490
    uint8_t diff_cu_qp_delta_depth;
    int8_t pps_cb_qp_offset;
    int8_t pps_cr_qp_offset;
    uint8_t pps_slice_chroma_qp_offsets_present_flag;
    uint8_t weighted_pred_flag;
    uint8_t weighted_bipred_flag;
    uint8_t transquant_bypass_enabled_flag;
    uint8_t tiles_enabled_flag;
    uint8_t entropy_coding_sync_enabled_flag;
3491
    /** Only valid if tiles_enabled_flag is set. Ignored otherwise. */
3492
    uint8_t num_tile_columns_minus1;
3493
    /** Only valid if tiles_enabled_flag is set. Ignored otherwise. */
3494
    uint8_t num_tile_rows_minus1;
3495
    /** Only valid if tiles_enabled_flag is set. Ignored otherwise. */
3496
    uint8_t uniform_spacing_flag;
3497
    /** Only need to set 0..num_tile_columns_minus1. The struct
3498
        definition reserves up to the maximum of 20. Invalid values are
3499
        ignored. */
3500
    uint16_t column_width_minus1[20];
3501
    /** Only need to set 0..num_tile_rows_minus1. The struct
3502
        definition reserves up to the maximum of 22. Invalid values are
3503
        ignored.*/
3504
    uint16_t row_height_minus1[22];
3505
    /** Only needed if tiles_enabled_flag is set. Invalid values are
3506
3507
3508
3509
        ignored. */
    uint8_t loop_filter_across_tiles_enabled_flag;
    uint8_t pps_loop_filter_across_slices_enabled_flag;
    uint8_t deblocking_filter_control_present_flag;
3510
    /** Only valid if deblocking_filter_control_present_flag is set. Ignored
3511
3512
        otherwise. */
    uint8_t deblocking_filter_override_enabled_flag;
3513
    /** Only valid if deblocking_filter_control_present_flag is set. Ignored
3514
3515
        otherwise. */
    uint8_t pps_deblocking_filter_disabled_flag;
3516
    /** Only valid if deblocking_filter_control_present_flag is set and
3517
3518
        pps_deblocking_filter_disabled_flag is not set. Ignored otherwise.*/
    int8_t pps_beta_offset_div2;
3519
    /** Only valid if deblocking_filter_control_present_flag is set and
3520
3521
3522
3523
3524
        pps_deblocking_filter_disabled_flag is not set. Ignored otherwise. */
    int8_t pps_tc_offset_div2;
    uint8_t lists_modification_present_flag;
    uint8_t log2_parallel_merge_level_minus2;
    uint8_t slice_segment_header_extension_present_flag;
3525
    /** @} */
3526

3527
3528
3529
3530
3531
    /** \name HEVC Slice Segment Header
     *
     * Copies of the HEVC Slice Segment Header bitstream fields and calculated
     * values detailed in the specification.
     * @{ */
3532
3533
3534
3535
3536
3537
    /** Set to 1 if nal_unit_type is equal to IDR_W_RADL or IDR_N_LP.
        Set to zero otherwise. */
    uint8_t IDRPicFlag;
    /** Set to 1 if nal_unit_type in the range of BLA_W_LP to
        RSV_IRAP_VCL23, inclusive. Set to zero otherwise.*/
    uint8_t RAPPicFlag;
3538
    /** See section 7.4.7.1 of the specification. */
3539
    uint8_t CurrRpsIdx;
3540
    /** See section 7.4.7.2 of the specification. */
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
    uint32_t NumPocTotalCurr;
    /** Corresponds to specification field, NumDeltaPocs[RefRpsIdx].
        Only applicable when short_term_ref_pic_set_sps_flag == 0.
        Implementations will ignore this value in other cases. See 7.4.8. */
    uint32_t NumDeltaPocsOfRefRpsIdx;
    /** Section 7.6.3.1 of the H.265/HEVC Specification defines the syntax of
        the slice_segment_header. This header contains information that
        some VDPAU implementations may choose to skip. The VDPAU API
        requires client applications to track the number of bits used in the
        slice header for structures associated with short term and long term
        reference pictures. First, VDPAU requires the number of bits used by
        the short_term_ref_pic_set array in the slice_segment_header. */
    uint32_t NumShortTermPictureSliceHeaderBits;
    /** Second, VDPAU requires the number of bits used for long term reference
        pictures in the slice_segment_header. This is equal to the number
        of bits used for the contents of the block beginning with
        "if(long_term_ref_pics_present_flag)". */
    uint32_t NumLongTermPictureSliceHeaderBits;
3559
    /** @} */
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596

    /** Slice Decoding Process - Picture Order Count */
    /** The value of PicOrderCntVal of the picture in the access unit
        containing the SEI message. The picture being decoded. */
    int32_t CurrPicOrderCntVal;

    /** Slice Decoding Process - Reference Picture Sets */
    /** Array of video reference surfaces.
        Set any unused positions to VDP_INVALID_HANDLE. */
    VdpVideoSurface RefPics[16];
    /** Array of picture order counts. These correspond to positions
        in the RefPics array. */
    int32_t PicOrderCntVal[16];
    /** Array used to specify whether a particular RefPic is
        a long term reference. A value of "1" indicates a long-term
        reference. */
    uint8_t IsLongTerm[16];
    /** Copy of specification field, see Section 8.3.2 of the
        H.265/HEVC Specification. */
    uint8_t NumPocStCurrBefore;
    /** Copy of specification field, see Section 8.3.2 of the
        H.265/HEVC Specification. */
    uint8_t NumPocStCurrAfter;
    /** Copy of specification field, see Section 8.3.2 of the
        H.265/HEVC Specification. */
    uint8_t NumPocLtCurr;
    /** Reference Picture Set list, one of the short-term RPS. These
        correspond to positions in the RefPics array. */
    uint8_t RefPicSetStCurrBefore[8];
    /** Reference Picture Set list, one of the short-term RPS. These
        correspond to positions in the RefPics array. */
    uint8_t RefPicSetStCurrAfter[8];
    /** Reference Picture Set list, one of the long-term RPS. These
        correspond to positions in the RefPics array. */
    uint8_t RefPicSetLtCurr[8];
} VdpPictureInfoHEVC;

3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
/**
 * \brief Picture parameter information for an HEVC 444 picture.
 *
 * Note: VDPAU clients must use VdpPictureInfoHEVC444 to describe the
 * attributes of a frame being decoded with
 * VDP_DECODER_PROFILE_HEVC_MAIN_444.
 */
typedef struct {
    /** \ref VdpPictureInfoHEVC struct. */
    VdpPictureInfoHEVC pictureInfo;

    /* SPS Range Extensions for Main 444, Main 10, etc. */
    uint8_t sps_range_extension_flag;
    /* sps extension for transform_skip_rotation_enabled_flag */
    uint8_t transformSkipRotationEnableFlag;
    /* sps extension for transform_skip_context_enabled_flag */
    uint8_t transformSkipContextEnableFlag;
    /* sps implicit_rdpcm_enabled_flag */
    uint8_t implicitRdpcmEnableFlag;
    /* sps explicit_rdpcm_enabled_flag */
    uint8_t explicitRdpcmEnableFlag;
    /* sps extended_precision_processing_flag,always 0 in current profile */
    uint8_t extendedPrecisionProcessingFlag;
    /* sps intra_smoothing_disabled_flag */
    uint8_t intraSmoothingDisabledFlag;
    /* sps high_precision_offsets_enabled_flag */
    uint8_t highPrecisionOffsetsEnableFlag;
    /* sps persistent_rice_adaptation_enabled_flag */
    uint8_t persistentRiceAdaptationEnableFlag;
    /* sps cabac_bypass_alignment_enabled_flag, always 0 in current profile */
    uint8_t cabacBypassAlignmentEnableFlag;
    /* sps intraBlockCopyEnableFlag, always 0 not used by the spec as of now */
    uint8_t intraBlockCopyEnableFlag;

    /* PPS Range Extensions for Main 444, Main 10, etc. */
    uint8_t pps_range_extension_flag;
    /* pps extension log2_max_transform_skip_block_size_minus2, 0...5 */
    uint8_t log2MaxTransformSkipSize;
    /* pps cross_component_prediction_enabled_flag */
    uint8_t crossComponentPredictionEnableFlag;
    /* pps chroma_qp_adjustment_enabled_flag */
    uint8_t chromaQpAdjustmentEnableFlag;
    /* pps diff_cu_chroma_qp_adjustment_depth, 0...3 */
    uint8_t diffCuChromaQpAdjustmentDepth;
    /* pps chroma_qp_adjustment_table_size_minus1+1, 1...6 */
    uint8_t chromaQpAdjustmentTableSize;
    /* pps log2_sao_offset_scale_luma, max(0,bitdepth-10), */
    /* maxBitdepth 16 for future. */
    uint8_t log2SaoOffsetScaleLuma;
    /* pps log2_sao_offset_scale_chroma */
    uint8_t log2SaoOffsetScaleChroma;
    /* -[12,+12] */
    int8_t cb_qp_adjustment[6];
    /* -[12,+12] */
    int8_t cr_qp_adjustment[6];

} VdpPictureInfoHEVC444;

3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
/**
 * \brief Picture parameter information for HEVC FormatRangeExtensions picture.
 *
 * HEVC Main 444 Profile is part of Format Range Extensions profiles,
 * Due to similarities between Format Range Extensions profiles, the picture
 * parameter structure is re-used for Format Range Extensions profiles
 * supported.
 */
typedef VdpPictureInfoHEVC444 VdpPictureInfoHEVCRangeExt;

Aaron Plattner's avatar
Aaron Plattner committed
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
/**
 * \brief Decode a compressed field/frame and render the result
 *        into a \ref VdpVideoSurface "VdpVideoSurface".
 * \param[in] decoder The decoder object that will perform the
 *       decode operation.
 * \param[in] target The video surface to render to.
 * \param[in] picture_info A (pointer to a) structure containing
 *       information about the picture to be decoded. Note that
 *       the appropriate type of VdpPictureInfo* structure must
 *       be provided to match to profile that the decoder was
 *       created for.
 * \param[in] bitstream_buffer_count The number of bitstream
 *       buffers containing compressed data for this picture.
 * \param[in] bitstream_buffers An array of bitstream buffers.
 * \return VdpStatus The completion status of the operation.
 *
 * See \ref video_mixer_usage for additional information.
 */
typedef VdpStatus VdpDecoderRender(
    VdpDecoder                 decoder,
    VdpVideoSurface            target,
    VdpPictureInfo const *     picture_info,
    uint32_t                   bitstream_buffer_count,
    VdpBitstreamBuffer const * bitstream_buffers
);

3691
/** @} */
Aaron Plattner's avatar
Aaron Plattner committed
3692
3693

/**
3694
 * \defgroup VdpVideoMixer VdpVideoMixer; Video Post-processing and Compositing object
3695
 *
Aaron Plattner's avatar
Aaron Plattner committed
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
 * VdpVideoMixer can perform some subset of the following
 * post-processing steps on video:
 * - De-interlacing
 *   - Various types, with or without inverse telecine
 * - Noise-reduction
 * - Sharpness adjustment
 * - Color space conversion to RGB
 * - Chroma format upscaling to 4:4:4
 *
 * A VdpVideoMixer takes a source \ref VdpVideoSurface
 * "VdpVideoSurface" VdpVideoSurface and performs various video
 * processing steps on it (potentially using information from
 * past or future video surfaces). It scales the video and
 * converts it to RGB, then optionally composites it with
3710
3711
3712
 * multiple auxiliary \ref VdpOutputSurface "VdpOutputSurface"s
 * before writing the result to the destination \ref
 * VdpOutputSurface "VdpOutputSurface".
Aaron Plattner's avatar
Aaron Plattner committed
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
 *
 * The video mixer compositing model is as follows:
 *
 * - A rectangle will be rendered on an output surface. No
 *   pixels will be rendered outside of this output rectangle.
 *   The contents of this rectangle will be a composite of many
 *   layers.
 *
 * - The first layer is the background color. The background
 *   color will fill the entire rectangle.
3723
 *
Aaron Plattner's avatar
Aaron Plattner committed
3724
3725
3726
3727
3728
3729
3730
3731
3732
 * - The second layer is the processed video which has been
 *   converted to RGB. These pixels will overwrite the
 *   background color of the first layer except where the second
 *   layer's rectangle does not completely cover the output
 *   rectangle. In those regions the background color will
 *   continue to show. If any portion of the second layer's
 *   output rectangle is outside of the output rectangle, those
 *   portions will be clipped.
 *
3733
 * - The third layer contains some number of auxiliary layers
Aaron Plattner's avatar
Aaron Plattner committed
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
 *   (in the form of \ref VdpOutputSurface "VdpOutputSurface"s)
 *   which will be composited using the alpha value from the
 *   those surfaces. The compositing operations are equivalent
 *   to rendering with \ref VdpOutputSurfaceRenderOutputSurface
 *   using a source blend factor of SOURCE_ALPHA, a destination
 *   blend factor of ONE_MINUS_SOURCE_ALPHA and an equation of
 *   ADD.
 *
 * @{
 */

/**
3746
 * \brief A VdpVideoMixer feature that must be requested at
Aaron Plattner's avatar
Aaron Plattner committed
3747
 *        creation time to be used.
3748
3749
3750
3751
 *
 * Certain advanced VdpVideoMixer features are optional, and the
 * ability to use those features at all must be requested when
 * the VdpVideoMixer object is created. Each feature is named via
Aaron Plattner's avatar
Aaron Plattner committed
3752
 * a specific VdpVideoMixerFeature value.
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
 *
 * Once requested, these features are permanently available
 * within that specific VdpVideoMixer object. All features that
 * are not explicitly requested at creation time default to
 * being permanently unavailable.
 *
 * Even when requested, all features default to being initially
 * disabled. However, applications can subsequently enable and
 * disable features at any time. See \ref
 * VdpVideoMixerSetFeatureEnables.
 *
 * Some features allow configuration of their operation. Each
 * configurable item is an \ref VdpVideoMixerAttribute. These
 * attributes may be manipulated at any time using \ref
 * VdpVideoMixerSetAttributeValues.
Aaron Plattner's avatar
Aaron Plattner committed
3768
3769
3770
3771
3772
3773
3774
 */
typedef uint32_t VdpVideoMixerFeature;

/**
 * \hideinitializer
 * \brief A VdpVideoMixerFeature.
 *
3775
3776
3777
3778
3779
3780
 * When requested and enabled, motion adaptive temporal
 * deinterlacing will be used on interlaced content.
 *
 * When multiple de-interlacing options are requested and
 * enabled, the back-end implementation chooses the best
 * algorithm to apply.
Aaron Plattner's avatar
Aaron Plattner committed
3781
 */
3782
#define VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL         ((VdpVideoMixerFeature)0)
Aaron Plattner's avatar
Aaron Plattner committed
3783
3784
3785
3786
/**
 * \hideinitializer
 * \brief A VdpVideoMixerFeature.
 *
3787
3788
3789
3790
3791
3792
3793
 * When requested and enabled, this enables a more advanced
 * version of temporal de-interlacing, that additionally uses
 * edge-guided spatial interpolation.
 *
 * When multiple de-interlacing options are requested and
 * enabled, the back-end implementation chooses the best
 * algorithm to apply.
Aaron Plattner's avatar
Aaron Plattner committed
3794
 */
3795
#define VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL ((VdpVideoMixerFeature)1)
Aaron Plattner's avatar
Aaron Plattner committed
3796
3797
3798
3799
3800
/**
 * \hideinitializer
 * \brief A VdpVideoMixerFeature.
 *
 * When requested and enabled, cadence detection will be enabled
3801
3802
 * on interlaced content and the video mixer will try to extract
 * progressive frames from pull-down material.
Aaron Plattner's avatar
Aaron Plattner committed
3803
 */
3804
#define VDP_VIDEO_MIXER_FEATURE_INVERSE_TELECINE             ((VdpVideoMixerFeature)2)
Aaron Plattner's avatar
Aaron Plattner committed
3805
3806
3807
3808
/**
 * \hideinitializer
 * \brief A VdpVideoMixerFeature.
 *
3809
3810
 * When requested and enabled, a noise reduction algorithm will
 * be applied to the video.
Aaron Plattner's avatar
Aaron Plattner committed
3811
 */
3812
#define VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION              ((VdpVideoMixerFeature)3)
Aaron Plattner's avatar
Aaron Plattner committed
3813
3814
3815
3816
/**
 * \hideinitializer
 * \brief A VdpVideoMixerFeature.
 *
3817
3818
 * When requested and enabled, a sharpening algorithm will be
 * applied to the video.
Aaron Plattner's avatar
Aaron Plattner committed
3819
 */
3820
#define VDP_VIDEO_MIXER_FEATURE_SHARPNESS                    ((VdpVideoMixerFeature)4)
Aaron Plattner's avatar
Aaron Plattner committed
3821
3822
3823
3824
/**
 * \hideinitializer
 * \brief A VdpVideoMixerFeature.
 *
3825
3826
3827
3828
 * When requested and enabled, the alpha of the rendered
 * surface, which is normally set to the alpha of the background
 * color, will be forced to 0.0 on pixels corresponding to
 * source video surface luminance values in the range specified
Aaron Plattner's avatar
Aaron Plattner committed
3829
 * by attributes \ref VDP_VIDEO_MIXER_ATTRIBUTE_LUMA_KEY_MIN_LUMA
3830
3831
 * to \ref VDP_VIDEO_MIXER_ATTRIBUTE_LUMA_KEY_MAX_LUMA. This
 * keying is performed after scaling and de-interlacing.
Aaron Plattner's avatar
Aaron Plattner committed
3832
 */
3833
#define VDP_VIDEO_MIXER_FEATURE_LUMA_KEY                     ((VdpVideoMixerFeature)5)
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
/**
 * \hideinitializer
 * \brief A VdpVideoMixerFeature.
 *
 * A VDPAU implementation may support multiple scaling algorithms of
 * differing quality, and may potentially support a different subset
 * of algorithms on different hardware.
 *
 * In some cases, higher quality algorithms may require more resources
 * (memory size, memory bandwidth, etc.) to operate. Hence, these high
 * quality algorithms must be explicitly requested and enabled by the client
 * application. This allows applications operating in a resource-constrained
 * environment to have some level of control over resource usage.
 *
 * Basic scaling is always built into any video mixer, and is known as
 * level 0. Scaling quality increases beginning with optional level 1,
 * through optional level 9.
 *
 * If an application requests and enables multiple high quality scaling
 * algorithms, the highest level enabled scaling algorithm will be used.
 */
3855
#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1      ((VdpVideoMixerFeature)11)
Stephen Warren's avatar
Stephen Warren committed
3856
3857
3858
3859
3860
3861
/**
 * \hideinitializer
 * \brief A VdpVideoMixerFeature.
 *
 * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
 */
3862
#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L2      ((VdpVideoMixerFeature)12)
Stephen Warren's avatar
Stephen Warren committed
3863
3864
3865
3866
3867
3868
/**
 * \hideinitializer
 * \brief A VdpVideoMixerFeature.
 *
 * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
 */
3869
#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L3      ((VdpVideoMixerFeature)13)
Stephen Warren's avatar
Stephen Warren committed
3870
3871
3872
3873
3874
3875
/**
 * \hideinitializer
 * \brief A VdpVideoMixerFeature.
 *
 * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
 */
3876
#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L4      ((VdpVideoMixerFeature)14)
Stephen Warren's avatar
Stephen Warren committed
3877
3878
3879
3880
3881
3882
/**
 * \hideinitializer
 * \brief A VdpVideoMixerFeature.
 *
 * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
 */
3883
#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L5      ((VdpVideoMixerFeature)15)
Stephen Warren's avatar
Stephen Warren committed
3884
3885
3886
3887
3888
3889
/**
 * \hideinitializer
 * \brief A VdpVideoMixerFeature.
 *
 * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
 */
3890
#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L6      ((VdpVideoMixerFeature)16)
Stephen Warren's avatar
Stephen Warren committed
3891
3892
3893
3894
3895
3896
/**
 * \hideinitializer
 * \brief A VdpVideoMixerFeature.
 *
 * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
 */
3897
#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L7      ((VdpVideoMixerFeature)17)
Stephen Warren's avatar
Stephen Warren committed
3898
3899
3900
3901
3902
3903
/**
 * \hideinitializer
 * \brief A VdpVideoMixerFeature.
 *
 * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
 */
3904
#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L8      ((VdpVideoMixerFeature)18)
Stephen Warren's avatar
Stephen Warren committed
3905
3906
3907
3908
3909
3910
/**
 * \hideinitializer
 * \brief A VdpVideoMixerFeature.
 *
 * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
 */
3911
#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L9      ((VdpVideoMixerFeature)19)
Aaron Plattner's avatar
Aaron Plattner committed
3912
3913
3914

/**
 * \brief A VdpVideoMixer creation parameter.
3915
 *
Aaron Plattner's avatar
Aaron Plattner committed
3916
3917
 * When a VdpVideoMixer is created, certain parameters may be
 * supplied. Each parameter is named via a specific
3918
3919
3920
3921
3922
3923
 * VdpVideoMixerParameter value.
 *
 * Each parameter has a specific type, and specific default
 * value if not specified at VdpVideoMixer creation time. The
 * application may query the legal supported range for some
 * parameters.
Aaron Plattner's avatar
Aaron Plattner committed
3924
3925
3926
 */
typedef uint32_t VdpVideoMixerParameter;

3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
/**
 * \hideinitializer
 * \brief The exact width of input video surfaces.
 *
 * This parameter's type is uint32_t.
 *
 * This parameter defaults to 0 if not specified, which entails
 * that it must be specified.
 *
 * The application may query this parameter's supported
 * range.
Aaron Plattner's avatar
Aaron Plattner committed
3938
 */
3939
#define VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_WIDTH  ((VdpVideoMixerParameter)0)
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
/**
 * \hideinitializer
 * \brief The exact height of input video surfaces.
 *
 * This parameter's type is uint32_t.
 *
 * This parameter defaults to 0 if not specified, which entails
 * that it must be specified.
 *
 * The application may query this parameter's supported
Aaron Plattner's avatar
Aaron Plattner committed
3950
 * range.
3951
 */
3952
#define VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_HEIGHT ((VdpVideoMixerParameter)1)
3953
3954
3955
/**
 * \hideinitializer
 * \brief The chroma type of the input video surfaces the will
Aaron Plattner's avatar
Aaron Plattner committed
3956
 *        process.
3957
 *
3958
 * This parameter's type is VdpChromaType.
3959
 *
Aaron Plattner's avatar
Aaron Plattner committed
3960
 * If not specified, this parameter defaults to
3961
3962
3963
 * VDP_CHROMA_TYPE_420.
 *
 * The application may not query this application's supported
Aaron Plattner's avatar
Aaron Plattner committed
3964
 * range, since it is a potentially disjoint enumeration.
3965
 */
3966
#define VDP_VIDEO_MIXER_PARAMETER_CHROMA_TYPE          ((VdpVideoMixerParameter)2)
3967
3968
3969
/**
 * \hideinitializer
 * \brief The number of auxiliary layers in the mixer's
Aaron Plattner's avatar
Aaron Plattner committed
3970
 *        compositing model.
3971
3972
3973
3974
3975
 *
 * Note that this indicates the maximum number of layers that
 * may be processed by a given \ref VdpVideoMixer "VdpVideoMixer"
 * object. Each individual \ref VdpVideoMixerRender invocation
 * may choose to use a different number of actual layers, from 0
Aaron Plattner's avatar
Aaron Plattner committed
3976
 * up to this limit.
3977
3978
3979
 *
 * This attribute's type is uint32_t.
 *
Aaron Plattner's avatar
Aaron Plattner committed
3980
 * If not specified, this parameter defaults to 0.
3981
3982
 *
 * The application may query this parameter's supported
Aaron Plattner's avatar
Aaron Plattner committed
3983
 * range.
3984
 */
3985
#define VDP_VIDEO_MIXER_PARAMETER_LAYERS               ((VdpVideoMixerParameter)3)
Aaron Plattner's avatar
Aaron Plattner committed
3986
3987

/**
3988
3989
3990
 * \brief An adjustable attribute of VdpVideoMixer operation.
 *
 * Various attributes of VdpVideoMixer operation may be adjusted
Aaron Plattner's avatar
Aaron Plattner committed
3991
 * at any time. Each attribute is named via a specific
3992
3993
3994
3995
3996
3997
 * VdpVideoMixerAttribute value.
 *
 * Each attribute has a specific type, and specific default
 * value if not specified at VdpVideoMixer creation time. The
 * application may query the legal supported range for some
 * attributes.
Aaron Plattner's avatar
Aaron Plattner committed
3998
3999
4000
 */
typedef uint32_t VdpVideoMixerAttribute;

4001
4002
4003
/**
 * \hideinitializer
 * \brief The background color in the VdpVideoMixer's compositing
Aaron Plattner's avatar
Aaron Plattner committed
4004
 *        model.
4005
4006
4007
4008
 *
 * This attribute's type is VdpColor.
 *
 * This parameter defaults to black (all color components 0.0
Aaron Plattner's avatar
Aaron Plattner committed
4009
 * and alpha 1.0).
4010
4011
 *
 * The application may not query this parameter's supported
Aaron Plattner's avatar
Aaron Plattner committed
4012
 * range, since the type is not scalar.
4013
 */
4014
#define VDP_VIDEO_MIXER_ATTRIBUTE_BACKGROUND_COLOR      ((VdpVideoMixerAttribute)0)
4015
4016
4017
/**
 * \hideinitializer
 * \brief The color-space conversion matrix used by the
Aaron Plattner's avatar
Aaron Plattner committed
4018
 *        VdpVideoMixer.
4019
4020
 *
 * This attribute's type is \ref VdpCSCMatrix.
Aaron Plattner's avatar
Aaron Plattner committed
4021
4022
4023
4024
4025
4026
4027
 *
 * Note: When using \ref VdpVideoMixerGetAttributeValues to retrieve the
 * current CSC matrix, the attribute_values array must contain a pointer to
 * a pointer a VdpCSCMatrix (VdpCSCMatrix** as a void *). The get function will
 * either initialize the referenced CSC matrix to the current value, *or*
 * clear the supplied pointer to NULL, if the previous set call supplied a
 * value of NULL in parameter_values, to request the default matrix.
4028
 *
Aaron Plattner's avatar
Aaron Plattner committed
4029
4030
4031
4032
4033
4034
4035
4036
 * \code
 * VdpCSCMatrix   matrix;
 * VdpCSCMatrix * matrix_ptr;
 * void * attribute_values[] = {&matrix_ptr};
 * VdpStatus st = vdp_video_mixer_get_attribute_values(..., attribute_values, ...);
 * \endcode
 *
 * This parameter defaults to a matrix suitable for ITU-R BT.601
4037
4038
4039
 * input surfaces, with no procamp adjustments.
 *
 * The application may not query this parameter's supported
Aaron Plattner's avatar
Aaron Plattner committed
4040
 * range, since the type is not scalar.
4041
 */
4042
#define VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX            ((VdpVideoMixerAttribute)1)
4043
4044
/**
 * \hideinitializer
Aaron Plattner's avatar
Aaron Plattner committed
4045
 * \brief The amount of noise reduction algorithm to apply.
4046
4047
4048
4049
 *
 * This attribute's type is float.
 *
 * This parameter defaults to 0.0, which equates to no noise
Aaron Plattner's avatar
Aaron Plattner committed
4050
 * reduction.
4051
4052
4053
4054
 *
 * The application may query this parameter's supported range.
 * However, the range is fixed as 0.0...1.0.
 */
4055
#define VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL ((VdpVideoMixerAttribute)2)
4056
4057
/**
 * \hideinitializer
Aaron Plattner's avatar
Aaron Plattner committed
4058
 * \brief The amount of sharpening, or blurring, to apply.
4059
 *
Aaron Plattner's avatar
Aaron Plattner committed
4060
 * This attribute's type is float.
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
 *
 * This parameter defaults to 0.0, which equates to no
 * sharpening.
 *
 * Positive values request sharpening. Negative values request
 * blurring.
 *
 * The application may query this parameter's supported range.
 * However, the range is fixed as -1.0...1.0.
 */
4071
#define VDP_VIDEO_MIXER_ATTRIBUTE_SHARPNESS_LEVEL       ((VdpVideoMixerAttribute)3)
4072
4073
/**
 * \hideinitializer
Aaron Plattner's avatar
Aaron Plattner committed
4074
 * \brief The minimum luma value for the luma key algorithm.
4075
4076
4077
 *
 * This attribute's type is float.
 *
Aaron Plattner's avatar
Aaron Plattner committed
4078
 * This parameter defaults to 0.0.
4079
4080
4081
4082
 *
 * The application may query this parameter's supported range.
 * However, the range is fixed as 0.0...1.0.
 */
4083
#define VDP_VIDEO_MIXER_ATTRIBUTE_LUMA_KEY_MIN_LUMA     ((VdpVideoMixerAttribute)4)
4084
4085
/**
 * \hideinitializer
Aaron Plattner's avatar
Aaron Plattner committed
4086
 * \brief The maximum luma value for the luma key algorithm.
4087
4088
4089
 *
 * This attribute's type is float.
 *
Aaron Plattner's avatar
Aaron Plattner committed
4090
 * This parameter defaults to 1.0.
4091
4092
4093
4094
 *
 * The application may query this parameter's supported range.
 * However, the range is fixed as 0.0...1.0.
 */
4095
#define VDP_VIDEO_MIXER_ATTRIBUTE_LUMA_KEY_MAX_LUMA     ((VdpVideoMixerAttribute)5)
4096
4097
/**
 * \hideinitializer
4098
 * \brief Whether de-interlacers should operate solely on luma, and bob chroma.
4099
 *
4100
4101
4102
4103
 * Note: This attribute only affects advanced de-interlacing algorithms, not
 * bob or weave.
 *
 * This attribute's type is uint8_t.
4104
 *
4105
 * This parameter defaults to 0.
4106
4107
4108
4109
 *
 * The application may query this parameter's supported range.
 * However, the range is fixed as 0 (no/off) ... 1 (yes/on).
 */
4110
#define VDP_VIDEO_MIXER_ATTRIBUTE_SKIP_CHROMA_DEINTERLACE ((VdpVideoMixerAttribute)6)
Aaron Plattner's avatar
Aaron Plattner committed
4111
4112

/**
4113
 * \brief Query the implementation's support for a specific
Aaron Plattner's avatar
Aaron Plattner committed
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
 *        feature.
 * \param[in] device The device to query.
 * \param[in] feature The feature for which support is to be
 *       queried.
 * \param[out] is_supported Is the specified feature supported?
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpVideoMixerQueryFeatureSupport(
    VdpDevice            device,
    VdpVideoMixerFeature feature,
    /* output parameters follow */
    VdpBool *            is_supported
);

/**
4129
 * \brief Query the implementation's support for a specific
Aaron Plattner's avatar
Aaron Plattner committed
4130
4131
4132
4133
 *        parameter.
 * \param[in] device The device to query.
 * \param[in] parameter The parameter for which support is to be
 *       queried.
4134
 * \param[out] is_supported Is the specified parameter
Aaron Plattner's avatar
Aaron Plattner committed
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
 *       supported?
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpVideoMixerQueryParameterSupport(
    VdpDevice              device,
    VdpVideoMixerParameter parameter,
    /* output parameters follow */
    VdpBool *              is_supported
);

/**
4146
 * \brief Query the implementation's support for a specific
Aaron Plattner's avatar
Aaron Plattner committed
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
 *        attribute.
 * \param[in] device The device to query.
 * \param[in] feature The feature for which support is to be
 *       queried.
 * \param[out] is_supported Is the specified feature supported?
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpVideoMixerQueryAttributeSupport(
    VdpDevice              device,
    VdpVideoMixerAttribute attribute,
    /* output parameters follow */
    VdpBool *              is_supported
);

/**
4162
 * \brief Query the implementation's supported for a specific
Aaron Plattner's avatar
Aaron Plattner committed
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
 *        parameter.
 * \param[in] device The device to query.
 * \param[in] parameter The parameter for which support is to be
 *       queried.
 * \param[out] min_value The minimum supported value.
 * \param[out] max_value The maximum supported value.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpVideoMixerQueryParameterValueRange(
    VdpDevice              device,
    VdpVideoMixerParameter parameter,
    /* output parameters follow */
    void *                min_value,
    void *                max_value
);

/**
4180
 * \brief Query the implementation's supported for a specific
Aaron Plattner's avatar
Aaron Plattner committed
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
 *        attribute.
 * \param[in] device The device to query.
 * \param[in] attribute The attribute for which support is to be
 *       queried.
 * \param[out] min_value The minimum supported value.
 * \param[out] max_value The maximum supported value.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpVideoMixerQueryAttributeValueRange(
    VdpDevice              device,
    VdpVideoMixerAttribute attribute,
    /* output parameters follow */
    void *                min_value,
    void *                max_value
);

/**
 * \brief An opaque handle representing a VdpVideoMixer object.
 */
typedef uint32_t VdpVideoMixer;

/**
 * \brief Create a VdpVideoMixer.
4204
 * \param[in] device The device that will contain the mixer.
Aaron Plattner's avatar
Aaron Plattner committed
4205
4206
4207
4208
4209
4210
 * \param[in] feature_count The number of features to request.
 * \param[in] features The list of features to request.
 * \param[in] parameter_count The number of parameters to set.
 * \param[in] parameters The list of parameters to set.
 * \param[in] parameter_values The values for the parameters. Note that each
 *     entry in the value array is a pointer to the actual value. In other
4211
 *     words, the values themselves are not cast to "void *" and passed
Aaron Plattner's avatar
Aaron Plattner committed
4212
4213
 *     "inside" the array.
 * \param[out] mixer The new mixer's handle.
4214
4215
4216
4217
4218
4219
 * \return VdpStatus The completion status of the operation.
 *
 * Initially, all requested features will be disabled. They can
 * be enabled using \ref VdpVideoMixerSetFeatureEnables.
 *
 * Initially, all attributes will have default values. Values
Aaron Plattner's avatar
Aaron Plattner committed
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
 * can be changed using \ref VdpVideoMixerSetAttributeValues.
 */
typedef VdpStatus VdpVideoMixerCreate(
    VdpDevice                      device,
    // The set of features to request
    uint32_t                       feature_count,
    VdpVideoMixerFeature const *   features,
    // The parameters used during creation
    uint32_t                       parameter_count,
    VdpVideoMixerParameter const * parameters,
    void const * const *           parameter_values,
    /* output parameters follow */
    VdpVideoMixer *                mixer
);

/**
 * \brief Enable or disable features.
 * \param[in] mixer The mixer to manipulate.
4238
 * \param[in] feature_count The number of features to
Aaron Plattner's avatar
Aaron Plattner committed
4239
4240
 *       enable/disable.
 * \param[in] features The list of features to enable/disable.
4241
 * \param[in] feature_enables The list of new feature enable
Aaron Plattner's avatar
Aaron Plattner committed
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
 *       values.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpVideoMixerSetFeatureEnables(
    VdpVideoMixer                mixer,
    uint32_t                     feature_count,
    VdpVideoMixerFeature const * features,
    VdpBool const *              feature_enables
);

/**
 * \brief Set attribute values
 * \param[in] mixer The mixer to manipulate.
 * \param[in] attribute_count The number of attributes to set.
 * \param[in] attributes The list of attributes to set.
 * \param[in] attribute_values The values for the attributes. Note that each
 *     entry in the value array is a pointer to the actual value. In other
4259
 *     words, the values themselves are not cast to "void *" and passed
Aaron Plattner's avatar
Aaron Plattner committed
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
 *     "inside" the array. A NULL pointer requests that the default value be
 *     set for that attribute.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpVideoMixerSetAttributeValues(
    VdpVideoMixer                  mixer,
    uint32_t                       attribute_count,
    VdpVideoMixerAttribute const * attributes,
    void const * const *           attribute_values
);

/**
4272
 * \brief Retrieve whether features were requested at creation
Aaron Plattner's avatar
Aaron Plattner committed
4273
4274
4275
4276
 *        time.
 * \param[in] mixer The mixer to query.
 * \param[in] feature_count The number of features to query.
 * \param[in] features The list of features to query.
4277
 * \param[out] feature_supported A list of values indicating
Aaron Plattner's avatar
Aaron Plattner committed
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
 *       whether the feature was requested, and hence is
 *       available.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpVideoMixerGetFeatureSupport(
    VdpVideoMixer                mixer,
    uint32_t                     feature_count,
    VdpVideoMixerFeature const * features,
    /* output parameters follow */
    VdpBool *                    feature_supports
);

/**
 * \brief Retrieve whether features are enabled.
 * \param[in] mixer The mixer to manipulate.
 * \param[in] feature_count The number of features to query.
 * \param[in] features The list of features to query.
4295
 * \param[out] feature_enabled A list of values indicating
Aaron Plattner's avatar
Aaron Plattner committed
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
 *       whether the feature is enabled.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpVideoMixerGetFeatureEnables(
    VdpVideoMixer                mixer,
    uint32_t                     feature_count,
    VdpVideoMixerFeature const * features,
    /* output parameters follow */
    VdpBool *                    feature_enables
);

/**
 * \brief Retrieve parameter values given at creation time.
 * \param[in] mixer The mixer to manipulate.
 * \param[in] parameter_count The number of parameters to query.
 * \param[in] parameters The list of parameters to query.
4312
 * \param[out] parameter_values The list of current values for
Aaron Plattner's avatar
Aaron Plattner committed
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
 *     the parameters. Note that each entry in the value array is a pointer to
 *     storage that will receive the actual value. If the attribute's type is
 *     a pointer itself, please closely read the documentation for that
 *     attribute type for any other data passing requirements.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpVideoMixerGetParameterValues(
    VdpVideoMixer                  mixer,
    uint32_t                       parameter_count,
    VdpVideoMixerParameter const * parameters,
    /* output parameters follow */
    void * const *                 parameter_values
);

/**
 * \brief Retrieve current attribute values.
 * \param[in] mixer The mixer to manipulate.
 * \param[in] attribute_count The number of attributes to query.
 * \param[in] attributes The list of attributes to query.
4332
 * \param[out] attribute_values The list of current values for
Aaron Plattner's avatar
Aaron Plattner committed
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
 *     the attributes. Note that each entry in the value array is a pointer to
 *     storage that will receive the actual value. If the attribute's type is
 *     a pointer itself, please closely read the documentation for that
 *     attribute type for any other data passing requirements.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpVideoMixerGetAttributeValues(
    VdpVideoMixer                  mixer,
    uint32_t                       attribute_count,
    VdpVideoMixerAttribute const * attributes,
    /* output parameters follow */
    void * const *                 attribute_values
);

/**
 * \brief Destroy a VdpVideoMixer.
 * \param[in] device The device to destroy.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpVideoMixerDestroy(
    VdpVideoMixer mixer
);

4356
4357
/**
 * \hideinitializer
Aaron Plattner's avatar
Aaron Plattner committed
4358
4359
 * \brief The structure of the picture present in a \ref
 *        VdpVideoSurface "VdpVideoSurface".
4360
 */
Aaron Plattner's avatar
Aaron Plattner committed
4361
typedef enum {
4362
4363
4364
    /**
     * The picture is a field, and is the top field of the surface.
     */
Aaron Plattner's avatar
Aaron Plattner committed
4365
    VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD,
4366
    /**
Aaron Plattner's avatar
Aaron Plattner committed
4367
4368
4369
4370
     * The picture is a field, and is the bottom field of the
     * surface.
     */
    VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD,
4371
4372
4373
    /**
     * The picture is a frame, and hence is the entire surface.
     */
Aaron Plattner's avatar
Aaron Plattner committed
4374
4375
4376
4377
4378
    VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME,
} VdpVideoMixerPictureStructure;

#define VDP_LAYER_VERSION 0

4379
4380
/**
 * \brief Definition of an additional \ref VdpOutputSurface
Aaron Plattner's avatar
Aaron Plattner committed
4381
 *        "VdpOutputSurface" layer in the composting model.
4382
 */
Aaron Plattner's avatar
Aaron Plattner committed
4383
4384
4385
4386
4387
typedef struct {
    /**
     * This field must be filled with VDP_LAYER_VERSION
     */
    uint32_t struct_version;
4388
4389
4390
    /**
     * The surface to composite from.
     */
Aaron Plattner's avatar
Aaron Plattner committed
4391
    VdpOutputSurface source_surface;
4392
4393
4394
4395
    /**
     * The sub-rectangle of the source surface to use. If NULL, the
     * entire source surface will be used.
     */
Aaron Plattner's avatar
Aaron Plattner committed
4396
    VdpRect const *  source_rect;
4397
4398
4399
4400
4401
4402
4403
4404
    /**
     * The sub-rectangle of the destination surface to map
     * this layer into. This rectangle is relative to the entire
     * destination surface. This rectangle will be clipped by \ref
     * VdpVideoMixerRender's \b destination_rect. If NULL, the
     * destination rectangle will be sized to match the source
     * rectangle, and will be located at the origin.
     */
Aaron Plattner's avatar
Aaron Plattner committed
4405
4406
4407
4408
     VdpRect const * destination_rect;
} VdpLayer;

/**
4409
 * \brief Perform a video post-processing and compositing
Aaron Plattner's avatar
Aaron Plattner committed
4410
 *        operation.
4411
 * \param[in] mixer The mixer object that will perform the
Aaron Plattner's avatar
Aaron Plattner committed
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
 *       mixing/rendering operation.
 * \param[in] background_surface A background image. If set to any value other
 *       than VDP_INVALID_HANDLE, the specific surface will be used instead of
 *       the background color as the first layer in the mixer's compositing
 *       process.
 * \param[in] background_source_rect When background_surface is specified,
 *       this parameter indicates the portion of background_surface that will
 *       be used as the background layer. The specified region will be
 *       extracted and scaled to match the size of destination_rect. If NULL,
 *       the entire background_surface will be used.
4422
 * \param[in] current_picture_structure The picture structure of
Aaron Plattner's avatar
Aaron Plattner committed
4423
4424
4425
4426
4427
4428
4429
 *       the field/frame to be processed. This field/frame is
 *       presented in the \b video_surface_current parameter. If
 *       frame, then all \b video_surface_* parameters are
 *       assumed to be frames. If field, then all
 *       video_surface_* parameters are assumed to be fields,
 *       with alternating top/bottom-ness derived from
 *       video_surface_current.
4430
 * \param[in] video_surfaces_past_count The number of provided
Aaron Plattner's avatar
Aaron Plattner committed
4431
4432
4433
4434
4435
4436
4437
 *       fields/frames prior to the current picture.
 * \param[in] video_surfaces_past The fields/frames prior to the
 *       current field/frame. Note that array index 0 is the
 *       field/frame temporally nearest to the current
 *       field/frame, with increasing array indices used for
 *       older frames. Unavailable entries may be set to
 *       \ref VDP_INVALID_HANDLE.
4438
 * \param[in] video_surface_current The field/frame to be
Aaron Plattner's avatar
Aaron Plattner committed
4439
4440
4441
 *       processed.
 * \param[in] video_surfaces_future_count The number of provided
 *       fields/frames following the current picture.
4442
 * \param[in] video_surfaces_future The fields/frames that
Aaron Plattner's avatar
Aaron Plattner committed
4443
4444
4445
4446
4447
 *       follow the current field/frame. Note that array index 0
 *       is the field/frame temporally nearest to the current
 *       field/frame, with increasing array indices used for
 *       newer frames. Unavailable entries may be set to \ref
 *       VDP_INVALID_HANDLE.
4448
 * \param[in] video_source_rect The sub-rectangle of the source
Aaron Plattner's avatar
Aaron Plattner committed
4449
 *       video surface to extract and process. If NULL, the
Stephen Warren's avatar
Stephen Warren committed
4450
4451
4452
4453
 *       entire surface will be used. Left/right and/or top/bottom
 *       co-ordinates may be swapped to flip the source. Values
 *       from outside the video surface are valid and samples
 *       at those locations will be taken from the nearest edge.
Aaron Plattner's avatar
Aaron Plattner committed
4454
 * \param[in] destination_surface
4455
 * \param[in] destination_rect The sub-rectangle of the
Aaron Plattner's avatar
Aaron Plattner committed
4456
4457
 *       destination surface to modify. Note that rectangle clips
 *       all other actions.
4458
 * \param[in] destination_video_rect The sub-rectangle of the
Aaron Plattner's avatar
Aaron Plattner committed
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
 *       destination surface that will contain the processed
 *       video. This rectangle is relative to the entire
 *       destination surface. This rectangle is clipped by \b
 *       destination_rect. If NULL, the destination rectangle
 *       will be sized to match the source rectangle, and will
 *       be located at the origin.
 * \param[in] layer_count The number of additional layers to
 *       composite above the video.
 * \param[in] layers The array of additional layers to composite
 *       above the video.
4469
4470
4471
4472
 * \return VdpStatus The completion status of the operation.
 *
 * For a complete discussion of how to use this API, please see
 * \ref video_mixer_usage.
Aaron Plattner's avatar
Aaron Plattner committed
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
 */
typedef VdpStatus VdpVideoMixerRender(
    VdpVideoMixer                 mixer,
    VdpOutputSurface              background_surface,
    VdpRect const *               background_source_rect,
    VdpVideoMixerPictureStructure current_picture_structure,
    uint32_t                      video_surface_past_count,
    VdpVideoSurface const *       video_surface_past,
    VdpVideoSurface               video_surface_current,
    uint32_t                      video_surface_future_count,
    VdpVideoSurface const *       video_surface_future,
    VdpRect const *               video_source_rect,
    VdpOutputSurface              destination_surface,
    VdpRect const *               destination_rect,
    VdpRect const *               destination_video_rect,
    uint32_t                      layer_count,
    VdpLayer const *              layers
);

4492
/** @} */
Aaron Plattner's avatar
Aaron Plattner committed
4493
4494

/**
4495
 * \defgroup VdpPresentationQueue VdpPresentationQueue; Video presentation (display) object
Aaron Plattner's avatar
Aaron Plattner committed
4496
4497
4498
4499
4500
4501
 *
 * The VdpPresentationQueue manages a queue of surfaces and
 * associated timestamps. For each surface in the queue, once
 * the associated timestamp is reached, the surface is displayed
 * to the user. This timestamp-based approach yields high
 * quality video delivery.
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
 *
 * The exact location of the displayed content is Window System
 * specific. For this reason, the \ref api_winsys provides an
 * API to create a \ref VdpPresentationQueueTarget object (e.g.
 * via \ref VdpPresentationQueueTargetCreateX11) which
 * encapsulates this information.
 *
 * Note that the presentation queue performs no scaling of
 * surfaces to match the display target's size, aspect ratio,
 * etc.
 *
 * Surfaces that are too large to fit into the display target
 * will be clipped. Surfaces that are too small to fill the
 * display target will be aligned to the top-left corner of the
 * display target, with the balance of the display target being
Aaron Plattner's avatar
Aaron Plattner committed
4517
 * filled with a constant configurable "background" color.
4518
4519
4520
4521
4522
 *
 * Note that the presentation queue operates in a manner that is
 * semantically equivalent to an overlay surface, with any
 * required color key painting hidden internally. However,
 * implementations are free to use whatever semantically
Aaron Plattner's avatar
Aaron Plattner committed
4523
4524
4525
4526
 * equivalent technique they wish. Note that implementations
 * that actually use color-keyed overlays will typically use
 * the "background" color as the overlay color key value, so
 * this color should be chosen with care.
4527
4528
 *
 * @{
Aaron Plattner's avatar
Aaron Plattner committed
4529
4530
 */

4531
/**
Aaron Plattner's avatar
Aaron Plattner committed
4532
 * \brief The representation of a point in time.
4533
 *
Aaron Plattner's avatar
Aaron Plattner committed
4534
4535
4536
 * VdpTime timestamps are intended to be a high-precision timing
 * system, potentially independent from any other time domain in
 * the system.
4537
 *
Aaron Plattner's avatar
Aaron Plattner committed
4538
4539
4540
4541
4542
4543
4544
 * Time is represented in units of nanoseconds. The origin
 * (i.e. the time represented by a value of 0) is implementation
 * dependent.
 */
typedef uint64_t VdpTime;

/**
4545
 * \brief An opaque handle representing the location where
Aaron Plattner's avatar
Aaron Plattner committed
4546
 *        video will be presented.
4547
 *
Aaron Plattner's avatar
Aaron Plattner committed
4548
 * VdpPresentationQueueTarget are created using a \ref api_winsys
4549
4550
 * specific API, such as \ref
 * VdpPresentationQueueTargetCreateX11.
Aaron Plattner's avatar
Aaron Plattner committed
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
 */
typedef uint32_t VdpPresentationQueueTarget;

/**
 * \brief Destroy a VdpPresentationQueueTarget.
 * \param[in] presentation_queue_target The target to destroy.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpPresentationQueueTargetDestroy(
    VdpPresentationQueueTarget presentation_queue_target
);

/**
4564
 * \brief An opaque handle representing a presentation queue
Aaron Plattner's avatar
Aaron Plattner committed
4565
4566
4567
4568
4569
4570
 *        object.
 */
typedef uint32_t VdpPresentationQueue;

/**
 * \brief Create a VdpPresentationQueue.
4571
4572
 * \param[in] device The device that will contain the queue.
 * \param[in] presentation_queue_target The location to display
Aaron Plattner's avatar
Aaron Plattner committed
4573
4574
 *       the content.
 * \param[out] presentation_queue The new queue's handle.
4575
 * \return VdpStatus The completion status of the operation.
Aaron Plattner's avatar
Aaron Plattner committed
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
 *
 * Note: The initial value for the background color will be set to
 * an implementation-defined value.
 */
typedef VdpStatus VdpPresentationQueueCreate(
    VdpDevice                  device,
    VdpPresentationQueueTarget presentation_queue_target,
    /* output parameters follow */
    VdpPresentationQueue *     presentation_queue
);

/**
 * \brief Destroy a VdpPresentationQueue.
 * \param[in] presentation_queue The queue to destroy.
 * \return VdpStatus The completion status of the operation.
 */
typedef VdpStatus VdpPresentationQueueDestroy(
    VdpPresentationQueue presentation_queue
);

/**
 * \brief Configure the background color setting.
4598
4599
4600
 * \param[in] presentation_queue The queue to manipulate.
 * \param[in] background_color The new background color.
 *
Aaron Plattner's avatar
Aaron Plattner committed
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
 * Note: Implementations may choose whether to apply the
 * new background color value immediately, or defer it until
 * the next surface is presented.
 */
typedef VdpStatus VdpPresentationQueueSetBackgroundColor(
    VdpPresentationQueue presentation_queue,
    VdpColor * const     background_color
);

/**
 * \brief Retrieve the current background color setting.
4612
 * \param[in] presentation_queue The queue to query.
Aaron Plattner's avatar
Aaron Plattner committed
4613
4614
4615
4616
4617
4618
4619
4620
 * \param[out] background_color The current background color.
 */
typedef VdpStatus VdpPresentationQueueGetBackgroundColor(
    VdpPresentationQueue presentation_queue,
    VdpColor *           background_color
);

/**
4621
4622
4623
 * \brief Retrieve the presentation queue's "current" time.
 * \param[in] presentation_queue The queue to query.
 * \param[out] current_time The current time, which may
Aaron Plattner's avatar
Aaron Plattner committed
4624
 *       represent a point between display VSYNC events.
4625
 * \return VdpStatus The completion status of the operation.
Aaron Plattner's avatar
Aaron Plattner committed
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
 */
typedef VdpStatus VdpPresentationQueueGetTime(
    VdpPresentationQueue presentation_queue,
    /* output parameters follow */
    VdpTime *            current_time
);

/**
 * \brief Enter a surface into the presentation queue.
 * \param[in] presentation_queue The queue to query.
 * \param[in] surface The surface to enter into the queue.
 * \param[in] clip_width If set to a non-zero value, the presentation queue
 *       will display only clip_width pixels of the surface (anchored to the
 *       top-left corner of the surface.
 * \param[in] clip_height If set to a non-zero value, the presentation queue
 *       will display only clip_height lines of the surface (anchored to the
 *       top-left corner of the surface.
4643
 * \param[in] earliest_presentation_time The timestamp
Aaron Plattner's avatar
Aaron Plattner committed
4644
4645
4646
 *       associated with the surface. The presentation queue
 *       will not display the surface until the presentation
 *       queue's current time is at least this value.
4647
 * \return VdpStatus The completion status of the operation.
Aaron Plattner's avatar
Aaron Plattner committed
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
 *
 * Applications may choose to allow resizing of the presentation queue target
 * (which may be e.g. a regular Window when using an X11-based
 * implementation).
 *
 * \b clip_width and \b clip_height may be used to limit the size of the
 * displayed region of a surface, in order to match the specific region that
 * was rendered to.
 *
 * In turn, this allows the application to allocate over-sized (e.g.
 * screen-sized) surfaces, but render to a region that matches the current
 * size of the video window.
 *
 * Using this technique, an application's response to window resizing may
 * simply be to render to, and display, a different region of the surface,
 * rather than de-/re-allocation of surfaces to match the updated window size.
4664
4665
4666
4667
4668
4669
4670
4671
 *
 * Implementations may impose an upper bound on the number of entries
 * contained by the presentation queue at a given time. This limit is likely
 * different to the number of \ref VdpOutputSurface "VdpOutputSurface"s that
 * may be allocated at a given time. This limit applies to entries in the
 * QUEUED or VISIBLE state only. In other words, entries that have
 * transitioned from a QUEUED or VISIBLE state to an IDLE state do not count
 * toward this limit.
4672
 */
Aaron Plattner's avatar
Aaron Plattner committed
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
typedef VdpStatus VdpPresentationQueueDisplay(
    VdpPresentationQueue presentation_queue,
    VdpOutputSurface     surface,
    uint32_t             clip_width,
    uint32_t             clip_height,
    VdpTime              earliest_presentation_time
);

/**
 * \brief Wait for a surface to finish being displayed.
 * \param[in] presentation_queue The queue to query.
4684
4685
 * \param[in] surface The surface to wait for.
 * \param[out] first_presentation_time The timestamp of the
Aaron Plattner's avatar
Aaron Plattner committed
4686
4687
 *       VSYNC at which this surface was first displayed. Note
 *       that 0 means the surface was never displayed.
4688
4689
 * \return VdpStatus The completion status of the operation.
 *
4690
4691
4692
4693
4694
 * Note that this API would block forever if queried about the surface most
 * recently added to a presentation queue. That is because there would be no
 * other surface that could possibly replace that surface as the currently
 * displayed surface, and hence that surface would never become idle. For
 * that reason, this function will return an error in that case.
Aaron Plattner's avatar
Aaron Plattner committed
4695
4696
4697
4698
4699
4700
4701
4702
 */
typedef VdpStatus VdpPresentationQueueBlockUntilSurfaceIdle(
    VdpPresentationQueue presentation_queue,
    VdpOutputSurface     surface,
    /* output parameters follow */
    VdpTime *            first_presentation_time
);

4703
4704
/**
 * \hideinitializer
Aaron Plattner's avatar
Aaron Plattner committed
4705
4706
4707
 * \brief The status of a surface within a presentation queue.
 */
typedef enum {
4708
    /** The surface is not queued or currently visible. */
Aaron Plattner's avatar
Aaron Plattner committed
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
    VDP_PRESENTATION_QUEUE_STATUS_IDLE,
    /** The surface is in the queue, and not currently visible. */
    VDP_PRESENTATION_QUEUE_STATUS_QUEUED,
    /** The surface is the currently visible surface. */
    VDP_PRESENTATION_QUEUE_STATUS_VISIBLE,
} VdpPresentationQueueStatus;

/**
 * \brief Poll the current queue status of a surface.
 * \param[in] presentation_queue The queue to query.
4719
4720
 * \param[in] surface The surface to query.
 * \param[out] status The current status of the surface within
Aaron Plattner's avatar
Aaron Plattner committed
4721
 *       the queue.
4722
 * \param[out] first_presentation_time The timestamp of the
Aaron Plattner's avatar
Aaron Plattner committed
4723
4724
 *       VSYNC at which this surface was first displayed. Note
 *       that 0 means the surface was never displayed.
4725
 * \return VdpStatus The completion status of the operation.
Aaron Plattner's avatar
Aaron Plattner committed
4726
4727
4728
4729
4730
4731
4732
4733
4734
 */
typedef VdpStatus VdpPresentationQueueQuerySurfaceStatus(
    VdpPresentationQueue         presentation_queue,
    VdpOutputSurface             surface,
    /* output parameters follow */
    VdpPresentationQueueStatus * status,
    VdpTime *                    first_presentation_time
);

4735
/** @} */
Aaron Plattner's avatar
Aaron Plattner committed
4736
4737

/**
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
 * \defgroup display_preemption Display Preemption
 *
 * The Window System may operate within a frame-work (such as
 * Linux's VT switching) where the display is shared between the
 * Window System (e.g. X) and some other output mechanism (e.g.
 * the VT.) Given this scenario, the Window System's control of
 * the display could be preempted, and restored, at any time.
 *
 * VDPAU does not mandate that implementations hide such
 * preemptions from VDPAU client applications; doing so may
 * impose extreme burdens upon VDPAU implementations. Equally,
 * however, implementations are free to hide such preemptions
 * from client applications.
 *
Aaron Plattner's avatar
Aaron Plattner committed
4752
 * VDPAU allows implementations to inform the client application
4753
4754
4755
 * when such a preemption has occurred, and then refuse to
 * continue further operation.
 *
Aaron Plattner's avatar
Aaron Plattner committed
4756
4757
4758
4759
 * Similarly, some form of fatal hardware error could prevent further
 * operation of the VDPAU implementation, without a complete
 * re-initialization.
 *
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
 * The following discusses the behavior of implementations that
 * choose not to hide preemption from client applications.
 *
 * When preemption occurs, VDPAU internally destroys all
 * objects; the client application need not do this. However, if
 * the client application wishes to continue operation, it must
 * recreate all objects that it uses. It is probable that this
 * recreation will not succeed until the display ownership is
 * restored to the Window System.
 *
 * Once preemption has occurred, all VDPAU entry points will
 * return the specific error code \ref
 * VDP_STATUS_DISPLAY_PREEMPTED.
 *
 * VDPAU client applications may also be notified of such
 * preemptions and fatal errors via a callback. See \ref
 * VdpPreemptionCallbackRegister for more details.
 *
Aaron Plattner's avatar
Aaron Plattner committed
4778
4779
4780
4781
 * @{
 */

/**
4782
 * \brief A callback to notify the client application that a
Aaron Plattner's avatar
Aaron Plattner committed
4783
4784
 *        device's display has been preempted.
 * \param[in] device The device that had its display preempted.
4785
 * \param[in] context The client-supplied callback context
Aaron Plattner's avatar
Aaron Plattner committed
4786
 *       information.
4787
 * \return void No return value
Aaron Plattner's avatar
Aaron Plattner committed
4788
4789
4790
4791
4792
4793
4794
4795
 */
typedef void VdpPreemptionCallback(
    VdpDevice device,
    void *   context
);

/**
 * \brief Configure the display preemption callback.
4796
4797
 * \param[in] device The device to be monitored for preemption.
 * \param[in] callback The client application's callback
Aaron Plattner's avatar
Aaron Plattner committed
4798
 *       function. If NULL, the callback is unregistered.
4799
 * \param[in] context The client-supplied callback context
Aaron Plattner's avatar
Aaron Plattner committed
4800
4801
 *       information. This information will be passed to the
 *       callback function if/when invoked.
4802
 * \return VdpStatus The completion status of the operation.
Aaron Plattner's avatar
Aaron Plattner committed
4803
4804
4805
4806
4807
4808
4809
 */
typedef VdpStatus VdpPreemptionCallbackRegister(
    VdpDevice             device,
    VdpPreemptionCallback callback,
    void *               context
);

4810
/** @} */
Aaron Plattner's avatar
Aaron Plattner committed
4811
4812
4813

/**
 * \defgroup get_proc_address Entry Point Retrieval
4814
 *
Aaron Plattner's avatar
Aaron Plattner committed
4815
4816
4817
4818
 * In order to facilitate multiple implementations of VDPAU
 * co-existing within a single process, all functionality is
 * available via function pointers. The mechanism to retrieve
 * those function pointers is described below.
4819
4820
 *
 * @{
Aaron Plattner's avatar
Aaron Plattner committed
4821
4822
 */

4823
4824
/**
 * \brief A type suitable for \ref VdpGetProcAddress
Aaron Plattner's avatar
Aaron Plattner committed
4825
 *        "VdpGetProcAddress"'s \b function_id parameter.
4826
 */
Aaron Plattner's avatar
Aaron Plattner committed
4827
4828
4829
typedef uint32_t VdpFuncId;

/** \hideinitializer */
4830
#define VDP_FUNC_ID_GET_ERROR_STRING                                            ((VdpFuncId)0)
Aaron Plattner's avatar
Aaron Plattner committed
4831
/** \hideinitializer */
4832
#define VDP_FUNC_ID_GET_PROC_ADDRESS                                            ((VdpFuncId)1)
Aaron Plattner's avatar
Aaron Plattner committed
4833
/** \hideinitializer */
4834
#define VDP_FUNC_ID_GET_API_VERSION                                             ((VdpFuncId)2)
Aaron Plattner's avatar
Aaron Plattner committed
4835
/** \hideinitializer */
4836
#define VDP_FUNC_ID_GET_INFORMATION_STRING                                      ((VdpFuncId)4)
Aaron Plattner's avatar
Aaron Plattner committed
4837
/** \hideinitializer */
4838
#define VDP_FUNC_ID_DEVICE_DESTROY                                              ((VdpFuncId)5)
Aaron Plattner's avatar
Aaron Plattner committed
4839
/** \hideinitializer */
4840
#define VDP_FUNC_ID_GENERATE_CSC_MATRIX                                         ((VdpFuncId)6)
Aaron Plattner's avatar
Aaron Plattner committed
4841
/** \hideinitializer */
4842
#define VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES                            ((VdpFuncId)7)
Aaron Plattner's avatar
Aaron Plattner committed
4843
/** \hideinitializer */
4844
#define VDP_FUNC_ID_VIDEO_SURFACE_QUERY_GET_PUT_BITS_Y_CB_CR_CAPABILITIES       ((VdpFuncId)8)
Aaron Plattner's avatar
Aaron Plattner committed
4845
/** \hideinitializer */
4846
#define VDP_FUNC_ID_VIDEO_SURFACE_CREATE                                        ((VdpFuncId)9)
Aaron Plattner's avatar
Aaron Plattner committed
4847
/** \hideinitializer */
4848
#define VDP_FUNC_ID_VIDEO_SURFACE_DESTROY                                       ((VdpFuncId)10)
Aaron Plattner's avatar
Aaron Plattner committed
4849
/** \hideinitializer */
4850
#define VDP_FUNC_ID_VIDEO_SURFACE_GET_PARAMETERS                                ((VdpFuncId)11)
Aaron Plattner's avatar
Aaron Plattner committed
4851
/** \hideinitializer */
4852
#define VDP_FUNC_ID_VIDEO_SURFACE_GET_BITS_Y_CB_CR                              ((VdpFuncId)12)
Aaron Plattner's avatar
Aaron Plattner committed
4853
/** \hideinitializer */
4854
#define VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR                              ((VdpFuncId)13)
Aaron Plattner's avatar
Aaron Plattner committed
4855
/** \hideinitializer */
4856
#define VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_CAPABILITIES                           ((VdpFuncId)14)
Aaron Plattner's avatar
Aaron Plattner committed
4857
/** \hideinitializer */
4858
#define VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_GET_PUT_BITS_NATIVE_CAPABILITIES       ((VdpFuncId)15)
Aaron Plattner's avatar
Aaron Plattner committed
4859
/** \hideinitializer */
4860
#define VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_PUT_BITS_INDEXED_CAPABILITIES          ((VdpFuncId)16)
Aaron Plattner's avatar
Aaron Plattner committed
4861
/** \hideinitializer */
4862
#define VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_PUT_BITS_Y_CB_CR_CAPABILITIES          ((VdpFuncId)17)
Aaron Plattner's avatar
Aaron Plattner committed
4863
/** \hideinitializer */
4864
#define VDP_FUNC_ID_OUTPUT_SURFACE_CREATE                                       ((VdpFuncId)18)
Aaron Plattner's avatar
Aaron Plattner committed
4865
/** \hideinitializer */
4866
#define VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY                                      ((VdpFuncId)19)
Aaron Plattner's avatar
Aaron Plattner committed
4867
/** \hideinitializer */
4868
#define VDP_FUNC_ID_OUTPUT_SURFACE_GET_PARAMETERS                               ((VdpFuncId)20)
Aaron Plattner's avatar
Aaron Plattner committed
4869
/** \hideinitializer */
4870
#define VDP_FUNC_ID_OUTPUT_SURFACE_GET_BITS_NATIVE                              ((VdpFuncId)21)
Aaron Plattner's avatar
Aaron Plattner committed
4871
/** \hideinitializer */
4872
#define VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_NATIVE                              ((VdpFuncId)22)
Aaron Plattner's avatar
Aaron Plattner committed
4873
/** \hideinitializer */
4874
#define VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_INDEXED                             ((VdpFuncId)23)
Aaron Plattner's avatar
Aaron Plattner committed
4875
/** \hideinitializer */
4876
#define VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_Y_CB_CR                             ((VdpFuncId)24)
Aaron Plattner's avatar
Aaron Plattner committed
4877
/** \hideinitializer */
4878
#define VDP_FUNC_ID_BITMAP_SURFACE_QUERY_CAPABILITIES                           ((VdpFuncId)25)
Aaron Plattner's avatar
Aaron Plattner committed
4879
/** \hideinitializer */
4880
#define VDP_FUNC_ID_BITMAP_SURFACE_CREATE                                       ((VdpFuncId)26)
Aaron Plattner's avatar
Aaron Plattner committed
4881
/** \hideinitializer */
4882
#define VDP_FUNC_ID_BITMAP_SURFACE_DESTROY                                      ((VdpFuncId)27)
Aaron Plattner's avatar
Aaron Plattner committed
4883
/** \hideinitializer */
4884
#define VDP_FUNC_ID_BITMAP_SURFACE_GET_PARAMETERS                               ((VdpFuncId)28)
Aaron Plattner's avatar
Aaron Plattner committed
4885
/** \hideinitializer */
4886
#define VDP_FUNC_ID_BITMAP_SURFACE_PUT_BITS_NATIVE                              ((VdpFuncId)29)
Aaron Plattner's avatar
Aaron Plattner committed
4887
/** \hideinitializer */
4888
#define VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_OUTPUT_SURFACE                        ((VdpFuncId)33)
Aaron Plattner's avatar
Aaron Plattner committed
4889
/** \hideinitializer */
4890
#define VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_BITMAP_SURFACE                        ((VdpFuncId)34)
Aaron Plattner's avatar
Aaron Plattner committed
4891
/** \hideinitializer */
4892
#define VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_VIDEO_SURFACE_LUMA                    ((VdpFuncId)35)
Aaron Plattner's avatar
Aaron Plattner committed
4893
/** \hideinitializer */
4894
#define VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES                                  ((VdpFuncId)36)
Aaron Plattner's avatar
Aaron Plattner committed
4895
/** \hideinitializer */
4896
#define VDP_FUNC_ID_DECODER_CREATE                                              ((VdpFuncId)37)
Aaron Plattner's avatar
Aaron Plattner committed
4897
/** \hideinitializer */
4898
#define VDP_FUNC_ID_DECODER_DESTROY                                             ((VdpFuncId)38)
Aaron Plattner's avatar
Aaron Plattner committed
4899
/** \hideinitializer */
4900
#define VDP_FUNC_ID_DECODER_GET_PARAMETERS                                      ((VdpFuncId)39)
Aaron Plattner's avatar
Aaron Plattner committed
4901
/** \hideinitializer */
4902
#define VDP_FUNC_ID_DECODER_RENDER                                              ((VdpFuncId)40)
Aaron Plattner's avatar
Aaron Plattner committed
4903
/** \hideinitializer */
4904
#define VDP_FUNC_ID_VIDEO_MIXER_QUERY_FEATURE_SUPPORT                           ((VdpFuncId)41)
Aaron Plattner's avatar
Aaron Plattner committed
4905
/** \hideinitializer */
4906
#define VDP_FUNC_ID_VIDEO_MIXER_QUERY_PARAMETER_SUPPORT                         ((VdpFuncId)42)
Aaron Plattner's avatar
Aaron Plattner committed
4907
/** \hideinitializer */
4908
#define VDP_FUNC_ID_VIDEO_MIXER_QUERY_ATTRIBUTE_SUPPORT                         ((VdpFuncId)43)
Aaron Plattner's avatar
Aaron Plattner committed
4909
/** \hideinitializer */
4910
#define VDP_FUNC_ID_VIDEO_MIXER_QUERY_PARAMETER_VALUE_RANGE                     ((VdpFuncId)44)
Aaron Plattner's avatar
Aaron Plattner committed
4911
/** \hideinitializer */
4912
#define VDP_FUNC_ID_VIDEO_MIXER_QUERY_ATTRIBUTE_VALUE_RANGE                     ((VdpFuncId)45)
Aaron Plattner's avatar
Aaron Plattner committed
4913
/** \hideinitializer */
4914
#define VDP_FUNC_ID_VIDEO_MIXER_CREATE                                          ((VdpFuncId)46)
Aaron Plattner's avatar
Aaron Plattner committed
4915
/** \hideinitializer */
4916
#define VDP_FUNC_ID_VIDEO_MIXER_SET_FEATURE_ENABLES                             ((VdpFuncId)47)
Aaron Plattner's avatar
Aaron Plattner committed
4917
/** \hideinitializer */
4918
#define VDP_FUNC_ID_VIDEO_MIXER_SET_ATTRIBUTE_VALUES                            ((VdpFuncId)48)
Aaron Plattner's avatar
Aaron Plattner committed
4919
/** \hideinitializer */
4920
#define VDP_FUNC_ID_VIDEO_MIXER_GET_FEATURE_SUPPORT                             ((VdpFuncId)49)
Aaron Plattner's avatar
Aaron Plattner committed
4921
/** \hideinitializer */
4922
#define VDP_FUNC_ID_VIDEO_MIXER_GET_FEATURE_ENABLES                             ((VdpFuncId)50)
Aaron Plattner's avatar
Aaron Plattner committed
4923
/** \hideinitializer */
4924
#define VDP_FUNC_ID_VIDEO_MIXER_GET_PARAMETER_VALUES                            ((VdpFuncId)51)
Aaron Plattner's avatar
Aaron Plattner committed
4925
/** \hideinitializer */
4926
#define VDP_FUNC_ID_VIDEO_MIXER_GET_ATTRIBUTE_VALUES                            ((VdpFuncId)52)
Aaron Plattner's avatar
Aaron Plattner committed
4927
/** \hideinitializer */
4928
#define VDP_FUNC_ID_VIDEO_MIXER_DESTROY                                         ((VdpFuncId)53)
Aaron Plattner's avatar
Aaron Plattner committed
4929
/** \hideinitializer */
4930
#define VDP_FUNC_ID_VIDEO_MIXER_RENDER                                          ((VdpFuncId)54)
Aaron Plattner's avatar
Aaron Plattner committed
4931
/** \hideinitializer */
4932
#define VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_DESTROY                           ((VdpFuncId)55)
Aaron Plattner's avatar
Aaron Plattner committed
4933
/** \hideinitializer */
4934
#define VDP_FUNC_ID_PRESENTATION_QUEUE_CREATE                                   ((VdpFuncId)56)
Aaron Plattner's avatar
Aaron Plattner committed
4935
/** \hideinitializer */
4936
#define VDP_FUNC_ID_PRESENTATION_QUEUE_DESTROY                                  ((VdpFuncId)57)
Aaron Plattner's avatar
Aaron Plattner committed
4937
/** \hideinitializer */
4938
#define VDP_FUNC_ID_PRESENTATION_QUEUE_SET_BACKGROUND_COLOR                     ((VdpFuncId)58)
Aaron Plattner's avatar
Aaron Plattner committed
4939
/** \hideinitializer */
4940
#define VDP_FUNC_ID_PRESENTATION_QUEUE_GET_BACKGROUND_COLOR                     ((VdpFuncId)59)
Aaron Plattner's avatar
Aaron Plattner committed
4941
/** \hideinitializer */
4942
#define VDP_FUNC_ID_PRESENTATION_QUEUE_GET_TIME                                 ((VdpFuncId)62)
Aaron Plattner's avatar
Aaron Plattner committed
4943
/** \hideinitializer */
4944
#define VDP_FUNC_ID_PRESENTATION_QUEUE_DISPLAY                                  ((VdpFuncId)63)
Aaron Plattner's avatar
Aaron Plattner committed
4945
/** \hideinitializer */
4946
#define VDP_FUNC_ID_PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE                 ((VdpFuncId)64)
Aaron Plattner's avatar
Aaron Plattner committed
4947
/** \hideinitializer */
4948
#define VDP_FUNC_ID_PRESENTATION_QUEUE_QUERY_SURFACE_STATUS                     ((VdpFuncId)65)
Aaron Plattner's avatar
Aaron Plattner committed
4949
/** \hideinitializer */
4950
#define VDP_FUNC_ID_PREEMPTION_CALLBACK_REGISTER                                ((VdpFuncId)66)
4951
4952
/** \hideinitializer */
#define VDP_FUNC_ID_DECODER_QUERY_CAPABILITY                                    ((VdpFuncId)67)
Aaron Plattner's avatar
Aaron Plattner committed
4953
4954
4955

#define VDP_FUNC_ID_BASE_WINSYS 0x1000

4956
/**
Aaron Plattner's avatar
Aaron Plattner committed
4957
4958
4959
 * \brief Retrieve a VDPAU function pointer.
 * \param[in] device The device that the function will operate
 *       against.
4960
 * \param[in] function_id The specific function to retrieve.
Aaron Plattner's avatar
Aaron Plattner committed
4961
4962
 * \param[out] function_pointer The actual pointer for the
 *       application to call.
4963
 * \return VdpStatus The completion status of the operation.
Aaron Plattner's avatar
Aaron Plattner committed
4964
4965
4966
4967
4968
4969
4970
4971
 */
typedef VdpStatus VdpGetProcAddress(
    VdpDevice device,
    VdpFuncId function_id,
    /* output parameters follow */
    void * *  function_pointer
);

4972
4973
/** @} */
/** @} */
Aaron Plattner's avatar
Aaron Plattner committed
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987

/**
 * \defgroup api_winsys Window System Integration Layer
 *
 * The set of VDPAU functionality specific to an individual
 * Windowing System.
 */

#ifdef __cplusplus
}
#endif

#endif