vdpau.h revision fb570538
1/*
2 * This source file is documented using Doxygen markup.
3 * See http://www.stack.nl/~dimitri/doxygen/
4 */
5
6/*
7 * This copyright notice applies to this header file:
8 *
9 * Copyright (c) 2008-2015 NVIDIA Corporation
10 *
11 * Permission is hereby granted, free of charge, to any person
12 * obtaining a copy of this software and associated documentation
13 * files (the "Software"), to deal in the Software without
14 * restriction, including without limitation the rights to use,
15 * copy, modify, merge, publish, distribute, sublicense, and/or sell
16 * copies of the Software, and to permit persons to whom the
17 * Software is furnished to do so, subject to the following
18 * conditions:
19 *
20 * The above copyright notice and this permission notice shall be
21 * included in all copies or substantial portions of the Software.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
25 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
27 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
28 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
30 * OTHER DEALINGS IN THE SOFTWARE.
31 */
32
33/**
34 * \mainpage Video Decode and Presentation API for Unix
35 *
36 * \section intro Introduction
37 *
38 * The Video Decode and Presentation API for Unix (VDPAU) provides
39 * a complete solution for decoding, post-processing, compositing,
40 * and displaying compressed or uncompressed video streams. These
41 * video streams may be combined (composited) with bitmap content,
42 * to implement OSDs and other application user interfaces.
43 *
44 * \section api_partitioning API Partitioning
45 *
46 * VDPAU is split into two distinct modules:
47 * - \ref api_core
48 * - \ref api_winsys
49 *
50 * The intent is that most VDPAU functionality exists and
51 * operates identically across all possible Windowing Systems.
52 * This functionality is the \ref api_core.
53 *
54 * However, a small amount of functionality must be included that
55 * is tightly coupled to the underlying Windowing System. This
56 * functionality is the \ref api_winsys. Possibly examples
57 * include:
58 * - Creation of the initial VDPAU \ref VdpDevice "VdpDevice"
59 *   handle, since this act requires intimate knowledge of the
60 *   underlying Window System, such as specific display handle or
61 *   driver identification.
62 * - Conversion of VDPAU surfaces to/from underlying Window
63 *   System surface types, e.g. to allow manipulation of
64 *   VDPAU-generated surfaces via native Window System APIs.
65 *
66 * \section objects Object Types
67 *
68 * VDPAU is roughly object oriented; most functionality is
69 * exposed by creating an object (handle) of a certain class
70 * (type), then executing various functions against that handle.
71 * The set of object classes supported, and their purpose, is
72 * discussed below.
73 *
74 * \subsection device_type Device Type
75 *
76 * A \ref VdpDevice "VdpDevice" is the root object in VDPAU's
77 * object system. The \ref api_winsys allows creation of a \ref
78 * VdpDevice "VdpDevice" object handle, from which all other API
79 * entry points can be retrieved and invoked.
80 *
81 * \subsection surface_types Surface Types
82 *
83 * A surface stores pixel information. Various types of surfaces
84 * existing for different purposes:
85 *
86 * - \ref VdpVideoSurface "VdpVideoSurface"s store decompressed
87 *   YCbCr video frames in an implementation-defined internal
88 *   format.
89 * - \ref VdpOutputSurface "VdpOutputSurface"s store RGB 4:4:4
90 *   data. They are legal render targets for video
91 *   post-processing and compositing operations.
92 * - \ref VdpBitmapSurface "VdpBitmapSurface"s store RGB 4:4:4
93 *   data. These surfaces are designed to contain read-only
94 *   bitmap data, to be used for OSD or application UI
95 *   compositing.
96 *
97 * \subsection transfer_types Transfer Types
98 *
99 * A data transfer object reads data from a surface (or
100 * surfaces), processes it, and writes the result to another
101 * surface. Various types of processing are possible:
102 *
103 * - \ref VdpDecoder "VdpDecoder" objects process compressed video
104 *   data, and generate decompressed images.
105 * - \ref VdpOutputSurface "VdpOutputSurface"s have their own \ref
106 *   VdpOutputSurfaceRender "rendering functionality".
107 * - \ref VdpVideoMixer "VdpVideoMixer" objects perform video
108 *   post-processing, de-interlacing, and compositing.
109 * - \ref VdpPresentationQueue "VdpPresentationQueue" is
110 *   responsible for timestamp-based display of surfaces.
111 *
112 * \section data_flow Data Flow
113 *
114 * Compressed video data originates in the application's memory
115 * space. This memory is typically obtained using \c malloc, and
116 * filled via regular file or network read system calls.
117 * Alternatively, the application may \c mmap a file.
118 *
119 * The compressed data is then processed using a \ref VdpDecoder
120 * "VdpDecoder", which will decompress the field or frame,
121 * and write the result into a \ref VdpVideoSurface
122 * "VdpVideoSurface". This action may require reading pixel data
123 * from some number of other \ref VdpVideoSurface "VdpVideoSurface"
124 * objects, depending on the type of compressed data and
125 * field/frame in question.
126 *
127 * If the application wishes to display any form of OSD or
128 * user-interface, this must be created in a \ref
129 * VdpOutputSurface "VdpOutputSurface".
130 *
131 * This process begins with the creation of \ref VdpBitmapSurface
132 * "VdpBitmapSurface" objects to contain the OSD/UI's static data,
133 * such as individual glyphs.
134 *
135 * \ref VdpOutputSurface "VdpOutputSurface" \ref
136 * VdpOutputSurfaceRender "rendering functionality" may be used
137 * to composite together various \ref VdpBitmapSurface
138 * "VdpBitmapSurface"s and \ref VdpOutputSurface
139 * "VdpOutputSurface"s, into another VdpOutputSurface
140 * "VdpOutputSurface".
141 *
142 * Once video has been decoded, it must be post-processed. This
143 * involves various steps such as color space conversion,
144 * de-interlacing, and other video adjustments. This step is
145 * performed using an \ref VdpVideoMixer "VdpVideoMixer" object.
146 * This object can not only perform the aforementioned video
147 * post-processing, but also composite the video with a number of
148 * \ref VdpOutputSurface "VdpOutputSurface"s, thus allowing complex
149 * user interfaces to be built. The final result is written into
150 * another \ref VdpOutputSurface "VdpOutputSurface".
151 *
152 * Note that at this point, the resultant \ref VdpOutputSurface
153 * "VdpOutputSurface" may be fed back through the above path,
154 * either using \ref VdpOutputSurface "VdpOutputSurface" \ref
155 * VdpOutputSurfaceRender "rendering functionality",
156 * or as input to the \ref VdpVideoMixer "VdpVideoMixer" object.
157 *
158 * Finally, the resultant \ref VdpOutputSurface
159 * "VdpOutputSurface" must be displayed on screen. This is the job
160 * of the \ref VdpPresentationQueue "VdpPresentationQueue" object.
161 *
162 * \image html vdpau_data_flow.png
163 *
164 * \section entry_point_retrieval Entry Point Retrieval
165 *
166 * VDPAU is designed so that multiple implementations can be
167 * used without application changes. For example, VDPAU could be
168 * hosted on X11, or via direct GPU access.
169 *
170 * The key technology behind this is the use of function
171 * pointers and a "get proc address" style API for all entry
172 * points. Put another way, functions are not called directly
173 * via global symbols set up by the linker, but rather through
174 * pointers.
175 *
176 * In practical terms, the \ref api_winsys provides factory
177 * functions which not only create and return \ref VdpDevice
178 * "VdpDevice" objects, but also a function pointer to a \ref
179 * VdpGetProcAddress function, through which all entry point
180 * function pointers will be retrieved.
181 *
182 * \subsection entry_point_philosophy Philosophy
183 *
184 * It is entirely possible to envisage a simpler scheme whereby
185 * such function pointers are hidden. That is, the application
186 * would link against a wrapper library that exposed "real"
187 * functions. The application would then call such functions
188 * directly, by symbol, like any other function. The wrapper
189 * library would handle loading the appropriate back-end, and
190 * implementing a similar "get proc address" scheme internally.
191 *
192 * However, the above scheme does not work well in the context
193 * of separated \ref api_core and \ref api_winsys. In this
194 * scenario, one would require a separate wrapper library per
195 * Window System, since each Window System would have a
196 * different function name and prototype for the main factory
197 * function. If an application then wanted to be Window System
198 * agnostic (making final determination at run-time via some
199 * form of plugin), it may then need to link against two
200 * wrapper libraries, which would cause conflicts for all
201 * symbols other than the main factory function.
202 *
203 * Another disadvantage of the wrapper library approach is the
204 * extra level of function call required; the wrapper library
205 * would internally implement the existing "get proc address"
206 * and "function pointer" style dispatch anyway. Exposing this
207 * directly to the application is slightly more efficient.
208 *
209 * \section threading Multi-threading
210 *
211 * All VDPAU functionality is fully thread-safe; any number of
212 * threads may call into any VDPAU functions at any time. VDPAU
213 * may not be called from signal-handlers.
214 *
215 * Note, however, that this simply guarantees that internal
216 * VDPAU state will not be corrupted by thread usage, and that
217 * crashes and deadlocks will not occur. Completely arbitrary
218 * thread usage may not generate the results that an application
219 * desires. In particular, care must be taken when multiple
220 * threads are performing operations on the same VDPAU objects.
221 *
222 * VDPAU implementations guarantee correct flow of surface
223 * content through the rendering pipeline, but only when
224 * function calls that read from or write to a surface return to
225 * the caller prior to any thread calling any other function(s)
226 * that read from or write to the surface. Invoking multiple
227 * reads from a surface in parallel is OK.
228 *
229 * Note that this restriction is placed upon VDPAU function
230 * invocations, and specifically not upon any back-end
231 * hardware's physical rendering operations. VDPAU
232 * implementations are expected to internally synchronize such
233 * hardware operations.
234 *
235 * In a single-threaded application, the above restriction comes
236 * naturally; each function call completes before it is possible
237 * to begin a new function call.
238 *
239 * In a multi-threaded application, threads may need to be
240 * synchronized. For example, consider the situation where:
241 *
242 * - Thread 1 is parsing compressed video data, passing them
243 *   through a \ref VdpDecoder "VdpDecoder" object, and filling a
244 *   ring-buffer of \ref VdpVideoSurface "VdpVideoSurface"s
245 * - Thread 2 is consuming those \ref VdpVideoSurface
246 *   "VdpVideoSurface"s, and using a \ref VdpVideoMixer
247 *   "VdpVideoMixer" to process them and composite them with UI.
248 *
249 * In this case, the threads must synchronize to ensure that
250 * thread 1's call to \ref VdpDecoderRender has returned prior to
251 * thread 2's call(s) to \ref VdpVideoMixerRender that use that
252 * specific surface. This could be achieved using the following
253 * pseudo-code:
254 *
255 * \code
256 * Queue<VdpVideoSurface> q_full_surfaces;
257 * Queue<VdpVideoSurface> q_empty_surfaces;
258 *
259 * thread_1() {
260 *     for (;;) {
261 *         VdpVideoSurface s = q_empty_surfaces.get();
262 *         // Parse compressed stream here
263 *         VdpDecoderRender(s, ...);
264 *         q_full_surfaces.put(s);
265 *     }
266 * }
267 *
268 * // This would need to be more complex if
269 * // VdpVideoMixerRender were to be provided with more
270 * // than one field/frame at a time.
271 * thread_2() {
272 *     for (;;) {
273 *         // Possibly, other rendering operations to mixer
274 *         // layer surfaces here.
275 *         VdpOutputSurface t = ...;
276 *         VdpPresentationQueueBlockUntilSurfaceIdle(t);
277 *         VdpVideoSurface s = q_full_surfaces.get();
278 *         VdpVideoMixerRender(s, t, ...);
279 *         q_empty_surfaces.put(s);
280 *         // Possibly, other rendering operations to "t" here
281 *         VdpPresentationQueueDisplay(t, ...);
282 *     }
283 * }
284 * \endcode
285 *
286 * Finally, note that VDPAU makes no guarantees regarding any
287 * level of parallelism in any given implementation. Put another
288 * way, use of multi-threading is not guaranteed to yield any
289 * performance gain, and in theory could even slightly reduce
290 * performance due to threading/synchronization overhead.
291 *
292 * However, the intent of the threading requirements is to allow
293 * for e.g. video decoding and video mixer operations to proceed
294 * in parallel in hardware. Given a (presumably multi-threaded)
295 * application that kept each portion of the hardware busy, this
296 * would yield a performance increase.
297 *
298 * \section endianness Surface Endianness
299 *
300 * When dealing with surface content, i.e. the input/output of
301 * Put/GetBits functions, applications must take care to access
302 * memory in the correct fashion, so as to avoid endianness
303 * issues.
304 *
305 * By established convention in the 3D graphics world, RGBA data
306 * is defined to be an array of 32-bit pixels containing packed
307 * RGBA components, not as an array of bytes or interleaved RGBA
308 * components. VDPAU follows this convention. As such,
309 * applications are expected to access such surfaces as arrays
310 * of 32-bit components (i.e. using a 32-bit pointer), and not
311 * as interleaved arrays of 8-bit components (i.e. using an
312 * 8-bit pointer.) Deviation from this convention will lead to
313 * endianness issues, unless appropriate care is taken.
314 *
315 * The same convention is followed for some packed YCbCr formats
316 * such as \ref VDP_YCBCR_FORMAT_Y8U8V8A8; i.e. they are
317 * considered arrays of 32-bit pixels, and hence should be
318 * accessed as such.
319 *
320 * For YCbCr formats with chroma decimation and/or planar
321 * formats, however, this convention is awkward. Therefore,
322 * formats such as \ref VDP_YCBCR_FORMAT_NV12 are defined as
323 * arrays of (potentially interleaved) byte-sized components.
324 * Hence, applications should manipulate such data 8-bits at a
325 * time, using 8-bit pointers.
326 *
327 * Note that one common usage for the input/output of
328 * Put/GetBits APIs is file I/O. Typical file I/O APIs treat all
329 * memory as a simple array of 8-bit values. This violates the
330 * rule requiring surface data to be accessed in its true native
331 * format. As such, applications may be required to solve
332 * endianness issues. Possible solutions include:
333 *
334 * - Authoring static UI data files according to the endianness
335 *   of the target execution platform.
336 * - Conditionally byte-swapping Put/GetBits data buffers at
337 *   run-time based on execution platform.
338 *
339 * Note: Complete details regarding each surface format's
340 * precise pixel layout is included with the documentation of
341 * each surface type. For example, see \ref
342 * VDP_RGBA_FORMAT_B8G8R8A8.
343 *
344 * \section video_decoder_usage Video Decoder Usage
345 *
346 * VDPAU is a slice-level API. Put another way, VDPAU implementations accept
347 * "slice" data from the bitstream, and perform all required processing of
348 * those slices (e.g VLD decoding, IDCT, motion compensation, in-loop
349 * deblocking, etc.).
350 *
351 * The client application is responsible for:
352 *
353 * - Extracting the slices from the bitstream (e.g. parsing/demultiplexing
354 *   container formats, scanning the data to determine slice start positions
355 *   and slice sizes).
356 * - Parsing various bitstream headers/structures (e.g. sequence header,
357 *   sequence parameter set, picture parameter set, entry point structures,
358 *   etc.) Various fields from the parsed header structures needs to be
359 *   provided to VDPAU alongside the slice bitstream in a "picture info"
360 *   structure.
361 * - Surface management (e.g. H.264 DPB processing, display re-ordering)
362 *
363 * It is recommended that applications pass solely the slice data to VDPAU;
364 * specifically that any header data structures be excluded from the portion
365 * of the bitstream passed to VDPAU. VDPAU implementations must operate
366 * correctly if non-slice data is included, at least for formats employing
367 * start codes to delimit slice data. However, any extra data may need
368 * to be uploaded to hardware for parsing thus lowering performance, and/or,
369 * in the worst case, may even overflow internal buffers that are sized solely
370 * for slice data.
371 *
372 * The exact data that should be passed to VDPAU is detailed below for each
373 * supported format:
374 *
375 * \subsection bitstream_mpeg1_mpeg2 MPEG-1 and MPEG-2
376 *
377 * Include all slices beginning with start codes 0x00000101 through
378 * 0x000001AF. The slice start code must be included for all slices.
379 *
380 * \subsection bitstream_h264 H.264
381 *
382 * Include all NALs with nal_unit_type of 1 or 5 (coded slice of non-IDR/IDR
383 * picture respectively). The complete slice start code (including 0x000001
384 * prefix) must be included for all slices, even when the prefix is not
385 * included in the bitstream.
386 *
387 * Note that if desired:
388 *
389 * - The slice start code prefix may be included in a separate bitstream
390 *   buffer array entry to the actual slice data extracted from the bitstream.
391 * - 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 * VC-1 simple/main profile bitstreams always consist of a single slice per
397 * picture, and do not use start codes to delimit pictures. Instead, the
398 * container format must indicate where each picture begins/ends.
399 *
400 * As such, no slice start codes should be included in the data passed to
401 * VDPAU; simply pass in the exact data from the bitstream.
402 *
403 * Header information contained in the bitstream should be parsed by the
404 * application and passed to VDPAU using the "picture info" data structure;
405 * this header information explicitly must not be included in the bitstream
406 * data passed to VDPAU for this encoding format.
407 *
408 * \subsection bitstream_vc1_ap VC-1 Advanced Profile
409 *
410 * Include all slices beginning with start codes 0x0000010D (frame),
411 * 0x0000010C (field) or 0x0000010B (slice). The slice start code should be
412 * included in all cases.
413 *
414 * Some VC-1 advanced profile streams do not contain slice start codes; again,
415 * the container format must indicate where picture data begins and ends. In
416 * this case, pictures are assumed to be progressive and to contain a single
417 * slice. It is highly recommended that applications detect this condition,
418 * and add the missing start codes to the bitstream passed to VDPAU. However,
419 * VDPAU implementations must allow bitstreams with missing start codes, and
420 * act as if a 0x0000010D (frame) start code had been present.
421 *
422 * Note that pictures containing multiple slices, or interlace streams, must
423 * contain a complete set of slice start codes in the original bitstream;
424 * without them, it is not possible to correctly parse and decode the stream.
425 *
426 * The bitstream passed to VDPAU should contain all original emulation
427 * prevention bytes present in the original bitstream; do not remove these
428 * from the bitstream.
429 *
430 * \subsection bitstream_mpeg4part2 MPEG-4 Part 2 and DivX
431 *
432 * Include all slices beginning with start codes 0x000001B6. The slice start
433 * code must be included for all slices.
434 *
435 * \subsection bitstream_hevc H.265/HEVC - High Efficiency Video Codec
436 *
437 * Include all video coding layer (VCL) NAL units, with nal_unit_type values
438 * of 0 (TRAIL_N) through 31 (RSV_VCL31) inclusive. In addition to parsing
439 * and providing NAL units, an H.265/HEVC decoder application using VDPAU
440 * for decoding must parse certain values of the first slice segment header
441 * in a VCL NAL unit and provide it through VdpPictureInfoHEVC. Please see
442 * the documentation for VdpPictureInfoHEVC below for further details.
443 *
444 * The complete slice start code (including the 0x000001 prefix) must be
445 * included for all slices, even when the prefix is not included in the
446 * bitstream.
447 *
448 * Note that if desired:
449 *
450 * - The slice start code prefix may be included in a separate bitstream
451 *   buffer array entry to the actual slice data extracted from the bitstream.
452 * - Multiple bitstream buffer array entries (e.g. one per slice) may point at
453 *   the same physical data storage for the slice start code prefix.
454 *
455 * \section video_mixer_usage Video Mixer Usage
456 *
457 * \subsection video_surface_content VdpVideoSurface Content
458 *
459 * Each \ref VdpVideoSurface "VdpVideoSurface" is expected to contain an
460 * entire frame's-worth of data, irrespective of whether an interlaced of
461 * progressive sequence is being decoded.
462 *
463 * Depending on the exact encoding structure of the compressed video stream,
464 * the application may need to call \ref VdpDecoderRender twice to fill a
465 * single \ref VdpVideoSurface "VdpVideoSurface". When the stream contains an
466 * encoded progressive frame, or a "frame coded" interlaced field-pair, a
467 * single \ref VdpDecoderRender call will fill the entire surface. When the
468 * stream contains separately encoded interlaced fields, two
469 * \ref VdpDecoderRender calls will be required; one for the top field, and
470 * one for the bottom field.
471 *
472 * Implementation note: When \ref VdpDecoderRender renders an interlaced
473 * field, this operation must not disturb the content of the other field in
474 * the surface.
475 *
476 * \subsection vm_surf_list VdpVideoMixer Surface List
477 *
478 * An video stream is logically composed of a sequence of fields. An
479 * example is shown below, in display order, assuming top field first:
480 *
481 * <pre>t0 b0 t1 b1 t2 b2 t3 b3 t4 b4 t5 b5 t6 b6 t7 b7 t8 b8 t9 b9</pre>
482 *
483 * The canonical usage is to call \ref VdpVideoMixerRender once for decoded
484 * field, in display order, to yield one post-processed frame for display.
485 *
486 * For each call to \ref VdpVideoMixerRender, the field to be processed should
487 * be provided as the \b video_surface_current parameter.
488 *
489 * To enable operation of advanced de-interlacing algorithms and/or
490 * post-processing algorithms, some past and/or future surfaces should be
491 * provided as context. These are provided in the \b video_surface_past and
492 * \b video_surface_future lists. In general, these lists may contain any
493 * number of surfaces. Specific implementations may have specific requirements
494 * determining the minimum required number of surfaces for optimal operation,
495 * and the maximum number of useful surfaces, beyond which surfaces are not
496 * 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 * Note that it is entirely possible, in general, for any of the
500 * \ref VdpVideoMixer "VdpVideoMixer" post-processing steps other than
501 * de-interlacing to require access to multiple input fields/frames. For
502 * example, an motion-sensitive noise-reduction algorithm.
503 *
504 * For example, when processing field t4, the \ref VdpVideoMixerRender
505 * parameters may contain the following values, if the application chose to
506 * provide 3 fields of context for both the past and future:
507 *
508 * <pre>
509 * current_picture_structure: VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD
510 * past:    [b3, t3, b2]
511 * current: t4
512 * future:  [b4, t5, b5]
513 * </pre>
514 *
515 * Note that for both the past/future lists, array index 0 represents the
516 * field temporally closest to current, in display order.
517 *
518 * The \ref VdpVideoMixerRender parameter \b current_picture_structure applies
519 * to \b video_surface_current. The picture structure for the other surfaces
520 * will be automatically derived from that for the current picture. The
521 * derivation algorithm is extremely simple; the concatenated list
522 * past/current/future is simply assumed to have an alternating top/bottom
523 * pattern throughout.
524 *
525 * Continuing the example above, subsequent calls to \ref VdpVideoMixerRender
526 * would provide the following sets of parameters:
527 *
528 * <pre>
529 * current_picture_structure: VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD
530 * past:    [t4, b3, t3]
531 * current: b4
532 * future:  [t5, b5, t6]
533 * </pre>
534 *
535 * then:
536 *
537 * <pre>
538 * current_picture_structure: VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD
539 * past:    [b4, t4, b3]
540 * current: t5
541 * future:  [b5, t6, b7]
542 * </pre>
543 *
544 * In other words, the concatenated list of past/current/future frames simply
545 * forms a window that slides through the sequence of decoded fields.
546 *
547 * It is syntactically legal for an application to choose not to provide a
548 * particular entry in the past or future lists. In this case, the "slot" in
549 * the surface list must be filled with the special value
550 * \ref VDP_INVALID_HANDLE, to explicitly indicate that the picture is
551 * missing; do not simply shuffle other surfaces together to fill in the gap.
552 * Note that entries should only be omitted under special circumstances, such
553 * as failed decode due to bitstream error during picture header parsing,
554 * since missing entries will typically cause advanced de-interlacing
555 * algorithms to experience significantly degraded operation.
556 *
557 * Specific examples for different de-interlacing types are presented below.
558 *
559 * \subsection deint_weave Weave De-interlacing
560 *
561 * Weave de-interlacing is the act of interleaving the lines of two temporally
562 * adjacent fields to form a frame for display.
563 *
564 * To disable de-interlacing for progressive streams, simply specify
565 * \b current_picture_structure as \ref VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME;
566 * no de-interlacing will be applied.
567 *
568 * Weave de-interlacing for interlaced streams is identical to disabling
569 * de-interlacing, as describe immediately above, because each
570 * \ref VdpVideoSurface already contains an entire frame's worth (i.e. two
571 * fields) of picture data.
572 *
573 * Inverse telecine is disabled when using weave de-interlacing.
574 *
575 * Weave de-interlacing produces one output frame for each input frame. The
576 * application should make one \ref VdpVideoMixerRender call per pair of
577 * decoded fields, or per decoded frame.
578 *
579 * Weave de-interlacing requires no entries in the past/future lists.
580 *
581 * All implementations must support weave de-interlacing.
582 *
583 * \subsection deint_bob Bob De-interlacing
584 *
585 * Bob de-interlacing is the act of vertically scaling a single field to the
586 * size of a single frame.
587 *
588 * To achieve bob de-interlacing, simply provide a single field as
589 * \b video_surface_current, and set \b current_picture_structure
590 * appropriately, to indicate whether a top or bottom field was provided.
591 *
592 * Inverse telecine is disabled when using bob de-interlacing.
593 *
594 * Bob de-interlacing produces one output frame for each input field. The
595 * application should make one \ref VdpVideoMixerRender call per decoded
596 * field.
597 *
598 * Bob de-interlacing requires no entries in the past/future lists.
599 *
600 * Bob de-interlacing is the default when no advanced method is requested and
601 * enabled. Advanced de-interlacing algorithms may fall back to bob e.g. when
602 * required past/future fields are missing.
603 *
604 * All implementations must support bob de-interlacing.
605 *
606 * \subsection deint_adv Advanced De-interlacing
607 *
608 * Operation of both temporal and temporal-spatial de-interlacing is
609 * identical; the only difference is the internal processing the algorithm
610 * performs in generating the output frame.
611 *
612 * These algorithms use various advanced processing on the pixels of both the
613 * current and various past/future fields in order to determine how best to
614 * de-interlacing individual portions of the image.
615 *
616 * Inverse telecine may be enabled when using advanced de-interlacing.
617 *
618 * Advanced de-interlacing produces one output frame for each input field. The
619 * application should make one \ref VdpVideoMixerRender call per decoded
620 * field.
621 *
622 * Advanced de-interlacing requires entries in the past/future lists.
623 *
624 * Availability of advanced de-interlacing algorithms is implementation
625 * dependent.
626 *
627 * \subsection deint_rate De-interlacing Rate
628 *
629 * For all de-interlacing algorithms except weave, a choice may be made to
630 * call \ref VdpVideoMixerRender for either each decoded field, or every
631 * second decoded field.
632 *
633 * If \ref VdpVideoMixerRender is called for every decoded field, the
634 * generated post-processed frame rate is equal to the decoded field rate.
635 * Put another way, the generated post-processed nominal field rate is equal
636 * to 2x the decoded field rate. This is standard practice.
637 *
638 * If \ref VdpVideoMixerRender is called for every second decoded field (say
639 * every top field), the generated post-processed frame rate is half to the
640 * decoded field rate. This mode of operation is thus referred to as
641 * "half-rate".
642 *
643 * Implementations may choose whether to support half-rate de-interlacing
644 * or not. Regular full-rate de-interlacing should be supported by any
645 * supported advanced de-interlacing algorithm.
646 *
647 * The descriptions of de-interlacing algorithms above assume that regular
648 * (not half-rate) operation is being performed, when detailing the number of
649 * VdpVideoMixerRender calls.
650 *
651 * Recall that the concatenation of past/current/future surface lists simply
652 * forms a window into the stream of decoded fields. To achieve standard
653 * de-interlacing, the window is slid through the list of decoded fields one
654 * field at a time, and a call is made to \ref VdpVideoMixerRender for each
655 * movement of the window. To achieve half-rate de-interlacing, the window is
656 * slid through the* list of decoded fields two fields at a time, and a
657 * call is made to \ref VdpVideoMixerRender for each movement of the window.
658 *
659 * \subsection invtc Inverse Telecine
660 *
661 * Assuming the implementation supports it, inverse telecine may be enabled
662 * alongside any advanced de-interlacing algorithm. Inverse telecine is never
663 * active for bob or weave.
664 *
665 * Operation of \ref VdpVideoMixerRender with inverse telecine active is
666 * identical to the basic operation mechanisms describe above in every way;
667 * all inverse telecine processing is performed internally to the
668 * \ref VdpVideoMixer "VdpVideoMixer".
669 *
670 * In particular, there is no provision way for \ref VdpVideoMixerRender to
671 * indicate when identical input fields have been observed, and consequently
672 * identical output frames may have been produced.
673 *
674 * De-interlacing (and inverse telecine) may be applied to streams that are
675 * marked as being progressive. This will allow detection of, and correct
676 * de-interlacing of, mixed interlace/progressive streams, bad edits, etc.
677 * To implement de-interlacing/inverse-telecine on progressive material,
678 * simply treat the stream of decoded frames as a stream of decoded fields,
679 * apply any telecine flags (see the next section), and then apply
680 * de-interlacing to those fields as described above.
681 *
682 * Implementations are free to determine whether inverse telecine operates
683 * in conjunction with half-rate de-interlacing or not. It should always
684 * operate with regular de-interlacing, when advertized.
685 *
686 * \subsection tcflags Telecine (Pull-Down) Flags
687 *
688 * Some media delivery formats, e.g. DVD-Video, include flags that are
689 * intended to modify the decoded field sequence before display. This allows
690 * e.g. 24p content to be encoded at 48i, which saves space relative to a 60i
691 * encoded stream, but still displayed at 60i, to match target consumer
692 * display equipment.
693 *
694 * If the inverse telecine option is not activated in the
695 * \ref VdpVideoMixer "VdpVideoMixer", these flags should be ignored, and the
696 * decoded fields passed directly to \ref VdpVideoMixerRender as detailed
697 * above.
698 *
699 * However, to make full use of the inverse telecine feature, these flags
700 * should be applied to the field stream, yielding another field stream with
701 * some repeated fields, before passing the field stream to
702 * \ref VdpVideoMixerRender. In this scenario, the sliding window mentioned
703 * in the descriptions above applies to the field stream after application of
704 * flags.
705 *
706 * \section extending Extending the API
707 *
708 * \subsection extend_enums Enumerations and Other Constants
709 *
710 * VDPAU defines a number of enumeration types.
711 *
712 * When modifying VDPAU, existing enumeration constants must
713 * continue to exist (although they may be deprecated), and do
714 * so in the existing order.
715 *
716 * The above discussion naturally applies to "manually" defined
717 * enumerations, using pre-processor macros, too.
718 *
719 * \subsection extend_structs Structures
720 *
721 * In most case, VDPAU includes no provision for modifying existing
722 * structure definitions, although they may be deprecated.
723 *
724 * New structures may be created, together with new API entry
725 * points or feature/attribute/parameter values, to expose new
726 * functionality.
727 *
728 * A few structures are considered plausible candidates for future extension.
729 * Such structures include a version number as the first field, indicating the
730 * exact layout of the client-provided data. When changing such structures, the
731 * old structure must be preserved and a new structure created. This allows
732 * applications built against the old version of the structure to continue to
733 * interoperate. For example, to extend the VdpProcamp structure, define a new
734 * VdpProcamp1 and update VdpGenerateCSCMatrix to take the new structure as an
735 * argument. Document in a comment that the caller must fill the struct_version
736 * field with the value 1. VDPAU implementations should use the struct_version
737 * field to determine which version of the structure the application was built
738 * against.  Note that you cannot simply increment the value of
739 * VDP_PROCAMP_VERSION because applications recompiled against a newer version
740 * of vdpau.h but that have not been updated to use the new structure must still
741 * report that they're using version 0.
742 *
743 * Note that the layouts of VdpPictureInfo structures are defined by their
744 * corresponding VdpDecoderProfile numbers, so no struct_version field is
745 * needed for them. This layout includes the size of the structure, so new
746 * profiles that extend existing functionality may incorporate the old
747 * VdpPictureInfo as a substructure, but may not modify existing VdpPictureInfo
748 * structures.
749 *
750 * \subsection extend_functions Functions
751 *
752 * Existing functions may not be modified, although they may be
753 * deprecated.
754 *
755 * New functions may be added at will. Note the enumeration
756 * requirements when modifying the enumeration that defines the
757 * list of entry points.
758 *
759 * \section preemption_note Display Preemption
760 *
761 * Please note that the display may be preempted away from
762 * VDPAU at any time. See \ref display_preemption for more
763 * details.
764 *
765 * \subsection trademarks Trademarks
766 *
767 * VDPAU is a trademark of NVIDIA Corporation. You may freely use the
768 * VDPAU trademark, as long as trademark ownership is attributed to
769 * NVIDIA Corporation.
770 */
771
772/**
773 * \file vdpau.h
774 * \brief The Core API
775 *
776 * This file contains the \ref api_core "Core API".
777 */
778
779#ifndef _VDPAU_H
780#define _VDPAU_H
781
782#include <stdint.h>
783
784#ifdef __cplusplus
785extern "C" {
786#endif
787
788/**
789 * \defgroup api_core Core API
790 *
791 * The core API encompasses all VDPAU functionality that operates
792 * in the same fashion across all Window Systems.
793 *
794 * @{
795 */
796
797/**
798 * \defgroup base_types Basic Types
799 *
800 * VDPAU primarily uses ISO C99 types from \c stdint.h.
801 *
802 * @{
803 */
804
805/** \brief A true \ref VdpBool value */
806#define VDP_TRUE 1
807/** \brief A false \ref VdpBool value */
808#define VDP_FALSE 0
809/**
810 * \brief A boolean value, holding \ref VDP_TRUE or \ref
811 * VDP_FALSE.
812 */
813typedef int VdpBool;
814
815/*@}*/
816
817/**
818 * \defgroup misc_types Miscellaneous Types
819 *
820 * @{
821 */
822
823/**
824 * \brief An invalid object handle value.
825 *
826 * This value may be used to represent an invalid, or
827 * non-existent, object (\ref VdpDevice "VdpDevice",
828 * \ref VdpVideoSurface "VdpVideoSurface", etc.)
829 *
830 * Note that most APIs require valid object handles in all
831 * cases, and will fail when presented with this value.
832 */
833#define VDP_INVALID_HANDLE 0xffffffffU
834
835/**
836 * \brief The set of all chroma formats for \ref VdpVideoSurface
837 * "VdpVideoSurface"s.
838 */
839typedef uint32_t VdpChromaType;
840
841/** \hideinitializer \brief 4:2:0 chroma format. Undefined field/frame based
842 *  Video surfaces allocated with this chroma type have undefined
843 *  field/frame structure. The implementation is free to internally morph
844 *  the surface between frame/field(NV12/NV24) as required by
845 *  VdpVideoDecoder operation. Interop with OpenGL allows registration
846 *  of these surfaces for either field- or frame-based interop. But, an implicit
847 *  field/frame structure conversion may be performed.
848 */
849#define VDP_CHROMA_TYPE_420 ((VdpChromaType)0)
850/** \hideinitializer \brief 4:2:2 chroma format. Undefined field/frame based
851 *  Video surfaces allocated with this chroma type have undefined
852 *  field/frame structure. The implementation is free to internally morph
853 *  the surface between frame/field(NV12/NV24) as required by
854 *  VdpVideoDecoder operation. Interop with OpenGL allows registration
855 *  of these surfaces for either field- or frame-based interop. But, an implicit
856 *  field/frame structure conversion may be performed.
857 */
858#define VDP_CHROMA_TYPE_422 ((VdpChromaType)1)
859/** \hideinitializer \brief 4:4:4 chroma format. Undefined field/frame based
860 *  Video surfaces allocated with this chroma type have undefined
861 *  field/frame structure. The implementation is free to internally morph
862 *  the surface between frame/field(NV12/NV24) as required by
863 *  VdpVideoDecoder operation. Interop with OpenGL allows registration
864 *  of these surfaces for either field- or frame-based interop. But, an implicit
865 *  field/frame structure conversion may be performed.
866 */
867#define VDP_CHROMA_TYPE_444 ((VdpChromaType)2)
868
869/** \hideinitializer \brief 4:2:0 chroma format. Field based.
870 *  Video surfaces allocated with this chroma type can only be
871 *  interoped with OpenGL if the matching field/frame structure is
872 *  specified in the OpenGL API */
873#define VDP_CHROMA_TYPE_420_FIELD ((VdpChromaType)3)
874/** \hideinitializer \brief 4:2:2 chroma format. Field based.
875 *  Video surfaces allocated with this chroma type can only be
876 *  interoped with OpenGL if the matching field/frame structure is
877 *  specified in the OpenGL API */
878#define VDP_CHROMA_TYPE_422_FIELD ((VdpChromaType)4)
879/** \hideinitializer \brief 4:4:4 chroma format. Field based.
880 *  Video surfaces allocated with this chroma type can only be
881 *  interoped with OpenGL if the matching field/frame structure is
882 *  specified in the OpenGL API */
883#define VDP_CHROMA_TYPE_444_FIELD ((VdpChromaType)5)
884
885/** \hideinitializer \brief 4:2:0 chroma format. Frame based.
886 *  Video surfaces allocated with this chroma type can only be
887 *  interoped with OpenGL if the matching field/frame structure is
888 *  specified in the OpenGL API */
889#define VDP_CHROMA_TYPE_420_FRAME ((VdpChromaType)6)
890/** \hideinitializer \brief 4:2:2 chroma format. Frame based.
891 *  Video surfaces allocated with this chroma type can only be
892 *  interoped with OpenGL if the matching field/frame structure is
893 *  specified in the OpenGL API */
894#define VDP_CHROMA_TYPE_422_FRAME ((VdpChromaType)7)
895/** \hideinitializer \brief 4:4:4 chroma format. Frame based.
896 *  Video surfaces allocated with this chroma type can only be
897 *  interoped with OpenGL if the matching field/frame structure is
898 *  specified in the OpenGL API */
899#define VDP_CHROMA_TYPE_444_FRAME ((VdpChromaType)8)
900
901/**
902 * \brief The set of all known YCbCr surface formats.
903 */
904typedef uint32_t VdpYCbCrFormat;
905
906/**
907 * \hideinitializer
908 * \brief The "NV12" YCbCr surface format.
909 *
910 * This format has a two planes, a Y plane and a UV plane.
911 *
912 * The Y plane is an array of byte-sized Y components.
913 * Applications should access this data via a uint8_t pointer.
914 *
915 * The UV plane is an array of interleaved byte-sized U and V
916 * components, in the order U, V, U, V. Applications should
917 * access this data via a uint8_t pointer.
918 */
919#define VDP_YCBCR_FORMAT_NV12     ((VdpYCbCrFormat)0)
920/**
921 * \hideinitializer
922 * \brief The "YV12" YCbCr surface format.
923 *
924 * This format has a three planes, a Y plane, a V plane, and a U
925 * plane.
926 *
927 * Each of the planes is an array of byte-sized components.
928 *
929 * Applications should access this data via a uint8_t pointer.
930 */
931#define VDP_YCBCR_FORMAT_YV12     ((VdpYCbCrFormat)1)
932/**
933 * \hideinitializer
934 * \brief The "UYVY" YCbCr surface format.
935 *
936 * This format may also be known as Y422, UYNV, HDYC.
937 *
938 * This format has a single plane.
939 *
940 * This plane is an array of interleaved byte-sized Y, U, and V
941 * components, in the order U, Y, V, Y, U, Y, V, Y.
942 *
943 * Applications should access this data via a uint8_t pointer.
944 */
945#define VDP_YCBCR_FORMAT_UYVY     ((VdpYCbCrFormat)2)
946/**
947 * \hideinitializer
948 * \brief The "YUYV" YCbCr surface format.
949 *
950 * This format may also be known as YUY2, YUNV, V422.
951 *
952 * This format has a single plane.
953 *
954 * This plane is an array of interleaved byte-sized Y, U, and V
955 * components, in the order Y, U, Y, V, Y, U, Y, V.
956 *
957 * Applications should access this data via a uint8_t pointer.
958 */
959#define VDP_YCBCR_FORMAT_YUYV     ((VdpYCbCrFormat)3)
960/**
961 * \hideinitializer
962 * \brief A packed YCbCr format.
963 *
964 * This format has a single plane.
965 *
966 * This plane is an array packed 32-bit pixel data. Within each
967 * 32-bit pixel, bits [31:24] contain A, bits [23:16] contain V,
968 * bits [15:8] contain U, and bits [7:0] contain Y.
969 *
970 * Applications should access this data via a uint32_t pointer.
971 */
972#define VDP_YCBCR_FORMAT_Y8U8V8A8 ((VdpYCbCrFormat)4)
973/**
974 * \hideinitializer
975 * \brief A packed YCbCr format.
976 *
977 * This format has a single plane.
978 *
979 * This plane is an array packed 32-bit pixel data. Within each
980 * 32-bit pixel, bits [31:24] contain A, bits [23:16] contain Y,
981 * bits [15:8] contain U, and bits [7:0] contain V.
982 *
983 * Applications should access this data via a uint32_t pointer.
984 */
985#define VDP_YCBCR_FORMAT_V8U8Y8A8 ((VdpYCbCrFormat)5)
986/**
987 * \hideinitializer
988 * \brief The "Y_UV_444" YCbCr surface format.
989 *
990 * This format has two planes, a Y plane and a UV plane.
991 *
992 * The Y plane is an array of byte-sized Y components.
993 * Applications should access this data via a uint8_t pointer.
994 *
995 * The UV plane is an array of interleaved byte-sized U and V
996 * components, in the order U, V, U, V. Applications should
997 * access this data via a uint8_t pointer.
998 */
999#define VDP_YCBCR_FORMAT_Y_UV_444     ((VdpYCbCrFormat)6)
1000/**
1001 * \hideinitializer
1002 * \brief The "Y_U_V_444" YCbCr surface format.
1003 *
1004 * This format has three planes, a Y plane, a V plane, and a U
1005 * plane.
1006 *
1007 * Each of the planes is an array of byte-sized components.
1008 *
1009 * Applications should access this data via a uint8_t pointer.
1010 */
1011#define VDP_YCBCR_FORMAT_Y_U_V_444     ((VdpYCbCrFormat)7)
1012
1013/**
1014 * \brief  The set of all known RGB surface formats.
1015 */
1016typedef uint32_t VdpRGBAFormat;
1017
1018/**
1019 * \hideinitializer
1020 * \brief A packed RGB format.
1021 *
1022 * This format has a single plane.
1023 *
1024 * This plane is an array packed 32-bit pixel data. Within each
1025 * 32-bit pixel, bits [31:24] contain A, bits [23:16] contain R,
1026 * bits [15:8] contain G, and bits [7:0] contain B.
1027 *
1028 * Applications should access this data via a uint32_t pointer.
1029 */
1030#define VDP_RGBA_FORMAT_B8G8R8A8    ((VdpRGBAFormat)0)
1031/**
1032 * \hideinitializer
1033 * \brief A packed RGB format.
1034 *
1035 * This format has a single plane.
1036 *
1037 * This plane is an array packed 32-bit pixel data. Within each
1038 * 32-bit pixel, bits [31:24] contain A, bits [23:16] contain B,
1039 * bits [15:8] contain G, and bits [7:0] contain R.
1040 *
1041 * Applications should access this data via a uint32_t pointer.
1042 */
1043#define VDP_RGBA_FORMAT_R8G8B8A8    ((VdpRGBAFormat)1)
1044/**
1045 * \hideinitializer
1046 * \brief A packed RGB format.
1047 *
1048 * This format has a single plane.
1049 *
1050 * This plane is an array packed 32-bit pixel data. Within each
1051 * 32-bit pixel, bits [31:30] contain A, bits [29:20] contain B,
1052 * bits [19:10] contain G, and bits [9:0] contain R.
1053 *
1054 * Applications should access this data via a uint32_t pointer.
1055 */
1056#define VDP_RGBA_FORMAT_R10G10B10A2 ((VdpRGBAFormat)2)
1057/**
1058 * \hideinitializer
1059 * \brief A packed RGB format.
1060 *
1061 * This format has a single plane.
1062 *
1063 * This plane is an array packed 32-bit pixel data. Within each
1064 * 32-bit pixel, bits [31:30] contain A, bits [29:20] contain R,
1065 * bits [19:10] contain G, and bits [9:0] contain B.
1066 *
1067 * Applications should access this data via a uint32_t pointer.
1068 */
1069#define VDP_RGBA_FORMAT_B10G10R10A2 ((VdpRGBAFormat)3)
1070/**
1071 * \hideinitializer
1072 * \brief An alpha-only surface format.
1073 *
1074 * This format has a single plane.
1075 *
1076 * This plane is an array of byte-sized components.
1077 *
1078 * Applications should access this data via a uint8_t pointer.
1079 */
1080#define VDP_RGBA_FORMAT_A8          ((VdpRGBAFormat)4)
1081
1082/**
1083 * \brief  The set of all known indexed surface formats.
1084 */
1085typedef uint32_t VdpIndexedFormat;
1086
1087/**
1088 * \hideinitializer
1089 * \brief A 4-bit indexed format, with alpha.
1090 *
1091 * This format has a single plane.
1092 *
1093 * This plane is an array of byte-sized components. Within each
1094 * byte, bits [7:4] contain I (index), and bits [3:0] contain A.
1095 *
1096 * Applications should access this data via a uint8_t pointer.
1097 */
1098#define VDP_INDEXED_FORMAT_A4I4 ((VdpIndexedFormat)0)
1099/**
1100 * \hideinitializer
1101 * \brief A 4-bit indexed format, with alpha.
1102 *
1103 * This format has a single plane.
1104 *
1105 * This plane is an array of byte-sized components. Within each
1106 * byte, bits [7:4] contain A, and bits [3:0] contain I (index).
1107 *
1108 * Applications should access this data via a uint8_t pointer.
1109 */
1110#define VDP_INDEXED_FORMAT_I4A4 ((VdpIndexedFormat)1)
1111/**
1112 * \hideinitializer
1113 * \brief A 8-bit indexed format, with alpha.
1114 *
1115 * This format has a single plane.
1116 *
1117 * This plane is an array of interleaved byte-sized A and I
1118 * (index) components, in the order A, I, A, I.
1119 *
1120 * Applications should access this data via a uint8_t pointer.
1121 */
1122#define VDP_INDEXED_FORMAT_A8I8 ((VdpIndexedFormat)2)
1123/**
1124 * \hideinitializer
1125 * \brief A 8-bit indexed format, with alpha.
1126 *
1127 * This format has a single plane.
1128 *
1129 * This plane is an array of interleaved byte-sized A and I
1130 * (index) components, in the order I, A, I, A.
1131 *
1132 * Applications should access this data via a uint8_t pointer.
1133 */
1134#define VDP_INDEXED_FORMAT_I8A8 ((VdpIndexedFormat)3)
1135
1136/**
1137 * \brief A location within a surface.
1138 *
1139 * The VDPAU co-ordinate system has its origin at the top-left
1140 * of a surface, with x and y components increasing right and
1141 * down.
1142 */
1143typedef struct {
1144    /** X co-ordinate. */
1145    uint32_t x;
1146    /** Y co-ordinate. */
1147    uint32_t y;
1148} VdpPoint;
1149
1150/**
1151 * \brief A rectangular region of a surface.
1152 *
1153 * The co-ordinates are top-left inclusive, bottom-right
1154 * exclusive.
1155 *
1156 * The VDPAU co-ordinate system has its origin at the top-left
1157 * of a surface, with x and y components increasing right and
1158 * down.
1159 */
1160typedef struct {
1161    /** Left X co-ordinate. Inclusive. */
1162    uint32_t x0;
1163    /** Top Y co-ordinate. Inclusive. */
1164    uint32_t y0;
1165    /** Right X co-ordinate. Exclusive. */
1166    uint32_t x1;
1167    /** Bottom Y co-ordinate. Exclusive. */
1168    uint32_t y1;
1169} VdpRect;
1170
1171/**
1172 * A constant RGBA color.
1173 *
1174 * Note that the components are stored as float values in the
1175 * range 0.0...1.0 rather than format-specific integer values.
1176 * This allows VdpColor values to be independent from the exact
1177 * surface format(s) in use.
1178 */
1179typedef struct {
1180    float red;
1181    float green;
1182    float blue;
1183    float alpha;
1184} VdpColor;
1185
1186/*@}*/
1187
1188/**
1189 * \defgroup error_handling Error Handling
1190 *
1191 * @{
1192 */
1193
1194/**
1195 * \hideinitializer
1196 * \brief The set of all possible error codes.
1197 */
1198typedef enum {
1199    /** The operation completed successfully; no error. */
1200    VDP_STATUS_OK = 0,
1201    /**
1202     * No backend implementation could be loaded.
1203     */
1204    VDP_STATUS_NO_IMPLEMENTATION,
1205    /**
1206     * The display was preempted, or a fatal error occurred.
1207     *
1208     * The application must re-initialize VDPAU.
1209     */
1210    VDP_STATUS_DISPLAY_PREEMPTED,
1211    /**
1212     * An invalid handle value was provided.
1213     *
1214     * Either the handle does not exist at all, or refers to an object of an
1215     * incorrect type.
1216     */
1217    VDP_STATUS_INVALID_HANDLE,
1218    /**
1219     * An invalid pointer was provided.
1220     *
1221     * Typically, this means that a NULL pointer was provided for an "output"
1222     * parameter.
1223     */
1224    VDP_STATUS_INVALID_POINTER,
1225    /**
1226     * An invalid/unsupported \ref VdpChromaType value was supplied.
1227     */
1228    VDP_STATUS_INVALID_CHROMA_TYPE,
1229    /**
1230     * An invalid/unsupported \ref VdpYCbCrFormat value was supplied.
1231     */
1232    VDP_STATUS_INVALID_Y_CB_CR_FORMAT,
1233    /**
1234     * An invalid/unsupported \ref VdpRGBAFormat value was supplied.
1235     */
1236    VDP_STATUS_INVALID_RGBA_FORMAT,
1237    /**
1238     * An invalid/unsupported \ref VdpIndexedFormat value was supplied.
1239     */
1240    VDP_STATUS_INVALID_INDEXED_FORMAT,
1241    /**
1242     * An invalid/unsupported \ref VdpColorStandard value was supplied.
1243     */
1244    VDP_STATUS_INVALID_COLOR_STANDARD,
1245    /**
1246     * An invalid/unsupported \ref VdpColorTableFormat value was supplied.
1247     */
1248    VDP_STATUS_INVALID_COLOR_TABLE_FORMAT,
1249    /**
1250     * An invalid/unsupported \ref VdpOutputSurfaceRenderBlendFactor value was
1251     * supplied.
1252     */
1253    VDP_STATUS_INVALID_BLEND_FACTOR,
1254    /**
1255     * An invalid/unsupported \ref VdpOutputSurfaceRenderBlendEquation value
1256     * was supplied.
1257     */
1258    VDP_STATUS_INVALID_BLEND_EQUATION,
1259    /**
1260     * An invalid/unsupported flag value/combination was supplied.
1261     */
1262    VDP_STATUS_INVALID_FLAG,
1263    /**
1264     * An invalid/unsupported \ref VdpDecoderProfile value was supplied.
1265     */
1266    VDP_STATUS_INVALID_DECODER_PROFILE,
1267    /**
1268     * An invalid/unsupported \ref VdpVideoMixerFeature value was supplied.
1269     */
1270    VDP_STATUS_INVALID_VIDEO_MIXER_FEATURE,
1271    /**
1272     * An invalid/unsupported \ref VdpVideoMixerParameter value was supplied.
1273     */
1274    VDP_STATUS_INVALID_VIDEO_MIXER_PARAMETER,
1275    /**
1276     * An invalid/unsupported \ref VdpVideoMixerAttribute value was supplied.
1277     */
1278    VDP_STATUS_INVALID_VIDEO_MIXER_ATTRIBUTE,
1279    /**
1280     * An invalid/unsupported \ref VdpVideoMixerPictureStructure value was
1281     * supplied.
1282     */
1283    VDP_STATUS_INVALID_VIDEO_MIXER_PICTURE_STRUCTURE,
1284    /**
1285     * An invalid/unsupported \ref VdpFuncId value was supplied.
1286     */
1287    VDP_STATUS_INVALID_FUNC_ID,
1288    /**
1289     * The size of a supplied object does not match the object it is being
1290     * used with.
1291     *
1292     * For example, a \ref VdpVideoMixer "VdpVideoMixer" is configured to
1293     * process \ref VdpVideoSurface "VdpVideoSurface" objects of a specific
1294     * size. If presented with a \ref VdpVideoSurface "VdpVideoSurface" of a
1295     * different size, this error will be raised.
1296     */
1297    VDP_STATUS_INVALID_SIZE,
1298    /**
1299     * An invalid/unsupported value was supplied.
1300     *
1301     * This is a catch-all error code for values of type other than those
1302     * with a specific error code.
1303     */
1304    VDP_STATUS_INVALID_VALUE,
1305    /**
1306     * An invalid/unsupported structure version was specified in a versioned
1307     * structure. This implies that the implementation is older than the
1308     * header file the application was built against.
1309     */
1310    VDP_STATUS_INVALID_STRUCT_VERSION,
1311    /**
1312     * The system does not have enough resources to complete the requested
1313     * operation at this time.
1314     */
1315    VDP_STATUS_RESOURCES,
1316    /**
1317     * The set of handles supplied are not all related to the same VdpDevice.
1318     *
1319     * When performing operations that operate on multiple surfaces, such as
1320     * \ref  VdpOutputSurfaceRenderOutputSurface or \ref VdpVideoMixerRender,
1321     * all supplied surfaces must have been created within the context of the
1322     * same \ref VdpDevice "VdpDevice" object. This error is raised if they were
1323     * not.
1324     */
1325    VDP_STATUS_HANDLE_DEVICE_MISMATCH,
1326    /**
1327     * A catch-all error, used when no other error code applies.
1328     */
1329    VDP_STATUS_ERROR,
1330} VdpStatus;
1331
1332/**
1333 * \brief Retrieve a string describing an error code.
1334 * \param[in] status The error code.
1335 * \return A pointer to the string. Note that this is a
1336 *       statically allocated read-only string. As such, the
1337 *       application must not free the returned pointer. The
1338 *       pointer is valid as long as the VDPAU implementation is
1339 *       present within the application's address space.
1340 */
1341typedef char const * VdpGetErrorString(
1342    VdpStatus status
1343);
1344
1345/*@}*/
1346
1347/**
1348 * \defgroup versioning Versioning
1349 *
1350 *
1351 * @{
1352 */
1353
1354/**
1355 * \brief The VDPAU interface version described by this header file.
1356 *
1357 * This version will only increase if a major incompatible change is made.
1358 * For example, if the parameters passed to an existing function are modified,
1359 * rather than simply adding new functions/enumerations), or if the mechanism
1360 * used to load the backend driver is modified incompatibly. Such changes are
1361 * unlikely.
1362 *
1363 * This value also represents the DSO version of VDPAU-related
1364 * shared-libraries.
1365 *
1366 * VDPAU version numbers are simple integers that increase monotonically
1367 * (typically by value 1).
1368 */
1369#define VDPAU_INTERFACE_VERSION 1
1370
1371/**
1372 * \brief The VDPAU version described by this header file.
1373 *
1374 * This version will increase whenever any non-documentation change is made to
1375 * vdpau.h, or related header files such as vdpau_x11.h. Such changes
1376 * typically involve the addition of new functions, constants, or features.
1377 * Such changes are expected to be completely backwards-compatible.
1378 *
1379 * VDPAU version numbers are simple integers that increase monotonically
1380 * (typically by value 1).
1381 */
1382#define VDPAU_VERSION 1
1383
1384/**
1385 * \brief Retrieve the VDPAU version implemented by the backend.
1386 * \param[out] api_version The API version.
1387 * \return VdpStatus The completion status of the operation.
1388 */
1389typedef VdpStatus VdpGetApiVersion(
1390    /* output parameters follow */
1391    uint32_t * api_version
1392);
1393
1394/**
1395 * \brief Retrieve an implementation-specific string description
1396 *        of the implementation. This typically includes detailed version
1397 *        information.
1398 * \param[out] information_string A pointer to the information
1399 *       string. Note that this is a statically allocated
1400 *       read-only string. As such, the application must not
1401 *       free the returned pointer. The pointer is valid as long
1402 *       as the implementation is present within the
1403 *       application's address space.
1404 * \return VdpStatus The completion status of the operation.
1405 *
1406 * Note that the returned string is useful for information
1407 * reporting. It is not intended that the application should
1408 * parse this string in order to determine any information about
1409 * the implementation.
1410 */
1411typedef VdpStatus VdpGetInformationString(
1412    /* output parameters follow */
1413    char const * * information_string
1414);
1415
1416/*@}*/
1417
1418/**
1419 * \defgroup VdpDevice VdpDevice; Primary API object
1420 *
1421 * The VdpDevice is the root of the VDPAU object system. Using a
1422 * VdpDevice object, all other object types may be created. See
1423 * the sections describing those other object types for details
1424 * on object creation.
1425 *
1426 * Note that VdpDevice objects are created using the \ref
1427 * api_winsys.
1428 *
1429 * @{
1430 */
1431
1432/**
1433 * \brief  An opaque handle representing a VdpDevice object.
1434 */
1435typedef uint32_t VdpDevice;
1436
1437/**
1438 * \brief Destroy a VdpDevice.
1439 * \param[in] device The device to destroy.
1440 * \return VdpStatus The completion status of the operation.
1441 */
1442typedef VdpStatus VdpDeviceDestroy(
1443    VdpDevice device
1444);
1445
1446/*@}*/
1447
1448/**
1449 * \defgroup VdpCSCMatrix VdpCSCMatrix; CSC Matrix Manipulation
1450 *
1451 * When converting from YCbCr to RGB data formats, a color space
1452 * conversion operation must be performed. This operation is
1453 * parameterized using a "color space conversion matrix". The
1454 * VdpCSCMatrix is a data structure representing this
1455 * information.
1456 *
1457 * @{
1458 */
1459
1460/**
1461 * \brief Storage for a color space conversion matrix.
1462 *
1463 * Note that the application may choose to construct the matrix
1464 * content by either:
1465 * - Directly filling in the fields of the CSC matrix
1466 * - Using the \ref VdpGenerateCSCMatrix helper function.
1467 *
1468 * The color space conversion equation is as follows:
1469 *
1470 * \f[
1471 * \left( \begin{array}{c} R \\ G \\ B \end{array} \right)
1472 * =
1473 * \left( \begin{array}{cccc}
1474 * m_{0,0} & m_{0,1} & m_{0,2} & m_{0,3} \\
1475 * m_{1,0} & m_{1,1} & m_{1,2} & m_{1,3} \\
1476 * m_{2,0} & m_{2,1} & m_{2,2} & m_{2,3}
1477 * \end{array}
1478 * \right)
1479 * *
1480 * \left( \begin{array}{c} Y \\ Cb \\ Cr \\ 1.0 \end{array}
1481 *      \right)
1482 * \f]
1483 */
1484typedef float VdpCSCMatrix[3][4];
1485
1486#define VDP_PROCAMP_VERSION 0
1487
1488/**
1489 * \brief Procamp operation parameterization data.
1490 *
1491 * When performing a color space conversion operation, various
1492 * adjustments can be performed at the same time, such as
1493 * brightness and contrast. This structure defines the level of
1494 * adjustments to make.
1495 */
1496typedef struct {
1497    /**
1498     * This field must be filled with VDP_PROCAMP_VERSION
1499     */
1500    uint32_t struct_version;
1501    /**
1502     * Brightness adjustment amount. A value clamped between
1503     * -1.0 and 1.0. 0.0 represents no modification.
1504     */
1505    float brightness;
1506    /**
1507     * Contrast adjustment amount. A value clamped between
1508     * 0.0 and 10.0. 1.0 represents no modification.
1509     */
1510    float contrast;
1511    /**
1512     * Saturation adjustment amount. A value clamped between 0.0 and
1513     * 10.0. 1.0 represents no modification.
1514     */
1515    float saturation;
1516    /**
1517     * Hue adjustment amount. A value clamped between
1518     * -PI and PI. 0.0 represents no modification.
1519     */
1520    float hue;
1521} VdpProcamp;
1522
1523/**
1524 * \brief YCbCr color space specification.
1525 *
1526 * A number of YCbCr color spaces exist. This enumeration
1527 * defines the specifications known to VDPAU.
1528 */
1529typedef uint32_t VdpColorStandard;
1530
1531/** \hideinitializer \brief ITU-R BT.601 */
1532#define VDP_COLOR_STANDARD_ITUR_BT_601 ((VdpColorStandard)0)
1533/** \hideinitializer \brief ITU-R BT.709 */
1534#define VDP_COLOR_STANDARD_ITUR_BT_709 ((VdpColorStandard)1)
1535/** \hideinitializer \brief SMPTE-240M */
1536#define VDP_COLOR_STANDARD_SMPTE_240M  ((VdpColorStandard)2)
1537
1538/**
1539 * \brief Generate a color space conversion matrix
1540 * \param[in] procamp The procamp adjustments to make. If NULL,
1541 *        no adjustments will be made.
1542 * \param[in] standard The YCbCr color space to convert from.
1543 * \param[out] csc_matrix The CSC matrix to initialize.
1544 * \return VdpStatus The completion status of the operation.
1545 */
1546typedef VdpStatus VdpGenerateCSCMatrix(
1547    VdpProcamp *     procamp,
1548    VdpColorStandard standard,
1549    /* output parameters follow */
1550    VdpCSCMatrix *   csc_matrix
1551);
1552
1553/*@}*/
1554
1555/**
1556 * \defgroup VdpVideoSurface VdpVideoSurface; Video Surface object
1557 *
1558 * A VdpVideoSurface stores YCbCr data in an internal format,
1559 * with a variety of possible chroma sub-sampling options.
1560 *
1561 * A VdpVideoSurface may be filled with:
1562 * - Data provided by the CPU via \ref
1563 *   VdpVideoSurfacePutBitsYCbCr (i.e. software decode.)
1564 * - The result of applying a \ref VdpDecoder "VdpDecoder" to
1565 *   compressed video data.
1566 *
1567 * VdpVideoSurface content may be accessed by:
1568 * - The application via \ref VdpVideoSurfaceGetBitsYCbCr
1569 * - The Hardware that implements \ref VdpOutputSurface
1570 *   "VdpOutputSurface" \ref VdpOutputSurfaceRender
1571 *   "rendering functionality".
1572 * - The Hardware the implements \ref VdpVideoMixer
1573 *   "VdpVideoMixer" functionality.
1574 *
1575 * VdpVideoSurfaces are not directly displayable. They must be
1576 * converted into a displayable format using \ref VdpVideoMixer
1577 * "VdpVideoMixer" objects.
1578 *
1579 * See \ref video_mixer_usage for additional information.
1580 *
1581 * @{
1582 */
1583
1584/**
1585 * \brief Query the implementation's VdpVideoSurface
1586 *        capabilities.
1587 * \param[in] device The device to query.
1588 * \param[in] surface_chroma_type The type of chroma type for
1589 *       which information is requested.
1590 * \param[out] is_supported Is this chroma type supported?
1591 * \param[out] max_width The maximum supported surface width for
1592 *       this chroma type.
1593 * \param[out] max_height The maximum supported surface height
1594 *       for this chroma type.
1595 * \return VdpStatus The completion status of the operation.
1596 */
1597typedef VdpStatus VdpVideoSurfaceQueryCapabilities(
1598    VdpDevice     device,
1599    VdpChromaType surface_chroma_type,
1600    /* output parameters follow */
1601    VdpBool *     is_supported,
1602    uint32_t *    max_width,
1603    uint32_t *    max_height
1604);
1605
1606/**
1607 * \brief Query the implementation's VdpVideoSurface
1608 *        GetBits/PutBits capabilities.
1609 * \param[in] device The device to query.
1610 * \param[in] surface_chroma_type The type of chroma type for
1611 *       which information is requested.
1612 * \param[in] bits_ycbcr_format The format of application "bits"
1613 *       buffer for which information is requested.
1614 * \param[out] is_supported Is this chroma type supported?
1615 * \return VdpStatus The completion status of the operation.
1616 */
1617typedef VdpStatus VdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities(
1618    VdpDevice      device,
1619    VdpChromaType  surface_chroma_type,
1620    VdpYCbCrFormat bits_ycbcr_format,
1621    /* output parameters follow */
1622    VdpBool *      is_supported
1623);
1624
1625/**
1626 * \brief An opaque handle representing a VdpVideoSurface
1627 *        object.
1628 */
1629typedef uint32_t VdpVideoSurface;
1630
1631/**
1632 * \brief Create a VdpVideoSurface.
1633 * \param[in] device The device that will contain the surface.
1634 * \param[in] chroma_type The chroma type of the new surface.
1635 * \param[in] width The width of the new surface.
1636 * \param[in] height The height of the new surface.
1637 * \param[out] surface The new surface's handle.
1638 * \return VdpStatus The completion status of the operation.
1639 *
1640 * The memory backing the surface may not be initialized during
1641 * creation. Applications are expected to initialize any region
1642 * that they use, via \ref VdpDecoderRender or \ref
1643 * VdpVideoSurfacePutBitsYCbCr.
1644 *
1645 * Note that certain widths/heights are impossible for specific values of
1646 * chroma_type. For example, the definition of VDP_CHROMA_TYPE_420 implies
1647 * that the width must be even, since each single chroma sample covers two
1648 * luma samples horizontally. A similar argument applies to surface heights,
1649 * although doubly so, since interlaced pictures must be supported; each
1650 * field's height must itself be a multiple of 2. Hence the overall surface's
1651 * height must be a multiple of 4.
1652 *
1653 * Similar rules apply to other chroma_type values.
1654 *
1655 * Implementations may also impose additional restrictions on the surface
1656 * sizes they support, potentially requiring additional rounding of actual
1657 * surface sizes.
1658 *
1659 * In most cases, this is not an issue, since:
1660 * - Video streams are encoded as an array of macro-blocks, which typically
1661 *   have larger size alignment requirements than video surfaces do.
1662 * - APIs such as \ref VdpVideoMixerRender allow specification of a sub-region
1663 *   of the surface to read, which allows the padding data to be clipped away.
1664 *
1665 * However, other APIs such as \ref VdpVideoSurfaceGetBitsYCbCr and
1666 * \ref VdpVideoSurfacePutBitsYCbCr do not allow a sub-region to be specified,
1667 * and always operate on surface size that was actually allocated, rather
1668 * than the surface size that was requested. In this case, applications need
1669 * to be aware of the actual surface size, in order to allocate appropriately
1670 * sized buffers for the get-/put-bits operations.
1671 *
1672 * For this reason, applications may need to call
1673 * \ref VdpVideoSurfaceGetParameters after creation, in order to retrieve the
1674 * actual surface size.
1675 */
1676typedef VdpStatus VdpVideoSurfaceCreate(
1677    VdpDevice         device,
1678    VdpChromaType     chroma_type,
1679    uint32_t          width,
1680    uint32_t          height,
1681    /* output parameters follow */
1682    VdpVideoSurface * surface
1683);
1684
1685/**
1686 * \brief Destroy a VdpVideoSurface.
1687 * \param[in] surface The surface's handle.
1688 * \return VdpStatus The completion status of the operation.
1689 */
1690typedef VdpStatus VdpVideoSurfaceDestroy(
1691    VdpVideoSurface surface
1692);
1693
1694/**
1695 * \brief Retrieve the parameters used to create a
1696 *        VdpVideoSurface.
1697 * \param[in] surface The surface's handle.
1698 * \param[out] chroma_type The chroma type of the surface.
1699 * \param[out] width The width of the surface.
1700 * \param[out] height The height of the surface.
1701 * \return VdpStatus The completion status of the operation.
1702 */
1703typedef VdpStatus VdpVideoSurfaceGetParameters(
1704    VdpVideoSurface surface,
1705    /* output parameters follow */
1706    VdpChromaType * chroma_type,
1707    uint32_t *      width,
1708    uint32_t *      height
1709);
1710
1711/**
1712 * \brief Copy image data from a VdpVideoSurface to application
1713 *        memory in a specified YCbCr format.
1714 * \param[in] surface The surface's handle.
1715 * \param[in] destination_ycbcr_format The format of the
1716 *       application's data buffers.
1717 * \param[in] destination_data Pointers to the application data
1718 *       buffers into which the image data will be written. Note
1719 *       that this is an array of pointers, one per plane. The
1720 *       destination_format parameter will define how many
1721 *       planes are required.
1722 * \param[in] destination_pitches Pointers to the pitch values
1723 *       for the application data buffers. Note that this is an
1724 *       array of pointers, one per plane. The
1725 *       destination_format parameter will define how many
1726 *       planes are required.
1727 * \return VdpStatus The completion status of the operation.
1728 */
1729typedef VdpStatus VdpVideoSurfaceGetBitsYCbCr(
1730    VdpVideoSurface  surface,
1731    VdpYCbCrFormat   destination_ycbcr_format,
1732    void * const *   destination_data,
1733    uint32_t const * destination_pitches
1734);
1735
1736/**
1737 * \brief Copy image data from application memory in a specific
1738 *        YCbCr format to a VdpVideoSurface.
1739 * \param[in] surface The surface's handle.
1740 * \param[in] source_ycbcr_format The format of the
1741 *       application's data buffers.
1742 * \param[in] source_data Pointers to the application data
1743 *       buffers from which the image data will be copied. Note
1744 *       that this is an array of pointers, one per plane. The
1745 *       source_format parameter will define how many
1746 *       planes are required.
1747 * \param[in] source_pitches Pointers to the pitch values
1748 *       for the application data buffers. Note that this is an
1749 *       array of pointers, one per plane. The
1750 *       source_format parameter will define how many
1751 *       planes are required.
1752 * \return VdpStatus The completion status of the operation.
1753 */
1754typedef VdpStatus VdpVideoSurfacePutBitsYCbCr(
1755    VdpVideoSurface      surface,
1756    VdpYCbCrFormat       source_ycbcr_format,
1757    void const * const * source_data,
1758    uint32_t const *     source_pitches
1759);
1760
1761/*@}*/
1762
1763/**
1764 * \defgroup VdpOutputSurface VdpOutputSurface; Output Surface \
1765 * object
1766 *
1767 * A VdpOutputSurface stores RGBA data in a defined format.
1768 *
1769 * A VdpOutputSurface may be filled with:
1770 * - Data provided by the CPU via the various
1771 *   VdpOutputSurfacePutBits functions.
1772 * - Using the VdpOutputSurface \ref VdpOutputSurfaceRender
1773 *   "rendering functionality".
1774 * - Using a \ref VdpVideoMixer "VdpVideoMixer" object.
1775 *
1776 * VdpOutputSurface content may be accessed by:
1777 * - The application via the various VdpOutputSurfaceGetBits
1778 *   functions.
1779 * - The Hardware that implements VdpOutputSurface
1780 *   \ref VdpOutputSurfaceRender "rendering functionality".
1781 * - The Hardware the implements \ref VdpVideoMixer
1782 *   "VdpVideoMixer" functionality.
1783 * - The Hardware that implements \ref VdpPresentationQueue
1784 *   "VdpPresentationQueue" functionality,
1785 *
1786 * VdpOutputSurfaces are directly displayable using a \ref
1787 * VdpPresentationQueue "VdpPresentationQueue" object.
1788 *
1789 * @{
1790 */
1791
1792/**
1793 * \brief The set of all known color table formats, for use with
1794 * \ref VdpOutputSurfacePutBitsIndexed.
1795 */
1796typedef uint32_t VdpColorTableFormat;
1797
1798/**
1799 * \hideinitializer
1800 * \brief 8-bit per component packed into 32-bits
1801 *
1802 * This format is an array of packed 32-bit RGB color values.
1803 * Bits [31:24] are unused, bits [23:16] contain R, bits [15:8]
1804 * contain G, and bits [7:0] contain B. Note: The format is
1805 * physically an array of uint32_t values, and should be accessed
1806 * as such by the application in order to avoid endianness
1807 * issues.
1808 */
1809#define VDP_COLOR_TABLE_FORMAT_B8G8R8X8 ((VdpColorTableFormat)0)
1810
1811/**
1812 * \brief Query the implementation's VdpOutputSurface
1813 *        capabilities.
1814 * \param[in] device The device to query.
1815 * \param[in] surface_rgba_format The surface format for
1816 *       which information is requested.
1817 * \param[out] is_supported Is this surface format supported?
1818 * \param[out] max_width The maximum supported surface width for
1819 *       this chroma type.
1820 * \param[out] max_height The maximum supported surface height
1821 *       for this chroma type.
1822 * \return VdpStatus The completion status of the operation.
1823 */
1824typedef VdpStatus VdpOutputSurfaceQueryCapabilities(
1825    VdpDevice     device,
1826    VdpRGBAFormat surface_rgba_format,
1827    /* output parameters follow */
1828    VdpBool *     is_supported,
1829    uint32_t *    max_width,
1830    uint32_t *    max_height
1831);
1832
1833/**
1834 * \brief Query the implementation's capability to perform a
1835 *        PutBits operation using application data matching the
1836 *        surface's format.
1837 * \param[in] device The device to query.
1838 * \param[in] surface_rgba_format The surface format for
1839 *       which information is requested.
1840 * \param[out] is_supported Is this surface format supported?
1841 * \return VdpStatus The completion status of the operation.
1842 */
1843typedef VdpStatus VdpOutputSurfaceQueryGetPutBitsNativeCapabilities(
1844    VdpDevice     device,
1845    VdpRGBAFormat surface_rgba_format,
1846    /* output parameters follow */
1847    VdpBool *     is_supported
1848);
1849
1850/**
1851 * \brief Query the implementation's capability to perform a
1852 *        PutBits operation using application data in a specific
1853 *        indexed format.
1854 * \param[in] device The device to query.
1855 * \param[in] surface_rgba_format The surface format for
1856 *       which information is requested.
1857 * \param[in] bits_indexed_format The format of the application
1858 *       data buffer.
1859 * \param[in] color_table_format The format of the color lookup
1860 *       table.
1861 * \param[out] is_supported Is this surface format supported?
1862 * \return VdpStatus The completion status of the operation.
1863 */
1864typedef VdpStatus VdpOutputSurfaceQueryPutBitsIndexedCapabilities(
1865    VdpDevice           device,
1866    VdpRGBAFormat       surface_rgba_format,
1867    VdpIndexedFormat    bits_indexed_format,
1868    VdpColorTableFormat color_table_format,
1869    /* output parameters follow */
1870    VdpBool *           is_supported
1871);
1872
1873/**
1874 * \brief Query the implementation's capability to perform a
1875 *        PutBits operation using application data in a specific
1876 *        YCbCr/YUB format.
1877 * \param[in] device The device to query.
1878 * \param[in] surface_rgba_format The surface format for which
1879 *       information is requested.
1880 * \param[in] bits_ycbcr_format The format of the application
1881 *       data buffer.
1882 * \param[out] is_supported Is this surface format supported?
1883 * \return VdpStatus The completion status of the operation.
1884 */
1885typedef VdpStatus VdpOutputSurfaceQueryPutBitsYCbCrCapabilities(
1886    VdpDevice      device,
1887    VdpRGBAFormat  surface_rgba_format,
1888    VdpYCbCrFormat bits_ycbcr_format,
1889    /* output parameters follow */
1890    VdpBool *      is_supported
1891);
1892
1893/**
1894 * \brief An opaque handle representing a VdpOutputSurface
1895 *        object.
1896 */
1897typedef uint32_t VdpOutputSurface;
1898
1899/**
1900 * \brief Create a VdpOutputSurface.
1901 * \param[in] device The device that will contain the surface.
1902 * \param[in] rgba_format The format of the new surface.
1903 * \param[in] width The width of the new surface.
1904 * \param[in] height The height of the new surface.
1905 * \param[out] surface The new surface's handle.
1906 * \return VdpStatus The completion status of the operation.
1907 *
1908 * The memory backing the surface will be initialized to 0 color
1909 * and 0 alpha (i.e. black.)
1910 */
1911typedef VdpStatus VdpOutputSurfaceCreate(
1912    VdpDevice          device,
1913    VdpRGBAFormat      rgba_format,
1914    uint32_t           width,
1915    uint32_t           height,
1916    /* output parameters follow */
1917    VdpOutputSurface * surface
1918);
1919
1920/**
1921 * \brief Destroy a VdpOutputSurface.
1922 * \param[in] surface The surface's handle.
1923 * \return VdpStatus The completion status of the operation.
1924 */
1925typedef VdpStatus VdpOutputSurfaceDestroy(
1926    VdpOutputSurface surface
1927);
1928
1929/**
1930 * \brief Retrieve the parameters used to create a
1931 *        VdpOutputSurface.
1932 * \param[in] surface The surface's handle.
1933 * \param[out] rgba_format The format of the surface.
1934 * \param[out] width The width of the surface.
1935 * \param[out] height The height of the surface.
1936 * \return VdpStatus The completion status of the operation.
1937 */
1938typedef VdpStatus VdpOutputSurfaceGetParameters(
1939    VdpOutputSurface surface,
1940    /* output parameters follow */
1941    VdpRGBAFormat *  rgba_format,
1942    uint32_t *       width,
1943    uint32_t *       height
1944);
1945
1946/**
1947 * \brief Copy image data from a VdpOutputSurface to application
1948 *        memory in the surface's native format.
1949 * \param[in] surface The surface's handle.
1950 * \param[in] source_rect The sub-rectangle of the source
1951 *       surface to copy. If NULL, the entire surface will be
1952 *       retrieved.
1953 * \param[in] destination_data Pointers to the application data
1954 *       buffers into which the image data will be written. Note
1955 *       that this is an array of pointers, one per plane. The
1956 *       destination_format parameter will define how many
1957 *       planes are required.
1958 * \param[in] destination_pitches Pointers to the pitch values
1959 *       for the application data buffers. Note that this is an
1960 *       array of pointers, one per plane. The
1961 *       destination_format parameter will define how many
1962 *       planes are required.
1963 * \return VdpStatus The completion status of the operation.
1964 */
1965typedef VdpStatus VdpOutputSurfaceGetBitsNative(
1966    VdpOutputSurface surface,
1967    VdpRect const *  source_rect,
1968    void * const *   destination_data,
1969    uint32_t const * destination_pitches
1970);
1971
1972/**
1973 * \brief Copy image data from application memory in the
1974 *        surface's native format to a VdpOutputSurface.
1975 * \param[in] surface The surface's handle.
1976 * \param[in] source_data Pointers to the application data
1977 *       buffers from which the image data will be copied. Note
1978 *       that this is an array of pointers, one per plane. The
1979 *       source_format parameter will define how many
1980 *       planes are required.
1981 * \param[in] source_pitches Pointers to the pitch values
1982 *       for the application data buffers. Note that this is an
1983 *       array of pointers, one per plane. The
1984 *       source_format parameter will define how many
1985 *       planes are required.
1986 * \param[in] destination_rect The sub-rectangle of the surface
1987 *       to fill with application data. If NULL, the entire
1988 *       surface will be updated.
1989 * \return VdpStatus The completion status of the operation.
1990 */
1991typedef VdpStatus VdpOutputSurfacePutBitsNative(
1992    VdpOutputSurface     surface,
1993    void const * const * source_data,
1994    uint32_t const *     source_pitches,
1995    VdpRect const *      destination_rect
1996);
1997
1998/**
1999 * \brief Copy image data from application memory in a specific
2000 *        indexed format to a VdpOutputSurface.
2001 * \param[in] surface The surface's handle.
2002 * \param[in] source_indexed_format The format of the
2003 *       application's data buffers.
2004 * \param[in] source_data Pointers to the application data
2005 *       buffers from which the image data will be copied. Note
2006 *       that this is an array of pointers, one per plane. The
2007 *       source_indexed_format parameter will define how many
2008 *       planes are required.
2009 * \param[in] source_pitches Pointers to the pitch values
2010 *       for the application data buffers. Note that this is an
2011 *       array of pointers, one per plane. The
2012 *       source_indexed_format parameter will define how many
2013 *       planes are required.
2014 * \param[in] destination_rect The sub-rectangle of the surface
2015 *       to fill with application data. If NULL, the entire
2016 *       surface will be updated.
2017 * \param[in] color_table_format The format of the color_table.
2018 * \param[in] color_table A table that maps between source index
2019 *       and target color data. See \ref VdpColorTableFormat for
2020 *       details regarding the memory layout.
2021 * \return VdpStatus The completion status of the operation.
2022 */
2023typedef VdpStatus VdpOutputSurfacePutBitsIndexed(
2024    VdpOutputSurface     surface,
2025    VdpIndexedFormat     source_indexed_format,
2026    void const * const * source_data,
2027    uint32_t const *     source_pitch,
2028    VdpRect const *      destination_rect,
2029    VdpColorTableFormat  color_table_format,
2030    void const *         color_table
2031);
2032
2033/**
2034 * \brief Copy image data from application memory in a specific
2035 *        YCbCr format to a VdpOutputSurface.
2036 * \param[in] surface The surface's handle.
2037 * \param[in] source_ycbcr_format The format of the
2038 *       application's data buffers.
2039 * \param[in] source_data Pointers to the application data
2040 *       buffers from which the image data will be copied. Note
2041 *       that this is an array of pointers, one per plane. The
2042 *       source_ycbcr_format parameter will define how many
2043 *       planes are required.
2044 * \param[in] source_pitches Pointers to the pitch values
2045 *       for the application data buffers. Note that this is an
2046 *       array of pointers, one per plane. The
2047 *       source_ycbcr_format parameter will define how many
2048 *       planes are required.
2049 * \param[in] destination_rect The sub-rectangle of the surface
2050 *       to fill with application data. If NULL, the entire
2051 *       surface will be updated.
2052 * \param[in] csc_matrix The color space conversion matrix used
2053 *       by the copy operation. If NULL, a default matrix will
2054 *       be used internally. Th default matrix is equivalent to
2055 *       ITU-R BT.601 with no procamp changes.
2056 * \return VdpStatus The completion status of the operation.
2057 */
2058typedef VdpStatus VdpOutputSurfacePutBitsYCbCr(
2059    VdpOutputSurface     surface,
2060    VdpYCbCrFormat       source_ycbcr_format,
2061    void const * const * source_data,
2062    uint32_t const *     source_pitches,
2063    VdpRect const *      destination_rect,
2064    VdpCSCMatrix const * csc_matrix
2065);
2066
2067/*@}*/
2068
2069/**
2070 * \defgroup VdpBitmapSurface VdpBitmapSurface; Bitmap Surface \
2071 * object
2072 *
2073 * A VdpBitmapSurface stores RGBA data in a defined format.
2074 *
2075 * A VdpBitmapSurface may be filled with:
2076 * - Data provided by the CPU via the \ref
2077 *   VdpBitmapSurfacePutBitsNative function.
2078 *
2079 * VdpBitmapSurface content may be accessed by:
2080 * - The Hardware that implements \ref VdpOutputSurface
2081 *   "VdpOutputSurface" \ref VdpOutputSurfaceRender
2082 *   "rendering functionality"
2083 *
2084 * VdpBitmapSurface objects are intended to store static read-only data, such
2085 * as font glyphs, and the bitmaps used to compose an applications'
2086 * user-interface.
2087 *
2088 * The primary differences between VdpBitmapSurfaces and
2089 * \ref VdpOutputSurface "VdpOutputSurface"s are:
2090 *
2091 * - You cannot render to a VdpBitmapSurface, just upload native data via
2092 *   the PutBits API.
2093 *
2094 * - The read-only nature of a VdpBitmapSurface gives the implementation more
2095 *   flexibility in its choice of data storage location for the bitmap data.
2096 *   For example, some implementations may choose to store some/all
2097 *   VdpBitmapSurface objects in system memory to relieve GPU memory pressure.
2098 *
2099 * - VdpBitmapSurface and VdpOutputSurface may support different subsets of all
2100 *   known RGBA formats.
2101 *
2102 * @{
2103 */
2104
2105/**
2106 * \brief Query the implementation's VdpBitmapSurface
2107 *        capabilities.
2108 * \param[in] device The device to query.
2109 * \param[in] surface_rgba_format The surface format for
2110 *       which information is requested.
2111 * \param[out] is_supported Is this surface format supported?
2112 * \param[out] max_width The maximum supported surface width for
2113 *       this chroma type.
2114 * \param[out] max_height The maximum supported surface height
2115 *       for this chroma type.
2116 * \return VdpStatus The completion status of the operation.
2117 */
2118typedef VdpStatus VdpBitmapSurfaceQueryCapabilities(
2119    VdpDevice     device,
2120    VdpRGBAFormat surface_rgba_format,
2121    /* output parameters follow */
2122    VdpBool *     is_supported,
2123    uint32_t *    max_width,
2124    uint32_t *    max_height
2125);
2126
2127/**
2128 * \brief An opaque handle representing a VdpBitmapSurface
2129 *        object.
2130 */
2131typedef uint32_t VdpBitmapSurface;
2132
2133/**
2134 * \brief Create a VdpBitmapSurface.
2135 * \param[in] device The device that will contain the surface.
2136 * \param[in] rgba_format The format of the new surface.
2137 * \param[in] width The width of the new surface.
2138 * \param[in] height The height of the new surface.
2139 * \param[in] frequently_accessed Is this bitmap used
2140 *       frequently, or infrequently, by compositing options?
2141 *       Implementations may use this as a hint to determine how
2142 *       to allocate the underlying storage for the surface.
2143 * \param[out] surface The new surface's handle.
2144 * \return VdpStatus The completion status of the operation.
2145 *
2146 * The memory backing the surface may not be initialized
2147 * during creation. Applications are expected initialize any
2148 * region that they use, via \ref VdpBitmapSurfacePutBitsNative.
2149 */
2150typedef VdpStatus VdpBitmapSurfaceCreate(
2151    VdpDevice          device,
2152    VdpRGBAFormat      rgba_format,
2153    uint32_t           width,
2154    uint32_t           height,
2155    VdpBool            frequently_accessed,
2156    /* output parameters follow */
2157    VdpBitmapSurface * surface
2158);
2159
2160/**
2161 * \brief Destroy a VdpBitmapSurface.
2162 * \param[in] surface The surface's handle.
2163 * \return VdpStatus The completion status of the operation.
2164 */
2165typedef VdpStatus VdpBitmapSurfaceDestroy(
2166    VdpBitmapSurface surface
2167);
2168
2169/**
2170 * \brief Retrieve the parameters used to create a
2171 *        VdpBitmapSurface.
2172 * \param[in] surface The surface's handle.
2173 * \param[out] rgba_format The format of the surface.
2174 * \param[out] width The width of the surface.
2175 * \param[out] height The height of the surface.
2176 * \param[out] frequently_accessed The frequently_accessed state
2177 *       of the surface.
2178 * \return VdpStatus The completion status of the operation.
2179 */
2180typedef VdpStatus VdpBitmapSurfaceGetParameters(
2181    VdpBitmapSurface surface,
2182    /* output parameters follow */
2183    VdpRGBAFormat *  rgba_format,
2184    uint32_t *       width,
2185    uint32_t *       height,
2186    VdpBool *        frequently_accessed
2187);
2188
2189/**
2190 * \brief Copy image data from application memory in the
2191 *        surface's native format to a VdpBitmapSurface.
2192 * \param[in] surface The surface's handle.
2193 * \param[in] source_data Pointers to the application data
2194 *       buffers from which the image data will be copied. Note
2195 *       that this is an array of pointers, one per plane. The
2196 *       source_format parameter will define how many
2197 *       planes are required.
2198 * \param[in] source_pitches Pointers to the pitch values
2199 *       for the application data buffers. Note that this is an
2200 *       array of pointers, one per plane. The
2201 *       source_format parameter will define how many
2202 *       planes are required.
2203 * \param[in] destination_rect The sub-rectangle of the surface
2204 *       to fill with application data. If NULL, the entire
2205 *       surface will be updated.
2206 * \return VdpStatus The completion status of the operation.
2207 */
2208typedef VdpStatus VdpBitmapSurfacePutBitsNative(
2209    VdpBitmapSurface     surface,
2210    void const * const * source_data,
2211    uint32_t const *     source_pitches,
2212    VdpRect const *      destination_rect
2213);
2214
2215/*@}*/
2216
2217/**
2218 * \defgroup VdpOutputSurfaceRender VdpOutputSurface Rendering \
2219 *           Functionality
2220 *
2221 * \ref VdpOutputSurface "VdpOutputSurface" objects
2222 * directly provide some rendering/compositing operations. These
2223 * are described below.
2224 *
2225 * @{
2226 */
2227
2228/**
2229 * \hideinitializer
2230 * \brief The blending equation factors.
2231 */
2232typedef enum {
2233    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ZERO                     = 0,
2234    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE                      = 1,
2235    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_COLOR                = 2,
2236    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_COLOR      = 3,
2237    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA                = 4,
2238    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA      = 5,
2239    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_DST_ALPHA                = 6,
2240    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_DST_ALPHA      = 7,
2241    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_DST_COLOR                = 8,
2242    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_DST_COLOR      = 9,
2243    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA_SATURATE       = 10,
2244    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_CONSTANT_COLOR           = 11,
2245    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR = 12,
2246    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_CONSTANT_ALPHA           = 13,
2247    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA = 14,
2248} VdpOutputSurfaceRenderBlendFactor;
2249
2250/**
2251 * \hideinitializer
2252 * \brief The blending equations.
2253 */
2254typedef enum {
2255    VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_SUBTRACT         = 0,
2256    VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_REVERSE_SUBTRACT = 1,
2257    VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD              = 2,
2258    VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_MIN              = 3,
2259    VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_MAX              = 4,
2260} VdpOutputSurfaceRenderBlendEquation;
2261
2262#define VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSION 0
2263
2264/**
2265 * \brief Complete blending operation definition.
2266 *
2267 * A "blend state" operation controls the math behind certain rendering
2268 * operations.
2269 *
2270 * The blend math is the familiar OpenGL blend math:
2271 *     \f[
2272 *     dst.a = equation(blendFactorDstAlpha*dst.a,
2273 *     blendFactorSrcAlpha*src.a);
2274 *     \f]
2275 *     \f[
2276 *     dst.rgb = equation(blendFactorDstColor*dst.rgb,
2277 *     blendFactorSrcColor*src.rgb);
2278 *     \f]
2279 *
2280 * Note that when equation is MIN or MAX, the blend factors and constants
2281 * are ignored, and are treated as if they were 1.0.
2282 */
2283typedef struct {
2284    /**
2285     * This field must be filled with VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSIION
2286     */
2287    uint32_t struct_version;
2288    VdpOutputSurfaceRenderBlendFactor   blend_factor_source_color;
2289    VdpOutputSurfaceRenderBlendFactor   blend_factor_destination_color;
2290    VdpOutputSurfaceRenderBlendFactor   blend_factor_source_alpha;
2291    VdpOutputSurfaceRenderBlendFactor   blend_factor_destination_alpha;
2292    VdpOutputSurfaceRenderBlendEquation blend_equation_color;
2293    VdpOutputSurfaceRenderBlendEquation blend_equation_alpha;
2294    VdpColor                            blend_constant;
2295} VdpOutputSurfaceRenderBlendState;
2296
2297/**
2298 * \hideinitializer
2299 * \brief Do not rotate source_surface prior to compositing.
2300 */
2301#define VDP_OUTPUT_SURFACE_RENDER_ROTATE_0   0
2302
2303/**
2304 * \hideinitializer
2305 * \brief Rotate source_surface 90 degrees clockwise prior to
2306 *        compositing.
2307 */
2308#define VDP_OUTPUT_SURFACE_RENDER_ROTATE_90  1
2309
2310/**
2311 * \hideinitializer
2312 * \brief Rotate source_surface 180 degrees prior to
2313 *        compositing.
2314 */
2315#define VDP_OUTPUT_SURFACE_RENDER_ROTATE_180 2
2316
2317/**
2318 * \hideinitializer
2319 * \brief Rotate source_surface 270 degrees clockwise prior to
2320 *        compositing.
2321 */
2322#define VDP_OUTPUT_SURFACE_RENDER_ROTATE_270 3
2323
2324/**
2325 * \hideinitializer
2326 * \brief A separate color is used for each vertex of the
2327 *        smooth-shaded quad. Hence, colors array contains 4
2328 *        elements rather than 1. See description of colors
2329 *        array.
2330 */
2331#define VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX (1 << 2)
2332
2333/**
2334 * \brief Composite a sub-rectangle of a \ref VdpOutputSurface
2335 *        "VdpOutputSurface" into a sub-rectangle of another
2336 *        \ref VdpOutputSurface VdpOutputSurface.
2337 * \param[in] destination_surface The destination surface of the
2338 *       compositing operation.
2339 * \param[in] destination_rect The sub-rectangle of the
2340 *       destination surface to update. If NULL, the entire
2341 *       destination surface will be updated.
2342 * \param[in] source_surface The source surface for the
2343 *       compositing operation. The surface is treated as having
2344 *       four components: red, green, blue and alpha. Any
2345 *       missing components are treated as 1.0. For example, for
2346 *       an A8 VdpOutputSurface, alpha will come from the surface
2347 *       but red, green and blue will be treated as 1.0. If
2348 *       source_surface is VDP_INVALID_HANDLE, all components will
2349 *       be treated as 1.0. Note that destination_surface and
2350 *       source_surface must have been allocated via the same
2351 *       \ref VdpDevice "VdpDevice".
2352 * \param[in] source_rect The sub-rectangle of the source
2353 *       surface to read from. If NULL, the entire
2354 *       source_surface will be read. Left/right and/or top/bottom
2355 *       co-ordinates may be swapped to flip the source. Any
2356 *       flip occurs prior to any requested rotation. Values
2357 *       from outside the source surface are valid and samples
2358 *       at those locations will be taken from the nearest edge.
2359 * \param[in] colors A pointer to an array of \ref VdpColor
2360 *      "VdpColor" objects. If the flag
2361 *      VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX is set,
2362 *      VDPAU will four entries from the array, and treat them
2363 *      as the colors corresponding to the upper-left,
2364 *      upper-right, lower-right and lower-left corners of the
2365 *      post-rotation source (i.e. indices 0, 1, 2 and 3 run
2366 *      clockwise from the upper left corner). If the flag
2367 *      VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX is not
2368 *      set, VDPAU will use the single VdpColor for all four
2369 *      corners. If colors is NULL then red, green, blue and
2370 *      alpha values of 1.0 will be used.
2371 * \param[in] blend_state If a blend state is provided, the
2372 *     blend state will be used for the composite operation. If
2373 *     NULL, blending is effectively disabled, which is
2374 *     equivalent to a blend equation of ADD, source blend
2375 *     factors of ONE and destination blend factors of ZERO.
2376 *     See \ref VdpOutputSurfaceRenderBlendState for details
2377 *     regarding the mathematics of the blending operation.
2378 * \param[in] flags A set of flags influencing how the
2379 *       compositing operation works.
2380 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_0
2381 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_90
2382 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_180
2383 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_270
2384 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX
2385 * \return VdpStatus The completion status of the operation.
2386 *
2387 * The general compositing pipeline is as follows.
2388 *
2389 * -# Extract source_rect from source_surface.
2390 *
2391 * -# The extracted source is rotated 0, 90, 180 or 270 degrees
2392 *    according to the flags.
2393 *
2394 * -# The rotated source is component-wise multiplied by a
2395 *    smooth-shaded quad with a (potentially) different color at
2396 *    each vertex.
2397 *
2398 * -# The resulting rotated, smooth-shaded quad is scaled to the
2399 *    size of destination_rect and composited with
2400 *    destination_surface using the provided blend state.
2401 *
2402 */
2403typedef VdpStatus VdpOutputSurfaceRenderOutputSurface(
2404    VdpOutputSurface                         destination_surface,
2405    VdpRect const *                          destination_rect,
2406    VdpOutputSurface                         source_surface,
2407    VdpRect const *                          source_rect,
2408    VdpColor const *                         colors,
2409    VdpOutputSurfaceRenderBlendState const * blend_state,
2410    uint32_t                                 flags
2411);
2412
2413/**
2414 * \brief Composite a sub-rectangle of a \ref VdpBitmapSurface
2415 *        "VdpBitmapSurface" into a sub-rectangle of a
2416 *        \ref VdpOutputSurface VdpOutputSurface.
2417 * \param[in] destination_surface The destination surface of the
2418 *       compositing operation.
2419 * \param[in] destination_rect The sub-rectangle of the
2420 *       destination surface to update. If NULL, the entire
2421 *       destination surface will be updated.
2422 * \param[in] source_surface The source surface for the
2423 *       compositing operation. The surface is treated as having
2424 *       four components: red, green, blue and alpha. Any
2425 *       missing components are treated as 1.0. For example, for
2426 *       an A8 VdpBitmapSurface, alpha will come from the surface
2427 *       but red, green and blue will be treated as 1.0. If
2428 *       source_surface is VDP_INVALID_HANDLE, all components will
2429 *       be treated as 1.0. Note that destination_surface and
2430 *       source_surface must have been allocated via the same
2431 *       \ref VdpDevice "VdpDevice".
2432 * \param[in] source_rect The sub-rectangle of the source
2433 *       surface to read from. If NULL, the entire
2434 *       source_surface will be read. Left/right ot top/bottom
2435 *       co-ordinates may be swapped to flip the source. Any
2436 *       flip occurs prior to any requested rotation. Values
2437 *       from outside the source surface are valid and samples
2438 *       at those locations will be taken from the nearest edge.
2439 * \param[in] colors A pointer to an array of \ref VdpColor
2440 *      "VdpColor" objects. If the flag
2441 *      VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX is set,
2442 *      VDPAU will four entries from the array, and treat them
2443 *      as the colors corresponding to the upper-left,
2444 *      upper-right, lower-right and lower-left corners of the
2445 *      post-rotation source (i.e. indices 0, 1, 2 and 3 run
2446 *      clockwise from the upper left corner). If the flag
2447 *      VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX is not
2448 *      set, VDPAU will use the single VdpColor for all four
2449 *      corners. If colors is NULL then red, green, blue and
2450 *      alpha values of 1.0 will be used.
2451 * \param[in] blend_state If a blend state is provided, the
2452 *     blend state will be used for the composite operation. If
2453 *     NULL, blending is effectively disabled, which is
2454 *     equivalent to a blend equation of ADD, source blend
2455 *     factors of ONE and destination blend factors of ZERO.
2456 *     See \ref VdpOutputSurfaceRenderBlendState for details
2457 *     regarding the mathematics of the blending operation.
2458 * \param[in] flags A set of flags influencing how the
2459 *       compositing operation works.
2460 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_0
2461 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_90
2462 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_180
2463 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_270
2464 * \arg \ref VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX
2465 * \return VdpStatus The completion status of the operation.
2466 *
2467 * The general compositing pipeline is as follows.
2468 *
2469 * -# Extract source_rect from source_surface.
2470 *
2471 * -# The extracted source is rotated 0, 90, 180 or 270 degrees
2472 *   according to the flags.
2473 *
2474 * -# The rotated source is component-wise multiplied by a
2475 *    smooth-shaded quad with a (potentially) different color at
2476 *    each vertex.
2477 *
2478 * -# The resulting rotated, smooth-shaded quad is scaled to the
2479 *    size of destination_rect and composited with
2480 *    destination_surface using the provided blend state.
2481 *
2482 */
2483typedef VdpStatus VdpOutputSurfaceRenderBitmapSurface(
2484    VdpOutputSurface                         destination_surface,
2485    VdpRect const *                          destination_rect,
2486    VdpBitmapSurface                         source_surface,
2487    VdpRect const *                          source_rect,
2488    VdpColor const *                         colors,
2489    VdpOutputSurfaceRenderBlendState const * blend_state,
2490    uint32_t                                 flags
2491);
2492
2493/*@}*/
2494
2495/**
2496 * \defgroup VdpDecoder VdpDecoder; Video Decoding object
2497 *
2498 * The VdpDecoder object decodes compressed video data, writing
2499 * the results to a \ref VdpVideoSurface "VdpVideoSurface".
2500 *
2501 * A specific VDPAU implementation may support decoding multiple
2502 * types of compressed video data. However, VdpDecoder objects
2503 * are able to decode a specific type of compressed video data.
2504 * This type must be specified during creation.
2505 *
2506 * @{
2507 */
2508
2509/**
2510 * \brief The set of all known compressed video formats, and
2511 *        associated profiles, that may be decoded.
2512 */
2513typedef uint32_t VdpDecoderProfile;
2514
2515/** \hideinitializer */
2516#define VDP_DECODER_PROFILE_MPEG1                       ((VdpDecoderProfile)0)
2517/** \hideinitializer */
2518#define VDP_DECODER_PROFILE_MPEG2_SIMPLE                ((VdpDecoderProfile)1)
2519/** \hideinitializer */
2520#define VDP_DECODER_PROFILE_MPEG2_MAIN                  ((VdpDecoderProfile)2)
2521/** \hideinitializer */
2522/** \brief MPEG 4 part 10 == H.264 == AVC */
2523#define VDP_DECODER_PROFILE_H264_BASELINE               ((VdpDecoderProfile)6)
2524/** \hideinitializer */
2525#define VDP_DECODER_PROFILE_H264_MAIN                   ((VdpDecoderProfile)7)
2526/** \hideinitializer */
2527#define VDP_DECODER_PROFILE_H264_HIGH                   ((VdpDecoderProfile)8)
2528/** \hideinitializer */
2529#define VDP_DECODER_PROFILE_VC1_SIMPLE                  ((VdpDecoderProfile)9)
2530/** \hideinitializer */
2531#define VDP_DECODER_PROFILE_VC1_MAIN                    ((VdpDecoderProfile)10)
2532/** \hideinitializer */
2533#define VDP_DECODER_PROFILE_VC1_ADVANCED                ((VdpDecoderProfile)11)
2534/** \hideinitializer */
2535#define VDP_DECODER_PROFILE_MPEG4_PART2_SP              ((VdpDecoderProfile)12)
2536/** \hideinitializer */
2537#define VDP_DECODER_PROFILE_MPEG4_PART2_ASP             ((VdpDecoderProfile)13)
2538/** \hideinitializer */
2539#define VDP_DECODER_PROFILE_DIVX4_QMOBILE               ((VdpDecoderProfile)14)
2540/** \hideinitializer */
2541#define VDP_DECODER_PROFILE_DIVX4_MOBILE                ((VdpDecoderProfile)15)
2542/** \hideinitializer */
2543#define VDP_DECODER_PROFILE_DIVX4_HOME_THEATER          ((VdpDecoderProfile)16)
2544/** \hideinitializer */
2545#define VDP_DECODER_PROFILE_DIVX4_HD_1080P              ((VdpDecoderProfile)17)
2546/** \hideinitializer */
2547#define VDP_DECODER_PROFILE_DIVX5_QMOBILE               ((VdpDecoderProfile)18)
2548/** \hideinitializer */
2549#define VDP_DECODER_PROFILE_DIVX5_MOBILE                ((VdpDecoderProfile)19)
2550/** \hideinitializer */
2551#define VDP_DECODER_PROFILE_DIVX5_HOME_THEATER          ((VdpDecoderProfile)20)
2552/** \hideinitializer */
2553#define VDP_DECODER_PROFILE_DIVX5_HD_1080P              ((VdpDecoderProfile)21)
2554/** \hideinitializer */
2555#define VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE   ((VdpDecoderProfile)22)
2556/** \hideinitializer */
2557#define VDP_DECODER_PROFILE_H264_EXTENDED               ((VdpDecoderProfile)23)
2558/** \hideinitializer */
2559#define VDP_DECODER_PROFILE_H264_PROGRESSIVE_HIGH       ((VdpDecoderProfile)24)
2560/** \hideinitializer */
2561#define VDP_DECODER_PROFILE_H264_CONSTRAINED_HIGH       ((VdpDecoderProfile)25)
2562/** \hideinitializer */
2563/** \brief Support for 8 bit depth only */
2564#define VDP_DECODER_PROFILE_H264_HIGH_444_PREDICTIVE    ((VdpDecoderProfile)26)
2565/** \hideinitializer */
2566/** \brief MPEG-H Part 2 == H.265 == HEVC */
2567#define VDP_DECODER_PROFILE_HEVC_MAIN                   ((VdpDecoderProfile)100)
2568/** \hideinitializer */
2569#define VDP_DECODER_PROFILE_HEVC_MAIN_10                ((VdpDecoderProfile)101)
2570/** \hideinitializer */
2571#define VDP_DECODER_PROFILE_HEVC_MAIN_STILL             ((VdpDecoderProfile)102)
2572/** \hideinitializer */
2573#define VDP_DECODER_PROFILE_HEVC_MAIN_12                ((VdpDecoderProfile)103)
2574/** \hideinitializer */
2575#define VDP_DECODER_PROFILE_HEVC_MAIN_444               ((VdpDecoderProfile)104)
2576
2577/** \hideinitializer */
2578#define VDP_DECODER_LEVEL_MPEG1_NA 0
2579
2580/** \hideinitializer */
2581#define VDP_DECODER_LEVEL_MPEG2_LL   0
2582/** \hideinitializer */
2583#define VDP_DECODER_LEVEL_MPEG2_ML   1
2584/** \hideinitializer */
2585#define VDP_DECODER_LEVEL_MPEG2_HL14 2
2586/** \hideinitializer */
2587#define VDP_DECODER_LEVEL_MPEG2_HL   3
2588
2589/** \hideinitializer */
2590#define VDP_DECODER_LEVEL_H264_1     10
2591/** \hideinitializer */
2592#define VDP_DECODER_LEVEL_H264_1b    9
2593/** \hideinitializer */
2594#define VDP_DECODER_LEVEL_H264_1_1   11
2595/** \hideinitializer */
2596#define VDP_DECODER_LEVEL_H264_1_2   12
2597/** \hideinitializer */
2598#define VDP_DECODER_LEVEL_H264_1_3   13
2599/** \hideinitializer */
2600#define VDP_DECODER_LEVEL_H264_2     20
2601/** \hideinitializer */
2602#define VDP_DECODER_LEVEL_H264_2_1   21
2603/** \hideinitializer */
2604#define VDP_DECODER_LEVEL_H264_2_2   22
2605/** \hideinitializer */
2606#define VDP_DECODER_LEVEL_H264_3     30
2607/** \hideinitializer */
2608#define VDP_DECODER_LEVEL_H264_3_1   31
2609/** \hideinitializer */
2610#define VDP_DECODER_LEVEL_H264_3_2   32
2611/** \hideinitializer */
2612#define VDP_DECODER_LEVEL_H264_4     40
2613/** \hideinitializer */
2614#define VDP_DECODER_LEVEL_H264_4_1   41
2615/** \hideinitializer */
2616#define VDP_DECODER_LEVEL_H264_4_2   42
2617/** \hideinitializer */
2618#define VDP_DECODER_LEVEL_H264_5     50
2619/** \hideinitializer */
2620#define VDP_DECODER_LEVEL_H264_5_1   51
2621
2622/** \hideinitializer */
2623#define VDP_DECODER_LEVEL_VC1_SIMPLE_LOW    0
2624/** \hideinitializer */
2625#define VDP_DECODER_LEVEL_VC1_SIMPLE_MEDIUM 1
2626
2627/** \hideinitializer */
2628#define VDP_DECODER_LEVEL_VC1_MAIN_LOW    0
2629/** \hideinitializer */
2630#define VDP_DECODER_LEVEL_VC1_MAIN_MEDIUM 1
2631/** \hideinitializer */
2632#define VDP_DECODER_LEVEL_VC1_MAIN_HIGH   2
2633
2634/** \hideinitializer */
2635#define VDP_DECODER_LEVEL_VC1_ADVANCED_L0 0
2636/** \hideinitializer */
2637#define VDP_DECODER_LEVEL_VC1_ADVANCED_L1 1
2638/** \hideinitializer */
2639#define VDP_DECODER_LEVEL_VC1_ADVANCED_L2 2
2640/** \hideinitializer */
2641#define VDP_DECODER_LEVEL_VC1_ADVANCED_L3 3
2642/** \hideinitializer */
2643#define VDP_DECODER_LEVEL_VC1_ADVANCED_L4 4
2644
2645/** \hideinitializer */
2646#define VDP_DECODER_LEVEL_MPEG4_PART2_SP_L0 0
2647/** \hideinitializer */
2648#define VDP_DECODER_LEVEL_MPEG4_PART2_SP_L1 1
2649/** \hideinitializer */
2650#define VDP_DECODER_LEVEL_MPEG4_PART2_SP_L2 2
2651/** \hideinitializer */
2652#define VDP_DECODER_LEVEL_MPEG4_PART2_SP_L3 3
2653
2654/** \hideinitializer */
2655#define VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L0 0
2656/** \hideinitializer */
2657#define VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L1 1
2658/** \hideinitializer */
2659#define VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L2 2
2660/** \hideinitializer */
2661#define VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L3 3
2662/** \hideinitializer */
2663#define VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L4 4
2664/** \hideinitializer */
2665#define VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L5 5
2666
2667/** \hideinitializer */
2668#define VDP_DECODER_LEVEL_DIVX_NA 0
2669
2670/**
2671 * The VDPAU H.265/HEVC decoder levels correspond to the values of
2672 * general_level_idc as described in the H.265 Specification, Annex A,
2673 * Table A.1. The enumeration values are equal to thirty times the level
2674 * number.
2675 */
2676#define VDP_DECODER_LEVEL_HEVC_1         30
2677/** \hideinitializer */
2678#define VDP_DECODER_LEVEL_HEVC_2         60
2679/** \hideinitializer */
2680#define VDP_DECODER_LEVEL_HEVC_2_1       63
2681/** \hideinitializer */
2682#define VDP_DECODER_LEVEL_HEVC_3         90
2683/** \hideinitializer */
2684#define VDP_DECODER_LEVEL_HEVC_3_1       93
2685/** \hideinitializer */
2686#define VDP_DECODER_LEVEL_HEVC_4        120
2687/** \hideinitializer */
2688#define VDP_DECODER_LEVEL_HEVC_4_1      123
2689/** \hideinitializer */
2690#define VDP_DECODER_LEVEL_HEVC_5        150
2691/** \hideinitializer */
2692#define VDP_DECODER_LEVEL_HEVC_5_1      153
2693/** \hideinitializer */
2694#define VDP_DECODER_LEVEL_HEVC_5_2      156
2695/** \hideinitializer */
2696#define VDP_DECODER_LEVEL_HEVC_6        180
2697/** \hideinitializer */
2698#define VDP_DECODER_LEVEL_HEVC_6_1      183
2699/** \hideinitializer */
2700#define VDP_DECODER_LEVEL_HEVC_6_2      186
2701
2702typedef enum {
2703    VDP_VIDEO_SURFACE_FIELD_STRUCTURE         = (1 << 0),
2704    VDP_VIDEO_SURFACE_FRAME_STRUCTURE         = (1 << 1)
2705} VdpVideoSurfaceSupportedPictureStructure;
2706
2707typedef enum {
2708    VDP_DECODER_PROFILE_MAX_LEVEL                      = 0,
2709    VDP_DECODER_PROFILE_MAX_MACROBLOCKS                = 1,
2710    VDP_DECODER_PROFILE_MAX_WIDTH                      = 2,
2711    VDP_DECODER_PROFILE_MAX_HEIGHT                     = 3,
2712    VDP_DECODER_PROFILE_SUPPORTED_PICTURE_STRUCTURE    = 4,
2713    /**
2714     * A list of supported chroma types, stored as a bitmask of 1 shifted
2715     * by each supported VdpChromaType value.  E.g.,
2716     *   (1 << VDP_CHROMA_TYPE_420) |
2717     *   (1 << VDP_CHROMA_TYPE_422) |
2718     *   (1 << VDP_CHROMA_TYPE_444)
2719     */
2720    VDP_DECODER_PROFILE_SUPPORTED_CHROMA_TYPES         = 5
2721} VdpDecoderCapability;
2722
2723/**
2724  * \brief Query the supported value of the requested capability, for
2725  *       the specified profile on the specified device.
2726  * \param[in] device The device to query.
2727  * \param[in] profile The decoder profile for which information is requested.
2728  * \param[in] capability The decoder profile capability for which the value
2729  *       is requested.
2730  * \param[out] capability_value The value of the requested capability.
2731  * \return VdpStatus The completion status of the operation.
2732  */
2733
2734typedef VdpStatus VdpDecoderQueryProfileCapability(
2735    VdpDevice                   device,
2736    VdpDecoderProfile           profile,
2737    /* output parameters follow */
2738    VdpDecoderCapability        capability,
2739    void *                      capability_value
2740);
2741
2742/**
2743 * \brief Query the implementation's VdpDecoder capabilities.
2744 * \param[in] device The device to query.
2745 * \param[in] profile The decoder profile for which information is requested.
2746 * \param[out] is_supported Is this profile supported?
2747 * \param[out] max_level The maximum specification level supported for this
2748 *       profile.
2749 * \param[out] max_macroblocks The maximum supported surface size in
2750 *       macroblocks. Note that this could be greater than that dictated by
2751 *       the maximum level.
2752 * \param[out] max_width The maximum supported surface width for this profile.
2753 *       Note that this could be greater than that dictated by the maximum
2754 *       level.
2755 * \param[out] max_height The maximum supported surface height for this
2756 *       profile. Note that this could be greater than that dictated by the
2757 *       maximum level.
2758 * \return VdpStatus The completion status of the operation.
2759 */
2760typedef VdpStatus VdpDecoderQueryCapabilities(
2761    VdpDevice         device,
2762    VdpDecoderProfile profile,
2763    /* output parameters follow */
2764    VdpBool *         is_supported,
2765    uint32_t *        max_level,
2766    uint32_t *        max_macroblocks,
2767    uint32_t *        max_width,
2768    uint32_t *        max_height
2769);
2770
2771/**
2772 * \brief An opaque handle representing a VdpDecoder object.
2773 */
2774typedef uint32_t VdpDecoder;
2775
2776/**
2777 * \brief Create a VdpDecoder.
2778 * \param[in] device The device that will contain the surface.
2779 * \param[in] profile The video format the decoder will decode.
2780 * \param[in] width The width of the new surface.
2781 * \param[in] height The height of the new surface.
2782 * \param[in] max_references The maximum number of references that may be
2783 *       used by a single frame in the stream to be decoded. This parameter
2784 *       exists mainly for formats such as H.264, where different streams
2785 *       may use a different number of references. Requesting too many
2786 *       references may waste memory, but decoding should still operate
2787 *       correctly. Requesting too few references will cause decoding to
2788 *       fail.
2789 * \param[out] decoder The new decoder's handle.
2790 * \return VdpStatus The completion status of the operation.
2791 */
2792typedef VdpStatus VdpDecoderCreate(
2793    VdpDevice         device,
2794    VdpDecoderProfile profile,
2795    uint32_t          width,
2796    uint32_t          height,
2797    uint32_t          max_references,
2798    /* output parameters follow */
2799    VdpDecoder *      decoder
2800);
2801
2802/**
2803 * \brief Destroy a VdpDecoder.
2804 * \param[in] surface The decoder's handle.
2805 * \return VdpStatus The completion status of the operation.
2806 */
2807typedef VdpStatus VdpDecoderDestroy(
2808    VdpDecoder decoder
2809);
2810
2811/**
2812 * \brief Retrieve the parameters used to create a
2813 *        VdpDecoder.
2814 * \param[in] surface The surface's handle.
2815 * \param[out] profile The video format used to create the
2816 *       decoder.
2817 * \param[out] width The width of surfaces decode by the
2818 *       decoder.
2819 * \param[out] height The height of surfaces decode by the
2820 *       decoder
2821 * \return VdpStatus The completion status of the operation.
2822 */
2823typedef VdpStatus VdpDecoderGetParameters(
2824    VdpDecoder          decoder,
2825    /* output parameters follow */
2826    VdpDecoderProfile * profile,
2827    uint32_t *          width,
2828    uint32_t *          height
2829);
2830
2831#define VDP_BITSTREAM_BUFFER_VERSION 0
2832
2833/**
2834 * \brief Application data buffer containing compressed video
2835 *        data.
2836 */
2837typedef struct {
2838    /**
2839     * This field must be filled with VDP_BITSTREAM_BUFFER_VERSION
2840     */
2841    uint32_t     struct_version;
2842    /** A pointer to the bitstream data bytes */
2843    void const * bitstream;
2844    /** The number of data bytes */
2845    uint32_t     bitstream_bytes;
2846} VdpBitstreamBuffer;
2847
2848/**
2849 * \brief A generic "picture information" type.
2850 *
2851 * This type serves solely to document the expected usage of a
2852 * generic (void *) function parameter. In actual usage, the
2853 * application is expected to physically provide a pointer to an
2854 * instance of one of the "real" VdpPictureInfo* structures,
2855 * picking the type appropriate for the decoder object in
2856 * question.
2857 */
2858typedef void VdpPictureInfo;
2859
2860/**
2861 * \brief Picture parameter information for an MPEG 1 or MPEG 2
2862 *        picture.
2863 *
2864 * Note: References to bitstream fields below may refer to data literally parsed
2865 * from the bitstream, or derived from the bitstream using a mechanism described
2866 * in the specification.
2867 */
2868typedef struct {
2869    /**
2870     * Reference used by B and P frames.
2871     * Set to VDP_INVALID_HANDLE when not used.
2872     */
2873    VdpVideoSurface forward_reference;
2874    /**
2875     * Reference used by B frames.
2876     * Set to VDP_INVALID_HANDLE when not used.
2877     */
2878    VdpVideoSurface backward_reference;
2879    /** Number of slices in the bitstream provided. */
2880    uint32_t        slice_count;
2881
2882    /** \name MPEG bitstream
2883     *
2884     * Copies of the MPEG bitstream fields.
2885     * @{ */
2886    uint8_t picture_structure;
2887    uint8_t picture_coding_type;
2888    uint8_t intra_dc_precision;
2889    uint8_t frame_pred_frame_dct;
2890    uint8_t concealment_motion_vectors;
2891    uint8_t intra_vlc_format;
2892    uint8_t alternate_scan;
2893    uint8_t q_scale_type;
2894    uint8_t top_field_first;
2895    /** MPEG-1 only. For MPEG-2, set to 0. */
2896    uint8_t full_pel_forward_vector;
2897    /** MPEG-1 only. For MPEG-2, set to 0. */
2898    uint8_t full_pel_backward_vector;
2899    /** For MPEG-1, fill both horizontal and vertical entries. */
2900    uint8_t f_code[2][2];
2901    /** Convert to raster order. */
2902    uint8_t intra_quantizer_matrix[64];
2903    /** Convert to raster order. */
2904    uint8_t non_intra_quantizer_matrix[64];
2905    /** @} */
2906} VdpPictureInfoMPEG1Or2;
2907
2908/**
2909 * \brief Information about an H.264 reference frame
2910 *
2911 * Note: References to bitstream fields below may refer to data literally parsed
2912 * from the bitstream, or derived from the bitstream using a mechanism described
2913 * in the specification.
2914 */
2915typedef struct {
2916    /**
2917     * The surface that contains the reference image.
2918     * Set to VDP_INVALID_HANDLE for unused entries.
2919     */
2920    VdpVideoSurface surface;
2921    /** Is this a long term reference (else short term). */
2922    VdpBool         is_long_term;
2923    /**
2924     * Is the top field used as a reference.
2925     * Set to VDP_FALSE for unused entries.
2926     */
2927    VdpBool         top_is_reference;
2928    /**
2929     * Is the bottom field used as a reference.
2930     * Set to VDP_FALSE for unused entries.
2931     */
2932    VdpBool         bottom_is_reference;
2933    /** [0]: top, [1]: bottom */
2934    int32_t         field_order_cnt[2];
2935    /**
2936     * Copy of the H.264 bitstream field:
2937     * frame_num from slice_header for short-term references,
2938     * LongTermPicNum from decoding algorithm for long-term references.
2939     */
2940    uint16_t        frame_idx;
2941} VdpReferenceFrameH264;
2942
2943/**
2944 * \brief Picture parameter information for an H.264 picture.
2945 *
2946 * Note: The \ref referenceFrames array must contain the "DPB" as
2947 * defined by the H.264 specification. In particular, once a
2948 * reference frame has been decoded to a surface, that surface must
2949 * continue to appear in the DPB until no longer required to predict
2950 * any future frame. Once a surface is removed from the DPB, it can
2951 * no longer be used as a reference, unless decoded again.
2952 *
2953 * Also note that only surfaces previously generated using \ref
2954 * VdpDecoderRender may be used as reference frames. In particular,
2955 * surfaces filled using any "put bits" API will not work.
2956 *
2957 * Note: References to bitstream fields below may refer to data literally parsed
2958 * from the bitstream, or derived from the bitstream using a mechanism described
2959 * in the specification.
2960 *
2961 * Note: VDPAU clients must use VdpPictureInfoH264Predictive to describe the
2962 * attributes of a frame being decoded with
2963 * VDP_DECODER_PROFILE_H264_HIGH_444_PREDICTIVE.
2964 */
2965typedef struct {
2966    /** Number of slices in the bitstream provided. */
2967    uint32_t slice_count;
2968    /** [0]: top, [1]: bottom */
2969    int32_t  field_order_cnt[2];
2970    /** Will the decoded frame be used as a reference later. */
2971    VdpBool  is_reference;
2972
2973    /** \name H.264 bitstream
2974     *
2975     * Copies of the H.264 bitstream fields.
2976     * @{ */
2977    uint16_t frame_num;
2978    uint8_t  field_pic_flag;
2979    uint8_t  bottom_field_flag;
2980    uint8_t  num_ref_frames;
2981    uint8_t  mb_adaptive_frame_field_flag;
2982    uint8_t  constrained_intra_pred_flag;
2983    uint8_t  weighted_pred_flag;
2984    uint8_t  weighted_bipred_idc;
2985    uint8_t  frame_mbs_only_flag;
2986    uint8_t  transform_8x8_mode_flag;
2987    int8_t   chroma_qp_index_offset;
2988    int8_t   second_chroma_qp_index_offset;
2989    int8_t   pic_init_qp_minus26;
2990    uint8_t  num_ref_idx_l0_active_minus1;
2991    uint8_t  num_ref_idx_l1_active_minus1;
2992    uint8_t  log2_max_frame_num_minus4;
2993    uint8_t  pic_order_cnt_type;
2994    uint8_t  log2_max_pic_order_cnt_lsb_minus4;
2995    uint8_t  delta_pic_order_always_zero_flag;
2996    uint8_t  direct_8x8_inference_flag;
2997    uint8_t  entropy_coding_mode_flag;
2998    uint8_t  pic_order_present_flag;
2999    uint8_t  deblocking_filter_control_present_flag;
3000    uint8_t  redundant_pic_cnt_present_flag;
3001    /** Convert to raster order. */
3002    uint8_t scaling_lists_4x4[6][16];
3003    /** Convert to raster order. */
3004    uint8_t scaling_lists_8x8[2][64];
3005    /** @} */
3006
3007    /** See \ref VdpPictureInfoH264 for instructions regarding this field. */
3008    VdpReferenceFrameH264 referenceFrames[16];
3009} VdpPictureInfoH264;
3010
3011/**
3012 * \brief Picture parameter information for an H.264 Hi444PP picture.
3013 *
3014 * Note: VDPAU clients must use VdpPictureInfoH264Predictive to describe the
3015 * attributes of a frame being decoded with
3016 * VDP_DECODER_PROFILE_H264_HIGH_444_PREDICTIVE.
3017 *
3018 * Note: software drivers may choose to honor values of
3019 * qpprime_y_zero_transform_bypass_flag greater than 1 for internal use.
3020 */
3021typedef struct {
3022    /** \ref VdpPictureInfoH264 struct. */
3023    VdpPictureInfoH264 pictureInfo;
3024
3025    /** \name H.264 bitstream
3026     *
3027     * Copies of the H.264 bitstream fields.
3028     * @{ */
3029    /**
3030     *  0 - lossless disabled
3031     *  1 - lossless enabled
3032     */
3033    uint8_t qpprime_y_zero_transform_bypass_flag;
3034    /**
3035     *  0 - disabled
3036     *  1 - enabled
3037     */
3038    uint8_t separate_colour_plane_flag;
3039    /** @} */
3040} VdpPictureInfoH264Predictive;
3041
3042/**
3043 * \brief Picture parameter information for a VC1 picture.
3044 *
3045 * Note: References to bitstream fields below may refer to data literally parsed
3046 * from the bitstream, or derived from the bitstream using a mechanism described
3047 * in the specification.
3048 */
3049typedef struct {
3050    /**
3051     * Reference used by B and P frames.
3052     * Set to VDP_INVALID_HANDLE when not used.
3053     */
3054    VdpVideoSurface forward_reference;
3055    /**
3056     * Reference used by B frames.
3057     * Set to VDP_INVALID_HANDLE when not used.
3058     */
3059    VdpVideoSurface backward_reference;
3060
3061    /** Number of slices in the bitstream provided. */
3062    uint32_t slice_count;
3063    /** I=0, P=1, B=3, BI=4  from 7.1.1.4. */
3064    uint8_t  picture_type;
3065    /** Progressive=0, Frame-interlace=2, Field-interlace=3; see VC-1 7.1.1.15. */
3066    uint8_t  frame_coding_mode;
3067
3068    /** \name VC-1 bitstream
3069     *
3070     * Copies of the VC-1 bitstream fields.
3071     * @{ */
3072    /** See VC-1 6.1.5. */
3073    uint8_t postprocflag;
3074    /** See VC-1 6.1.8. */
3075    uint8_t pulldown;
3076    /** See VC-1 6.1.9. */
3077    uint8_t interlace;
3078    /** See VC-1 6.1.10. */
3079    uint8_t tfcntrflag;
3080    /** See VC-1 6.1.11. */
3081    uint8_t finterpflag;
3082    /** See VC-1 6.1.3. */
3083    uint8_t psf;
3084    /** See VC-1 6.2.8. */
3085    uint8_t dquant;
3086    /** See VC-1 6.2.3. */
3087    uint8_t panscan_flag;
3088    /** See VC-1 6.2.4. */
3089    uint8_t refdist_flag;
3090    /** See VC-1 6.2.11. */
3091    uint8_t quantizer;
3092    /** See VC-1 6.2.7. */
3093    uint8_t extended_mv;
3094    /** See VC-1 6.2.14. */
3095    uint8_t extended_dmv;
3096    /** See VC-1 6.2.10. */
3097    uint8_t overlap;
3098    /** See VC-1 6.2.9. */
3099    uint8_t vstransform;
3100    /** See VC-1 6.2.5. */
3101    uint8_t loopfilter;
3102    /** See VC-1 6.2.6. */
3103    uint8_t fastuvmc;
3104    /** See VC-1 6.12.15. */
3105    uint8_t range_mapy_flag;
3106    uint8_t range_mapy;
3107    /** See VC-1 6.2.16. */
3108    uint8_t range_mapuv_flag;
3109    uint8_t range_mapuv;
3110
3111    /**
3112     * See VC-1 J.1.10.
3113     * Only used by simple and main profiles.
3114     */
3115    uint8_t multires;
3116    /**
3117     * See VC-1 J.1.16.
3118     * Only used by simple and main profiles.
3119     */
3120    uint8_t syncmarker;
3121    /**
3122     * VC-1 SP/MP range reduction control.
3123     * Only used by simple and main profiles.
3124     * Bit 0: Copy of rangered VC-1 bitstream field; See VC-1 J.1.17.
3125     * Bit 1: Copy of rangeredfrm VC-1 bitstream fiels; See VC-1 7.1.13.
3126     */
3127    uint8_t rangered;
3128    /**
3129     * See VC-1 J.1.17.
3130     * Only used by simple and main profiles.
3131     */
3132    uint8_t maxbframes;
3133    /** @} */
3134
3135    /**
3136     * Out-of-loop deblocking enable.
3137     * Bit 0 of POSTPROC from VC-1 7.1.1.27
3138     * Note that bit 1 of POSTPROC (dering enable) should not be included.
3139     */
3140    uint8_t deblockEnable;
3141    /**
3142     * Parameter used by VC-1 Annex H deblocking algorithm. Note that VDPAU
3143     * implementations may choose which deblocking algorithm to use.
3144     * See VC-1 7.1.1.6
3145     */
3146    uint8_t pquant;
3147} VdpPictureInfoVC1;
3148
3149/**
3150 * \brief Picture parameter information for an MPEG-4 Part 2 picture.
3151 *
3152 * Note: References to bitstream fields below may refer to data literally parsed
3153 * from the bitstream, or derived from the bitstream using a mechanism described
3154 * in the specification.
3155 */
3156typedef struct {
3157    /**
3158     * Reference used by B and P frames.
3159     * Set to VDP_INVALID_HANDLE when not used.
3160     */
3161    VdpVideoSurface forward_reference;
3162    /**
3163     * Reference used by B frames.
3164     * Set to VDP_INVALID_HANDLE when not used.
3165     */
3166    VdpVideoSurface backward_reference;
3167
3168    /** \name MPEG 4 part 2 bitstream
3169     *
3170     * Copies of the MPEG 4 part 2 bitstream fields.
3171     * @{ */
3172    int32_t trd[2];
3173    int32_t trb[2];
3174    uint16_t vop_time_increment_resolution;
3175    uint8_t vop_coding_type;
3176    uint8_t vop_fcode_forward;
3177    uint8_t vop_fcode_backward;
3178    uint8_t resync_marker_disable;
3179    uint8_t interlaced;
3180    uint8_t quant_type;
3181    uint8_t quarter_sample;
3182    uint8_t short_video_header;
3183    /** Derived from vop_rounding_type bitstream field. */
3184    uint8_t rounding_control;
3185    uint8_t alternate_vertical_scan_flag;
3186    uint8_t top_field_first;
3187    uint8_t intra_quantizer_matrix[64];
3188    uint8_t non_intra_quantizer_matrix[64];
3189    /** @} */
3190} VdpPictureInfoMPEG4Part2;
3191
3192/**
3193 * \brief Picture parameter information for a DivX 4 picture.
3194 *
3195 * Due to similarites between MPEG-4 Part 2 and DivX 4, the picture
3196 * parameter structure is re-used.
3197 */
3198typedef VdpPictureInfoMPEG4Part2 VdpPictureInfoDivX4;
3199
3200/**
3201 * \brief Picture parameter information for a DivX 5 picture.
3202 *
3203 * Due to similarites between MPEG-4 Part 2 and DivX 5, the picture
3204 * parameter structure is re-used.
3205 */
3206typedef VdpPictureInfoMPEG4Part2 VdpPictureInfoDivX5;
3207
3208/**
3209 * \brief Picture parameter information for an H.265/HEVC picture.
3210 *
3211 * References to bitsream fields below may refer to data literally parsed from
3212 * the bitstream, or derived from the bitstream using a mechanism described in
3213 * Rec. ITU-T H.265 (04/2013), hereafter referred to as "the H.265/HEVC
3214 * Specification".
3215 *
3216 * VDPAU H.265/HEVC implementations implement the portion of the decoding
3217 * process described by clauses 8.4, 8.5, 8.6 and 8.7 of the the
3218 * H.265/HEVC Specification. VdpPictureInfoHEVC provides enough data
3219 * to complete this portion of the decoding process, plus additional
3220 * information not defined in the H.265/HEVC Specification that may be
3221 * useful to particular implementations.
3222 *
3223 * Client applications must supply every field in this struct.
3224 */
3225typedef struct {
3226    /** \name HEVC Sequence Parameter Set
3227     *
3228     * Copies of the HEVC Sequence Parameter Set bitstream fields.
3229     * @{ */
3230    uint8_t chroma_format_idc;
3231    /** Only valid if chroma_format_idc == 3. Ignored otherwise.*/
3232    uint8_t separate_colour_plane_flag;
3233    uint32_t pic_width_in_luma_samples;
3234    uint32_t pic_height_in_luma_samples;
3235    uint8_t bit_depth_luma_minus8;
3236    uint8_t bit_depth_chroma_minus8;
3237    uint8_t log2_max_pic_order_cnt_lsb_minus4;
3238    /** Provides the value corresponding to the nuh_temporal_id of the frame
3239        to be decoded. */
3240    uint8_t sps_max_dec_pic_buffering_minus1;
3241    uint8_t log2_min_luma_coding_block_size_minus3;
3242    uint8_t log2_diff_max_min_luma_coding_block_size;
3243    uint8_t log2_min_transform_block_size_minus2;
3244    uint8_t log2_diff_max_min_transform_block_size;
3245    uint8_t max_transform_hierarchy_depth_inter;
3246    uint8_t max_transform_hierarchy_depth_intra;
3247    uint8_t scaling_list_enabled_flag;
3248    /** Scaling lists, in diagonal order, to be used for this frame. */
3249    /** Scaling List for 4x4 quantization matrix,
3250       indexed as ScalingList4x4[matrixId][i]. */
3251    uint8_t ScalingList4x4[6][16];
3252    /** Scaling List for 8x8 quantization matrix,
3253       indexed as ScalingList8x8[matrixId][i]. */
3254    uint8_t ScalingList8x8[6][64];
3255    /** Scaling List for 16x16 quantization matrix,
3256       indexed as ScalingList16x16[matrixId][i]. */
3257    uint8_t ScalingList16x16[6][64];
3258    /** Scaling List for 32x32 quantization matrix,
3259       indexed as ScalingList32x32[matrixId][i]. */
3260    uint8_t ScalingList32x32[2][64];
3261    /** Scaling List DC Coefficients for 16x16,
3262       indexed as ScalingListDCCoeff16x16[matrixId]. */
3263    uint8_t ScalingListDCCoeff16x16[6];
3264    /** Scaling List DC Coefficients for 32x32,
3265       indexed as ScalingListDCCoeff32x32[matrixId]. */
3266    uint8_t ScalingListDCCoeff32x32[2];
3267    uint8_t amp_enabled_flag;
3268    uint8_t sample_adaptive_offset_enabled_flag;
3269    uint8_t pcm_enabled_flag;
3270    /** Only needs to be set if pcm_enabled_flag is set. Ignored otherwise. */
3271    uint8_t pcm_sample_bit_depth_luma_minus1;
3272    /** Only needs to be set if pcm_enabled_flag is set. Ignored otherwise. */
3273    uint8_t pcm_sample_bit_depth_chroma_minus1;
3274    /** Only needs to be set if pcm_enabled_flag is set. Ignored otherwise. */
3275    uint8_t log2_min_pcm_luma_coding_block_size_minus3;
3276    /** Only needs to be set if pcm_enabled_flag is set. Ignored otherwise. */
3277    uint8_t log2_diff_max_min_pcm_luma_coding_block_size;
3278    /** Only needs to be set if pcm_enabled_flag is set. Ignored otherwise. */
3279    uint8_t pcm_loop_filter_disabled_flag;
3280    /** Per spec, when zero, assume short_term_ref_pic_set_sps_flag
3281        is also zero. */
3282    uint8_t num_short_term_ref_pic_sets;
3283    uint8_t long_term_ref_pics_present_flag;
3284    /** Only needed if long_term_ref_pics_present_flag is set. Ignored
3285        otherwise. */
3286    uint8_t num_long_term_ref_pics_sps;
3287    uint8_t sps_temporal_mvp_enabled_flag;
3288    uint8_t strong_intra_smoothing_enabled_flag;
3289    /** @} */
3290
3291    /** \name HEVC Picture Parameter Set
3292     *
3293     * Copies of the HEVC Picture Parameter Set bitstream fields.
3294     * @{ */
3295    uint8_t dependent_slice_segments_enabled_flag;
3296    uint8_t output_flag_present_flag;
3297    uint8_t num_extra_slice_header_bits;
3298    uint8_t sign_data_hiding_enabled_flag;
3299    uint8_t cabac_init_present_flag;
3300    uint8_t num_ref_idx_l0_default_active_minus1;
3301    uint8_t num_ref_idx_l1_default_active_minus1;
3302    int8_t init_qp_minus26;
3303    uint8_t constrained_intra_pred_flag;
3304    uint8_t transform_skip_enabled_flag;
3305    uint8_t cu_qp_delta_enabled_flag;
3306    /** Only needed if cu_qp_delta_enabled_flag is set. Ignored otherwise. */
3307    uint8_t diff_cu_qp_delta_depth;
3308    int8_t pps_cb_qp_offset;
3309    int8_t pps_cr_qp_offset;
3310    uint8_t pps_slice_chroma_qp_offsets_present_flag;
3311    uint8_t weighted_pred_flag;
3312    uint8_t weighted_bipred_flag;
3313    uint8_t transquant_bypass_enabled_flag;
3314    uint8_t tiles_enabled_flag;
3315    uint8_t entropy_coding_sync_enabled_flag;
3316    /** Only valid if tiles_enabled_flag is set. Ignored otherwise. */
3317    uint8_t num_tile_columns_minus1;
3318    /** Only valid if tiles_enabled_flag is set. Ignored otherwise. */
3319    uint8_t num_tile_rows_minus1;
3320    /** Only valid if tiles_enabled_flag is set. Ignored otherwise. */
3321    uint8_t uniform_spacing_flag;
3322    /** Only need to set 0..num_tile_columns_minus1. The struct
3323        definition reserves up to the maximum of 20. Invalid values are
3324        ignored. */
3325    uint16_t column_width_minus1[20];
3326    /** Only need to set 0..num_tile_rows_minus1. The struct
3327        definition reserves up to the maximum of 22. Invalid values are
3328        ignored.*/
3329    uint16_t row_height_minus1[22];
3330    /** Only needed if tiles_enabled_flag is set. Invalid values are
3331        ignored. */
3332    uint8_t loop_filter_across_tiles_enabled_flag;
3333    uint8_t pps_loop_filter_across_slices_enabled_flag;
3334    uint8_t deblocking_filter_control_present_flag;
3335    /** Only valid if deblocking_filter_control_present_flag is set. Ignored
3336        otherwise. */
3337    uint8_t deblocking_filter_override_enabled_flag;
3338    /** Only valid if deblocking_filter_control_present_flag is set. Ignored
3339        otherwise. */
3340    uint8_t pps_deblocking_filter_disabled_flag;
3341    /** Only valid if deblocking_filter_control_present_flag is set and
3342        pps_deblocking_filter_disabled_flag is not set. Ignored otherwise.*/
3343    int8_t pps_beta_offset_div2;
3344    /** Only valid if deblocking_filter_control_present_flag is set and
3345        pps_deblocking_filter_disabled_flag is not set. Ignored otherwise. */
3346    int8_t pps_tc_offset_div2;
3347    uint8_t lists_modification_present_flag;
3348    uint8_t log2_parallel_merge_level_minus2;
3349    uint8_t slice_segment_header_extension_present_flag;
3350
3351    /** \name HEVC Slice Segment Header
3352     *
3353     * Copies of the HEVC Slice Segment Header bitstream fields and calculated
3354     * values detailed in the specification.
3355     * @{ */
3356    /** Set to 1 if nal_unit_type is equal to IDR_W_RADL or IDR_N_LP.
3357        Set to zero otherwise. */
3358    uint8_t IDRPicFlag;
3359    /** Set to 1 if nal_unit_type in the range of BLA_W_LP to
3360        RSV_IRAP_VCL23, inclusive. Set to zero otherwise.*/
3361    uint8_t RAPPicFlag;
3362    /** See section 7.4.7.1 of the specification. */
3363    uint8_t CurrRpsIdx;
3364    /** See section 7.4.7.2 of the specification. */
3365    uint32_t NumPocTotalCurr;
3366    /** Corresponds to specification field, NumDeltaPocs[RefRpsIdx].
3367        Only applicable when short_term_ref_pic_set_sps_flag == 0.
3368        Implementations will ignore this value in other cases. See 7.4.8. */
3369    uint32_t NumDeltaPocsOfRefRpsIdx;
3370    /** Section 7.6.3.1 of the H.265/HEVC Specification defines the syntax of
3371        the slice_segment_header. This header contains information that
3372        some VDPAU implementations may choose to skip. The VDPAU API
3373        requires client applications to track the number of bits used in the
3374        slice header for structures associated with short term and long term
3375        reference pictures. First, VDPAU requires the number of bits used by
3376        the short_term_ref_pic_set array in the slice_segment_header. */
3377    uint32_t NumShortTermPictureSliceHeaderBits;
3378    /** Second, VDPAU requires the number of bits used for long term reference
3379        pictures in the slice_segment_header. This is equal to the number
3380        of bits used for the contents of the block beginning with
3381        "if(long_term_ref_pics_present_flag)". */
3382    uint32_t NumLongTermPictureSliceHeaderBits;
3383    /** @} */
3384
3385    /** Slice Decoding Process - Picture Order Count */
3386    /** The value of PicOrderCntVal of the picture in the access unit
3387        containing the SEI message. The picture being decoded. */
3388    int32_t CurrPicOrderCntVal;
3389
3390    /** Slice Decoding Process - Reference Picture Sets */
3391    /** Array of video reference surfaces.
3392        Set any unused positions to VDP_INVALID_HANDLE. */
3393    VdpVideoSurface RefPics[16];
3394    /** Array of picture order counts. These correspond to positions
3395        in the RefPics array. */
3396    int32_t PicOrderCntVal[16];
3397    /** Array used to specify whether a particular RefPic is
3398        a long term reference. A value of "1" indicates a long-term
3399        reference. */
3400    uint8_t IsLongTerm[16];
3401    /** Copy of specification field, see Section 8.3.2 of the
3402        H.265/HEVC Specification. */
3403    uint8_t NumPocStCurrBefore;
3404    /** Copy of specification field, see Section 8.3.2 of the
3405        H.265/HEVC Specification. */
3406    uint8_t NumPocStCurrAfter;
3407    /** Copy of specification field, see Section 8.3.2 of the
3408        H.265/HEVC Specification. */
3409    uint8_t NumPocLtCurr;
3410    /** Reference Picture Set list, one of the short-term RPS. These
3411        correspond to positions in the RefPics array. */
3412    uint8_t RefPicSetStCurrBefore[8];
3413    /** Reference Picture Set list, one of the short-term RPS. These
3414        correspond to positions in the RefPics array. */
3415    uint8_t RefPicSetStCurrAfter[8];
3416    /** Reference Picture Set list, one of the long-term RPS. These
3417        correspond to positions in the RefPics array. */
3418    uint8_t RefPicSetLtCurr[8];
3419} VdpPictureInfoHEVC;
3420
3421/**
3422 * \brief Picture parameter information for an HEVC 444 picture.
3423 *
3424 * Note: VDPAU clients must use VdpPictureInfoHEVC444 to describe the
3425 * attributes of a frame being decoded with
3426 * VDP_DECODER_PROFILE_HEVC_MAIN_444.
3427 */
3428typedef struct {
3429    /** \ref VdpPictureInfoHEVC struct. */
3430    VdpPictureInfoHEVC pictureInfo;
3431
3432    /* SPS Range Extensions for Main 444, Main 10, etc. */
3433    uint8_t sps_range_extension_flag;
3434    /* sps extension for transform_skip_rotation_enabled_flag */
3435    uint8_t transformSkipRotationEnableFlag;
3436    /* sps extension for transform_skip_context_enabled_flag */
3437    uint8_t transformSkipContextEnableFlag;
3438    /* sps implicit_rdpcm_enabled_flag */
3439    uint8_t implicitRdpcmEnableFlag;
3440    /* sps explicit_rdpcm_enabled_flag */
3441    uint8_t explicitRdpcmEnableFlag;
3442    /* sps extended_precision_processing_flag,always 0 in current profile */
3443    uint8_t extendedPrecisionProcessingFlag;
3444    /* sps intra_smoothing_disabled_flag */
3445    uint8_t intraSmoothingDisabledFlag;
3446    /* sps high_precision_offsets_enabled_flag */
3447    uint8_t highPrecisionOffsetsEnableFlag;
3448    /* sps persistent_rice_adaptation_enabled_flag */
3449    uint8_t persistentRiceAdaptationEnableFlag;
3450    /* sps cabac_bypass_alignment_enabled_flag, always 0 in current profile */
3451    uint8_t cabacBypassAlignmentEnableFlag;
3452    /* sps intraBlockCopyEnableFlag, always 0 not used by the spec as of now */
3453    uint8_t intraBlockCopyEnableFlag;
3454
3455    /* PPS Range Extensions for Main 444, Main 10, etc. */
3456    uint8_t pps_range_extension_flag;
3457    /* pps extension log2_max_transform_skip_block_size_minus2, 0...5 */
3458    uint8_t log2MaxTransformSkipSize;
3459    /* pps cross_component_prediction_enabled_flag */
3460    uint8_t crossComponentPredictionEnableFlag;
3461    /* pps chroma_qp_adjustment_enabled_flag */
3462    uint8_t chromaQpAdjustmentEnableFlag;
3463    /* pps diff_cu_chroma_qp_adjustment_depth, 0...3 */
3464    uint8_t diffCuChromaQpAdjustmentDepth;
3465    /* pps chroma_qp_adjustment_table_size_minus1+1, 1...6 */
3466    uint8_t chromaQpAdjustmentTableSize;
3467    /* pps log2_sao_offset_scale_luma, max(0,bitdepth-10), */
3468    /* maxBitdepth 16 for future. */
3469    uint8_t log2SaoOffsetScaleLuma;
3470    /* pps log2_sao_offset_scale_chroma */
3471    uint8_t log2SaoOffsetScaleChroma;
3472    /* -[12,+12] */
3473    int8_t cb_qp_adjustment[6];
3474    /* -[12,+12] */
3475    int8_t cr_qp_adjustment[6];
3476
3477} VdpPictureInfoHEVC444;
3478
3479/**
3480 * \brief Decode a compressed field/frame and render the result
3481 *        into a \ref VdpVideoSurface "VdpVideoSurface".
3482 * \param[in] decoder The decoder object that will perform the
3483 *       decode operation.
3484 * \param[in] target The video surface to render to.
3485 * \param[in] picture_info A (pointer to a) structure containing
3486 *       information about the picture to be decoded. Note that
3487 *       the appropriate type of VdpPictureInfo* structure must
3488 *       be provided to match to profile that the decoder was
3489 *       created for.
3490 * \param[in] bitstream_buffer_count The number of bitstream
3491 *       buffers containing compressed data for this picture.
3492 * \param[in] bitstream_buffers An array of bitstream buffers.
3493 * \return VdpStatus The completion status of the operation.
3494 *
3495 * See \ref video_mixer_usage for additional information.
3496 */
3497typedef VdpStatus VdpDecoderRender(
3498    VdpDecoder                 decoder,
3499    VdpVideoSurface            target,
3500    VdpPictureInfo const *     picture_info,
3501    uint32_t                   bitstream_buffer_count,
3502    VdpBitstreamBuffer const * bitstream_buffers
3503);
3504
3505/*@}*/
3506
3507/**
3508 * \defgroup VdpVideoMixer VdpVideoMixer; Video Post-processing \
3509 *           and Compositing object
3510 *
3511 * VdpVideoMixer can perform some subset of the following
3512 * post-processing steps on video:
3513 * - De-interlacing
3514 *   - Various types, with or without inverse telecine
3515 * - Noise-reduction
3516 * - Sharpness adjustment
3517 * - Color space conversion to RGB
3518 * - Chroma format upscaling to 4:4:4
3519 *
3520 * A VdpVideoMixer takes a source \ref VdpVideoSurface
3521 * "VdpVideoSurface" VdpVideoSurface and performs various video
3522 * processing steps on it (potentially using information from
3523 * past or future video surfaces). It scales the video and
3524 * converts it to RGB, then optionally composites it with
3525 * multiple auxiliary \ref VdpOutputSurface "VdpOutputSurface"s
3526 * before writing the result to the destination \ref
3527 * VdpOutputSurface "VdpOutputSurface".
3528 *
3529 * The video mixer compositing model is as follows:
3530 *
3531 * - A rectangle will be rendered on an output surface. No
3532 *   pixels will be rendered outside of this output rectangle.
3533 *   The contents of this rectangle will be a composite of many
3534 *   layers.
3535 *
3536 * - The first layer is the background color. The background
3537 *   color will fill the entire rectangle.
3538 *
3539 * - The second layer is the processed video which has been
3540 *   converted to RGB. These pixels will overwrite the
3541 *   background color of the first layer except where the second
3542 *   layer's rectangle does not completely cover the output
3543 *   rectangle. In those regions the background color will
3544 *   continue to show. If any portion of the second layer's
3545 *   output rectangle is outside of the output rectangle, those
3546 *   portions will be clipped.
3547 *
3548 * - The third layer contains some number of auxiliary layers
3549 *   (in the form of \ref VdpOutputSurface "VdpOutputSurface"s)
3550 *   which will be composited using the alpha value from the
3551 *   those surfaces. The compositing operations are equivalent
3552 *   to rendering with \ref VdpOutputSurfaceRenderOutputSurface
3553 *   using a source blend factor of SOURCE_ALPHA, a destination
3554 *   blend factor of ONE_MINUS_SOURCE_ALPHA and an equation of
3555 *   ADD.
3556 *
3557 * @{
3558 */
3559
3560/**
3561 * \brief A VdpVideoMixer feature that must be requested at
3562 *        creation time to be used.
3563 *
3564 * Certain advanced VdpVideoMixer features are optional, and the
3565 * ability to use those features at all must be requested when
3566 * the VdpVideoMixer object is created. Each feature is named via
3567 * a specific VdpVideoMixerFeature value.
3568 *
3569 * Once requested, these features are permanently available
3570 * within that specific VdpVideoMixer object. All features that
3571 * are not explicitly requested at creation time default to
3572 * being permanently unavailable.
3573 *
3574 * Even when requested, all features default to being initially
3575 * disabled. However, applications can subsequently enable and
3576 * disable features at any time. See \ref
3577 * VdpVideoMixerSetFeatureEnables.
3578 *
3579 * Some features allow configuration of their operation. Each
3580 * configurable item is an \ref VdpVideoMixerAttribute. These
3581 * attributes may be manipulated at any time using \ref
3582 * VdpVideoMixerSetAttributeValues.
3583 */
3584typedef uint32_t VdpVideoMixerFeature;
3585
3586/**
3587 * \hideinitializer
3588 * \brief A VdpVideoMixerFeature.
3589 *
3590 * When requested and enabled, motion adaptive temporal
3591 * deinterlacing will be used on interlaced content.
3592 *
3593 * When multiple de-interlacing options are requested and
3594 * enabled, the back-end implementation chooses the best
3595 * algorithm to apply.
3596 */
3597#define VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL         ((VdpVideoMixerFeature)0)
3598/**
3599 * \hideinitializer
3600 * \brief A VdpVideoMixerFeature.
3601 *
3602 * When requested and enabled, this enables a more advanced
3603 * version of temporal de-interlacing, that additionally uses
3604 * edge-guided spatial interpolation.
3605 *
3606 * When multiple de-interlacing options are requested and
3607 * enabled, the back-end implementation chooses the best
3608 * algorithm to apply.
3609 */
3610#define VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL ((VdpVideoMixerFeature)1)
3611/**
3612 * \hideinitializer
3613 * \brief A VdpVideoMixerFeature.
3614 *
3615 * When requested and enabled, cadence detection will be enabled
3616 * on interlaced content and the video mixer will try to extract
3617 * progressive frames from pull-down material.
3618 */
3619#define VDP_VIDEO_MIXER_FEATURE_INVERSE_TELECINE             ((VdpVideoMixerFeature)2)
3620/**
3621 * \hideinitializer
3622 * \brief A VdpVideoMixerFeature.
3623 *
3624 * When requested and enabled, a noise reduction algorithm will
3625 * be applied to the video.
3626 */
3627#define VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION              ((VdpVideoMixerFeature)3)
3628/**
3629 * \hideinitializer
3630 * \brief A VdpVideoMixerFeature.
3631 *
3632 * When requested and enabled, a sharpening algorithm will be
3633 * applied to the video.
3634 */
3635#define VDP_VIDEO_MIXER_FEATURE_SHARPNESS                    ((VdpVideoMixerFeature)4)
3636/**
3637 * \hideinitializer
3638 * \brief A VdpVideoMixerFeature.
3639 *
3640 * When requested and enabled, the alpha of the rendered
3641 * surface, which is normally set to the alpha of the background
3642 * color, will be forced to 0.0 on pixels corresponding to
3643 * source video surface luminance values in the range specified
3644 * by attributes \ref VDP_VIDEO_MIXER_ATTRIBUTE_LUMA_KEY_MIN_LUMA
3645 * to \ref VDP_VIDEO_MIXER_ATTRIBUTE_LUMA_KEY_MAX_LUMA. This
3646 * keying is performed after scaling and de-interlacing.
3647 */
3648#define VDP_VIDEO_MIXER_FEATURE_LUMA_KEY                     ((VdpVideoMixerFeature)5)
3649/**
3650 * \hideinitializer
3651 * \brief A VdpVideoMixerFeature.
3652 *
3653 * A VDPAU implementation may support multiple scaling algorithms of
3654 * differing quality, and may potentially support a different subset
3655 * of algorithms on different hardware.
3656 *
3657 * In some cases, higher quality algorithms may require more resources
3658 * (memory size, memory bandwidth, etc.) to operate. Hence, these high
3659 * quality algorithms must be explicitly requested and enabled by the client
3660 * application. This allows applications operating in a resource-constrained
3661 * environment to have some level of control over resource usage.
3662 *
3663 * Basic scaling is always built into any video mixer, and is known as
3664 * level 0. Scaling quality increases beginning with optional level 1,
3665 * through optional level 9.
3666 *
3667 * If an application requests and enables multiple high quality scaling
3668 * algorithms, the highest level enabled scaling algorithm will be used.
3669 */
3670#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1      ((VdpVideoMixerFeature)11)
3671/**
3672 * \hideinitializer
3673 * \brief A VdpVideoMixerFeature.
3674 *
3675 * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
3676 */
3677#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L2      ((VdpVideoMixerFeature)12)
3678/**
3679 * \hideinitializer
3680 * \brief A VdpVideoMixerFeature.
3681 *
3682 * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
3683 */
3684#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L3      ((VdpVideoMixerFeature)13)
3685/**
3686 * \hideinitializer
3687 * \brief A VdpVideoMixerFeature.
3688 *
3689 * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
3690 */
3691#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L4      ((VdpVideoMixerFeature)14)
3692/**
3693 * \hideinitializer
3694 * \brief A VdpVideoMixerFeature.
3695 *
3696 * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
3697 */
3698#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L5      ((VdpVideoMixerFeature)15)
3699/**
3700 * \hideinitializer
3701 * \brief A VdpVideoMixerFeature.
3702 *
3703 * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
3704 */
3705#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L6      ((VdpVideoMixerFeature)16)
3706/**
3707 * \hideinitializer
3708 * \brief A VdpVideoMixerFeature.
3709 *
3710 * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
3711 */
3712#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L7      ((VdpVideoMixerFeature)17)
3713/**
3714 * \hideinitializer
3715 * \brief A VdpVideoMixerFeature.
3716 *
3717 * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
3718 */
3719#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L8      ((VdpVideoMixerFeature)18)
3720/**
3721 * \hideinitializer
3722 * \brief A VdpVideoMixerFeature.
3723 *
3724 * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
3725 */
3726#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L9      ((VdpVideoMixerFeature)19)
3727
3728/**
3729 * \brief A VdpVideoMixer creation parameter.
3730 *
3731 * When a VdpVideoMixer is created, certain parameters may be
3732 * supplied. Each parameter is named via a specific
3733 * VdpVideoMixerParameter value.
3734 *
3735 * Each parameter has a specific type, and specific default
3736 * value if not specified at VdpVideoMixer creation time. The
3737 * application may query the legal supported range for some
3738 * parameters.
3739 */
3740typedef uint32_t VdpVideoMixerParameter;
3741
3742/**
3743 * \hideinitializer
3744 * \brief The exact width of input video surfaces.
3745 *
3746 * This parameter's type is uint32_t.
3747 *
3748 * This parameter defaults to 0 if not specified, which entails
3749 * that it must be specified.
3750 *
3751 * The application may query this parameter's supported
3752 * range.
3753 */
3754#define VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_WIDTH  ((VdpVideoMixerParameter)0)
3755/**
3756 * \hideinitializer
3757 * \brief The exact height of input video surfaces.
3758 *
3759 * This parameter's type is uint32_t.
3760 *
3761 * This parameter defaults to 0 if not specified, which entails
3762 * that it must be specified.
3763 *
3764 * The application may query this parameter's supported
3765 * range.
3766 */
3767#define VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_HEIGHT ((VdpVideoMixerParameter)1)
3768/**
3769 * \hideinitializer
3770 * \brief The chroma type of the input video surfaces the will
3771 *        process.
3772 *
3773 * This parameter's type is VdpChromaType.
3774 *
3775 * If not specified, this parameter defaults to
3776 * VDP_CHROMA_TYPE_420.
3777 *
3778 * The application may not query this application's supported
3779 * range, since it is a potentially disjoint enumeration.
3780 */
3781#define VDP_VIDEO_MIXER_PARAMETER_CHROMA_TYPE          ((VdpVideoMixerParameter)2)
3782/**
3783 * \hideinitializer
3784 * \brief The number of auxiliary layers in the mixer's
3785 *        compositing model.
3786 *
3787 * Note that this indicates the maximum number of layers that
3788 * may be processed by a given \ref VdpVideoMixer "VdpVideoMixer"
3789 * object. Each individual \ref VdpVideoMixerRender invocation
3790 * may choose to use a different number of actual layers, from 0
3791 * up to this limit.
3792 *
3793 * This attribute's type is uint32_t.
3794 *
3795 * If not specified, this parameter defaults to 0.
3796 *
3797 * The application may query this parameter's supported
3798 * range.
3799 */
3800#define VDP_VIDEO_MIXER_PARAMETER_LAYERS               ((VdpVideoMixerParameter)3)
3801
3802/**
3803 * \brief An adjustable attribute of VdpVideoMixer operation.
3804 *
3805 * Various attributes of VdpVideoMixer operation may be adjusted
3806 * at any time. Each attribute is named via a specific
3807 * VdpVideoMixerAttribute value.
3808 *
3809 * Each attribute has a specific type, and specific default
3810 * value if not specified at VdpVideoMixer creation time. The
3811 * application may query the legal supported range for some
3812 * attributes.
3813 */
3814typedef uint32_t VdpVideoMixerAttribute;
3815
3816/**
3817 * \hideinitializer
3818 * \brief The background color in the VdpVideoMixer's compositing
3819 *        model.
3820 *
3821 * This attribute's type is VdpColor.
3822 *
3823 * This parameter defaults to black (all color components 0.0
3824 * and alpha 1.0).
3825 *
3826 * The application may not query this parameter's supported
3827 * range, since the type is not scalar.
3828 */
3829#define VDP_VIDEO_MIXER_ATTRIBUTE_BACKGROUND_COLOR      ((VdpVideoMixerAttribute)0)
3830/**
3831 * \hideinitializer
3832 * \brief The color-space conversion matrix used by the
3833 *        VdpVideoMixer.
3834 *
3835 * This attribute's type is \ref VdpCSCMatrix.
3836 *
3837 * Note: When using \ref VdpVideoMixerGetAttributeValues to retrieve the
3838 * current CSC matrix, the attribute_values array must contain a pointer to
3839 * a pointer a VdpCSCMatrix (VdpCSCMatrix** as a void *). The get function will
3840 * either initialize the referenced CSC matrix to the current value, *or*
3841 * clear the supplied pointer to NULL, if the previous set call supplied a
3842 * value of NULL in parameter_values, to request the default matrix.
3843 *
3844 * \code
3845 * VdpCSCMatrix   matrix;
3846 * VdpCSCMatrix * matrix_ptr;
3847 * void * attribute_values[] = {&matrix_ptr};
3848 * VdpStatus st = vdp_video_mixer_get_attribute_values(..., attribute_values, ...);
3849 * \endcode
3850 *
3851 * This parameter defaults to a matrix suitable for ITU-R BT.601
3852 * input surfaces, with no procamp adjustments.
3853 *
3854 * The application may not query this parameter's supported
3855 * range, since the type is not scalar.
3856 */
3857#define VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX            ((VdpVideoMixerAttribute)1)
3858/**
3859 * \hideinitializer
3860 * \brief The amount of noise reduction algorithm to apply.
3861 *
3862 * This attribute's type is float.
3863 *
3864 * This parameter defaults to 0.0, which equates to no noise
3865 * reduction.
3866 *
3867 * The application may query this parameter's supported range.
3868 * However, the range is fixed as 0.0...1.0.
3869 */
3870#define VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL ((VdpVideoMixerAttribute)2)
3871/**
3872 * \hideinitializer
3873 * \brief The amount of sharpening, or blurring, to apply.
3874 *
3875 * This attribute's type is float.
3876 *
3877 * This parameter defaults to 0.0, which equates to no
3878 * sharpening.
3879 *
3880 * Positive values request sharpening. Negative values request
3881 * blurring.
3882 *
3883 * The application may query this parameter's supported range.
3884 * However, the range is fixed as -1.0...1.0.
3885 */
3886#define VDP_VIDEO_MIXER_ATTRIBUTE_SHARPNESS_LEVEL       ((VdpVideoMixerAttribute)3)
3887/**
3888 * \hideinitializer
3889 * \brief The minimum luma value for the luma key algorithm.
3890 *
3891 * This attribute's type is float.
3892 *
3893 * This parameter defaults to 0.0.
3894 *
3895 * The application may query this parameter's supported range.
3896 * However, the range is fixed as 0.0...1.0.
3897 */
3898#define VDP_VIDEO_MIXER_ATTRIBUTE_LUMA_KEY_MIN_LUMA     ((VdpVideoMixerAttribute)4)
3899/**
3900 * \hideinitializer
3901 * \brief The maximum luma value for the luma key algorithm.
3902 *
3903 * This attribute's type is float.
3904 *
3905 * This parameter defaults to 1.0.
3906 *
3907 * The application may query this parameter's supported range.
3908 * However, the range is fixed as 0.0...1.0.
3909 */
3910#define VDP_VIDEO_MIXER_ATTRIBUTE_LUMA_KEY_MAX_LUMA     ((VdpVideoMixerAttribute)5)
3911/**
3912 * \hideinitializer
3913 * \brief Whether de-interlacers should operate solely on luma, and bob chroma.
3914 *
3915 * Note: This attribute only affects advanced de-interlacing algorithms, not
3916 * bob or weave.
3917 *
3918 * This attribute's type is uint8_t.
3919 *
3920 * This parameter defaults to 0.
3921 *
3922 * The application may query this parameter's supported range.
3923 * However, the range is fixed as 0 (no/off) ... 1 (yes/on).
3924 */
3925#define VDP_VIDEO_MIXER_ATTRIBUTE_SKIP_CHROMA_DEINTERLACE ((VdpVideoMixerAttribute)6)
3926
3927/**
3928 * \brief Query the implementation's support for a specific
3929 *        feature.
3930 * \param[in] device The device to query.
3931 * \param[in] feature The feature for which support is to be
3932 *       queried.
3933 * \param[out] is_supported Is the specified feature supported?
3934 * \return VdpStatus The completion status of the operation.
3935 */
3936typedef VdpStatus VdpVideoMixerQueryFeatureSupport(
3937    VdpDevice            device,
3938    VdpVideoMixerFeature feature,
3939    /* output parameters follow */
3940    VdpBool *            is_supported
3941);
3942
3943/**
3944 * \brief Query the implementation's support for a specific
3945 *        parameter.
3946 * \param[in] device The device to query.
3947 * \param[in] parameter The parameter for which support is to be
3948 *       queried.
3949 * \param[out] is_supported Is the specified parameter
3950 *       supported?
3951 * \return VdpStatus The completion status of the operation.
3952 */
3953typedef VdpStatus VdpVideoMixerQueryParameterSupport(
3954    VdpDevice              device,
3955    VdpVideoMixerParameter parameter,
3956    /* output parameters follow */
3957    VdpBool *              is_supported
3958);
3959
3960/**
3961 * \brief Query the implementation's support for a specific
3962 *        attribute.
3963 * \param[in] device The device to query.
3964 * \param[in] feature The feature for which support is to be
3965 *       queried.
3966 * \param[out] is_supported Is the specified feature supported?
3967 * \return VdpStatus The completion status of the operation.
3968 */
3969typedef VdpStatus VdpVideoMixerQueryAttributeSupport(
3970    VdpDevice              device,
3971    VdpVideoMixerAttribute attribute,
3972    /* output parameters follow */
3973    VdpBool *              is_supported
3974);
3975
3976/**
3977 * \brief Query the implementation's supported for a specific
3978 *        parameter.
3979 * \param[in] device The device to query.
3980 * \param[in] parameter The parameter for which support is to be
3981 *       queried.
3982 * \param[out] min_value The minimum supported value.
3983 * \param[out] max_value The maximum supported value.
3984 * \return VdpStatus The completion status of the operation.
3985 */
3986typedef VdpStatus VdpVideoMixerQueryParameterValueRange(
3987    VdpDevice              device,
3988    VdpVideoMixerParameter parameter,
3989    /* output parameters follow */
3990    void *                min_value,
3991    void *                max_value
3992);
3993
3994/**
3995 * \brief Query the implementation's supported for a specific
3996 *        attribute.
3997 * \param[in] device The device to query.
3998 * \param[in] attribute The attribute for which support is to be
3999 *       queried.
4000 * \param[out] min_value The minimum supported value.
4001 * \param[out] max_value The maximum supported value.
4002 * \return VdpStatus The completion status of the operation.
4003 */
4004typedef VdpStatus VdpVideoMixerQueryAttributeValueRange(
4005    VdpDevice              device,
4006    VdpVideoMixerAttribute attribute,
4007    /* output parameters follow */
4008    void *                min_value,
4009    void *                max_value
4010);
4011
4012/**
4013 * \brief An opaque handle representing a VdpVideoMixer object.
4014 */
4015typedef uint32_t VdpVideoMixer;
4016
4017/**
4018 * \brief Create a VdpVideoMixer.
4019 * \param[in] device The device that will contain the mixer.
4020 * \param[in] feature_count The number of features to request.
4021 * \param[in] features The list of features to request.
4022 * \param[in] parameter_count The number of parameters to set.
4023 * \param[in] parameters The list of parameters to set.
4024 * \param[in] parameter_values The values for the parameters. Note that each
4025 *     entry in the value array is a pointer to the actual value. In other
4026 *     words, the values themselves are not cast to "void *" and passed
4027 *     "inside" the array.
4028 * \param[out] mixer The new mixer's handle.
4029 * \return VdpStatus The completion status of the operation.
4030 *
4031 * Initially, all requested features will be disabled. They can
4032 * be enabled using \ref VdpVideoMixerSetFeatureEnables.
4033 *
4034 * Initially, all attributes will have default values. Values
4035 * can be changed using \ref VdpVideoMixerSetAttributeValues.
4036 */
4037typedef VdpStatus VdpVideoMixerCreate(
4038    VdpDevice                      device,
4039    // The set of features to request
4040    uint32_t                       feature_count,
4041    VdpVideoMixerFeature const *   features,
4042    // The parameters used during creation
4043    uint32_t                       parameter_count,
4044    VdpVideoMixerParameter const * parameters,
4045    void const * const *           parameter_values,
4046    /* output parameters follow */
4047    VdpVideoMixer *                mixer
4048);
4049
4050/**
4051 * \brief Enable or disable features.
4052 * \param[in] mixer The mixer to manipulate.
4053 * \param[in] feature_count The number of features to
4054 *       enable/disable.
4055 * \param[in] features The list of features to enable/disable.
4056 * \param[in] feature_enables The list of new feature enable
4057 *       values.
4058 * \return VdpStatus The completion status of the operation.
4059 */
4060typedef VdpStatus VdpVideoMixerSetFeatureEnables(
4061    VdpVideoMixer                mixer,
4062    uint32_t                     feature_count,
4063    VdpVideoMixerFeature const * features,
4064    VdpBool const *              feature_enables
4065);
4066
4067/**
4068 * \brief Set attribute values
4069 * \param[in] mixer The mixer to manipulate.
4070 * \param[in] attribute_count The number of attributes to set.
4071 * \param[in] attributes The list of attributes to set.
4072 * \param[in] attribute_values The values for the attributes. Note that each
4073 *     entry in the value array is a pointer to the actual value. In other
4074 *     words, the values themselves are not cast to "void *" and passed
4075 *     "inside" the array. A NULL pointer requests that the default value be
4076 *     set for that attribute.
4077 * \return VdpStatus The completion status of the operation.
4078 */
4079typedef VdpStatus VdpVideoMixerSetAttributeValues(
4080    VdpVideoMixer                  mixer,
4081    uint32_t                       attribute_count,
4082    VdpVideoMixerAttribute const * attributes,
4083    void const * const *           attribute_values
4084);
4085
4086/**
4087 * \brief Retrieve whether features were requested at creation
4088 *        time.
4089 * \param[in] mixer The mixer to query.
4090 * \param[in] feature_count The number of features to query.
4091 * \param[in] features The list of features to query.
4092 * \param[out] feature_supported A list of values indicating
4093 *       whether the feature was requested, and hence is
4094 *       available.
4095 * \return VdpStatus The completion status of the operation.
4096 */
4097typedef VdpStatus VdpVideoMixerGetFeatureSupport(
4098    VdpVideoMixer                mixer,
4099    uint32_t                     feature_count,
4100    VdpVideoMixerFeature const * features,
4101    /* output parameters follow */
4102    VdpBool *                    feature_supports
4103);
4104
4105/**
4106 * \brief Retrieve whether features are enabled.
4107 * \param[in] mixer The mixer to manipulate.
4108 * \param[in] feature_count The number of features to query.
4109 * \param[in] features The list of features to query.
4110 * \param[out] feature_enabled A list of values indicating
4111 *       whether the feature is enabled.
4112 * \return VdpStatus The completion status of the operation.
4113 */
4114typedef VdpStatus VdpVideoMixerGetFeatureEnables(
4115    VdpVideoMixer                mixer,
4116    uint32_t                     feature_count,
4117    VdpVideoMixerFeature const * features,
4118    /* output parameters follow */
4119    VdpBool *                    feature_enables
4120);
4121
4122/**
4123 * \brief Retrieve parameter values given at creation time.
4124 * \param[in] mixer The mixer to manipulate.
4125 * \param[in] parameter_count The number of parameters to query.
4126 * \param[in] parameters The list of parameters to query.
4127 * \param[out] parameter_values The list of current values for
4128 *     the parameters. Note that each entry in the value array is a pointer to
4129 *     storage that will receive the actual value. If the attribute's type is
4130 *     a pointer itself, please closely read the documentation for that
4131 *     attribute type for any other data passing requirements.
4132 * \return VdpStatus The completion status of the operation.
4133 */
4134typedef VdpStatus VdpVideoMixerGetParameterValues(
4135    VdpVideoMixer                  mixer,
4136    uint32_t                       parameter_count,
4137    VdpVideoMixerParameter const * parameters,
4138    /* output parameters follow */
4139    void * const *                 parameter_values
4140);
4141
4142/**
4143 * \brief Retrieve current attribute values.
4144 * \param[in] mixer The mixer to manipulate.
4145 * \param[in] attribute_count The number of attributes to query.
4146 * \param[in] attributes The list of attributes to query.
4147 * \param[out] attribute_values The list of current values for
4148 *     the attributes. Note that each entry in the value array is a pointer to
4149 *     storage that will receive the actual value. If the attribute's type is
4150 *     a pointer itself, please closely read the documentation for that
4151 *     attribute type for any other data passing requirements.
4152 * \return VdpStatus The completion status of the operation.
4153 */
4154typedef VdpStatus VdpVideoMixerGetAttributeValues(
4155    VdpVideoMixer                  mixer,
4156    uint32_t                       attribute_count,
4157    VdpVideoMixerAttribute const * attributes,
4158    /* output parameters follow */
4159    void * const *                 attribute_values
4160);
4161
4162/**
4163 * \brief Destroy a VdpVideoMixer.
4164 * \param[in] device The device to destroy.
4165 * \return VdpStatus The completion status of the operation.
4166 */
4167typedef VdpStatus VdpVideoMixerDestroy(
4168    VdpVideoMixer mixer
4169);
4170
4171/**
4172 * \hideinitializer
4173 * \brief The structure of the picture present in a \ref
4174 *        VdpVideoSurface "VdpVideoSurface".
4175 */
4176typedef enum {
4177    /**
4178     * The picture is a field, and is the top field of the surface.
4179     */
4180    VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD,
4181    /**
4182     * The picture is a field, and is the bottom field of the
4183     * surface.
4184     */
4185    VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD,
4186    /**
4187     * The picture is a frame, and hence is the entire surface.
4188     */
4189    VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME,
4190} VdpVideoMixerPictureStructure;
4191
4192#define VDP_LAYER_VERSION 0
4193
4194/**
4195 * \brief Definition of an additional \ref VdpOutputSurface
4196 *        "VdpOutputSurface" layer in the composting model.
4197 */
4198typedef struct {
4199    /**
4200     * This field must be filled with VDP_LAYER_VERSION
4201     */
4202    uint32_t struct_version;
4203    /**
4204     * The surface to composite from.
4205     */
4206    VdpOutputSurface source_surface;
4207    /**
4208     * The sub-rectangle of the source surface to use. If NULL, the
4209     * entire source surface will be used.
4210     */
4211    VdpRect const *  source_rect;
4212    /**
4213     * The sub-rectangle of the destination surface to map
4214     * this layer into. This rectangle is relative to the entire
4215     * destination surface. This rectangle will be clipped by \ref
4216     * VdpVideoMixerRender's \b destination_rect. If NULL, the
4217     * destination rectangle will be sized to match the source
4218     * rectangle, and will be located at the origin.
4219     */
4220     VdpRect const * destination_rect;
4221} VdpLayer;
4222
4223/**
4224 * \brief Perform a video post-processing and compositing
4225 *        operation.
4226 * \param[in] mixer The mixer object that will perform the
4227 *       mixing/rendering operation.
4228 * \param[in] background_surface A background image. If set to any value other
4229 *       than VDP_INVALID_HANDLE, the specific surface will be used instead of
4230 *       the background color as the first layer in the mixer's compositing
4231 *       process.
4232 * \param[in] background_source_rect When background_surface is specified,
4233 *       this parameter indicates the portion of background_surface that will
4234 *       be used as the background layer. The specified region will be
4235 *       extracted and scaled to match the size of destination_rect. If NULL,
4236 *       the entire background_surface will be used.
4237 * \param[in] current_picture_structure The picture structure of
4238 *       the field/frame to be processed. This field/frame is
4239 *       presented in the \b video_surface_current parameter. If
4240 *       frame, then all \b video_surface_* parameters are
4241 *       assumed to be frames. If field, then all
4242 *       video_surface_* parameters are assumed to be fields,
4243 *       with alternating top/bottom-ness derived from
4244 *       video_surface_current.
4245 * \param[in] video_surfaces_past_count The number of provided
4246 *       fields/frames prior to the current picture.
4247 * \param[in] video_surfaces_past The fields/frames prior to the
4248 *       current field/frame. Note that array index 0 is the
4249 *       field/frame temporally nearest to the current
4250 *       field/frame, with increasing array indices used for
4251 *       older frames. Unavailable entries may be set to
4252 *       \ref VDP_INVALID_HANDLE.
4253 * \param[in] video_surface_current The field/frame to be
4254 *       processed.
4255 * \param[in] video_surfaces_future_count The number of provided
4256 *       fields/frames following the current picture.
4257 * \param[in] video_surfaces_future The fields/frames that
4258 *       follow the current field/frame. Note that array index 0
4259 *       is the field/frame temporally nearest to the current
4260 *       field/frame, with increasing array indices used for
4261 *       newer frames. Unavailable entries may be set to \ref
4262 *       VDP_INVALID_HANDLE.
4263 * \param[in] video_source_rect The sub-rectangle of the source
4264 *       video surface to extract and process. If NULL, the
4265 *       entire surface will be used. Left/right and/or top/bottom
4266 *       co-ordinates may be swapped to flip the source. Values
4267 *       from outside the video surface are valid and samples
4268 *       at those locations will be taken from the nearest edge.
4269 * \param[in] destination_surface
4270 * \param[in] destination_rect The sub-rectangle of the
4271 *       destination surface to modify. Note that rectangle clips
4272 *       all other actions.
4273 * \param[in] destination_video_rect The sub-rectangle of the
4274 *       destination surface that will contain the processed
4275 *       video. This rectangle is relative to the entire
4276 *       destination surface. This rectangle is clipped by \b
4277 *       destination_rect. If NULL, the destination rectangle
4278 *       will be sized to match the source rectangle, and will
4279 *       be located at the origin.
4280 * \param[in] layer_count The number of additional layers to
4281 *       composite above the video.
4282 * \param[in] layers The array of additional layers to composite
4283 *       above the video.
4284 * \return VdpStatus The completion status of the operation.
4285 *
4286 * For a complete discussion of how to use this API, please see
4287 * \ref video_mixer_usage.
4288 */
4289typedef VdpStatus VdpVideoMixerRender(
4290    VdpVideoMixer                 mixer,
4291    VdpOutputSurface              background_surface,
4292    VdpRect const *               background_source_rect,
4293    VdpVideoMixerPictureStructure current_picture_structure,
4294    uint32_t                      video_surface_past_count,
4295    VdpVideoSurface const *       video_surface_past,
4296    VdpVideoSurface               video_surface_current,
4297    uint32_t                      video_surface_future_count,
4298    VdpVideoSurface const *       video_surface_future,
4299    VdpRect const *               video_source_rect,
4300    VdpOutputSurface              destination_surface,
4301    VdpRect const *               destination_rect,
4302    VdpRect const *               destination_video_rect,
4303    uint32_t                      layer_count,
4304    VdpLayer const *              layers
4305);
4306
4307/*@}*/
4308
4309/**
4310 * \defgroup VdpPresentationQueue VdpPresentationQueue; Video \
4311 *           presentation (display) object
4312 *
4313 * The VdpPresentationQueue manages a queue of surfaces and
4314 * associated timestamps. For each surface in the queue, once
4315 * the associated timestamp is reached, the surface is displayed
4316 * to the user. This timestamp-based approach yields high
4317 * quality video delivery.
4318 *
4319 * The exact location of the displayed content is Window System
4320 * specific. For this reason, the \ref api_winsys provides an
4321 * API to create a \ref VdpPresentationQueueTarget object (e.g.
4322 * via \ref VdpPresentationQueueTargetCreateX11) which
4323 * encapsulates this information.
4324 *
4325 * Note that the presentation queue performs no scaling of
4326 * surfaces to match the display target's size, aspect ratio,
4327 * etc.
4328 *
4329 * Surfaces that are too large to fit into the display target
4330 * will be clipped. Surfaces that are too small to fill the
4331 * display target will be aligned to the top-left corner of the
4332 * display target, with the balance of the display target being
4333 * filled with a constant configurable "background" color.
4334 *
4335 * Note that the presentation queue operates in a manner that is
4336 * semantically equivalent to an overlay surface, with any
4337 * required color key painting hidden internally. However,
4338 * implementations are free to use whatever semantically
4339 * equivalent technique they wish. Note that implementations
4340 * that actually use color-keyed overlays will typically use
4341 * the "background" color as the overlay color key value, so
4342 * this color should be chosen with care.
4343 *
4344 * @{
4345 */
4346
4347/**
4348 * \brief The representation of a point in time.
4349 *
4350 * VdpTime timestamps are intended to be a high-precision timing
4351 * system, potentially independent from any other time domain in
4352 * the system.
4353 *
4354 * Time is represented in units of nanoseconds. The origin
4355 * (i.e. the time represented by a value of 0) is implementation
4356 * dependent.
4357 */
4358typedef uint64_t VdpTime;
4359
4360/**
4361 * \brief An opaque handle representing the location where
4362 *        video will be presented.
4363 *
4364 * VdpPresentationQueueTarget are created using a \ref api_winsys
4365 * specific API, such as \ref
4366 * VdpPresentationQueueTargetCreateX11.
4367 */
4368typedef uint32_t VdpPresentationQueueTarget;
4369
4370/**
4371 * \brief Destroy a VdpPresentationQueueTarget.
4372 * \param[in] presentation_queue_target The target to destroy.
4373 * \return VdpStatus The completion status of the operation.
4374 */
4375typedef VdpStatus VdpPresentationQueueTargetDestroy(
4376    VdpPresentationQueueTarget presentation_queue_target
4377);
4378
4379/**
4380 * \brief An opaque handle representing a presentation queue
4381 *        object.
4382 */
4383typedef uint32_t VdpPresentationQueue;
4384
4385/**
4386 * \brief Create a VdpPresentationQueue.
4387 * \param[in] device The device that will contain the queue.
4388 * \param[in] presentation_queue_target The location to display
4389 *       the content.
4390 * \param[out] presentation_queue The new queue's handle.
4391 * \return VdpStatus The completion status of the operation.
4392 *
4393 * Note: The initial value for the background color will be set to
4394 * an implementation-defined value.
4395 */
4396typedef VdpStatus VdpPresentationQueueCreate(
4397    VdpDevice                  device,
4398    VdpPresentationQueueTarget presentation_queue_target,
4399    /* output parameters follow */
4400    VdpPresentationQueue *     presentation_queue
4401);
4402
4403/**
4404 * \brief Destroy a VdpPresentationQueue.
4405 * \param[in] presentation_queue The queue to destroy.
4406 * \return VdpStatus The completion status of the operation.
4407 */
4408typedef VdpStatus VdpPresentationQueueDestroy(
4409    VdpPresentationQueue presentation_queue
4410);
4411
4412/**
4413 * \brief Configure the background color setting.
4414 * \param[in] presentation_queue The queue to manipulate.
4415 * \param[in] background_color The new background color.
4416 *
4417 * Note: Implementations may choose whether to apply the
4418 * new background color value immediately, or defer it until
4419 * the next surface is presented.
4420 */
4421typedef VdpStatus VdpPresentationQueueSetBackgroundColor(
4422    VdpPresentationQueue presentation_queue,
4423    VdpColor * const     background_color
4424);
4425
4426/**
4427 * \brief Retrieve the current background color setting.
4428 * \param[in] presentation_queue The queue to query.
4429 * \param[out] background_color The current background color.
4430 */
4431typedef VdpStatus VdpPresentationQueueGetBackgroundColor(
4432    VdpPresentationQueue presentation_queue,
4433    VdpColor *           background_color
4434);
4435
4436/**
4437 * \brief Retrieve the presentation queue's "current" time.
4438 * \param[in] presentation_queue The queue to query.
4439 * \param[out] current_time The current time, which may
4440 *       represent a point between display VSYNC events.
4441 * \return VdpStatus The completion status of the operation.
4442 */
4443typedef VdpStatus VdpPresentationQueueGetTime(
4444    VdpPresentationQueue presentation_queue,
4445    /* output parameters follow */
4446    VdpTime *            current_time
4447);
4448
4449/**
4450 * \brief Enter a surface into the presentation queue.
4451 * \param[in] presentation_queue The queue to query.
4452 * \param[in] surface The surface to enter into the queue.
4453 * \param[in] clip_width If set to a non-zero value, the presentation queue
4454 *       will display only clip_width pixels of the surface (anchored to the
4455 *       top-left corner of the surface.
4456 * \param[in] clip_height If set to a non-zero value, the presentation queue
4457 *       will display only clip_height lines of the surface (anchored to the
4458 *       top-left corner of the surface.
4459 * \param[in] earliest_presentation_time The timestamp
4460 *       associated with the surface. The presentation queue
4461 *       will not display the surface until the presentation
4462 *       queue's current time is at least this value.
4463 * \return VdpStatus The completion status of the operation.
4464 *
4465 * Applications may choose to allow resizing of the presentation queue target
4466 * (which may be e.g. a regular Window when using an X11-based
4467 * implementation).
4468 *
4469 * \b clip_width and \b clip_height may be used to limit the size of the
4470 * displayed region of a surface, in order to match the specific region that
4471 * was rendered to.
4472 *
4473 * In turn, this allows the application to allocate over-sized (e.g.
4474 * screen-sized) surfaces, but render to a region that matches the current
4475 * size of the video window.
4476 *
4477 * Using this technique, an application's response to window resizing may
4478 * simply be to render to, and display, a different region of the surface,
4479 * rather than de-/re-allocation of surfaces to match the updated window size.
4480 *
4481 * Implementations may impose an upper bound on the number of entries
4482 * contained by the presentation queue at a given time. This limit is likely
4483 * different to the number of \ref VdpOutputSurface "VdpOutputSurface"s that
4484 * may be allocated at a given time. This limit applies to entries in the
4485 * QUEUED or VISIBLE state only. In other words, entries that have
4486 * transitioned from a QUEUED or VISIBLE state to an IDLE state do not count
4487 * toward this limit.
4488 */
4489typedef VdpStatus VdpPresentationQueueDisplay(
4490    VdpPresentationQueue presentation_queue,
4491    VdpOutputSurface     surface,
4492    uint32_t             clip_width,
4493    uint32_t             clip_height,
4494    VdpTime              earliest_presentation_time
4495);
4496
4497/**
4498 * \brief Wait for a surface to finish being displayed.
4499 * \param[in] presentation_queue The queue to query.
4500 * \param[in] surface The surface to wait for.
4501 * \param[out] first_presentation_time The timestamp of the
4502 *       VSYNC at which this surface was first displayed. Note
4503 *       that 0 means the surface was never displayed.
4504 * \return VdpStatus The completion status of the operation.
4505 *
4506 * Note that this API would block forever if queried about the surface most
4507 * recently added to a presentation queue. That is because there would be no
4508 * other surface that could possibly replace that surface as the currently
4509 * displayed surface, and hence that surface would never become idle. For
4510 * that reason, this function will return an error in that case.
4511 */
4512typedef VdpStatus VdpPresentationQueueBlockUntilSurfaceIdle(
4513    VdpPresentationQueue presentation_queue,
4514    VdpOutputSurface     surface,
4515    /* output parameters follow */
4516    VdpTime *            first_presentation_time
4517);
4518
4519/**
4520 * \hideinitializer
4521 * \brief The status of a surface within a presentation queue.
4522 */
4523typedef enum {
4524    /** The surface is not queued or currently visible. */
4525    VDP_PRESENTATION_QUEUE_STATUS_IDLE,
4526    /** The surface is in the queue, and not currently visible. */
4527    VDP_PRESENTATION_QUEUE_STATUS_QUEUED,
4528    /** The surface is the currently visible surface. */
4529    VDP_PRESENTATION_QUEUE_STATUS_VISIBLE,
4530} VdpPresentationQueueStatus;
4531
4532/**
4533 * \brief Poll the current queue status of a surface.
4534 * \param[in] presentation_queue The queue to query.
4535 * \param[in] surface The surface to query.
4536 * \param[out] status The current status of the surface within
4537 *       the queue.
4538 * \param[out] first_presentation_time The timestamp of the
4539 *       VSYNC at which this surface was first displayed. Note
4540 *       that 0 means the surface was never displayed.
4541 * \return VdpStatus The completion status of the operation.
4542 */
4543typedef VdpStatus VdpPresentationQueueQuerySurfaceStatus(
4544    VdpPresentationQueue         presentation_queue,
4545    VdpOutputSurface             surface,
4546    /* output parameters follow */
4547    VdpPresentationQueueStatus * status,
4548    VdpTime *                    first_presentation_time
4549);
4550
4551/*@}*/
4552
4553/**
4554 * \defgroup display_preemption Display Preemption
4555 *
4556 * The Window System may operate within a frame-work (such as
4557 * Linux's VT switching) where the display is shared between the
4558 * Window System (e.g. X) and some other output mechanism (e.g.
4559 * the VT.) Given this scenario, the Window System's control of
4560 * the display could be preempted, and restored, at any time.
4561 *
4562 * VDPAU does not mandate that implementations hide such
4563 * preemptions from VDPAU client applications; doing so may
4564 * impose extreme burdens upon VDPAU implementations. Equally,
4565 * however, implementations are free to hide such preemptions
4566 * from client applications.
4567 *
4568 * VDPAU allows implementations to inform the client application
4569 * when such a preemption has occurred, and then refuse to
4570 * continue further operation.
4571 *
4572 * Similarly, some form of fatal hardware error could prevent further
4573 * operation of the VDPAU implementation, without a complete
4574 * re-initialization.
4575 *
4576 * The following discusses the behavior of implementations that
4577 * choose not to hide preemption from client applications.
4578 *
4579 * When preemption occurs, VDPAU internally destroys all
4580 * objects; the client application need not do this. However, if
4581 * the client application wishes to continue operation, it must
4582 * recreate all objects that it uses. It is probable that this
4583 * recreation will not succeed until the display ownership is
4584 * restored to the Window System.
4585 *
4586 * Once preemption has occurred, all VDPAU entry points will
4587 * return the specific error code \ref
4588 * VDP_STATUS_DISPLAY_PREEMPTED.
4589 *
4590 * VDPAU client applications may also be notified of such
4591 * preemptions and fatal errors via a callback. See \ref
4592 * VdpPreemptionCallbackRegister for more details.
4593 *
4594 * @{
4595 */
4596
4597/**
4598 * \brief A callback to notify the client application that a
4599 *        device's display has been preempted.
4600 * \param[in] device The device that had its display preempted.
4601 * \param[in] context The client-supplied callback context
4602 *       information.
4603 * \return void No return value
4604 */
4605typedef void VdpPreemptionCallback(
4606    VdpDevice device,
4607    void *   context
4608);
4609
4610/**
4611 * \brief Configure the display preemption callback.
4612 * \param[in] device The device to be monitored for preemption.
4613 * \param[in] callback The client application's callback
4614 *       function. If NULL, the callback is unregistered.
4615 * \param[in] context The client-supplied callback context
4616 *       information. This information will be passed to the
4617 *       callback function if/when invoked.
4618 * \return VdpStatus The completion status of the operation.
4619 */
4620typedef VdpStatus VdpPreemptionCallbackRegister(
4621    VdpDevice             device,
4622    VdpPreemptionCallback callback,
4623    void *               context
4624);
4625
4626/*@}*/
4627
4628/**
4629 * \defgroup get_proc_address Entry Point Retrieval
4630 *
4631 * In order to facilitate multiple implementations of VDPAU
4632 * co-existing within a single process, all functionality is
4633 * available via function pointers. The mechanism to retrieve
4634 * those function pointers is described below.
4635 *
4636 * @{
4637 */
4638
4639/**
4640 * \brief A type suitable for \ref VdpGetProcAddress
4641 *        "VdpGetProcAddress"'s \b function_id parameter.
4642 */
4643typedef uint32_t VdpFuncId;
4644
4645/** \hideinitializer */
4646#define VDP_FUNC_ID_GET_ERROR_STRING                                            ((VdpFuncId)0)
4647/** \hideinitializer */
4648#define VDP_FUNC_ID_GET_PROC_ADDRESS                                            ((VdpFuncId)1)
4649/** \hideinitializer */
4650#define VDP_FUNC_ID_GET_API_VERSION                                             ((VdpFuncId)2)
4651/** \hideinitializer */
4652#define VDP_FUNC_ID_GET_INFORMATION_STRING                                      ((VdpFuncId)4)
4653/** \hideinitializer */
4654#define VDP_FUNC_ID_DEVICE_DESTROY                                              ((VdpFuncId)5)
4655/** \hideinitializer */
4656#define VDP_FUNC_ID_GENERATE_CSC_MATRIX                                         ((VdpFuncId)6)
4657/** \hideinitializer */
4658#define VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES                            ((VdpFuncId)7)
4659/** \hideinitializer */
4660#define VDP_FUNC_ID_VIDEO_SURFACE_QUERY_GET_PUT_BITS_Y_CB_CR_CAPABILITIES       ((VdpFuncId)8)
4661/** \hideinitializer */
4662#define VDP_FUNC_ID_VIDEO_SURFACE_CREATE                                        ((VdpFuncId)9)
4663/** \hideinitializer */
4664#define VDP_FUNC_ID_VIDEO_SURFACE_DESTROY                                       ((VdpFuncId)10)
4665/** \hideinitializer */
4666#define VDP_FUNC_ID_VIDEO_SURFACE_GET_PARAMETERS                                ((VdpFuncId)11)
4667/** \hideinitializer */
4668#define VDP_FUNC_ID_VIDEO_SURFACE_GET_BITS_Y_CB_CR                              ((VdpFuncId)12)
4669/** \hideinitializer */
4670#define VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR                              ((VdpFuncId)13)
4671/** \hideinitializer */
4672#define VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_CAPABILITIES                           ((VdpFuncId)14)
4673/** \hideinitializer */
4674#define VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_GET_PUT_BITS_NATIVE_CAPABILITIES       ((VdpFuncId)15)
4675/** \hideinitializer */
4676#define VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_PUT_BITS_INDEXED_CAPABILITIES          ((VdpFuncId)16)
4677/** \hideinitializer */
4678#define VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_PUT_BITS_Y_CB_CR_CAPABILITIES          ((VdpFuncId)17)
4679/** \hideinitializer */
4680#define VDP_FUNC_ID_OUTPUT_SURFACE_CREATE                                       ((VdpFuncId)18)
4681/** \hideinitializer */
4682#define VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY                                      ((VdpFuncId)19)
4683/** \hideinitializer */
4684#define VDP_FUNC_ID_OUTPUT_SURFACE_GET_PARAMETERS                               ((VdpFuncId)20)
4685/** \hideinitializer */
4686#define VDP_FUNC_ID_OUTPUT_SURFACE_GET_BITS_NATIVE                              ((VdpFuncId)21)
4687/** \hideinitializer */
4688#define VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_NATIVE                              ((VdpFuncId)22)
4689/** \hideinitializer */
4690#define VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_INDEXED                             ((VdpFuncId)23)
4691/** \hideinitializer */
4692#define VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_Y_CB_CR                             ((VdpFuncId)24)
4693/** \hideinitializer */
4694#define VDP_FUNC_ID_BITMAP_SURFACE_QUERY_CAPABILITIES                           ((VdpFuncId)25)
4695/** \hideinitializer */
4696#define VDP_FUNC_ID_BITMAP_SURFACE_CREATE                                       ((VdpFuncId)26)
4697/** \hideinitializer */
4698#define VDP_FUNC_ID_BITMAP_SURFACE_DESTROY                                      ((VdpFuncId)27)
4699/** \hideinitializer */
4700#define VDP_FUNC_ID_BITMAP_SURFACE_GET_PARAMETERS                               ((VdpFuncId)28)
4701/** \hideinitializer */
4702#define VDP_FUNC_ID_BITMAP_SURFACE_PUT_BITS_NATIVE                              ((VdpFuncId)29)
4703/** \hideinitializer */
4704#define VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_OUTPUT_SURFACE                        ((VdpFuncId)33)
4705/** \hideinitializer */
4706#define VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_BITMAP_SURFACE                        ((VdpFuncId)34)
4707/** \hideinitializer */
4708#define VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_VIDEO_SURFACE_LUMA                    ((VdpFuncId)35)
4709/** \hideinitializer */
4710#define VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES                                  ((VdpFuncId)36)
4711/** \hideinitializer */
4712#define VDP_FUNC_ID_DECODER_CREATE                                              ((VdpFuncId)37)
4713/** \hideinitializer */
4714#define VDP_FUNC_ID_DECODER_DESTROY                                             ((VdpFuncId)38)
4715/** \hideinitializer */
4716#define VDP_FUNC_ID_DECODER_GET_PARAMETERS                                      ((VdpFuncId)39)
4717/** \hideinitializer */
4718#define VDP_FUNC_ID_DECODER_RENDER                                              ((VdpFuncId)40)
4719/** \hideinitializer */
4720#define VDP_FUNC_ID_VIDEO_MIXER_QUERY_FEATURE_SUPPORT                           ((VdpFuncId)41)
4721/** \hideinitializer */
4722#define VDP_FUNC_ID_VIDEO_MIXER_QUERY_PARAMETER_SUPPORT                         ((VdpFuncId)42)
4723/** \hideinitializer */
4724#define VDP_FUNC_ID_VIDEO_MIXER_QUERY_ATTRIBUTE_SUPPORT                         ((VdpFuncId)43)
4725/** \hideinitializer */
4726#define VDP_FUNC_ID_VIDEO_MIXER_QUERY_PARAMETER_VALUE_RANGE                     ((VdpFuncId)44)
4727/** \hideinitializer */
4728#define VDP_FUNC_ID_VIDEO_MIXER_QUERY_ATTRIBUTE_VALUE_RANGE                     ((VdpFuncId)45)
4729/** \hideinitializer */
4730#define VDP_FUNC_ID_VIDEO_MIXER_CREATE                                          ((VdpFuncId)46)
4731/** \hideinitializer */
4732#define VDP_FUNC_ID_VIDEO_MIXER_SET_FEATURE_ENABLES                             ((VdpFuncId)47)
4733/** \hideinitializer */
4734#define VDP_FUNC_ID_VIDEO_MIXER_SET_ATTRIBUTE_VALUES                            ((VdpFuncId)48)
4735/** \hideinitializer */
4736#define VDP_FUNC_ID_VIDEO_MIXER_GET_FEATURE_SUPPORT                             ((VdpFuncId)49)
4737/** \hideinitializer */
4738#define VDP_FUNC_ID_VIDEO_MIXER_GET_FEATURE_ENABLES                             ((VdpFuncId)50)
4739/** \hideinitializer */
4740#define VDP_FUNC_ID_VIDEO_MIXER_GET_PARAMETER_VALUES                            ((VdpFuncId)51)
4741/** \hideinitializer */
4742#define VDP_FUNC_ID_VIDEO_MIXER_GET_ATTRIBUTE_VALUES                            ((VdpFuncId)52)
4743/** \hideinitializer */
4744#define VDP_FUNC_ID_VIDEO_MIXER_DESTROY                                         ((VdpFuncId)53)
4745/** \hideinitializer */
4746#define VDP_FUNC_ID_VIDEO_MIXER_RENDER                                          ((VdpFuncId)54)
4747/** \hideinitializer */
4748#define VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_DESTROY                           ((VdpFuncId)55)
4749/** \hideinitializer */
4750#define VDP_FUNC_ID_PRESENTATION_QUEUE_CREATE                                   ((VdpFuncId)56)
4751/** \hideinitializer */
4752#define VDP_FUNC_ID_PRESENTATION_QUEUE_DESTROY                                  ((VdpFuncId)57)
4753/** \hideinitializer */
4754#define VDP_FUNC_ID_PRESENTATION_QUEUE_SET_BACKGROUND_COLOR                     ((VdpFuncId)58)
4755/** \hideinitializer */
4756#define VDP_FUNC_ID_PRESENTATION_QUEUE_GET_BACKGROUND_COLOR                     ((VdpFuncId)59)
4757/** \hideinitializer */
4758#define VDP_FUNC_ID_PRESENTATION_QUEUE_GET_TIME                                 ((VdpFuncId)62)
4759/** \hideinitializer */
4760#define VDP_FUNC_ID_PRESENTATION_QUEUE_DISPLAY                                  ((VdpFuncId)63)
4761/** \hideinitializer */
4762#define VDP_FUNC_ID_PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE                 ((VdpFuncId)64)
4763/** \hideinitializer */
4764#define VDP_FUNC_ID_PRESENTATION_QUEUE_QUERY_SURFACE_STATUS                     ((VdpFuncId)65)
4765/** \hideinitializer */
4766#define VDP_FUNC_ID_PREEMPTION_CALLBACK_REGISTER                                ((VdpFuncId)66)
4767/** \hideinitializer */
4768#define VDP_FUNC_ID_DECODER_QUERY_CAPABILITY                                    ((VdpFuncId)67)
4769
4770#define VDP_FUNC_ID_BASE_WINSYS 0x1000
4771
4772/**
4773 * \brief Retrieve a VDPAU function pointer.
4774 * \param[in] device The device that the function will operate
4775 *       against.
4776 * \param[in] function_id The specific function to retrieve.
4777 * \param[out] function_pointer The actual pointer for the
4778 *       application to call.
4779 * \return VdpStatus The completion status of the operation.
4780 */
4781typedef VdpStatus VdpGetProcAddress(
4782    VdpDevice device,
4783    VdpFuncId function_id,
4784    /* output parameters follow */
4785    void * *  function_pointer
4786);
4787
4788/*@}*/
4789/*@}*/
4790
4791/**
4792 * \defgroup api_winsys Window System Integration Layer
4793 *
4794 * The set of VDPAU functionality specific to an individual
4795 * Windowing System.
4796 */
4797
4798#ifdef __cplusplus
4799}
4800#endif
4801
4802#endif
4803
4804