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