vdpau.h revision a4f78def
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
841a4f78defSmrg/** \hideinitializer \brief 4:2:0 chroma format. */
842a4f78defSmrg#define VDP_CHROMA_TYPE_420 ((VdpChromaType)0)
843a4f78defSmrg/** \hideinitializer \brief 4:2:2 chroma format. */
844a4f78defSmrg#define VDP_CHROMA_TYPE_422 ((VdpChromaType)1)
845a4f78defSmrg/** \hideinitializer \brief 4:4:4 chroma format. */
846a4f78defSmrg#define VDP_CHROMA_TYPE_444 ((VdpChromaType)2)
847a4f78defSmrg
848a4f78defSmrg/**
849a4f78defSmrg * \brief The set of all known YCbCr surface formats.
850a4f78defSmrg */
851a4f78defSmrgtypedef uint32_t VdpYCbCrFormat;
852a4f78defSmrg
853a4f78defSmrg/**
854a4f78defSmrg * \hideinitializer
855a4f78defSmrg * \brief The "NV12" YCbCr surface format.
856a4f78defSmrg *
857a4f78defSmrg * This format has a two planes, a Y plane and a UV plane.
858a4f78defSmrg *
859a4f78defSmrg * The Y plane is an array of byte-sized Y components.
860a4f78defSmrg * Applications should access this data via a uint8_t pointer.
861a4f78defSmrg *
862a4f78defSmrg * The UV plane is an array of interleaved byte-sized U and V
863a4f78defSmrg * components, in the order U, V, U, V. Applications should
864a4f78defSmrg * access this data via a uint8_t pointer.
865a4f78defSmrg */
866a4f78defSmrg#define VDP_YCBCR_FORMAT_NV12     ((VdpYCbCrFormat)0)
867a4f78defSmrg/**
868a4f78defSmrg * \hideinitializer
869a4f78defSmrg * \brief The "YV12" YCbCr surface format.
870a4f78defSmrg *
871a4f78defSmrg * This format has a three planes, a Y plane, a V plane, and a U
872a4f78defSmrg * plane.
873a4f78defSmrg *
874a4f78defSmrg * Each of the planes is an array of byte-sized components.
875a4f78defSmrg *
876a4f78defSmrg * Applications should access this data via a uint8_t pointer.
877a4f78defSmrg */
878a4f78defSmrg#define VDP_YCBCR_FORMAT_YV12     ((VdpYCbCrFormat)1)
879a4f78defSmrg/**
880a4f78defSmrg * \hideinitializer
881a4f78defSmrg * \brief The "UYVY" YCbCr surface format.
882a4f78defSmrg *
883a4f78defSmrg * This format may also be known as Y422, UYNV, HDYC.
884a4f78defSmrg *
885a4f78defSmrg * This format has a single plane.
886a4f78defSmrg *
887a4f78defSmrg * This plane is an array of interleaved byte-sized Y, U, and V
888a4f78defSmrg * components, in the order U, Y, V, Y, U, Y, V, Y.
889a4f78defSmrg *
890a4f78defSmrg * Applications should access this data via a uint8_t pointer.
891a4f78defSmrg */
892a4f78defSmrg#define VDP_YCBCR_FORMAT_UYVY     ((VdpYCbCrFormat)2)
893a4f78defSmrg/**
894a4f78defSmrg * \hideinitializer
895a4f78defSmrg * \brief The "YUYV" YCbCr surface format.
896a4f78defSmrg *
897a4f78defSmrg * This format may also be known as YUY2, YUNV, V422.
898a4f78defSmrg *
899a4f78defSmrg * This format has a single plane.
900a4f78defSmrg *
901a4f78defSmrg * This plane is an array of interleaved byte-sized Y, U, and V
902a4f78defSmrg * components, in the order Y, U, Y, V, Y, U, Y, V.
903a4f78defSmrg *
904a4f78defSmrg * Applications should access this data via a uint8_t pointer.
905a4f78defSmrg */
906a4f78defSmrg#define VDP_YCBCR_FORMAT_YUYV     ((VdpYCbCrFormat)3)
907a4f78defSmrg/**
908a4f78defSmrg * \hideinitializer
909a4f78defSmrg * \brief A packed YCbCr format.
910a4f78defSmrg *
911a4f78defSmrg * This format has a single plane.
912a4f78defSmrg *
913a4f78defSmrg * This plane is an array packed 32-bit pixel data. Within each
914a4f78defSmrg * 32-bit pixel, bits [31:24] contain A, bits [23:16] contain V,
915a4f78defSmrg * bits [15:8] contain U, and bits [7:0] contain Y.
916a4f78defSmrg *
917a4f78defSmrg * Applications should access this data via a uint32_t pointer.
918a4f78defSmrg */
919a4f78defSmrg#define VDP_YCBCR_FORMAT_Y8U8V8A8 ((VdpYCbCrFormat)4)
920a4f78defSmrg/**
921a4f78defSmrg * \hideinitializer
922a4f78defSmrg * \brief A packed YCbCr format.
923a4f78defSmrg *
924a4f78defSmrg * This format has a single plane.
925a4f78defSmrg *
926a4f78defSmrg * This plane is an array packed 32-bit pixel data. Within each
927a4f78defSmrg * 32-bit pixel, bits [31:24] contain A, bits [23:16] contain Y,
928a4f78defSmrg * bits [15:8] contain U, and bits [7:0] contain V.
929a4f78defSmrg *
930a4f78defSmrg * Applications should access this data via a uint32_t pointer.
931a4f78defSmrg */
932a4f78defSmrg#define VDP_YCBCR_FORMAT_V8U8Y8A8 ((VdpYCbCrFormat)5)
933a4f78defSmrg
934a4f78defSmrg/**
935a4f78defSmrg * \brief  The set of all known RGB surface formats.
936a4f78defSmrg */
937a4f78defSmrgtypedef uint32_t VdpRGBAFormat;
938a4f78defSmrg
939a4f78defSmrg/**
940a4f78defSmrg * \hideinitializer
941a4f78defSmrg * \brief A packed RGB format.
942a4f78defSmrg *
943a4f78defSmrg * This format has a single plane.
944a4f78defSmrg *
945a4f78defSmrg * This plane is an array packed 32-bit pixel data. Within each
946a4f78defSmrg * 32-bit pixel, bits [31:24] contain A, bits [23:16] contain R,
947a4f78defSmrg * bits [15:8] contain G, and bits [7:0] contain B.
948a4f78defSmrg *
949a4f78defSmrg * Applications should access this data via a uint32_t pointer.
950a4f78defSmrg */
951a4f78defSmrg#define VDP_RGBA_FORMAT_B8G8R8A8    ((VdpRGBAFormat)0)
952a4f78defSmrg/**
953a4f78defSmrg * \hideinitializer
954a4f78defSmrg * \brief A packed RGB format.
955a4f78defSmrg *
956a4f78defSmrg * This format has a single plane.
957a4f78defSmrg *
958a4f78defSmrg * This plane is an array packed 32-bit pixel data. Within each
959a4f78defSmrg * 32-bit pixel, bits [31:24] contain A, bits [23:16] contain B,
960a4f78defSmrg * bits [15:8] contain G, and bits [7:0] contain R.
961a4f78defSmrg *
962a4f78defSmrg * Applications should access this data via a uint32_t pointer.
963a4f78defSmrg */
964a4f78defSmrg#define VDP_RGBA_FORMAT_R8G8B8A8    ((VdpRGBAFormat)1)
965a4f78defSmrg/**
966a4f78defSmrg * \hideinitializer
967a4f78defSmrg * \brief A packed RGB format.
968a4f78defSmrg *
969a4f78defSmrg * This format has a single plane.
970a4f78defSmrg *
971a4f78defSmrg * This plane is an array packed 32-bit pixel data. Within each
972a4f78defSmrg * 32-bit pixel, bits [31:30] contain A, bits [29:20] contain B,
973a4f78defSmrg * bits [19:10] contain G, and bits [9:0] contain R.
974a4f78defSmrg *
975a4f78defSmrg * Applications should access this data via a uint32_t pointer.
976a4f78defSmrg */
977a4f78defSmrg#define VDP_RGBA_FORMAT_R10G10B10A2 ((VdpRGBAFormat)2)
978a4f78defSmrg/**
979a4f78defSmrg * \hideinitializer
980a4f78defSmrg * \brief A packed RGB format.
981a4f78defSmrg *
982a4f78defSmrg * This format has a single plane.
983a4f78defSmrg *
984a4f78defSmrg * This plane is an array packed 32-bit pixel data. Within each
985a4f78defSmrg * 32-bit pixel, bits [31:30] contain A, bits [29:20] contain R,
986a4f78defSmrg * bits [19:10] contain G, and bits [9:0] contain B.
987a4f78defSmrg *
988a4f78defSmrg * Applications should access this data via a uint32_t pointer.
989a4f78defSmrg */
990a4f78defSmrg#define VDP_RGBA_FORMAT_B10G10R10A2 ((VdpRGBAFormat)3)
991a4f78defSmrg/**
992a4f78defSmrg * \hideinitializer
993a4f78defSmrg * \brief An alpha-only surface format.
994a4f78defSmrg *
995a4f78defSmrg * This format has a single plane.
996a4f78defSmrg *
997a4f78defSmrg * This plane is an array of byte-sized components.
998a4f78defSmrg *
999a4f78defSmrg * Applications should access this data via a uint8_t pointer.
1000a4f78defSmrg */
1001a4f78defSmrg#define VDP_RGBA_FORMAT_A8          ((VdpRGBAFormat)4)
1002a4f78defSmrg
1003a4f78defSmrg/**
1004a4f78defSmrg * \brief  The set of all known indexed surface formats.
1005a4f78defSmrg */
1006a4f78defSmrgtypedef uint32_t VdpIndexedFormat;
1007a4f78defSmrg
1008a4f78defSmrg/**
1009a4f78defSmrg * \hideinitializer
1010a4f78defSmrg * \brief A 4-bit indexed format, with alpha.
1011a4f78defSmrg *
1012a4f78defSmrg * This format has a single plane.
1013a4f78defSmrg *
1014a4f78defSmrg * This plane is an array of byte-sized components. Within each
1015a4f78defSmrg * byte, bits [7:4] contain I (index), and bits [3:0] contain A.
1016a4f78defSmrg *
1017a4f78defSmrg * Applications should access this data via a uint8_t pointer.
1018a4f78defSmrg */
1019a4f78defSmrg#define VDP_INDEXED_FORMAT_A4I4 ((VdpIndexedFormat)0)
1020a4f78defSmrg/**
1021a4f78defSmrg * \hideinitializer
1022a4f78defSmrg * \brief A 4-bit indexed format, with alpha.
1023a4f78defSmrg *
1024a4f78defSmrg * This format has a single plane.
1025a4f78defSmrg *
1026a4f78defSmrg * This plane is an array of byte-sized components. Within each
1027a4f78defSmrg * byte, bits [7:4] contain A, and bits [3:0] contain I (index).
1028a4f78defSmrg *
1029a4f78defSmrg * Applications should access this data via a uint8_t pointer.
1030a4f78defSmrg */
1031a4f78defSmrg#define VDP_INDEXED_FORMAT_I4A4 ((VdpIndexedFormat)1)
1032a4f78defSmrg/**
1033a4f78defSmrg * \hideinitializer
1034a4f78defSmrg * \brief A 8-bit indexed format, with alpha.
1035a4f78defSmrg *
1036a4f78defSmrg * This format has a single plane.
1037a4f78defSmrg *
1038a4f78defSmrg * This plane is an array of interleaved byte-sized A and I
1039a4f78defSmrg * (index) components, in the order A, I, A, I.
1040a4f78defSmrg *
1041a4f78defSmrg * Applications should access this data via a uint8_t pointer.
1042a4f78defSmrg */
1043a4f78defSmrg#define VDP_INDEXED_FORMAT_A8I8 ((VdpIndexedFormat)2)
1044a4f78defSmrg/**
1045a4f78defSmrg * \hideinitializer
1046a4f78defSmrg * \brief A 8-bit indexed format, with alpha.
1047a4f78defSmrg *
1048a4f78defSmrg * This format has a single plane.
1049a4f78defSmrg *
1050a4f78defSmrg * This plane is an array of interleaved byte-sized A and I
1051a4f78defSmrg * (index) components, in the order I, A, I, A.
1052a4f78defSmrg *
1053a4f78defSmrg * Applications should access this data via a uint8_t pointer.
1054a4f78defSmrg */
1055a4f78defSmrg#define VDP_INDEXED_FORMAT_I8A8 ((VdpIndexedFormat)3)
1056a4f78defSmrg
1057a4f78defSmrg/**
1058a4f78defSmrg * \brief A location within a surface.
1059a4f78defSmrg *
1060a4f78defSmrg * The VDPAU co-ordinate system has its origin at the top-left
1061a4f78defSmrg * of a surface, with x and y components increasing right and
1062a4f78defSmrg * down.
1063a4f78defSmrg */
1064a4f78defSmrgtypedef struct {
1065a4f78defSmrg    /** X co-ordinate. */
1066a4f78defSmrg    uint32_t x;
1067a4f78defSmrg    /** Y co-ordinate. */
1068a4f78defSmrg    uint32_t y;
1069a4f78defSmrg} VdpPoint;
1070a4f78defSmrg
1071a4f78defSmrg/**
1072a4f78defSmrg * \brief A rectangular region of a surface.
1073a4f78defSmrg *
1074a4f78defSmrg * The co-ordinates are top-left inclusive, bottom-right
1075a4f78defSmrg * exclusive.
1076a4f78defSmrg *
1077a4f78defSmrg * The VDPAU co-ordinate system has its origin at the top-left
1078a4f78defSmrg * of a surface, with x and y components increasing right and
1079a4f78defSmrg * down.
1080a4f78defSmrg */
1081a4f78defSmrgtypedef struct {
1082a4f78defSmrg    /** Left X co-ordinate. Inclusive. */
1083a4f78defSmrg    uint32_t x0;
1084a4f78defSmrg    /** Top Y co-ordinate. Inclusive. */
1085a4f78defSmrg    uint32_t y0;
1086a4f78defSmrg    /** Right X co-ordinate. Exclusive. */
1087a4f78defSmrg    uint32_t x1;
1088a4f78defSmrg    /** Bottom Y co-ordinate. Exclusive. */
1089a4f78defSmrg    uint32_t y1;
1090a4f78defSmrg} VdpRect;
1091a4f78defSmrg
1092a4f78defSmrg/**
1093a4f78defSmrg * A constant RGBA color.
1094a4f78defSmrg *
1095a4f78defSmrg * Note that the components are stored as float values in the
1096a4f78defSmrg * range 0.0...1.0 rather than format-specific integer values.
1097a4f78defSmrg * This allows VdpColor values to be independent from the exact
1098a4f78defSmrg * surface format(s) in use.
1099a4f78defSmrg */
1100a4f78defSmrgtypedef struct {
1101a4f78defSmrg    float red;
1102a4f78defSmrg    float green;
1103a4f78defSmrg    float blue;
1104a4f78defSmrg    float alpha;
1105a4f78defSmrg} VdpColor;
1106a4f78defSmrg
1107a4f78defSmrg/*@}*/
1108a4f78defSmrg
1109a4f78defSmrg/**
1110a4f78defSmrg * \defgroup error_handling Error Handling
1111a4f78defSmrg *
1112a4f78defSmrg * @{
1113a4f78defSmrg */
1114a4f78defSmrg
1115a4f78defSmrg/**
1116a4f78defSmrg * \hideinitializer
1117a4f78defSmrg * \brief The set of all possible error codes.
1118a4f78defSmrg */
1119a4f78defSmrgtypedef enum {
1120a4f78defSmrg    /** The operation completed successfully; no error. */
1121a4f78defSmrg    VDP_STATUS_OK = 0,
1122a4f78defSmrg    /**
1123a4f78defSmrg     * No backend implementation could be loaded.
1124a4f78defSmrg     */
1125a4f78defSmrg    VDP_STATUS_NO_IMPLEMENTATION,
1126a4f78defSmrg    /**
1127a4f78defSmrg     * The display was preempted, or a fatal error occurred.
1128a4f78defSmrg     *
1129a4f78defSmrg     * The application must re-initialize VDPAU.
1130a4f78defSmrg     */
1131a4f78defSmrg    VDP_STATUS_DISPLAY_PREEMPTED,
1132a4f78defSmrg    /**
1133a4f78defSmrg     * An invalid handle value was provided.
1134a4f78defSmrg     *
1135a4f78defSmrg     * Either the handle does not exist at all, or refers to an object of an
1136a4f78defSmrg     * incorrect type.
1137a4f78defSmrg     */
1138a4f78defSmrg    VDP_STATUS_INVALID_HANDLE,
1139a4f78defSmrg    /**
1140a4f78defSmrg     * An invalid pointer was provided.
1141a4f78defSmrg     *
1142a4f78defSmrg     * Typically, this means that a NULL pointer was provided for an "output"
1143a4f78defSmrg     * parameter.
1144a4f78defSmrg     */
1145a4f78defSmrg    VDP_STATUS_INVALID_POINTER,
1146a4f78defSmrg    /**
1147a4f78defSmrg     * An invalid/unsupported \ref VdpChromaType value was supplied.
1148a4f78defSmrg     */
1149a4f78defSmrg    VDP_STATUS_INVALID_CHROMA_TYPE,
1150a4f78defSmrg    /**
1151a4f78defSmrg     * An invalid/unsupported \ref VdpYCbCrFormat value was supplied.
1152a4f78defSmrg     */
1153a4f78defSmrg    VDP_STATUS_INVALID_Y_CB_CR_FORMAT,
1154a4f78defSmrg    /**
1155a4f78defSmrg     * An invalid/unsupported \ref VdpRGBAFormat value was supplied.
1156a4f78defSmrg     */
1157a4f78defSmrg    VDP_STATUS_INVALID_RGBA_FORMAT,
1158a4f78defSmrg    /**
1159a4f78defSmrg     * An invalid/unsupported \ref VdpIndexedFormat value was supplied.
1160a4f78defSmrg     */
1161a4f78defSmrg    VDP_STATUS_INVALID_INDEXED_FORMAT,
1162a4f78defSmrg    /**
1163a4f78defSmrg     * An invalid/unsupported \ref VdpColorStandard value was supplied.
1164a4f78defSmrg     */
1165a4f78defSmrg    VDP_STATUS_INVALID_COLOR_STANDARD,
1166a4f78defSmrg    /**
1167a4f78defSmrg     * An invalid/unsupported \ref VdpColorTableFormat value was supplied.
1168a4f78defSmrg     */
1169a4f78defSmrg    VDP_STATUS_INVALID_COLOR_TABLE_FORMAT,
1170a4f78defSmrg    /**
1171a4f78defSmrg     * An invalid/unsupported \ref VdpOutputSurfaceRenderBlendFactor value was
1172a4f78defSmrg     * supplied.
1173a4f78defSmrg     */
1174a4f78defSmrg    VDP_STATUS_INVALID_BLEND_FACTOR,
1175a4f78defSmrg    /**
1176a4f78defSmrg     * An invalid/unsupported \ref VdpOutputSurfaceRenderBlendEquation value
1177a4f78defSmrg     * was supplied.
1178a4f78defSmrg     */
1179a4f78defSmrg    VDP_STATUS_INVALID_BLEND_EQUATION,
1180a4f78defSmrg    /**
1181a4f78defSmrg     * An invalid/unsupported flag value/combination was supplied.
1182a4f78defSmrg     */
1183a4f78defSmrg    VDP_STATUS_INVALID_FLAG,
1184a4f78defSmrg    /**
1185a4f78defSmrg     * An invalid/unsupported \ref VdpDecoderProfile value was supplied.
1186a4f78defSmrg     */
1187a4f78defSmrg    VDP_STATUS_INVALID_DECODER_PROFILE,
1188a4f78defSmrg    /**
1189a4f78defSmrg     * An invalid/unsupported \ref VdpVideoMixerFeature value was supplied.
1190a4f78defSmrg     */
1191a4f78defSmrg    VDP_STATUS_INVALID_VIDEO_MIXER_FEATURE,
1192a4f78defSmrg    /**
1193a4f78defSmrg     * An invalid/unsupported \ref VdpVideoMixerParameter value was supplied.
1194a4f78defSmrg     */
1195a4f78defSmrg    VDP_STATUS_INVALID_VIDEO_MIXER_PARAMETER,
1196a4f78defSmrg    /**
1197a4f78defSmrg     * An invalid/unsupported \ref VdpVideoMixerAttribute value was supplied.
1198a4f78defSmrg     */
1199a4f78defSmrg    VDP_STATUS_INVALID_VIDEO_MIXER_ATTRIBUTE,
1200a4f78defSmrg    /**
1201a4f78defSmrg     * An invalid/unsupported \ref VdpVideoMixerPictureStructure value was
1202a4f78defSmrg     * supplied.
1203a4f78defSmrg     */
1204a4f78defSmrg    VDP_STATUS_INVALID_VIDEO_MIXER_PICTURE_STRUCTURE,
1205a4f78defSmrg    /**
1206a4f78defSmrg     * An invalid/unsupported \ref VdpFuncId value was supplied.
1207a4f78defSmrg     */
1208a4f78defSmrg    VDP_STATUS_INVALID_FUNC_ID,
1209a4f78defSmrg    /**
1210a4f78defSmrg     * The size of a supplied object does not match the object it is being
1211a4f78defSmrg     * used with.
1212a4f78defSmrg     *
1213a4f78defSmrg     * For example, a \ref VdpVideoMixer "VdpVideoMixer" is configured to
1214a4f78defSmrg     * process \ref VdpVideoSurface "VdpVideoSurface" objects of a specific
1215a4f78defSmrg     * size. If presented with a \ref VdpVideoSurface "VdpVideoSurface" of a
1216a4f78defSmrg     * different size, this error will be raised.
1217a4f78defSmrg     */
1218a4f78defSmrg    VDP_STATUS_INVALID_SIZE,
1219a4f78defSmrg    /**
1220a4f78defSmrg     * An invalid/unsupported value was supplied.
1221a4f78defSmrg     *
1222a4f78defSmrg     * This is a catch-all error code for values of type other than those
1223a4f78defSmrg     * with a specific error code.
1224a4f78defSmrg     */
1225a4f78defSmrg    VDP_STATUS_INVALID_VALUE,
1226a4f78defSmrg    /**
1227a4f78defSmrg     * An invalid/unsupported structure version was specified in a versioned
1228a4f78defSmrg     * structure. This implies that the implementation is older than the
1229a4f78defSmrg     * header file the application was built against.
1230a4f78defSmrg     */
1231a4f78defSmrg    VDP_STATUS_INVALID_STRUCT_VERSION,
1232a4f78defSmrg    /**
1233a4f78defSmrg     * The system does not have enough resources to complete the requested
1234a4f78defSmrg     * operation at this time.
1235a4f78defSmrg     */
1236a4f78defSmrg    VDP_STATUS_RESOURCES,
1237a4f78defSmrg    /**
1238a4f78defSmrg     * The set of handles supplied are not all related to the same VdpDevice.
1239a4f78defSmrg     *
1240a4f78defSmrg     * When performing operations that operate on multiple surfaces, such as
1241a4f78defSmrg     * \ref  VdpOutputSurfaceRenderOutputSurface or \ref VdpVideoMixerRender,
1242a4f78defSmrg     * all supplied surfaces must have been created within the context of the
1243a4f78defSmrg     * same \ref VdpDevice "VdpDevice" object. This error is raised if they were
1244a4f78defSmrg     * not.
1245a4f78defSmrg     */
1246a4f78defSmrg    VDP_STATUS_HANDLE_DEVICE_MISMATCH,
1247a4f78defSmrg    /**
1248a4f78defSmrg     * A catch-all error, used when no other error code applies.
1249a4f78defSmrg     */
1250a4f78defSmrg    VDP_STATUS_ERROR,
1251a4f78defSmrg} VdpStatus;
1252a4f78defSmrg
1253a4f78defSmrg/**
1254a4f78defSmrg * \brief Retrieve a string describing an error code.
1255a4f78defSmrg * \param[in] status The error code.
1256a4f78defSmrg * \return A pointer to the string. Note that this is a
1257a4f78defSmrg *       statically allocated read-only string. As such, the
1258a4f78defSmrg *       application must not free the returned pointer. The
1259a4f78defSmrg *       pointer is valid as long as the VDPAU implementation is
1260a4f78defSmrg *       present within the application's address space.
1261a4f78defSmrg */
1262a4f78defSmrgtypedef char const * VdpGetErrorString(
1263a4f78defSmrg    VdpStatus status
1264a4f78defSmrg);
1265a4f78defSmrg
1266a4f78defSmrg/*@}*/
1267a4f78defSmrg
1268a4f78defSmrg/**
1269a4f78defSmrg * \defgroup versioning Versioning
1270a4f78defSmrg *
1271a4f78defSmrg *
1272a4f78defSmrg * @{
1273a4f78defSmrg */
1274a4f78defSmrg
1275a4f78defSmrg/**
1276a4f78defSmrg * \brief The VDPAU interface version described by this header file.
1277a4f78defSmrg *
1278a4f78defSmrg * This version will only increase if a major incompatible change is made.
1279a4f78defSmrg * For example, if the parameters passed to an existing function are modified,
1280a4f78defSmrg * rather than simply adding new functions/enumerations), or if the mechanism
1281a4f78defSmrg * used to load the backend driver is modified incompatibly. Such changes are
1282a4f78defSmrg * unlikely.
1283a4f78defSmrg *
1284a4f78defSmrg * This value also represents the DSO version of VDPAU-related
1285a4f78defSmrg * shared-libraries.
1286a4f78defSmrg *
1287a4f78defSmrg * VDPAU version numbers are simple integers that increase monotonically
1288a4f78defSmrg * (typically by value 1).
1289a4f78defSmrg */
1290a4f78defSmrg#define VDPAU_INTERFACE_VERSION 1
1291a4f78defSmrg
1292a4f78defSmrg/**
1293a4f78defSmrg * \brief The VDPAU version described by this header file.
1294a4f78defSmrg *
1295a4f78defSmrg * This version will increase whenever any non-documentation change is made to
1296a4f78defSmrg * vdpau.h, or related header files such as vdpau_x11.h. Such changes
1297a4f78defSmrg * typically involve the addition of new functions, constants, or features.
1298a4f78defSmrg * Such changes are expected to be completely backwards-compatible.
1299a4f78defSmrg *
1300a4f78defSmrg * VDPAU version numbers are simple integers that increase monotonically
1301a4f78defSmrg * (typically by value 1).
1302a4f78defSmrg */
1303a4f78defSmrg#define VDPAU_VERSION 1
1304a4f78defSmrg
1305a4f78defSmrg/**
1306a4f78defSmrg * \brief Retrieve the VDPAU version implemented by the backend.
1307a4f78defSmrg * \param[out] api_version The API version.
1308a4f78defSmrg * \return VdpStatus The completion status of the operation.
1309a4f78defSmrg */
1310a4f78defSmrgtypedef VdpStatus VdpGetApiVersion(
1311a4f78defSmrg    /* output parameters follow */
1312a4f78defSmrg    uint32_t * api_version
1313a4f78defSmrg);
1314a4f78defSmrg
1315a4f78defSmrg/**
1316a4f78defSmrg * \brief Retrieve an implementation-specific string description
1317a4f78defSmrg *        of the implementation. This typically includes detailed version
1318a4f78defSmrg *        information.
1319a4f78defSmrg * \param[out] information_string A pointer to the information
1320a4f78defSmrg *       string. Note that this is a statically allocated
1321a4f78defSmrg *       read-only string. As such, the application must not
1322a4f78defSmrg *       free the returned pointer. The pointer is valid as long
1323a4f78defSmrg *       as the implementation is present within the
1324a4f78defSmrg *       application's address space.
1325a4f78defSmrg * \return VdpStatus The completion status of the operation.
1326a4f78defSmrg *
1327a4f78defSmrg * Note that the returned string is useful for information
1328a4f78defSmrg * reporting. It is not intended that the application should
1329a4f78defSmrg * parse this string in order to determine any information about
1330a4f78defSmrg * the implementation.
1331a4f78defSmrg */
1332a4f78defSmrgtypedef VdpStatus VdpGetInformationString(
1333a4f78defSmrg    /* output parameters follow */
1334a4f78defSmrg    char const * * information_string
1335a4f78defSmrg);
1336a4f78defSmrg
1337a4f78defSmrg/*@}*/
1338a4f78defSmrg
1339a4f78defSmrg/**
1340a4f78defSmrg * \defgroup VdpDevice VdpDevice; Primary API object
1341a4f78defSmrg *
1342a4f78defSmrg * The VdpDevice is the root of the VDPAU object system. Using a
1343a4f78defSmrg * VdpDevice object, all other object types may be created. See
1344a4f78defSmrg * the sections describing those other object types for details
1345a4f78defSmrg * on object creation.
1346a4f78defSmrg *
1347a4f78defSmrg * Note that VdpDevice objects are created using the \ref
1348a4f78defSmrg * api_winsys.
1349a4f78defSmrg *
1350a4f78defSmrg * @{
1351a4f78defSmrg */
1352a4f78defSmrg
1353a4f78defSmrg/**
1354a4f78defSmrg * \brief  An opaque handle representing a VdpDevice object.
1355a4f78defSmrg */
1356a4f78defSmrgtypedef uint32_t VdpDevice;
1357a4f78defSmrg
1358a4f78defSmrg/**
1359a4f78defSmrg * \brief Destroy a VdpDevice.
1360a4f78defSmrg * \param[in] device The device to destroy.
1361a4f78defSmrg * \return VdpStatus The completion status of the operation.
1362a4f78defSmrg */
1363a4f78defSmrgtypedef VdpStatus VdpDeviceDestroy(
1364a4f78defSmrg    VdpDevice device
1365a4f78defSmrg);
1366a4f78defSmrg
1367a4f78defSmrg/*@}*/
1368a4f78defSmrg
1369a4f78defSmrg/**
1370a4f78defSmrg * \defgroup VdpCSCMatrix VdpCSCMatrix; CSC Matrix Manipulation
1371a4f78defSmrg *
1372a4f78defSmrg * When converting from YCbCr to RGB data formats, a color space
1373a4f78defSmrg * conversion operation must be performed. This operation is
1374a4f78defSmrg * parameterized using a "color space conversion matrix". The
1375a4f78defSmrg * VdpCSCMatrix is a data structure representing this
1376a4f78defSmrg * information.
1377a4f78defSmrg *
1378a4f78defSmrg * @{
1379a4f78defSmrg */
1380a4f78defSmrg
1381a4f78defSmrg/**
1382a4f78defSmrg * \brief Storage for a color space conversion matrix.
1383a4f78defSmrg *
1384a4f78defSmrg * Note that the application may choose to construct the matrix
1385a4f78defSmrg * content by either:
1386a4f78defSmrg * - Directly filling in the fields of the CSC matrix
1387a4f78defSmrg * - Using the \ref VdpGenerateCSCMatrix helper function.
1388a4f78defSmrg *
1389a4f78defSmrg * The color space conversion equation is as follows:
1390a4f78defSmrg *
1391a4f78defSmrg * \f[
1392a4f78defSmrg * \left( \begin{array}{c} R \\ G \\ B \end{array} \right)
1393a4f78defSmrg * =
1394a4f78defSmrg * \left( \begin{array}{cccc}
1395a4f78defSmrg * m_{0,0} & m_{0,1} & m_{0,2} & m_{0,3} \\
1396a4f78defSmrg * m_{1,0} & m_{1,1} & m_{1,2} & m_{1,3} \\
1397a4f78defSmrg * m_{2,0} & m_{2,1} & m_{2,2} & m_{2,3}
1398a4f78defSmrg * \end{array}
1399a4f78defSmrg * \right)
1400a4f78defSmrg * *
1401a4f78defSmrg * \left( \begin{array}{c} Y \\ Cb \\ Cr \\ 1.0 \end{array}
1402a4f78defSmrg *      \right)
1403a4f78defSmrg * \f]
1404a4f78defSmrg */
1405a4f78defSmrgtypedef float VdpCSCMatrix[3][4];
1406a4f78defSmrg
1407a4f78defSmrg#define VDP_PROCAMP_VERSION 0
1408a4f78defSmrg
1409a4f78defSmrg/**
1410a4f78defSmrg * \brief Procamp operation parameterization data.
1411a4f78defSmrg *
1412a4f78defSmrg * When performing a color space conversion operation, various
1413a4f78defSmrg * adjustments can be performed at the same time, such as
1414a4f78defSmrg * brightness and contrast. This structure defines the level of
1415a4f78defSmrg * adjustments to make.
1416a4f78defSmrg */
1417a4f78defSmrgtypedef struct {
1418a4f78defSmrg    /**
1419a4f78defSmrg     * This field must be filled with VDP_PROCAMP_VERSION
1420a4f78defSmrg     */
1421a4f78defSmrg    uint32_t struct_version;
1422a4f78defSmrg    /**
1423a4f78defSmrg     * Brightness adjustment amount. A value clamped between
1424a4f78defSmrg     * -1.0 and 1.0. 0.0 represents no modification.
1425a4f78defSmrg     */
1426a4f78defSmrg    float brightness;
1427a4f78defSmrg    /**
1428a4f78defSmrg     * Contrast adjustment amount. A value clamped between
1429a4f78defSmrg     * 0.0 and 10.0. 1.0 represents no modification.
1430a4f78defSmrg     */
1431a4f78defSmrg    float contrast;
1432a4f78defSmrg    /**
1433a4f78defSmrg     * Saturation adjustment amount. A value clamped between 0.0 and
1434a4f78defSmrg     * 10.0. 1.0 represents no modification.
1435a4f78defSmrg     */
1436a4f78defSmrg    float saturation;
1437a4f78defSmrg    /**
1438a4f78defSmrg     * Hue adjustment amount. A value clamped between
1439a4f78defSmrg     * -PI and PI. 0.0 represents no modification.
1440a4f78defSmrg     */
1441a4f78defSmrg    float hue;
1442a4f78defSmrg} VdpProcamp;
1443a4f78defSmrg
1444a4f78defSmrg/**
1445a4f78defSmrg * \brief YCbCr color space specification.
1446a4f78defSmrg *
1447a4f78defSmrg * A number of YCbCr color spaces exist. This enumeration
1448a4f78defSmrg * defines the specifications known to VDPAU.
1449a4f78defSmrg */
1450a4f78defSmrgtypedef uint32_t VdpColorStandard;
1451a4f78defSmrg
1452a4f78defSmrg/** \hideinitializer \brief ITU-R BT.601 */
1453a4f78defSmrg#define VDP_COLOR_STANDARD_ITUR_BT_601 ((VdpColorStandard)0)
1454a4f78defSmrg/** \hideinitializer \brief ITU-R BT.709 */
1455a4f78defSmrg#define VDP_COLOR_STANDARD_ITUR_BT_709 ((VdpColorStandard)1)
1456a4f78defSmrg/** \hideinitializer \brief SMPTE-240M */
1457a4f78defSmrg#define VDP_COLOR_STANDARD_SMPTE_240M  ((VdpColorStandard)2)
1458a4f78defSmrg
1459a4f78defSmrg/**
1460a4f78defSmrg * \brief Generate a color space conversion matrix
1461a4f78defSmrg * \param[in] procamp The procamp adjustments to make. If NULL,
1462a4f78defSmrg *        no adjustments will be made.
1463a4f78defSmrg * \param[in] standard The YCbCr color space to convert from.
1464a4f78defSmrg * \param[out] csc_matrix The CSC matrix to initialize.
1465a4f78defSmrg * \return VdpStatus The completion status of the operation.
1466a4f78defSmrg */
1467a4f78defSmrgtypedef VdpStatus VdpGenerateCSCMatrix(
1468a4f78defSmrg    VdpProcamp *     procamp,
1469a4f78defSmrg    VdpColorStandard standard,
1470a4f78defSmrg    /* output parameters follow */
1471a4f78defSmrg    VdpCSCMatrix *   csc_matrix
1472a4f78defSmrg);
1473a4f78defSmrg
1474a4f78defSmrg/*@}*/
1475a4f78defSmrg
1476a4f78defSmrg/**
1477a4f78defSmrg * \defgroup VdpVideoSurface VdpVideoSurface; Video Surface object
1478a4f78defSmrg *
1479a4f78defSmrg * A VdpVideoSurface stores YCbCr data in an internal format,
1480a4f78defSmrg * with a variety of possible chroma sub-sampling options.
1481a4f78defSmrg *
1482a4f78defSmrg * A VdpVideoSurface may be filled with:
1483a4f78defSmrg * - Data provided by the CPU via \ref
1484a4f78defSmrg *   VdpVideoSurfacePutBitsYCbCr (i.e. software decode.)
1485a4f78defSmrg * - The result of applying a \ref VdpDecoder "VdpDecoder" to
1486a4f78defSmrg *   compressed video data.
1487a4f78defSmrg *
1488a4f78defSmrg * VdpVideoSurface content may be accessed by:
1489a4f78defSmrg * - The application via \ref VdpVideoSurfaceGetBitsYCbCr
1490a4f78defSmrg * - The Hardware that implements \ref VdpOutputSurface
1491a4f78defSmrg *   "VdpOutputSurface" \ref VdpOutputSurfaceRender
1492a4f78defSmrg *   "rendering functionality".
1493a4f78defSmrg * - The Hardware the implements \ref VdpVideoMixer
1494a4f78defSmrg *   "VdpVideoMixer" functionality.
1495a4f78defSmrg *
1496a4f78defSmrg * VdpVideoSurfaces are not directly displayable. They must be
1497a4f78defSmrg * converted into a displayable format using \ref VdpVideoMixer
1498a4f78defSmrg * "VdpVideoMixer" objects.
1499a4f78defSmrg *
1500a4f78defSmrg * See \ref video_mixer_usage for additional information.
1501a4f78defSmrg *
1502a4f78defSmrg * @{
1503a4f78defSmrg */
1504a4f78defSmrg
1505a4f78defSmrg/**
1506a4f78defSmrg * \brief Query the implementation's VdpVideoSurface
1507a4f78defSmrg *        capabilities.
1508a4f78defSmrg * \param[in] device The device to query.
1509a4f78defSmrg * \param[in] surface_chroma_type The type of chroma type for
1510a4f78defSmrg *       which information is requested.
1511a4f78defSmrg * \param[out] is_supported Is this chroma type supported?
1512a4f78defSmrg * \param[out] max_width The maximum supported surface width for
1513a4f78defSmrg *       this chroma type.
1514a4f78defSmrg * \param[out] max_height The maximum supported surface height
1515a4f78defSmrg *       for this chroma type.
1516a4f78defSmrg * \return VdpStatus The completion status of the operation.
1517a4f78defSmrg */
1518a4f78defSmrgtypedef VdpStatus VdpVideoSurfaceQueryCapabilities(
1519a4f78defSmrg    VdpDevice     device,
1520a4f78defSmrg    VdpChromaType surface_chroma_type,
1521a4f78defSmrg    /* output parameters follow */
1522a4f78defSmrg    VdpBool *     is_supported,
1523a4f78defSmrg    uint32_t *    max_width,
1524a4f78defSmrg    uint32_t *    max_height
1525a4f78defSmrg);
1526a4f78defSmrg
1527a4f78defSmrg/**
1528a4f78defSmrg * \brief Query the implementation's VdpVideoSurface
1529a4f78defSmrg *        GetBits/PutBits capabilities.
1530a4f78defSmrg * \param[in] device The device to query.
1531a4f78defSmrg * \param[in] surface_chroma_type The type of chroma type for
1532a4f78defSmrg *       which information is requested.
1533a4f78defSmrg * \param[in] bits_ycbcr_format The format of application "bits"
1534a4f78defSmrg *       buffer for which information is requested.
1535a4f78defSmrg * \param[out] is_supported Is this chroma type supported?
1536a4f78defSmrg * \return VdpStatus The completion status of the operation.
1537a4f78defSmrg */
1538a4f78defSmrgtypedef VdpStatus VdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities(
1539a4f78defSmrg    VdpDevice      device,
1540a4f78defSmrg    VdpChromaType  surface_chroma_type,
1541a4f78defSmrg    VdpYCbCrFormat bits_ycbcr_format,
1542a4f78defSmrg    /* output parameters follow */
1543a4f78defSmrg    VdpBool *      is_supported
1544a4f78defSmrg);
1545a4f78defSmrg
1546a4f78defSmrg/**
1547a4f78defSmrg * \brief An opaque handle representing a VdpVideoSurface
1548a4f78defSmrg *        object.
1549a4f78defSmrg */
1550a4f78defSmrgtypedef uint32_t VdpVideoSurface;
1551a4f78defSmrg
1552a4f78defSmrg/**
1553a4f78defSmrg * \brief Create a VdpVideoSurface.
1554a4f78defSmrg * \param[in] device The device that will contain the surface.
1555a4f78defSmrg * \param[in] chroma_type The chroma type of the new surface.
1556a4f78defSmrg * \param[in] width The width of the new surface.
1557a4f78defSmrg * \param[in] height The height of the new surface.
1558a4f78defSmrg * \param[out] surface The new surface's handle.
1559a4f78defSmrg * \return VdpStatus The completion status of the operation.
1560a4f78defSmrg *
1561a4f78defSmrg * The memory backing the surface may not be initialized during
1562a4f78defSmrg * creation. Applications are expected to initialize any region
1563a4f78defSmrg * that they use, via \ref VdpDecoderRender or \ref
1564a4f78defSmrg * VdpVideoSurfacePutBitsYCbCr.
1565a4f78defSmrg *
1566a4f78defSmrg * Note that certain widths/heights are impossible for specific values of
1567a4f78defSmrg * chroma_type. For example, the definition of VDP_CHROMA_TYPE_420 implies
1568a4f78defSmrg * that the width must be even, since each single chroma sample covers two
1569a4f78defSmrg * luma samples horizontally. A similar argument applies to surface heights,
1570a4f78defSmrg * although doubly so, since interlaced pictures must be supported; each
1571a4f78defSmrg * field's height must itself be a multiple of 2. Hence the overall surface's
1572a4f78defSmrg * height must be a multiple of 4.
1573a4f78defSmrg *
1574a4f78defSmrg * Similar rules apply to other chroma_type values.
1575a4f78defSmrg *
1576a4f78defSmrg * Implementations may also impose additional restrictions on the surface
1577a4f78defSmrg * sizes they support, potentially requiring additional rounding of actual
1578a4f78defSmrg * surface sizes.
1579a4f78defSmrg *
1580a4f78defSmrg * In most cases, this is not an issue, since:
1581a4f78defSmrg * - Video streams are encoded as an array of macro-blocks, which typically
1582a4f78defSmrg *   have larger size alignment requirements than video surfaces do.
1583a4f78defSmrg * - APIs such as \ref VdpVideoMixerRender allow specification of a sub-region
1584a4f78defSmrg *   of the surface to read, which allows the padding data to be clipped away.
1585a4f78defSmrg *
1586a4f78defSmrg * However, other APIs such as \ref VdpVideoSurfaceGetBitsYCbCr and
1587a4f78defSmrg * \ref VdpVideoSurfacePutBitsYCbCr do not allow a sub-region to be specified,
1588a4f78defSmrg * and always operate on surface size that was actually allocated, rather
1589a4f78defSmrg * than the surface size that was requested. In this case, applications need
1590a4f78defSmrg * to be aware of the actual surface size, in order to allocate appropriately
1591a4f78defSmrg * sized buffers for the get-/put-bits operations.
1592a4f78defSmrg *
1593a4f78defSmrg * For this reason, applications may need to call
1594a4f78defSmrg * \ref VdpVideoSurfaceGetParameters after creation, in order to retrieve the
1595a4f78defSmrg * actual surface size.
1596a4f78defSmrg */
1597a4f78defSmrgtypedef VdpStatus VdpVideoSurfaceCreate(
1598a4f78defSmrg    VdpDevice         device,
1599a4f78defSmrg    VdpChromaType     chroma_type,
1600a4f78defSmrg    uint32_t          width,
1601a4f78defSmrg    uint32_t          height,
1602a4f78defSmrg    /* output parameters follow */
1603a4f78defSmrg    VdpVideoSurface * surface
1604a4f78defSmrg);
1605a4f78defSmrg
1606a4f78defSmrg/**
1607a4f78defSmrg * \brief Destroy a VdpVideoSurface.
1608a4f78defSmrg * \param[in] surface The surface's handle.
1609a4f78defSmrg * \return VdpStatus The completion status of the operation.
1610a4f78defSmrg */
1611a4f78defSmrgtypedef VdpStatus VdpVideoSurfaceDestroy(
1612a4f78defSmrg    VdpVideoSurface surface
1613a4f78defSmrg);
1614a4f78defSmrg
1615a4f78defSmrg/**
1616a4f78defSmrg * \brief Retrieve the parameters used to create a
1617a4f78defSmrg *        VdpVideoSurface.
1618a4f78defSmrg * \param[in] surface The surface's handle.
1619a4f78defSmrg * \param[out] chroma_type The chroma type of the surface.
1620a4f78defSmrg * \param[out] width The width of the surface.
1621a4f78defSmrg * \param[out] height The height of the surface.
1622a4f78defSmrg * \return VdpStatus The completion status of the operation.
1623a4f78defSmrg */
1624a4f78defSmrgtypedef VdpStatus VdpVideoSurfaceGetParameters(
1625a4f78defSmrg    VdpVideoSurface surface,
1626a4f78defSmrg    /* output parameters follow */
1627a4f78defSmrg    VdpChromaType * chroma_type,
1628a4f78defSmrg    uint32_t *      width,
1629a4f78defSmrg    uint32_t *      height
1630a4f78defSmrg);
1631a4f78defSmrg
1632a4f78defSmrg/**
1633a4f78defSmrg * \brief Copy image data from a VdpVideoSurface to application
1634a4f78defSmrg *        memory in a specified YCbCr format.
1635a4f78defSmrg * \param[in] surface The surface's handle.
1636a4f78defSmrg * \param[in] destination_ycbcr_format The format of the
1637a4f78defSmrg *       application's data buffers.
1638a4f78defSmrg * \param[in] destination_data Pointers to the application data
1639a4f78defSmrg *       buffers into which the image data will be written. Note
1640a4f78defSmrg *       that this is an array of pointers, one per plane. The
1641a4f78defSmrg *       destination_format parameter will define how many
1642a4f78defSmrg *       planes are required.
1643a4f78defSmrg * \param[in] destination_pitches Pointers to the pitch values
1644a4f78defSmrg *       for the application data buffers. Note that this is an
1645a4f78defSmrg *       array of pointers, one per plane. The
1646a4f78defSmrg *       destination_format parameter will define how many
1647a4f78defSmrg *       planes are required.
1648a4f78defSmrg * \return VdpStatus The completion status of the operation.
1649a4f78defSmrg */
1650a4f78defSmrgtypedef VdpStatus VdpVideoSurfaceGetBitsYCbCr(
1651a4f78defSmrg    VdpVideoSurface  surface,
1652a4f78defSmrg    VdpYCbCrFormat   destination_ycbcr_format,
1653a4f78defSmrg    void * const *   destination_data,
1654a4f78defSmrg    uint32_t const * destination_pitches
1655a4f78defSmrg);
1656a4f78defSmrg
1657a4f78defSmrg/**
1658a4f78defSmrg * \brief Copy image data from application memory in a specific
1659a4f78defSmrg *        YCbCr format to a VdpVideoSurface.
1660a4f78defSmrg * \param[in] surface The surface's handle.
1661a4f78defSmrg * \param[in] source_ycbcr_format The format of the
1662a4f78defSmrg *       application's data buffers.
1663a4f78defSmrg * \param[in] source_data Pointers to the application data
1664a4f78defSmrg *       buffers from which the image data will be copied. Note
1665a4f78defSmrg *       that this is an array of pointers, one per plane. The
1666a4f78defSmrg *       source_format parameter will define how many
1667a4f78defSmrg *       planes are required.
1668a4f78defSmrg * \param[in] source_pitches Pointers to the pitch values
1669a4f78defSmrg *       for the application data buffers. Note that this is an
1670a4f78defSmrg *       array of pointers, one per plane. The
1671a4f78defSmrg *       source_format parameter will define how many
1672a4f78defSmrg *       planes are required.
1673a4f78defSmrg * \return VdpStatus The completion status of the operation.
1674a4f78defSmrg */
1675a4f78defSmrgtypedef VdpStatus VdpVideoSurfacePutBitsYCbCr(
1676a4f78defSmrg    VdpVideoSurface      surface,
1677a4f78defSmrg    VdpYCbCrFormat       source_ycbcr_format,
1678a4f78defSmrg    void const * const * source_data,
1679a4f78defSmrg    uint32_t const *     source_pitches
1680a4f78defSmrg);
1681a4f78defSmrg
1682a4f78defSmrg/*@}*/
1683a4f78defSmrg
1684a4f78defSmrg/**
1685a4f78defSmrg * \defgroup VdpOutputSurface VdpOutputSurface; Output Surface \
1686a4f78defSmrg * object
1687a4f78defSmrg *
1688a4f78defSmrg * A VdpOutputSurface stores RGBA data in a defined format.
1689a4f78defSmrg *
1690a4f78defSmrg * A VdpOutputSurface may be filled with:
1691a4f78defSmrg * - Data provided by the CPU via the various
1692a4f78defSmrg *   VdpOutputSurfacePutBits functions.
1693a4f78defSmrg * - Using the VdpOutputSurface \ref VdpOutputSurfaceRender
1694a4f78defSmrg *   "rendering functionality".
1695a4f78defSmrg * - Using a \ref VdpVideoMixer "VdpVideoMixer" object.
1696a4f78defSmrg *
1697a4f78defSmrg * VdpOutputSurface content may be accessed by:
1698a4f78defSmrg * - The application via the various VdpOutputSurfaceGetBits
1699a4f78defSmrg *   functions.
1700a4f78defSmrg * - The Hardware that implements VdpOutputSurface
1701a4f78defSmrg *   \ref VdpOutputSurfaceRender "rendering functionality".
1702a4f78defSmrg * - The Hardware the implements \ref VdpVideoMixer
1703a4f78defSmrg *   "VdpVideoMixer" functionality.
1704a4f78defSmrg * - The Hardware that implements \ref VdpPresentationQueue
1705a4f78defSmrg *   "VdpPresentationQueue" functionality,
1706a4f78defSmrg *
1707a4f78defSmrg * VdpVideoSurfaces are directly displayable using a \ref
1708a4f78defSmrg * VdpPresentationQueue "VdpPresentationQueue" object.
1709a4f78defSmrg *
1710a4f78defSmrg * @{
1711a4f78defSmrg */
1712a4f78defSmrg
1713a4f78defSmrg/**
1714a4f78defSmrg * \brief The set of all known color table formats, for use with
1715a4f78defSmrg * \ref VdpOutputSurfacePutBitsIndexed.
1716a4f78defSmrg */
1717a4f78defSmrgtypedef uint32_t VdpColorTableFormat;
1718a4f78defSmrg
1719a4f78defSmrg/**
1720a4f78defSmrg * \hideinitializer
1721a4f78defSmrg * \brief 8-bit per component packed into 32-bits
1722a4f78defSmrg *
1723a4f78defSmrg * This format is an array of packed 32-bit RGB color values.
1724a4f78defSmrg * Bits [31:24] are unused, bits [23:16] contain R, bits [15:8]
1725a4f78defSmrg * contain G, and bits [7:0] contain B. Note: The format is
1726a4f78defSmrg * physically an array of uint32_t values, and should be accessed
1727a4f78defSmrg * as such by the application in order to avoid endianness
1728a4f78defSmrg * issues.
1729a4f78defSmrg */
1730a4f78defSmrg#define VDP_COLOR_TABLE_FORMAT_B8G8R8X8 ((VdpColorTableFormat)0)
1731a4f78defSmrg
1732a4f78defSmrg/**
1733a4f78defSmrg * \brief Query the implementation's VdpOutputSurface
1734a4f78defSmrg *        capabilities.
1735a4f78defSmrg * \param[in] device The device to query.
1736a4f78defSmrg * \param[in] surface_rgba_format The surface format for
1737a4f78defSmrg *       which information is requested.
1738a4f78defSmrg * \param[out] is_supported Is this surface format supported?
1739a4f78defSmrg * \param[out] max_width The maximum supported surface width for
1740a4f78defSmrg *       this chroma type.
1741a4f78defSmrg * \param[out] max_height The maximum supported surface height
1742a4f78defSmrg *       for this chroma type.
1743a4f78defSmrg * \return VdpStatus The completion status of the operation.
1744a4f78defSmrg */
1745a4f78defSmrgtypedef VdpStatus VdpOutputSurfaceQueryCapabilities(
1746a4f78defSmrg    VdpDevice     device,
1747a4f78defSmrg    VdpRGBAFormat surface_rgba_format,
1748a4f78defSmrg    /* output parameters follow */
1749a4f78defSmrg    VdpBool *     is_supported,
1750a4f78defSmrg    uint32_t *    max_width,
1751a4f78defSmrg    uint32_t *    max_height
1752a4f78defSmrg);
1753a4f78defSmrg
1754a4f78defSmrg/**
1755a4f78defSmrg * \brief Query the implementation's capability to perform a
1756a4f78defSmrg *        PutBits operation using application data matching the
1757a4f78defSmrg *        surface's format.
1758a4f78defSmrg * \param[in] device The device to query.
1759a4f78defSmrg * \param[in] surface_rgba_format The surface format for
1760a4f78defSmrg *       which information is requested.
1761a4f78defSmrg * \param[out] is_supported Is this surface format supported?
1762a4f78defSmrg * \return VdpStatus The completion status of the operation.
1763a4f78defSmrg */
1764a4f78defSmrgtypedef VdpStatus VdpOutputSurfaceQueryGetPutBitsNativeCapabilities(
1765a4f78defSmrg    VdpDevice     device,
1766a4f78defSmrg    VdpRGBAFormat surface_rgba_format,
1767a4f78defSmrg    /* output parameters follow */
1768a4f78defSmrg    VdpBool *     is_supported
1769a4f78defSmrg);
1770a4f78defSmrg
1771a4f78defSmrg/**
1772a4f78defSmrg * \brief Query the implementation's capability to perform a
1773a4f78defSmrg *        PutBits operation using application data in a specific
1774a4f78defSmrg *        indexed format.
1775a4f78defSmrg * \param[in] device The device to query.
1776a4f78defSmrg * \param[in] surface_rgba_format The surface format for
1777a4f78defSmrg *       which information is requested.
1778a4f78defSmrg * \param[in] bits_indexed_format The format of the application
1779a4f78defSmrg *       data buffer.
1780a4f78defSmrg * \param[in] color_table_format The format of the color lookup
1781a4f78defSmrg *       table.
1782a4f78defSmrg * \param[out] is_supported Is this surface format supported?
1783a4f78defSmrg * \return VdpStatus The completion status of the operation.
1784a4f78defSmrg */
1785a4f78defSmrgtypedef VdpStatus VdpOutputSurfaceQueryPutBitsIndexedCapabilities(
1786a4f78defSmrg    VdpDevice           device,
1787a4f78defSmrg    VdpRGBAFormat       surface_rgba_format,
1788a4f78defSmrg    VdpIndexedFormat    bits_indexed_format,
1789a4f78defSmrg    VdpColorTableFormat color_table_format,
1790a4f78defSmrg    /* output parameters follow */
1791a4f78defSmrg    VdpBool *           is_supported
1792a4f78defSmrg);
1793a4f78defSmrg
1794a4f78defSmrg/**
1795a4f78defSmrg * \brief Query the implementation's capability to perform a
1796a4f78defSmrg *        PutBits operation using application data in a specific
1797a4f78defSmrg *        YCbCr/YUB format.
1798a4f78defSmrg * \param[in] device The device to query.
1799a4f78defSmrg * \param[in] surface_rgba_format The surface format for which
1800a4f78defSmrg *       information is requested.
1801a4f78defSmrg * \param[in] bits_ycbcr_format The format of the application
1802a4f78defSmrg *       data buffer.
1803a4f78defSmrg * \param[out] is_supported Is this surface format supported?
1804a4f78defSmrg * \return VdpStatus The completion status of the operation.
1805a4f78defSmrg */
1806a4f78defSmrgtypedef VdpStatus VdpOutputSurfaceQueryPutBitsYCbCrCapabilities(
1807a4f78defSmrg    VdpDevice      device,
1808a4f78defSmrg    VdpRGBAFormat  surface_rgba_format,
1809a4f78defSmrg    VdpYCbCrFormat bits_ycbcr_format,
1810a4f78defSmrg    /* output parameters follow */
1811a4f78defSmrg    VdpBool *      is_supported
1812a4f78defSmrg);
1813a4f78defSmrg
1814a4f78defSmrg/**
1815a4f78defSmrg * \brief An opaque handle representing a VdpOutputSurface
1816a4f78defSmrg *        object.
1817a4f78defSmrg */
1818a4f78defSmrgtypedef uint32_t VdpOutputSurface;
1819a4f78defSmrg
1820a4f78defSmrg/**
1821a4f78defSmrg * \brief Create a VdpOutputSurface.
1822a4f78defSmrg * \param[in] device The device that will contain the surface.
1823a4f78defSmrg * \param[in] rgba_format The format of the new surface.
1824a4f78defSmrg * \param[in] width The width of the new surface.
1825a4f78defSmrg * \param[in] height The height of the new surface.
1826a4f78defSmrg * \param[out] surface The new surface's handle.
1827a4f78defSmrg * \return VdpStatus The completion status of the operation.
1828a4f78defSmrg *
1829a4f78defSmrg * The memory backing the surface will be initialized to 0 color
1830a4f78defSmrg * and 0 alpha (i.e. black.)
1831a4f78defSmrg */
1832a4f78defSmrgtypedef VdpStatus VdpOutputSurfaceCreate(
1833a4f78defSmrg    VdpDevice          device,
1834a4f78defSmrg    VdpRGBAFormat      rgba_format,
1835a4f78defSmrg    uint32_t           width,
1836a4f78defSmrg    uint32_t           height,
1837a4f78defSmrg    /* output parameters follow */
1838a4f78defSmrg    VdpOutputSurface * surface
1839a4f78defSmrg);
1840a4f78defSmrg
1841a4f78defSmrg/**
1842a4f78defSmrg * \brief Destroy a VdpOutputSurface.
1843a4f78defSmrg * \param[in] surface The surface's handle.
1844a4f78defSmrg * \return VdpStatus The completion status of the operation.
1845a4f78defSmrg */
1846a4f78defSmrgtypedef VdpStatus VdpOutputSurfaceDestroy(
1847a4f78defSmrg    VdpOutputSurface surface
1848a4f78defSmrg);
1849a4f78defSmrg
1850a4f78defSmrg/**
1851a4f78defSmrg * \brief Retrieve the parameters used to create a
1852a4f78defSmrg *        VdpOutputSurface.
1853a4f78defSmrg * \param[in] surface The surface's handle.
1854a4f78defSmrg * \param[out] rgba_format The format of the surface.
1855a4f78defSmrg * \param[out] width The width of the surface.
1856a4f78defSmrg * \param[out] height The height of the surface.
1857a4f78defSmrg * \return VdpStatus The completion status of the operation.
1858a4f78defSmrg */
1859a4f78defSmrgtypedef VdpStatus VdpOutputSurfaceGetParameters(
1860a4f78defSmrg    VdpOutputSurface surface,
1861a4f78defSmrg    /* output parameters follow */
1862a4f78defSmrg    VdpRGBAFormat *  rgba_format,
1863a4f78defSmrg    uint32_t *       width,
1864a4f78defSmrg    uint32_t *       height
1865a4f78defSmrg);
1866a4f78defSmrg
1867a4f78defSmrg/**
1868a4f78defSmrg * \brief Copy image data from a VdpOutputSurface to application
1869a4f78defSmrg *        memory in the surface's native format.
1870a4f78defSmrg * \param[in] surface The surface's handle.
1871a4f78defSmrg * \param[in] source_rect The sub-rectangle of the source
1872a4f78defSmrg *       surface to copy. If NULL, the entire surface will be
1873a4f78defSmrg *       retrieved.
1874a4f78defSmrg * \param[in] destination_data Pointers to the application data
1875a4f78defSmrg *       buffers into which the image data will be written. Note
1876a4f78defSmrg *       that this is an array of pointers, one per plane. The
1877a4f78defSmrg *       destination_format parameter will define how many
1878a4f78defSmrg *       planes are required.
1879a4f78defSmrg * \param[in] destination_pitches Pointers to the pitch values
1880a4f78defSmrg *       for the application data buffers. Note that this is an
1881a4f78defSmrg *       array of pointers, one per plane. The
1882a4f78defSmrg *       destination_format parameter will define how many
1883a4f78defSmrg *       planes are required.
1884a4f78defSmrg * \return VdpStatus The completion status of the operation.
1885a4f78defSmrg */
1886a4f78defSmrgtypedef VdpStatus VdpOutputSurfaceGetBitsNative(
1887a4f78defSmrg    VdpOutputSurface surface,
1888a4f78defSmrg    VdpRect const *  source_rect,
1889a4f78defSmrg    void * const *   destination_data,
1890a4f78defSmrg    uint32_t const * destination_pitches
1891a4f78defSmrg);
1892a4f78defSmrg
1893a4f78defSmrg/**
1894a4f78defSmrg * \brief Copy image data from application memory in the
1895a4f78defSmrg *        surface's native format to a VdpOutputSurface.
1896a4f78defSmrg * \param[in] surface The surface's handle.
1897a4f78defSmrg * \param[in] source_data Pointers to the application data
1898a4f78defSmrg *       buffers from which the image data will be copied. Note
1899a4f78defSmrg *       that this is an array of pointers, one per plane. The
1900a4f78defSmrg *       source_format parameter will define how many
1901a4f78defSmrg *       planes are required.
1902a4f78defSmrg * \param[in] source_pitches Pointers to the pitch values
1903a4f78defSmrg *       for the application data buffers. Note that this is an
1904a4f78defSmrg *       array of pointers, one per plane. The
1905a4f78defSmrg *       source_format parameter will define how many
1906a4f78defSmrg *       planes are required.
1907a4f78defSmrg * \param[in] destination_rect The sub-rectangle of the surface
1908a4f78defSmrg *       to fill with application data. If NULL, the entire
1909a4f78defSmrg *       surface will be updated.
1910a4f78defSmrg * \return VdpStatus The completion status of the operation.
1911a4f78defSmrg */
1912a4f78defSmrgtypedef VdpStatus VdpOutputSurfacePutBitsNative(
1913a4f78defSmrg    VdpOutputSurface     surface,
1914a4f78defSmrg    void const * const * source_data,
1915a4f78defSmrg    uint32_t const *     source_pitches,
1916a4f78defSmrg    VdpRect const *      destination_rect
1917a4f78defSmrg);
1918a4f78defSmrg
1919a4f78defSmrg/**
1920a4f78defSmrg * \brief Copy image data from application memory in a specific
1921a4f78defSmrg *        indexed format to a VdpOutputSurface.
1922a4f78defSmrg * \param[in] surface The surface's handle.
1923a4f78defSmrg * \param[in] source_indexed_format The format of the
1924a4f78defSmrg *       application's data buffers.
1925a4f78defSmrg * \param[in] source_data Pointers to the application data
1926a4f78defSmrg *       buffers from which the image data will be copied. Note
1927a4f78defSmrg *       that this is an array of pointers, one per plane. The
1928a4f78defSmrg *       source_indexed_format parameter will define how many
1929a4f78defSmrg *       planes are required.
1930a4f78defSmrg * \param[in] source_pitches Pointers to the pitch values
1931a4f78defSmrg *       for the application data buffers. Note that this is an
1932a4f78defSmrg *       array of pointers, one per plane. The
1933a4f78defSmrg *       source_indexed_format parameter will define how many
1934a4f78defSmrg *       planes are required.
1935a4f78defSmrg * \param[in] destination_rect The sub-rectangle of the surface
1936a4f78defSmrg *       to fill with application data. If NULL, the entire
1937a4f78defSmrg *       surface will be updated.
1938a4f78defSmrg * \param[in] color_table_format The format of the color_table.
1939a4f78defSmrg * \param[in] color_table A table that maps between source index
1940a4f78defSmrg *       and target color data. See \ref VdpColorTableFormat for
1941a4f78defSmrg *       details regarding the memory layout.
1942a4f78defSmrg * \return VdpStatus The completion status of the operation.
1943a4f78defSmrg */
1944a4f78defSmrgtypedef VdpStatus VdpOutputSurfacePutBitsIndexed(
1945a4f78defSmrg    VdpOutputSurface     surface,
1946a4f78defSmrg    VdpIndexedFormat     source_indexed_format,
1947a4f78defSmrg    void const * const * source_data,
1948a4f78defSmrg    uint32_t const *     source_pitch,
1949a4f78defSmrg    VdpRect const *      destination_rect,
1950a4f78defSmrg    VdpColorTableFormat  color_table_format,
1951a4f78defSmrg    void const *         color_table
1952a4f78defSmrg);
1953a4f78defSmrg
1954a4f78defSmrg/**
1955a4f78defSmrg * \brief Copy image data from application memory in a specific
1956a4f78defSmrg *        YCbCr format to a VdpOutputSurface.
1957a4f78defSmrg * \param[in] surface The surface's handle.
1958a4f78defSmrg * \param[in] source_ycbcr_format The format of the
1959a4f78defSmrg *       application's data buffers.
1960a4f78defSmrg * \param[in] source_data Pointers to the application data
1961a4f78defSmrg *       buffers from which the image data will be copied. Note
1962a4f78defSmrg *       that this is an array of pointers, one per plane. The
1963a4f78defSmrg *       source_ycbcr_format parameter will define how many
1964a4f78defSmrg *       planes are required.
1965a4f78defSmrg * \param[in] source_pitches Pointers to the pitch values
1966a4f78defSmrg *       for the application data buffers. Note that this is an
1967a4f78defSmrg *       array of pointers, one per plane. The
1968a4f78defSmrg *       source_ycbcr_format parameter will define how many
1969a4f78defSmrg *       planes are required.
1970a4f78defSmrg * \param[in] destination_rect The sub-rectangle of the surface
1971a4f78defSmrg *       to fill with application data. If NULL, the entire
1972a4f78defSmrg *       surface will be updated.
1973a4f78defSmrg * \param[in] csc_matrix The color space conversion matrix used
1974a4f78defSmrg *       by the copy operation. If NULL, a default matrix will
1975a4f78defSmrg *       be used internally. Th default matrix is equivalent to
1976a4f78defSmrg *       ITU-R BT.601 with no procamp changes.
1977a4f78defSmrg * \return VdpStatus The completion status of the operation.
1978a4f78defSmrg */
1979a4f78defSmrgtypedef VdpStatus VdpOutputSurfacePutBitsYCbCr(
1980a4f78defSmrg    VdpOutputSurface     surface,
1981a4f78defSmrg    VdpYCbCrFormat       source_ycbcr_format,
1982a4f78defSmrg    void const * const * source_data,
1983a4f78defSmrg    uint32_t const *     source_pitches,
1984a4f78defSmrg    VdpRect const *      destination_rect,
1985a4f78defSmrg    VdpCSCMatrix const * csc_matrix
1986a4f78defSmrg);
1987a4f78defSmrg
1988a4f78defSmrg/*@}*/
1989a4f78defSmrg
1990a4f78defSmrg/**
1991a4f78defSmrg * \defgroup VdpBitmapSurface VdpBitmapSurface; Bitmap Surface \
1992a4f78defSmrg * object
1993a4f78defSmrg *
1994a4f78defSmrg * A VdpBitmapSurface stores RGBA data in a defined format.
1995a4f78defSmrg *
1996a4f78defSmrg * A VdpBitmapSurface may be filled with:
1997a4f78defSmrg * - Data provided by the CPU via the \ref
1998a4f78defSmrg *   VdpBitmapSurfacePutBitsNative function.
1999a4f78defSmrg *
2000a4f78defSmrg * VdpBitmapSurface content may be accessed by:
2001a4f78defSmrg * - The Hardware that implements \ref VdpOutputSurface
2002a4f78defSmrg *   "VdpOutputSurface" \ref VdpOutputSurfaceRender
2003a4f78defSmrg *   "rendering functionality"
2004a4f78defSmrg *
2005a4f78defSmrg * VdpBitmapSurface objects are intended to store static read-only data, such
2006a4f78defSmrg * as font glyphs, and the bitmaps used to compose an applications'
2007a4f78defSmrg * user-interface.
2008a4f78defSmrg *
2009a4f78defSmrg * The primary differences between VdpBitmapSurfaces and
2010a4f78defSmrg * \ref VdpOutputSurface "VdpOutputSurface"s are:
2011a4f78defSmrg *
2012a4f78defSmrg * - You cannot render to a VdpBitmapSurface, just upload native data via
2013a4f78defSmrg *   the PutBits API.
2014a4f78defSmrg *
2015a4f78defSmrg * - The read-only nature of a VdpBitmapSurface gives the implementation more
2016a4f78defSmrg *   flexibility in its choice of data storage location for the bitmap data.
2017a4f78defSmrg *   For example, some implementations may choose to store some/all
2018a4f78defSmrg *   VdpBitmapSurface objects in system memory to relieve GPU memory pressure.
2019a4f78defSmrg *
2020a4f78defSmrg * - VdpBitmapSurface and VdpOutputSurface may support different subsets of all
2021a4f78defSmrg *   known RGBA formats.
2022a4f78defSmrg *
2023a4f78defSmrg * @{
2024a4f78defSmrg */
2025a4f78defSmrg
2026a4f78defSmrg/**
2027a4f78defSmrg * \brief Query the implementation's VdpBitmapSurface
2028a4f78defSmrg *        capabilities.
2029a4f78defSmrg * \param[in] device The device to query.
2030a4f78defSmrg * \param[in] surface_rgba_format The surface format for
2031a4f78defSmrg *       which information is requested.
2032a4f78defSmrg * \param[out] is_supported Is this surface format supported?
2033a4f78defSmrg * \param[out] max_width The maximum supported surface width for
2034a4f78defSmrg *       this chroma type.
2035a4f78defSmrg * \param[out] max_height The maximum supported surface height
2036a4f78defSmrg *       for this chroma type.
2037a4f78defSmrg * \return VdpStatus The completion status of the operation.
2038a4f78defSmrg */
2039a4f78defSmrgtypedef VdpStatus VdpBitmapSurfaceQueryCapabilities(
2040a4f78defSmrg    VdpDevice     device,
2041a4f78defSmrg    VdpRGBAFormat surface_rgba_format,
2042a4f78defSmrg    /* output parameters follow */
2043a4f78defSmrg    VdpBool *     is_supported,
2044a4f78defSmrg    uint32_t *    max_width,
2045a4f78defSmrg    uint32_t *    max_height
2046a4f78defSmrg);
2047a4f78defSmrg
2048a4f78defSmrg/**
2049a4f78defSmrg * \brief An opaque handle representing a VdpBitmapSurface
2050a4f78defSmrg *        object.
2051a4f78defSmrg */
2052a4f78defSmrgtypedef uint32_t VdpBitmapSurface;
2053a4f78defSmrg
2054a4f78defSmrg/**
2055a4f78defSmrg * \brief Create a VdpBitmapSurface.
2056a4f78defSmrg * \param[in] device The device that will contain the surface.
2057a4f78defSmrg * \param[in] rgba_format The format of the new surface.
2058a4f78defSmrg * \param[in] width The width of the new surface.
2059a4f78defSmrg * \param[in] height The height of the new surface.
2060a4f78defSmrg * \param[in] frequently_accessed Is this bitmap used
2061a4f78defSmrg *       frequently, or infrequently, by compositing options?
2062a4f78defSmrg *       Implementations may use this as a hint to determine how
2063a4f78defSmrg *       to allocate the underlying storage for the surface.
2064a4f78defSmrg * \param[out] surface The new surface's handle.
2065a4f78defSmrg * \return VdpStatus The completion status of the operation.
2066a4f78defSmrg *
2067a4f78defSmrg * The memory backing the surface may not be initialized
2068a4f78defSmrg * during creation. Applications are expected initialize any
2069a4f78defSmrg * region that they use, via \ref VdpBitmapSurfacePutBitsNative.
2070a4f78defSmrg */
2071a4f78defSmrgtypedef VdpStatus VdpBitmapSurfaceCreate(
2072a4f78defSmrg    VdpDevice          device,
2073a4f78defSmrg    VdpRGBAFormat      rgba_format,
2074a4f78defSmrg    uint32_t           width,
2075a4f78defSmrg    uint32_t           height,
2076a4f78defSmrg    VdpBool            frequently_accessed,
2077a4f78defSmrg    /* output parameters follow */
2078a4f78defSmrg    VdpBitmapSurface * surface
2079a4f78defSmrg);
2080a4f78defSmrg
2081a4f78defSmrg/**
2082a4f78defSmrg * \brief Destroy a VdpBitmapSurface.
2083a4f78defSmrg * \param[in] surface The surface's handle.
2084a4f78defSmrg * \return VdpStatus The completion status of the operation.
2085a4f78defSmrg */
2086a4f78defSmrgtypedef VdpStatus VdpBitmapSurfaceDestroy(
2087a4f78defSmrg    VdpBitmapSurface surface
2088a4f78defSmrg);
2089a4f78defSmrg
2090a4f78defSmrg/**
2091a4f78defSmrg * \brief Retrieve the parameters used to create a
2092a4f78defSmrg *        VdpBitmapSurface.
2093a4f78defSmrg * \param[in] surface The surface's handle.
2094a4f78defSmrg * \param[out] rgba_format The format of the surface.
2095a4f78defSmrg * \param[out] width The width of the surface.
2096a4f78defSmrg * \param[out] height The height of the surface.
2097a4f78defSmrg * \param[out] frequently_accessed The frequently_accessed state
2098a4f78defSmrg *       of the surface.
2099a4f78defSmrg * \return VdpStatus The completion status of the operation.
2100a4f78defSmrg */
2101a4f78defSmrgtypedef VdpStatus VdpBitmapSurfaceGetParameters(
2102a4f78defSmrg    VdpBitmapSurface surface,
2103a4f78defSmrg    /* output parameters follow */
2104a4f78defSmrg    VdpRGBAFormat *  rgba_format,
2105a4f78defSmrg    uint32_t *       width,
2106a4f78defSmrg    uint32_t *       height,
2107a4f78defSmrg    VdpBool *        frequently_accessed
2108a4f78defSmrg);
2109a4f78defSmrg
2110a4f78defSmrg/**
2111a4f78defSmrg * \brief Copy image data from application memory in the
2112a4f78defSmrg *        surface's native format to a VdpBitmapSurface.
2113a4f78defSmrg * \param[in] surface The surface's handle.
2114a4f78defSmrg * \param[in] source_data Pointers to the application data
2115a4f78defSmrg *       buffers from which the image data will be copied. Note
2116a4f78defSmrg *       that this is an array of pointers, one per plane. The
2117a4f78defSmrg *       source_format parameter will define how many
2118a4f78defSmrg *       planes are required.
2119a4f78defSmrg * \param[in] source_pitches Pointers to the pitch values
2120a4f78defSmrg *       for the application data buffers. Note that this is an
2121a4f78defSmrg *       array of pointers, one per plane. The
2122a4f78defSmrg *       source_format parameter will define how many
2123a4f78defSmrg *       planes are required.
2124a4f78defSmrg * \param[in] destination_rect The sub-rectangle of the surface
2125a4f78defSmrg *       to fill with application data. If NULL, the entire
2126a4f78defSmrg *       surface will be updated.
2127a4f78defSmrg * \return VdpStatus The completion status of the operation.
2128a4f78defSmrg */
2129a4f78defSmrgtypedef VdpStatus VdpBitmapSurfacePutBitsNative(
2130a4f78defSmrg    VdpBitmapSurface     surface,
2131a4f78defSmrg    void const * const * source_data,
2132a4f78defSmrg    uint32_t const *     source_pitches,
2133a4f78defSmrg    VdpRect const *      destination_rect
2134a4f78defSmrg);
2135a4f78defSmrg
2136a4f78defSmrg/*@}*/
2137a4f78defSmrg
2138a4f78defSmrg/**
2139a4f78defSmrg * \defgroup VdpOutputSurfaceRender VdpOutputSurface Rendering \
2140a4f78defSmrg *           Functionality
2141a4f78defSmrg *
2142a4f78defSmrg * \ref VdpOutputSurface "VdpOutputSurface" objects
2143a4f78defSmrg * directly provide some rendering/compositing operations. These
2144a4f78defSmrg * are described below.
2145a4f78defSmrg *
2146a4f78defSmrg * @{
2147a4f78defSmrg */
2148a4f78defSmrg
2149a4f78defSmrg/**
2150a4f78defSmrg * \hideinitializer
2151a4f78defSmrg * \brief The blending equation factors.
2152a4f78defSmrg */
2153a4f78defSmrgtypedef enum {
2154a4f78defSmrg    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ZERO                     = 0,
2155a4f78defSmrg    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE                      = 1,
2156a4f78defSmrg    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_COLOR                = 2,
2157a4f78defSmrg    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_COLOR      = 3,
2158a4f78defSmrg    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA                = 4,
2159a4f78defSmrg    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA      = 5,
2160a4f78defSmrg    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_DST_ALPHA                = 6,
2161a4f78defSmrg    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_DST_ALPHA      = 7,
2162a4f78defSmrg    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_DST_COLOR                = 8,
2163a4f78defSmrg    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_DST_COLOR      = 9,
2164a4f78defSmrg    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA_SATURATE       = 10,
2165a4f78defSmrg    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_CONSTANT_COLOR           = 11,
2166a4f78defSmrg    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR = 12,
2167a4f78defSmrg    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_CONSTANT_ALPHA           = 13,
2168a4f78defSmrg    VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA = 14,
2169a4f78defSmrg} VdpOutputSurfaceRenderBlendFactor;
2170a4f78defSmrg
2171a4f78defSmrg/**
2172a4f78defSmrg * \hideinitializer
2173a4f78defSmrg * \brief The blending equations.
2174a4f78defSmrg */
2175a4f78defSmrgtypedef enum {
2176a4f78defSmrg    VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_SUBTRACT         = 0,
2177a4f78defSmrg    VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_REVERSE_SUBTRACT = 1,
2178a4f78defSmrg    VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD              = 2,
2179a4f78defSmrg    VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_MIN              = 3,
2180a4f78defSmrg    VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_MAX              = 4,
2181a4f78defSmrg} VdpOutputSurfaceRenderBlendEquation;
2182a4f78defSmrg
2183a4f78defSmrg#define VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSION 0
2184a4f78defSmrg
2185a4f78defSmrg/**
2186a4f78defSmrg * \brief Complete blending operation definition.
2187a4f78defSmrg *
2188a4f78defSmrg * A "blend state" operation controls the math behind certain rendering
2189a4f78defSmrg * operations.
2190a4f78defSmrg *
2191a4f78defSmrg * The blend math is the familiar OpenGL blend math:
2192a4f78defSmrg *     \f[
2193a4f78defSmrg *     dst.a = equation(blendFactorDstAlpha*dst.a,
2194a4f78defSmrg *     blendFactorSrcAlpha*src.a);
2195a4f78defSmrg *     \f]
2196a4f78defSmrg *     \f[
2197a4f78defSmrg *     dst.rgb = equation(blendFactorDstColor*dst.rgb,
2198a4f78defSmrg *     blendFactorSrcColor*src.rgb);
2199a4f78defSmrg *     \f]
2200a4f78defSmrg *
2201a4f78defSmrg * Note that when equation is MIN or MAX, the blend factors and constants
2202a4f78defSmrg * are ignored, and are treated as if they were 1.0.
2203a4f78defSmrg */
2204a4f78defSmrgtypedef struct {
2205a4f78defSmrg    /**
2206a4f78defSmrg     * This field must be filled with VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSIION
2207a4f78defSmrg     */
2208a4f78defSmrg    uint32_t struct_version;
2209a4f78defSmrg    VdpOutputSurfaceRenderBlendFactor   blend_factor_source_color;
2210a4f78defSmrg    VdpOutputSurfaceRenderBlendFactor   blend_factor_destination_color;
2211a4f78defSmrg    VdpOutputSurfaceRenderBlendFactor   blend_factor_source_alpha;
2212a4f78defSmrg    VdpOutputSurfaceRenderBlendFactor   blend_factor_destination_alpha;
2213a4f78defSmrg    VdpOutputSurfaceRenderBlendEquation blend_equation_color;
2214a4f78defSmrg    VdpOutputSurfaceRenderBlendEquation blend_equation_alpha;
2215a4f78defSmrg    VdpColor                            blend_constant;
2216a4f78defSmrg} VdpOutputSurfaceRenderBlendState;
2217a4f78defSmrg
2218a4f78defSmrg/**
2219a4f78defSmrg * \hideinitializer
2220a4f78defSmrg * \brief Do not rotate source_surface prior to compositing.
2221a4f78defSmrg */
2222a4f78defSmrg#define VDP_OUTPUT_SURFACE_RENDER_ROTATE_0   0
2223a4f78defSmrg
2224a4f78defSmrg/**
2225a4f78defSmrg * \hideinitializer
2226a4f78defSmrg * \brief Rotate source_surface 90 degrees clockwise prior to
2227a4f78defSmrg *        compositing.
2228a4f78defSmrg */
2229a4f78defSmrg#define VDP_OUTPUT_SURFACE_RENDER_ROTATE_90  1
2230a4f78defSmrg
2231a4f78defSmrg/**
2232a4f78defSmrg * \hideinitializer
2233a4f78defSmrg * \brief Rotate source_surface 180 degrees prior to
2234a4f78defSmrg *        compositing.
2235a4f78defSmrg */
2236a4f78defSmrg#define VDP_OUTPUT_SURFACE_RENDER_ROTATE_180 2
2237a4f78defSmrg
2238a4f78defSmrg/**
2239a4f78defSmrg * \hideinitializer
2240a4f78defSmrg * \brief Rotate source_surface 270 degrees clockwise prior to
2241a4f78defSmrg *        compositing.
2242a4f78defSmrg */
2243a4f78defSmrg#define VDP_OUTPUT_SURFACE_RENDER_ROTATE_270 3
2244a4f78defSmrg
2245a4f78defSmrg/**
2246a4f78defSmrg * \hideinitializer
2247a4f78defSmrg * \brief A separate color is used for each vertex of the
2248a4f78defSmrg *        smooth-shaded quad. Hence, colors array contains 4
2249a4f78defSmrg *        elements rather than 1. See description of colors
2250a4f78defSmrg *        array.
2251a4f78defSmrg */
2252a4f78defSmrg#define VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX (1 << 2)
2253a4f78defSmrg
2254a4f78defSmrg/**
2255a4f78defSmrg * \brief Composite a sub-rectangle of a \ref VdpOutputSurface
2256a4f78defSmrg *        "VdpOutputSurface" into a sub-rectangle of another
2257a4f78defSmrg *        \ref VdpOutputSurface VdpOutputSurface.
2258a4f78defSmrg * \param[in] destination_surface The destination surface of the
2259a4f78defSmrg *       compositing operation.
2260a4f78defSmrg * \param[in] destination_rect The sub-rectangle of the
2261a4f78defSmrg *       destination surface to update. If NULL, the entire
2262a4f78defSmrg *       destination surface will be updated.
2263a4f78defSmrg * \param[in] source_surface The source surface for the
2264a4f78defSmrg *       compositing operation. The surface is treated as having
2265a4f78defSmrg *       four components: red, green, blue and alpha. Any
2266a4f78defSmrg *       missing components are treated as 1.0. For example, for
2267a4f78defSmrg *       an A8 VdpOutputSurface, alpha will come from the surface
2268a4f78defSmrg *       but red, green and blue will be treated as 1.0. If
2269a4f78defSmrg *       source_surface is VDP_INVALID_HANDLE, all components will
2270a4f78defSmrg *       be treated as 1.0. Note that destination_surface and
2271a4f78defSmrg *       source_surface must have been allocated via the same
2272a4f78defSmrg *       \ref VdpDevice "VdpDevice".
2273a4f78defSmrg * \param[in] source_rect The sub-rectangle of the source
2274a4f78defSmrg *       surface to read from. If NULL, the entire
2275a4f78defSmrg *       source_surface will be read. Left/right and/or top/bottom
2276a4f78defSmrg *       co-ordinates may be swapped to flip the source. Any
2277a4f78defSmrg *       flip occurs prior to any requested rotation. Values
2278a4f78defSmrg *       from outside the source surface are valid and samples
2279a4f78defSmrg *       at those locations will be taken from the nearest edge.
2280a4f78defSmrg * \param[in] colors A pointer to an array of \ref VdpColor
2281a4f78defSmrg *      "VdpColor" objects. If the flag
2282a4f78defSmrg *      VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX is set,
2283a4f78defSmrg *      VDPAU will four entries from the array, and treat them
2284a4f78defSmrg *      as the colors corresponding to the upper-left,
2285a4f78defSmrg *      upper-right, lower-right and lower-left corners of the
2286a4f78defSmrg *      post-rotation source (i.e. indices 0, 1, 2 and 3 run
2287a4f78defSmrg *      clockwise from the upper left corner). If the flag
2288a4f78defSmrg *      VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX is not
2289a4f78defSmrg *      set, VDPAU will use the single VdpColor for all four
2290a4f78defSmrg *      corners. If colors is NULL then red, green, blue and
2291a4f78defSmrg *      alpha values of 1.0 will be used.
2292a4f78defSmrg * \param[in] blend_state If a blend state is provided, the
2293a4f78defSmrg *     blend state will be used for the composite operation. If
2294a4f78defSmrg *     NULL, blending is effectively disabled, which is
2295a4f78defSmrg *     equivalent to a blend equation of ADD, source blend
2296a4f78defSmrg *     factors of ONE and destination blend factors of ZERO.
2297a4f78defSmrg *     See \ref VdpOutputSurfaceRenderBlendState for details
2298a4f78defSmrg *     regarding the mathematics of the blending operation.
2299a4f78defSmrg * \param[in] flags A set of flags influencing how the
2300a4f78defSmrg *       compositing operation works.
2301a4f78defSmrg * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_0
2302a4f78defSmrg * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_90
2303a4f78defSmrg * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_180
2304a4f78defSmrg * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_270
2305a4f78defSmrg * \arg \ref VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX
2306a4f78defSmrg * \return VdpStatus The completion status of the operation.
2307a4f78defSmrg *
2308a4f78defSmrg * The general compositing pipeline is as follows.
2309a4f78defSmrg *
2310a4f78defSmrg * -# Extract source_rect from source_surface.
2311a4f78defSmrg *
2312a4f78defSmrg * -# The extracted source is rotated 0, 90, 180 or 270 degrees
2313a4f78defSmrg *    according to the flags.
2314a4f78defSmrg *
2315a4f78defSmrg * -# The rotated source is component-wise multiplied by a
2316a4f78defSmrg *    smooth-shaded quad with a (potentially) different color at
2317a4f78defSmrg *    each vertex.
2318a4f78defSmrg *
2319a4f78defSmrg * -# The resulting rotated, smooth-shaded quad is scaled to the
2320a4f78defSmrg *    size of destination_rect and composited with
2321a4f78defSmrg *    destination_surface using the provided blend state.
2322a4f78defSmrg *
2323a4f78defSmrg */
2324a4f78defSmrgtypedef VdpStatus VdpOutputSurfaceRenderOutputSurface(
2325a4f78defSmrg    VdpOutputSurface                         destination_surface,
2326a4f78defSmrg    VdpRect const *                          destination_rect,
2327a4f78defSmrg    VdpOutputSurface                         source_surface,
2328a4f78defSmrg    VdpRect const *                          source_rect,
2329a4f78defSmrg    VdpColor const *                         colors,
2330a4f78defSmrg    VdpOutputSurfaceRenderBlendState const * blend_state,
2331a4f78defSmrg    uint32_t                                 flags
2332a4f78defSmrg);
2333a4f78defSmrg
2334a4f78defSmrg/**
2335a4f78defSmrg * \brief Composite a sub-rectangle of a \ref VdpBitmapSurface
2336a4f78defSmrg *        "VdpBitmapSurface" into a sub-rectangle of a
2337a4f78defSmrg *        \ref VdpOutputSurface VdpOutputSurface.
2338a4f78defSmrg * \param[in] destination_surface The destination surface of the
2339a4f78defSmrg *       compositing operation.
2340a4f78defSmrg * \param[in] destination_rect The sub-rectangle of the
2341a4f78defSmrg *       destination surface to update. If NULL, the entire
2342a4f78defSmrg *       destination surface will be updated.
2343a4f78defSmrg * \param[in] source_surface The source surface for the
2344a4f78defSmrg *       compositing operation. The surface is treated as having
2345a4f78defSmrg *       four components: red, green, blue and alpha. Any
2346a4f78defSmrg *       missing components are treated as 1.0. For example, for
2347a4f78defSmrg *       an A8 VdpBitmapSurface, alpha will come from the surface
2348a4f78defSmrg *       but red, green and blue will be treated as 1.0. If
2349a4f78defSmrg *       source_surface is VDP_INVALID_HANDLE, all components will
2350a4f78defSmrg *       be treated as 1.0. Note that destination_surface and
2351a4f78defSmrg *       source_surface must have been allocated via the same
2352a4f78defSmrg *       \ref VdpDevice "VdpDevice".
2353a4f78defSmrg * \param[in] source_rect The sub-rectangle of the source
2354a4f78defSmrg *       surface to read from. If NULL, the entire
2355a4f78defSmrg *       source_surface will be read. Left/right ot top/bottom
2356a4f78defSmrg *       co-ordinates may be swapped to flip the source. Any
2357a4f78defSmrg *       flip occurs prior to any requested rotation. Values
2358a4f78defSmrg *       from outside the source surface are valid and samples
2359a4f78defSmrg *       at those locations will be taken from the nearest edge.
2360a4f78defSmrg * \param[in] colors A pointer to an array of \ref VdpColor
2361a4f78defSmrg *      "VdpColor" objects. If the flag
2362a4f78defSmrg *      VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX is set,
2363a4f78defSmrg *      VDPAU will four entries from the array, and treat them
2364a4f78defSmrg *      as the colors corresponding to the upper-left,
2365a4f78defSmrg *      upper-right, lower-right and lower-left corners of the
2366a4f78defSmrg *      post-rotation source (i.e. indices 0, 1, 2 and 3 run
2367a4f78defSmrg *      clockwise from the upper left corner). If the flag
2368a4f78defSmrg *      VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX is not
2369a4f78defSmrg *      set, VDPAU will use the single VdpColor for all four
2370a4f78defSmrg *      corners. If colors is NULL then red, green, blue and
2371a4f78defSmrg *      alpha values of 1.0 will be used.
2372a4f78defSmrg * \param[in] blend_state If a blend state is provided, the
2373a4f78defSmrg *     blend state will be used for the composite operation. If
2374a4f78defSmrg *     NULL, blending is effectively disabled, which is
2375a4f78defSmrg *     equivalent to a blend equation of ADD, source blend
2376a4f78defSmrg *     factors of ONE and destination blend factors of ZERO.
2377a4f78defSmrg *     See \ref VdpOutputSurfaceRenderBlendState for details
2378a4f78defSmrg *     regarding the mathematics of the blending operation.
2379a4f78defSmrg * \param[in] flags A set of flags influencing how the
2380a4f78defSmrg *       compositing operation works.
2381a4f78defSmrg * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_0
2382a4f78defSmrg * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_90
2383a4f78defSmrg * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_180
2384a4f78defSmrg * \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_270
2385a4f78defSmrg * \arg \ref VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX
2386a4f78defSmrg * \return VdpStatus The completion status of the operation.
2387a4f78defSmrg *
2388a4f78defSmrg * The general compositing pipeline is as follows.
2389a4f78defSmrg *
2390a4f78defSmrg * -# Extract source_rect from source_surface.
2391a4f78defSmrg *
2392a4f78defSmrg * -# The extracted source is rotated 0, 90, 180 or 270 degrees
2393a4f78defSmrg *   according to the flags.
2394a4f78defSmrg *
2395a4f78defSmrg * -# The rotated source is component-wise multiplied by a
2396a4f78defSmrg *    smooth-shaded quad with a (potentially) different color at
2397a4f78defSmrg *    each vertex.
2398a4f78defSmrg *
2399a4f78defSmrg * -# The resulting rotated, smooth-shaded quad is scaled to the
2400a4f78defSmrg *    size of destination_rect and composited with
2401a4f78defSmrg *    destination_surface using the provided blend state.
2402a4f78defSmrg *
2403a4f78defSmrg */
2404a4f78defSmrgtypedef VdpStatus VdpOutputSurfaceRenderBitmapSurface(
2405a4f78defSmrg    VdpOutputSurface                         destination_surface,
2406a4f78defSmrg    VdpRect const *                          destination_rect,
2407a4f78defSmrg    VdpBitmapSurface                         source_surface,
2408a4f78defSmrg    VdpRect const *                          source_rect,
2409a4f78defSmrg    VdpColor const *                         colors,
2410a4f78defSmrg    VdpOutputSurfaceRenderBlendState const * blend_state,
2411a4f78defSmrg    uint32_t                                 flags
2412a4f78defSmrg);
2413a4f78defSmrg
2414a4f78defSmrg/*@}*/
2415a4f78defSmrg
2416a4f78defSmrg/**
2417a4f78defSmrg * \defgroup VdpDecoder VdpDecoder; Video Decoding object
2418a4f78defSmrg *
2419a4f78defSmrg * The VdpDecoder object decodes compressed video data, writing
2420a4f78defSmrg * the results to a \ref VdpVideoSurface "VdpVideoSurface".
2421a4f78defSmrg *
2422a4f78defSmrg * A specific VDPAU implementation may support decoding multiple
2423a4f78defSmrg * types of compressed video data. However, VdpDecoder objects
2424a4f78defSmrg * are able to decode a specific type of compressed video data.
2425a4f78defSmrg * This type must be specified during creation.
2426a4f78defSmrg *
2427a4f78defSmrg * @{
2428a4f78defSmrg */
2429a4f78defSmrg
2430a4f78defSmrg/**
2431a4f78defSmrg * \brief The set of all known compressed video formats, and
2432a4f78defSmrg *        associated profiles, that may be decoded.
2433a4f78defSmrg */
2434a4f78defSmrgtypedef uint32_t VdpDecoderProfile;
2435a4f78defSmrg
2436a4f78defSmrg/** \hideinitializer */
2437a4f78defSmrg#define VDP_DECODER_PROFILE_MPEG1                       ((VdpDecoderProfile)0)
2438a4f78defSmrg/** \hideinitializer */
2439a4f78defSmrg#define VDP_DECODER_PROFILE_MPEG2_SIMPLE                ((VdpDecoderProfile)1)
2440a4f78defSmrg/** \hideinitializer */
2441a4f78defSmrg#define VDP_DECODER_PROFILE_MPEG2_MAIN                  ((VdpDecoderProfile)2)
2442a4f78defSmrg/** \hideinitializer */
2443a4f78defSmrg/** \brief MPEG 4 part 10 == H.264 == AVC */
2444a4f78defSmrg#define VDP_DECODER_PROFILE_H264_BASELINE               ((VdpDecoderProfile)6)
2445a4f78defSmrg/** \hideinitializer */
2446a4f78defSmrg#define VDP_DECODER_PROFILE_H264_MAIN                   ((VdpDecoderProfile)7)
2447a4f78defSmrg/** \hideinitializer */
2448a4f78defSmrg#define VDP_DECODER_PROFILE_H264_HIGH                   ((VdpDecoderProfile)8)
2449a4f78defSmrg/** \hideinitializer */
2450a4f78defSmrg#define VDP_DECODER_PROFILE_VC1_SIMPLE                  ((VdpDecoderProfile)9)
2451a4f78defSmrg/** \hideinitializer */
2452a4f78defSmrg#define VDP_DECODER_PROFILE_VC1_MAIN                    ((VdpDecoderProfile)10)
2453a4f78defSmrg/** \hideinitializer */
2454a4f78defSmrg#define VDP_DECODER_PROFILE_VC1_ADVANCED                ((VdpDecoderProfile)11)
2455a4f78defSmrg/** \hideinitializer */
2456a4f78defSmrg#define VDP_DECODER_PROFILE_MPEG4_PART2_SP              ((VdpDecoderProfile)12)
2457a4f78defSmrg/** \hideinitializer */
2458a4f78defSmrg#define VDP_DECODER_PROFILE_MPEG4_PART2_ASP             ((VdpDecoderProfile)13)
2459a4f78defSmrg/** \hideinitializer */
2460a4f78defSmrg#define VDP_DECODER_PROFILE_DIVX4_QMOBILE               ((VdpDecoderProfile)14)
2461a4f78defSmrg/** \hideinitializer */
2462a4f78defSmrg#define VDP_DECODER_PROFILE_DIVX4_MOBILE                ((VdpDecoderProfile)15)
2463a4f78defSmrg/** \hideinitializer */
2464a4f78defSmrg#define VDP_DECODER_PROFILE_DIVX4_HOME_THEATER          ((VdpDecoderProfile)16)
2465a4f78defSmrg/** \hideinitializer */
2466a4f78defSmrg#define VDP_DECODER_PROFILE_DIVX4_HD_1080P              ((VdpDecoderProfile)17)
2467a4f78defSmrg/** \hideinitializer */
2468a4f78defSmrg#define VDP_DECODER_PROFILE_DIVX5_QMOBILE               ((VdpDecoderProfile)18)
2469a4f78defSmrg/** \hideinitializer */
2470a4f78defSmrg#define VDP_DECODER_PROFILE_DIVX5_MOBILE                ((VdpDecoderProfile)19)
2471a4f78defSmrg/** \hideinitializer */
2472a4f78defSmrg#define VDP_DECODER_PROFILE_DIVX5_HOME_THEATER          ((VdpDecoderProfile)20)
2473a4f78defSmrg/** \hideinitializer */
2474a4f78defSmrg#define VDP_DECODER_PROFILE_DIVX5_HD_1080P              ((VdpDecoderProfile)21)
2475a4f78defSmrg/** \hideinitializer */
2476a4f78defSmrg#define VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE   ((VdpDecoderProfile)22)
2477a4f78defSmrg/** \hideinitializer */
2478a4f78defSmrg#define VDP_DECODER_PROFILE_H264_EXTENDED               ((VdpDecoderProfile)23)
2479a4f78defSmrg/** \hideinitializer */
2480a4f78defSmrg#define VDP_DECODER_PROFILE_H264_PROGRESSIVE_HIGH       ((VdpDecoderProfile)24)
2481a4f78defSmrg/** \hideinitializer */
2482a4f78defSmrg#define VDP_DECODER_PROFILE_H264_CONSTRAINED_HIGH       ((VdpDecoderProfile)25)
2483a4f78defSmrg/** \hideinitializer */
2484a4f78defSmrg/** \brief Support for 8 bit depth only */
2485a4f78defSmrg#define VDP_DECODER_PROFILE_H264_HIGH_444_PREDICTIVE    ((VdpDecoderProfile)26)
2486a4f78defSmrg/** \hideinitializer */
2487a4f78defSmrg/** \brief MPEG-H Part 2 == H.265 == HEVC */
2488a4f78defSmrg#define VDP_DECODER_PROFILE_HEVC_MAIN                   ((VdpDecoderProfile)100)
2489a4f78defSmrg/** \hideinitializer */
2490a4f78defSmrg#define VDP_DECODER_PROFILE_HEVC_MAIN_10                ((VdpDecoderProfile)101)
2491a4f78defSmrg/** \hideinitializer */
2492a4f78defSmrg#define VDP_DECODER_PROFILE_HEVC_MAIN_STILL             ((VdpDecoderProfile)102)
2493a4f78defSmrg/** \hideinitializer */
2494a4f78defSmrg#define VDP_DECODER_PROFILE_HEVC_MAIN_12                ((VdpDecoderProfile)103)
2495a4f78defSmrg/** \hideinitializer */
2496a4f78defSmrg#define VDP_DECODER_PROFILE_HEVC_MAIN_444               ((VdpDecoderProfile)104)
2497a4f78defSmrg
2498a4f78defSmrg/** \hideinitializer */
2499a4f78defSmrg#define VDP_DECODER_LEVEL_MPEG1_NA 0
2500a4f78defSmrg
2501a4f78defSmrg/** \hideinitializer */
2502a4f78defSmrg#define VDP_DECODER_LEVEL_MPEG2_LL   0
2503a4f78defSmrg/** \hideinitializer */
2504a4f78defSmrg#define VDP_DECODER_LEVEL_MPEG2_ML   1
2505a4f78defSmrg/** \hideinitializer */
2506a4f78defSmrg#define VDP_DECODER_LEVEL_MPEG2_HL14 2
2507a4f78defSmrg/** \hideinitializer */
2508a4f78defSmrg#define VDP_DECODER_LEVEL_MPEG2_HL   3
2509a4f78defSmrg
2510a4f78defSmrg/** \hideinitializer */
2511a4f78defSmrg#define VDP_DECODER_LEVEL_H264_1     10
2512a4f78defSmrg/** \hideinitializer */
2513a4f78defSmrg#define VDP_DECODER_LEVEL_H264_1b    9
2514a4f78defSmrg/** \hideinitializer */
2515a4f78defSmrg#define VDP_DECODER_LEVEL_H264_1_1   11
2516a4f78defSmrg/** \hideinitializer */
2517a4f78defSmrg#define VDP_DECODER_LEVEL_H264_1_2   12
2518a4f78defSmrg/** \hideinitializer */
2519a4f78defSmrg#define VDP_DECODER_LEVEL_H264_1_3   13
2520a4f78defSmrg/** \hideinitializer */
2521a4f78defSmrg#define VDP_DECODER_LEVEL_H264_2     20
2522a4f78defSmrg/** \hideinitializer */
2523a4f78defSmrg#define VDP_DECODER_LEVEL_H264_2_1   21
2524a4f78defSmrg/** \hideinitializer */
2525a4f78defSmrg#define VDP_DECODER_LEVEL_H264_2_2   22
2526a4f78defSmrg/** \hideinitializer */
2527a4f78defSmrg#define VDP_DECODER_LEVEL_H264_3     30
2528a4f78defSmrg/** \hideinitializer */
2529a4f78defSmrg#define VDP_DECODER_LEVEL_H264_3_1   31
2530a4f78defSmrg/** \hideinitializer */
2531a4f78defSmrg#define VDP_DECODER_LEVEL_H264_3_2   32
2532a4f78defSmrg/** \hideinitializer */
2533a4f78defSmrg#define VDP_DECODER_LEVEL_H264_4     40
2534a4f78defSmrg/** \hideinitializer */
2535a4f78defSmrg#define VDP_DECODER_LEVEL_H264_4_1   41
2536a4f78defSmrg/** \hideinitializer */
2537a4f78defSmrg#define VDP_DECODER_LEVEL_H264_4_2   42
2538a4f78defSmrg/** \hideinitializer */
2539a4f78defSmrg#define VDP_DECODER_LEVEL_H264_5     50
2540a4f78defSmrg/** \hideinitializer */
2541a4f78defSmrg#define VDP_DECODER_LEVEL_H264_5_1   51
2542a4f78defSmrg
2543a4f78defSmrg/** \hideinitializer */
2544a4f78defSmrg#define VDP_DECODER_LEVEL_VC1_SIMPLE_LOW    0
2545a4f78defSmrg/** \hideinitializer */
2546a4f78defSmrg#define VDP_DECODER_LEVEL_VC1_SIMPLE_MEDIUM 1
2547a4f78defSmrg
2548a4f78defSmrg/** \hideinitializer */
2549a4f78defSmrg#define VDP_DECODER_LEVEL_VC1_MAIN_LOW    0
2550a4f78defSmrg/** \hideinitializer */
2551a4f78defSmrg#define VDP_DECODER_LEVEL_VC1_MAIN_MEDIUM 1
2552a4f78defSmrg/** \hideinitializer */
2553a4f78defSmrg#define VDP_DECODER_LEVEL_VC1_MAIN_HIGH   2
2554a4f78defSmrg
2555a4f78defSmrg/** \hideinitializer */
2556a4f78defSmrg#define VDP_DECODER_LEVEL_VC1_ADVANCED_L0 0
2557a4f78defSmrg/** \hideinitializer */
2558a4f78defSmrg#define VDP_DECODER_LEVEL_VC1_ADVANCED_L1 1
2559a4f78defSmrg/** \hideinitializer */
2560a4f78defSmrg#define VDP_DECODER_LEVEL_VC1_ADVANCED_L2 2
2561a4f78defSmrg/** \hideinitializer */
2562a4f78defSmrg#define VDP_DECODER_LEVEL_VC1_ADVANCED_L3 3
2563a4f78defSmrg/** \hideinitializer */
2564a4f78defSmrg#define VDP_DECODER_LEVEL_VC1_ADVANCED_L4 4
2565a4f78defSmrg
2566a4f78defSmrg/** \hideinitializer */
2567a4f78defSmrg#define VDP_DECODER_LEVEL_MPEG4_PART2_SP_L0 0
2568a4f78defSmrg/** \hideinitializer */
2569a4f78defSmrg#define VDP_DECODER_LEVEL_MPEG4_PART2_SP_L1 1
2570a4f78defSmrg/** \hideinitializer */
2571a4f78defSmrg#define VDP_DECODER_LEVEL_MPEG4_PART2_SP_L2 2
2572a4f78defSmrg/** \hideinitializer */
2573a4f78defSmrg#define VDP_DECODER_LEVEL_MPEG4_PART2_SP_L3 3
2574a4f78defSmrg
2575a4f78defSmrg/** \hideinitializer */
2576a4f78defSmrg#define VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L0 0
2577a4f78defSmrg/** \hideinitializer */
2578a4f78defSmrg#define VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L1 1
2579a4f78defSmrg/** \hideinitializer */
2580a4f78defSmrg#define VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L2 2
2581a4f78defSmrg/** \hideinitializer */
2582a4f78defSmrg#define VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L3 3
2583a4f78defSmrg/** \hideinitializer */
2584a4f78defSmrg#define VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L4 4
2585a4f78defSmrg/** \hideinitializer */
2586a4f78defSmrg#define VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L5 5
2587a4f78defSmrg
2588a4f78defSmrg/** \hideinitializer */
2589a4f78defSmrg#define VDP_DECODER_LEVEL_DIVX_NA 0
2590a4f78defSmrg
2591a4f78defSmrg/**
2592a4f78defSmrg * The VDPAU H.265/HEVC decoder levels correspond to the values of
2593a4f78defSmrg * general_level_idc as described in the H.265 Specification, Annex A,
2594a4f78defSmrg * Table A.1. The enumeration values are equal to thirty times the level
2595a4f78defSmrg * number.
2596a4f78defSmrg */
2597a4f78defSmrg#define VDP_DECODER_LEVEL_HEVC_1         30
2598a4f78defSmrg/** \hideinitializer */
2599a4f78defSmrg#define VDP_DECODER_LEVEL_HEVC_2         60
2600a4f78defSmrg/** \hideinitializer */
2601a4f78defSmrg#define VDP_DECODER_LEVEL_HEVC_2_1       63
2602a4f78defSmrg/** \hideinitializer */
2603a4f78defSmrg#define VDP_DECODER_LEVEL_HEVC_3         90
2604a4f78defSmrg/** \hideinitializer */
2605a4f78defSmrg#define VDP_DECODER_LEVEL_HEVC_3_1       93
2606a4f78defSmrg/** \hideinitializer */
2607a4f78defSmrg#define VDP_DECODER_LEVEL_HEVC_4        120
2608a4f78defSmrg/** \hideinitializer */
2609a4f78defSmrg#define VDP_DECODER_LEVEL_HEVC_4_1      123
2610a4f78defSmrg/** \hideinitializer */
2611a4f78defSmrg#define VDP_DECODER_LEVEL_HEVC_5        150
2612a4f78defSmrg/** \hideinitializer */
2613a4f78defSmrg#define VDP_DECODER_LEVEL_HEVC_5_1      153
2614a4f78defSmrg/** \hideinitializer */
2615a4f78defSmrg#define VDP_DECODER_LEVEL_HEVC_5_2      156
2616a4f78defSmrg/** \hideinitializer */
2617a4f78defSmrg#define VDP_DECODER_LEVEL_HEVC_6        180
2618a4f78defSmrg/** \hideinitializer */
2619a4f78defSmrg#define VDP_DECODER_LEVEL_HEVC_6_1      183
2620a4f78defSmrg/** \hideinitializer */
2621a4f78defSmrg#define VDP_DECODER_LEVEL_HEVC_6_2      186
2622a4f78defSmrg
2623a4f78defSmrg/**
2624a4f78defSmrg * \brief Query the implementation's VdpDecoder capabilities.
2625a4f78defSmrg * \param[in] device The device to query.
2626a4f78defSmrg * \param[in] profile The decoder profile for which information is requested.
2627a4f78defSmrg * \param[out] is_supported Is this profile supported?
2628a4f78defSmrg * \param[out] max_level The maximum specification level supported for this
2629a4f78defSmrg *       profile.
2630a4f78defSmrg * \param[out] max_macroblocks The maximum supported surface size in
2631a4f78defSmrg *       macroblocks. Note that this could be greater than that dictated by
2632a4f78defSmrg *       the maximum level.
2633a4f78defSmrg * \param[out] max_width The maximum supported surface width for this profile.
2634a4f78defSmrg *       Note that this could be greater than that dictated by the maximum
2635a4f78defSmrg *       level.
2636a4f78defSmrg * \param[out] max_height The maximum supported surface height for this
2637a4f78defSmrg *       profile. Note that this could be greater than that dictated by the
2638a4f78defSmrg *       maximum level.
2639a4f78defSmrg * \return VdpStatus The completion status of the operation.
2640a4f78defSmrg */
2641a4f78defSmrgtypedef VdpStatus VdpDecoderQueryCapabilities(
2642a4f78defSmrg    VdpDevice         device,
2643a4f78defSmrg    VdpDecoderProfile profile,
2644a4f78defSmrg    /* output parameters follow */
2645a4f78defSmrg    VdpBool *         is_supported,
2646a4f78defSmrg    uint32_t *        max_level,
2647a4f78defSmrg    uint32_t *        max_macroblocks,
2648a4f78defSmrg    uint32_t *        max_width,
2649a4f78defSmrg    uint32_t *        max_height
2650a4f78defSmrg);
2651a4f78defSmrg
2652a4f78defSmrg/**
2653a4f78defSmrg * \brief An opaque handle representing a VdpDecoder object.
2654a4f78defSmrg */
2655a4f78defSmrgtypedef uint32_t VdpDecoder;
2656a4f78defSmrg
2657a4f78defSmrg/**
2658a4f78defSmrg * \brief Create a VdpDecoder.
2659a4f78defSmrg * \param[in] device The device that will contain the surface.
2660a4f78defSmrg * \param[in] profile The video format the decoder will decode.
2661a4f78defSmrg * \param[in] width The width of the new surface.
2662a4f78defSmrg * \param[in] height The height of the new surface.
2663a4f78defSmrg * \param[in] max_references The maximum number of references that may be
2664a4f78defSmrg *       used by a single frame in the stream to be decoded. This parameter
2665a4f78defSmrg *       exists mainly for formats such as H.264, where different streams
2666a4f78defSmrg *       may use a different number of references. Requesting too many
2667a4f78defSmrg *       references may waste memory, but decoding should still operate
2668a4f78defSmrg *       correctly. Requesting too few references will cause decoding to
2669a4f78defSmrg *       fail.
2670a4f78defSmrg * \param[out] decoder The new decoder's handle.
2671a4f78defSmrg * \return VdpStatus The completion status of the operation.
2672a4f78defSmrg */
2673a4f78defSmrgtypedef VdpStatus VdpDecoderCreate(
2674a4f78defSmrg    VdpDevice         device,
2675a4f78defSmrg    VdpDecoderProfile profile,
2676a4f78defSmrg    uint32_t          width,
2677a4f78defSmrg    uint32_t          height,
2678a4f78defSmrg    uint32_t          max_references,
2679a4f78defSmrg    /* output parameters follow */
2680a4f78defSmrg    VdpDecoder *      decoder
2681a4f78defSmrg);
2682a4f78defSmrg
2683a4f78defSmrg/**
2684a4f78defSmrg * \brief Destroy a VdpDecoder.
2685a4f78defSmrg * \param[in] surface The decoder's handle.
2686a4f78defSmrg * \return VdpStatus The completion status of the operation.
2687a4f78defSmrg */
2688a4f78defSmrgtypedef VdpStatus VdpDecoderDestroy(
2689a4f78defSmrg    VdpDecoder decoder
2690a4f78defSmrg);
2691a4f78defSmrg
2692a4f78defSmrg/**
2693a4f78defSmrg * \brief Retrieve the parameters used to create a
2694a4f78defSmrg *        VdpDecoder.
2695a4f78defSmrg * \param[in] surface The surface's handle.
2696a4f78defSmrg * \param[out] profile The video format used to create the
2697a4f78defSmrg *       decoder.
2698a4f78defSmrg * \param[out] width The width of surfaces decode by the
2699a4f78defSmrg *       decoder.
2700a4f78defSmrg * \param[out] height The height of surfaces decode by the
2701a4f78defSmrg *       decoder
2702a4f78defSmrg * \return VdpStatus The completion status of the operation.
2703a4f78defSmrg */
2704a4f78defSmrgtypedef VdpStatus VdpDecoderGetParameters(
2705a4f78defSmrg    VdpDecoder          decoder,
2706a4f78defSmrg    /* output parameters follow */
2707a4f78defSmrg    VdpDecoderProfile * profile,
2708a4f78defSmrg    uint32_t *          width,
2709a4f78defSmrg    uint32_t *          height
2710a4f78defSmrg);
2711a4f78defSmrg
2712a4f78defSmrg#define VDP_BITSTREAM_BUFFER_VERSION 0
2713a4f78defSmrg
2714a4f78defSmrg/**
2715a4f78defSmrg * \brief Application data buffer containing compressed video
2716a4f78defSmrg *        data.
2717a4f78defSmrg */
2718a4f78defSmrgtypedef struct {
2719a4f78defSmrg    /**
2720a4f78defSmrg     * This field must be filled with VDP_BITSTREAM_BUFFER_VERSION
2721a4f78defSmrg     */
2722a4f78defSmrg    uint32_t     struct_version;
2723a4f78defSmrg    /** A pointer to the bitstream data bytes */
2724a4f78defSmrg    void const * bitstream;
2725a4f78defSmrg    /** The number of data bytes */
2726a4f78defSmrg    uint32_t     bitstream_bytes;
2727a4f78defSmrg} VdpBitstreamBuffer;
2728a4f78defSmrg
2729a4f78defSmrg/**
2730a4f78defSmrg * \brief A generic "picture information" type.
2731a4f78defSmrg *
2732a4f78defSmrg * This type serves solely to document the expected usage of a
2733a4f78defSmrg * generic (void *) function parameter. In actual usage, the
2734a4f78defSmrg * application is expected to physically provide a pointer to an
2735a4f78defSmrg * instance of one of the "real" VdpPictureInfo* structures,
2736a4f78defSmrg * picking the type appropriate for the decoder object in
2737a4f78defSmrg * question.
2738a4f78defSmrg */
2739a4f78defSmrgtypedef void VdpPictureInfo;
2740a4f78defSmrg
2741a4f78defSmrg/**
2742a4f78defSmrg * \brief Picture parameter information for an MPEG 1 or MPEG 2
2743a4f78defSmrg *        picture.
2744a4f78defSmrg *
2745a4f78defSmrg * Note: References to bitstream fields below may refer to data literally parsed
2746a4f78defSmrg * from the bitstream, or derived from the bitstream using a mechanism described
2747a4f78defSmrg * in the specification.
2748a4f78defSmrg */
2749a4f78defSmrgtypedef struct {
2750a4f78defSmrg    /**
2751a4f78defSmrg     * Reference used by B and P frames.
2752a4f78defSmrg     * Set to VDP_INVALID_HANDLE when not used.
2753a4f78defSmrg     */
2754a4f78defSmrg    VdpVideoSurface forward_reference;
2755a4f78defSmrg    /**
2756a4f78defSmrg     * Reference used by B frames.
2757a4f78defSmrg     * Set to VDP_INVALID_HANDLE when not used.
2758a4f78defSmrg     */
2759a4f78defSmrg    VdpVideoSurface backward_reference;
2760a4f78defSmrg    /** Number of slices in the bitstream provided. */
2761a4f78defSmrg    uint32_t        slice_count;
2762a4f78defSmrg
2763a4f78defSmrg    /** \name MPEG bitstream
2764a4f78defSmrg     *
2765a4f78defSmrg     * Copies of the MPEG bitstream fields.
2766a4f78defSmrg     * @{ */
2767a4f78defSmrg    uint8_t picture_structure;
2768a4f78defSmrg    uint8_t picture_coding_type;
2769a4f78defSmrg    uint8_t intra_dc_precision;
2770a4f78defSmrg    uint8_t frame_pred_frame_dct;
2771a4f78defSmrg    uint8_t concealment_motion_vectors;
2772a4f78defSmrg    uint8_t intra_vlc_format;
2773a4f78defSmrg    uint8_t alternate_scan;
2774a4f78defSmrg    uint8_t q_scale_type;
2775a4f78defSmrg    uint8_t top_field_first;
2776a4f78defSmrg    /** MPEG-1 only. For MPEG-2, set to 0. */
2777a4f78defSmrg    uint8_t full_pel_forward_vector;
2778a4f78defSmrg    /** MPEG-1 only. For MPEG-2, set to 0. */
2779a4f78defSmrg    uint8_t full_pel_backward_vector;
2780a4f78defSmrg    /** For MPEG-1, fill both horizontal and vertical entries. */
2781a4f78defSmrg    uint8_t f_code[2][2];
2782a4f78defSmrg    /** Convert to raster order. */
2783a4f78defSmrg    uint8_t intra_quantizer_matrix[64];
2784a4f78defSmrg    /** Convert to raster order. */
2785a4f78defSmrg    uint8_t non_intra_quantizer_matrix[64];
2786a4f78defSmrg    /** @} */
2787a4f78defSmrg} VdpPictureInfoMPEG1Or2;
2788a4f78defSmrg
2789a4f78defSmrg/**
2790a4f78defSmrg * \brief Information about an H.264 reference frame
2791a4f78defSmrg *
2792a4f78defSmrg * Note: References to bitstream fields below may refer to data literally parsed
2793a4f78defSmrg * from the bitstream, or derived from the bitstream using a mechanism described
2794a4f78defSmrg * in the specification.
2795a4f78defSmrg */
2796a4f78defSmrgtypedef struct {
2797a4f78defSmrg    /**
2798a4f78defSmrg     * The surface that contains the reference image.
2799a4f78defSmrg     * Set to VDP_INVALID_HANDLE for unused entries.
2800a4f78defSmrg     */
2801a4f78defSmrg    VdpVideoSurface surface;
2802a4f78defSmrg    /** Is this a long term reference (else short term). */
2803a4f78defSmrg    VdpBool         is_long_term;
2804a4f78defSmrg    /**
2805a4f78defSmrg     * Is the top field used as a reference.
2806a4f78defSmrg     * Set to VDP_FALSE for unused entries.
2807a4f78defSmrg     */
2808a4f78defSmrg    VdpBool         top_is_reference;
2809a4f78defSmrg    /**
2810a4f78defSmrg     * Is the bottom field used as a reference.
2811a4f78defSmrg     * Set to VDP_FALSE for unused entries.
2812a4f78defSmrg     */
2813a4f78defSmrg    VdpBool         bottom_is_reference;
2814a4f78defSmrg    /** [0]: top, [1]: bottom */
2815a4f78defSmrg    int32_t         field_order_cnt[2];
2816a4f78defSmrg    /**
2817a4f78defSmrg     * Copy of the H.264 bitstream field:
2818a4f78defSmrg     * frame_num from slice_header for short-term references,
2819a4f78defSmrg     * LongTermPicNum from decoding algorithm for long-term references.
2820a4f78defSmrg     */
2821a4f78defSmrg    uint16_t        frame_idx;
2822a4f78defSmrg} VdpReferenceFrameH264;
2823a4f78defSmrg
2824a4f78defSmrg/**
2825a4f78defSmrg * \brief Picture parameter information for an H.264 picture.
2826a4f78defSmrg *
2827a4f78defSmrg * Note: The \ref referenceFrames array must contain the "DPB" as
2828a4f78defSmrg * defined by the H.264 specification. In particular, once a
2829a4f78defSmrg * reference frame has been decoded to a surface, that surface must
2830a4f78defSmrg * continue to appear in the DPB until no longer required to predict
2831a4f78defSmrg * any future frame. Once a surface is removed from the DPB, it can
2832a4f78defSmrg * no longer be used as a reference, unless decoded again.
2833a4f78defSmrg *
2834a4f78defSmrg * Also note that only surfaces previously generated using \ref
2835a4f78defSmrg * VdpDecoderRender may be used as reference frames. In particular,
2836a4f78defSmrg * surfaces filled using any "put bits" API will not work.
2837a4f78defSmrg *
2838a4f78defSmrg * Note: References to bitstream fields below may refer to data literally parsed
2839a4f78defSmrg * from the bitstream, or derived from the bitstream using a mechanism described
2840a4f78defSmrg * in the specification.
2841a4f78defSmrg *
2842a4f78defSmrg * Note: VDPAU clients must use VdpPictureInfoH264Predictive to describe the
2843a4f78defSmrg * attributes of a frame being decoded with
2844a4f78defSmrg * VDP_DECODER_PROFILE_H264_HIGH_444_PREDICTIVE.
2845a4f78defSmrg */
2846a4f78defSmrgtypedef struct {
2847a4f78defSmrg    /** Number of slices in the bitstream provided. */
2848a4f78defSmrg    uint32_t slice_count;
2849a4f78defSmrg    /** [0]: top, [1]: bottom */
2850a4f78defSmrg    int32_t  field_order_cnt[2];
2851a4f78defSmrg    /** Will the decoded frame be used as a reference later. */
2852a4f78defSmrg    VdpBool  is_reference;
2853a4f78defSmrg
2854a4f78defSmrg    /** \name H.264 bitstream
2855a4f78defSmrg     *
2856a4f78defSmrg     * Copies of the H.264 bitstream fields.
2857a4f78defSmrg     * @{ */
2858a4f78defSmrg    uint16_t frame_num;
2859a4f78defSmrg    uint8_t  field_pic_flag;
2860a4f78defSmrg    uint8_t  bottom_field_flag;
2861a4f78defSmrg    uint8_t  num_ref_frames;
2862a4f78defSmrg    uint8_t  mb_adaptive_frame_field_flag;
2863a4f78defSmrg    uint8_t  constrained_intra_pred_flag;
2864a4f78defSmrg    uint8_t  weighted_pred_flag;
2865a4f78defSmrg    uint8_t  weighted_bipred_idc;
2866a4f78defSmrg    uint8_t  frame_mbs_only_flag;
2867a4f78defSmrg    uint8_t  transform_8x8_mode_flag;
2868a4f78defSmrg    int8_t   chroma_qp_index_offset;
2869a4f78defSmrg    int8_t   second_chroma_qp_index_offset;
2870a4f78defSmrg    int8_t   pic_init_qp_minus26;
2871a4f78defSmrg    uint8_t  num_ref_idx_l0_active_minus1;
2872a4f78defSmrg    uint8_t  num_ref_idx_l1_active_minus1;
2873a4f78defSmrg    uint8_t  log2_max_frame_num_minus4;
2874a4f78defSmrg    uint8_t  pic_order_cnt_type;
2875a4f78defSmrg    uint8_t  log2_max_pic_order_cnt_lsb_minus4;
2876a4f78defSmrg    uint8_t  delta_pic_order_always_zero_flag;
2877a4f78defSmrg    uint8_t  direct_8x8_inference_flag;
2878a4f78defSmrg    uint8_t  entropy_coding_mode_flag;
2879a4f78defSmrg    uint8_t  pic_order_present_flag;
2880a4f78defSmrg    uint8_t  deblocking_filter_control_present_flag;
2881a4f78defSmrg    uint8_t  redundant_pic_cnt_present_flag;
2882a4f78defSmrg    /** Convert to raster order. */
2883a4f78defSmrg    uint8_t scaling_lists_4x4[6][16];
2884a4f78defSmrg    /** Convert to raster order. */
2885a4f78defSmrg    uint8_t scaling_lists_8x8[2][64];
2886a4f78defSmrg    /** @} */
2887a4f78defSmrg
2888a4f78defSmrg    /** See \ref VdpPictureInfoH264 for instructions regarding this field. */
2889a4f78defSmrg    VdpReferenceFrameH264 referenceFrames[16];
2890a4f78defSmrg} VdpPictureInfoH264;
2891a4f78defSmrg
2892a4f78defSmrg/**
2893a4f78defSmrg * \brief Picture parameter information for an H.264 Hi444PP picture.
2894a4f78defSmrg *
2895a4f78defSmrg * Note: VDPAU clients must use VdpPictureInfoH264Predictive to describe the
2896a4f78defSmrg * attributes of a frame being decoded with
2897a4f78defSmrg * VDP_DECODER_PROFILE_H264_HIGH_444_PREDICTIVE.
2898a4f78defSmrg *
2899a4f78defSmrg * Note: software drivers may choose to honor values of
2900a4f78defSmrg * qpprime_y_zero_transform_bypass_flag greater than 1 for internal use.
2901a4f78defSmrg */
2902a4f78defSmrgtypedef struct {
2903a4f78defSmrg    /** \ref VdpPictureInfoH264 struct. */
2904a4f78defSmrg    VdpPictureInfoH264 pictureInfo;
2905a4f78defSmrg
2906a4f78defSmrg    /** \name H.264 bitstream
2907a4f78defSmrg     *
2908a4f78defSmrg     * Copies of the H.264 bitstream fields.
2909a4f78defSmrg     * @{ */
2910a4f78defSmrg    /**
2911a4f78defSmrg     *  0 - lossless disabled
2912a4f78defSmrg     *  1 - lossless enabled
2913a4f78defSmrg     */
2914a4f78defSmrg    uint8_t qpprime_y_zero_transform_bypass_flag;
2915a4f78defSmrg    /**
2916a4f78defSmrg     *  0 - disabled
2917a4f78defSmrg     *  1 - enabled
2918a4f78defSmrg     */
2919a4f78defSmrg    uint8_t separate_colour_plane_flag;
2920a4f78defSmrg    /** @} */
2921a4f78defSmrg} VdpPictureInfoH264Predictive;
2922a4f78defSmrg
2923a4f78defSmrg/**
2924a4f78defSmrg * \brief Picture parameter information for a VC1 picture.
2925a4f78defSmrg *
2926a4f78defSmrg * Note: References to bitstream fields below may refer to data literally parsed
2927a4f78defSmrg * from the bitstream, or derived from the bitstream using a mechanism described
2928a4f78defSmrg * in the specification.
2929a4f78defSmrg */
2930a4f78defSmrgtypedef struct {
2931a4f78defSmrg    /**
2932a4f78defSmrg     * Reference used by B and P frames.
2933a4f78defSmrg     * Set to VDP_INVALID_HANDLE when not used.
2934a4f78defSmrg     */
2935a4f78defSmrg    VdpVideoSurface forward_reference;
2936a4f78defSmrg    /**
2937a4f78defSmrg     * Reference used by B frames.
2938a4f78defSmrg     * Set to VDP_INVALID_HANDLE when not used.
2939a4f78defSmrg     */
2940a4f78defSmrg    VdpVideoSurface backward_reference;
2941a4f78defSmrg
2942a4f78defSmrg    /** Number of slices in the bitstream provided. */
2943a4f78defSmrg    uint32_t slice_count;
2944a4f78defSmrg    /** I=0, P=1, B=3, BI=4  from 7.1.1.4. */
2945a4f78defSmrg    uint8_t  picture_type;
2946a4f78defSmrg    /** Progressive=0, Frame-interlace=2, Field-interlace=3; see VC-1 7.1.1.15. */
2947a4f78defSmrg    uint8_t  frame_coding_mode;
2948a4f78defSmrg
2949a4f78defSmrg    /** \name VC-1 bitstream
2950a4f78defSmrg     *
2951a4f78defSmrg     * Copies of the VC-1 bitstream fields.
2952a4f78defSmrg     * @{ */
2953a4f78defSmrg    /** See VC-1 6.1.5. */
2954a4f78defSmrg    uint8_t postprocflag;
2955a4f78defSmrg    /** See VC-1 6.1.8. */
2956a4f78defSmrg    uint8_t pulldown;
2957a4f78defSmrg    /** See VC-1 6.1.9. */
2958a4f78defSmrg    uint8_t interlace;
2959a4f78defSmrg    /** See VC-1 6.1.10. */
2960a4f78defSmrg    uint8_t tfcntrflag;
2961a4f78defSmrg    /** See VC-1 6.1.11. */
2962a4f78defSmrg    uint8_t finterpflag;
2963a4f78defSmrg    /** See VC-1 6.1.3. */
2964a4f78defSmrg    uint8_t psf;
2965a4f78defSmrg    /** See VC-1 6.2.8. */
2966a4f78defSmrg    uint8_t dquant;
2967a4f78defSmrg    /** See VC-1 6.2.3. */
2968a4f78defSmrg    uint8_t panscan_flag;
2969a4f78defSmrg    /** See VC-1 6.2.4. */
2970a4f78defSmrg    uint8_t refdist_flag;
2971a4f78defSmrg    /** See VC-1 6.2.11. */
2972a4f78defSmrg    uint8_t quantizer;
2973a4f78defSmrg    /** See VC-1 6.2.7. */
2974a4f78defSmrg    uint8_t extended_mv;
2975a4f78defSmrg    /** See VC-1 6.2.14. */
2976a4f78defSmrg    uint8_t extended_dmv;
2977a4f78defSmrg    /** See VC-1 6.2.10. */
2978a4f78defSmrg    uint8_t overlap;
2979a4f78defSmrg    /** See VC-1 6.2.9. */
2980a4f78defSmrg    uint8_t vstransform;
2981a4f78defSmrg    /** See VC-1 6.2.5. */
2982a4f78defSmrg    uint8_t loopfilter;
2983a4f78defSmrg    /** See VC-1 6.2.6. */
2984a4f78defSmrg    uint8_t fastuvmc;
2985a4f78defSmrg    /** See VC-1 6.12.15. */
2986a4f78defSmrg    uint8_t range_mapy_flag;
2987a4f78defSmrg    uint8_t range_mapy;
2988a4f78defSmrg    /** See VC-1 6.2.16. */
2989a4f78defSmrg    uint8_t range_mapuv_flag;
2990a4f78defSmrg    uint8_t range_mapuv;
2991a4f78defSmrg
2992a4f78defSmrg    /**
2993a4f78defSmrg     * See VC-1 J.1.10.
2994a4f78defSmrg     * Only used by simple and main profiles.
2995a4f78defSmrg     */
2996a4f78defSmrg    uint8_t multires;
2997a4f78defSmrg    /**
2998a4f78defSmrg     * See VC-1 J.1.16.
2999a4f78defSmrg     * Only used by simple and main profiles.
3000a4f78defSmrg     */
3001a4f78defSmrg    uint8_t syncmarker;
3002a4f78defSmrg    /**
3003a4f78defSmrg     * VC-1 SP/MP range reduction control.
3004a4f78defSmrg     * Only used by simple and main profiles.
3005a4f78defSmrg     * Bit 0: Copy of rangered VC-1 bitstream field; See VC-1 J.1.17.
3006a4f78defSmrg     * Bit 1: Copy of rangeredfrm VC-1 bitstream fiels; See VC-1 7.1.13.
3007a4f78defSmrg     */
3008a4f78defSmrg    uint8_t rangered;
3009a4f78defSmrg    /**
3010a4f78defSmrg     * See VC-1 J.1.17.
3011a4f78defSmrg     * Only used by simple and main profiles.
3012a4f78defSmrg     */
3013a4f78defSmrg    uint8_t maxbframes;
3014a4f78defSmrg    /** @} */
3015a4f78defSmrg
3016a4f78defSmrg    /**
3017a4f78defSmrg     * Out-of-loop deblocking enable.
3018a4f78defSmrg     * Bit 0 of POSTPROC from VC-1 7.1.1.27
3019a4f78defSmrg     * Note that bit 1 of POSTPROC (dering enable) should not be included.
3020a4f78defSmrg     */
3021a4f78defSmrg    uint8_t deblockEnable;
3022a4f78defSmrg    /**
3023a4f78defSmrg     * Parameter used by VC-1 Annex H deblocking algorithm. Note that VDPAU
3024a4f78defSmrg     * implementations may choose which deblocking algorithm to use.
3025a4f78defSmrg     * See VC-1 7.1.1.6
3026a4f78defSmrg     */
3027a4f78defSmrg    uint8_t pquant;
3028a4f78defSmrg} VdpPictureInfoVC1;
3029a4f78defSmrg
3030a4f78defSmrg/**
3031a4f78defSmrg * \brief Picture parameter information for an MPEG-4 Part 2 picture.
3032a4f78defSmrg *
3033a4f78defSmrg * Note: References to bitstream fields below may refer to data literally parsed
3034a4f78defSmrg * from the bitstream, or derived from the bitstream using a mechanism described
3035a4f78defSmrg * in the specification.
3036a4f78defSmrg */
3037a4f78defSmrgtypedef struct {
3038a4f78defSmrg    /**
3039a4f78defSmrg     * Reference used by B and P frames.
3040a4f78defSmrg     * Set to VDP_INVALID_HANDLE when not used.
3041a4f78defSmrg     */
3042a4f78defSmrg    VdpVideoSurface forward_reference;
3043a4f78defSmrg    /**
3044a4f78defSmrg     * Reference used by B frames.
3045a4f78defSmrg     * Set to VDP_INVALID_HANDLE when not used.
3046a4f78defSmrg     */
3047a4f78defSmrg    VdpVideoSurface backward_reference;
3048a4f78defSmrg
3049a4f78defSmrg    /** \name MPEG 4 part 2 bitstream
3050a4f78defSmrg     *
3051a4f78defSmrg     * Copies of the MPEG 4 part 2 bitstream fields.
3052a4f78defSmrg     * @{ */
3053a4f78defSmrg    int32_t trd[2];
3054a4f78defSmrg    int32_t trb[2];
3055a4f78defSmrg    uint16_t vop_time_increment_resolution;
3056a4f78defSmrg    uint8_t vop_coding_type;
3057a4f78defSmrg    uint8_t vop_fcode_forward;
3058a4f78defSmrg    uint8_t vop_fcode_backward;
3059a4f78defSmrg    uint8_t resync_marker_disable;
3060a4f78defSmrg    uint8_t interlaced;
3061a4f78defSmrg    uint8_t quant_type;
3062a4f78defSmrg    uint8_t quarter_sample;
3063a4f78defSmrg    uint8_t short_video_header;
3064a4f78defSmrg    /** Derived from vop_rounding_type bitstream field. */
3065a4f78defSmrg    uint8_t rounding_control;
3066a4f78defSmrg    uint8_t alternate_vertical_scan_flag;
3067a4f78defSmrg    uint8_t top_field_first;
3068a4f78defSmrg    uint8_t intra_quantizer_matrix[64];
3069a4f78defSmrg    uint8_t non_intra_quantizer_matrix[64];
3070a4f78defSmrg    /** @} */
3071a4f78defSmrg} VdpPictureInfoMPEG4Part2;
3072a4f78defSmrg
3073a4f78defSmrg/**
3074a4f78defSmrg * \brief Picture parameter information for a DivX 4 picture.
3075a4f78defSmrg *
3076a4f78defSmrg * Due to similarites between MPEG-4 Part 2 and DivX 4, the picture
3077a4f78defSmrg * parameter structure is re-used.
3078a4f78defSmrg */
3079a4f78defSmrgtypedef VdpPictureInfoMPEG4Part2 VdpPictureInfoDivX4;
3080a4f78defSmrg
3081a4f78defSmrg/**
3082a4f78defSmrg * \brief Picture parameter information for a DivX 5 picture.
3083a4f78defSmrg *
3084a4f78defSmrg * Due to similarites between MPEG-4 Part 2 and DivX 5, the picture
3085a4f78defSmrg * parameter structure is re-used.
3086a4f78defSmrg */
3087a4f78defSmrgtypedef VdpPictureInfoMPEG4Part2 VdpPictureInfoDivX5;
3088a4f78defSmrg
3089a4f78defSmrg/**
3090a4f78defSmrg * \brief Picture parameter information for an H.265/HEVC picture.
3091a4f78defSmrg *
3092a4f78defSmrg * References to bitsream fields below may refer to data literally parsed from
3093a4f78defSmrg * the bitstream, or derived from the bitstream using a mechanism described in
3094a4f78defSmrg * Rec. ITU-T H.265 (04/2013), hereafter referred to as "the H.265/HEVC
3095a4f78defSmrg * Specification".
3096a4f78defSmrg *
3097a4f78defSmrg * VDPAU H.265/HEVC implementations implement the portion of the decoding
3098a4f78defSmrg * process described by clauses 8.4, 8.5, 8.6 and 8.7 of the the
3099a4f78defSmrg * H.265/HEVC Specification. VdpPictureInfoHEVC provides enough data
3100a4f78defSmrg * to complete this portion of the decoding process, plus additional
3101a4f78defSmrg * information not defined in the H.265/HEVC Specification that may be
3102a4f78defSmrg * useful to particular implementations.
3103a4f78defSmrg *
3104a4f78defSmrg * Client applications must supply every field in this struct.
3105a4f78defSmrg */
3106a4f78defSmrgtypedef struct {
3107a4f78defSmrg    /** \name HEVC Sequence Parameter Set
3108a4f78defSmrg     *
3109a4f78defSmrg     * Copies of the HEVC Sequence Parameter Set bitstream fields.
3110a4f78defSmrg     * @{ */
3111a4f78defSmrg    uint8_t chroma_format_idc;
3112a4f78defSmrg    /** Only valid if chroma_format_idc == 3. Ignored otherwise.*/
3113a4f78defSmrg    uint8_t separate_colour_plane_flag;
3114a4f78defSmrg    uint32_t pic_width_in_luma_samples;
3115a4f78defSmrg    uint32_t pic_height_in_luma_samples;
3116a4f78defSmrg    uint8_t bit_depth_luma_minus8;
3117a4f78defSmrg    uint8_t bit_depth_chroma_minus8;
3118a4f78defSmrg    uint8_t log2_max_pic_order_cnt_lsb_minus4;
3119a4f78defSmrg    /** Provides the value corresponding to the nuh_temporal_id of the frame
3120a4f78defSmrg        to be decoded. */
3121a4f78defSmrg    uint8_t sps_max_dec_pic_buffering_minus1;
3122a4f78defSmrg    uint8_t log2_min_luma_coding_block_size_minus3;
3123a4f78defSmrg    uint8_t log2_diff_max_min_luma_coding_block_size;
3124a4f78defSmrg    uint8_t log2_min_transform_block_size_minus2;
3125a4f78defSmrg    uint8_t log2_diff_max_min_transform_block_size;
3126a4f78defSmrg    uint8_t max_transform_hierarchy_depth_inter;
3127a4f78defSmrg    uint8_t max_transform_hierarchy_depth_intra;
3128a4f78defSmrg    uint8_t scaling_list_enabled_flag;
3129a4f78defSmrg    /** Scaling lists, in diagonal order, to be used for this frame. */
3130a4f78defSmrg    /** Scaling List for 4x4 quantization matrix,
3131a4f78defSmrg       indexed as ScalingList4x4[matrixId][i]. */
3132a4f78defSmrg    uint8_t ScalingList4x4[6][16];
3133a4f78defSmrg    /** Scaling List for 8x8 quantization matrix,
3134a4f78defSmrg       indexed as ScalingList8x8[matrixId][i]. */
3135a4f78defSmrg    uint8_t ScalingList8x8[6][64];
3136a4f78defSmrg    /** Scaling List for 16x16 quantization matrix,
3137a4f78defSmrg       indexed as ScalingList16x16[matrixId][i]. */
3138a4f78defSmrg    uint8_t ScalingList16x16[6][64];
3139a4f78defSmrg    /** Scaling List for 32x32 quantization matrix,
3140a4f78defSmrg       indexed as ScalingList32x32[matrixId][i]. */
3141a4f78defSmrg    uint8_t ScalingList32x32[2][64];
3142a4f78defSmrg    /** Scaling List DC Coefficients for 16x16,
3143a4f78defSmrg       indexed as ScalingListDCCoeff16x16[matrixId]. */
3144a4f78defSmrg    uint8_t ScalingListDCCoeff16x16[6];
3145a4f78defSmrg    /** Scaling List DC Coefficients for 32x32,
3146a4f78defSmrg       indexed as ScalingListDCCoeff32x32[matrixId]. */
3147a4f78defSmrg    uint8_t ScalingListDCCoeff32x32[2];
3148a4f78defSmrg    uint8_t amp_enabled_flag;
3149a4f78defSmrg    uint8_t sample_adaptive_offset_enabled_flag;
3150a4f78defSmrg    uint8_t pcm_enabled_flag;
3151a4f78defSmrg    /** Only needs to be set if pcm_enabled_flag is set. Ignored otherwise. */
3152a4f78defSmrg    uint8_t pcm_sample_bit_depth_luma_minus1;
3153a4f78defSmrg    /** Only needs to be set if pcm_enabled_flag is set. Ignored otherwise. */
3154a4f78defSmrg    uint8_t pcm_sample_bit_depth_chroma_minus1;
3155a4f78defSmrg    /** Only needs to be set if pcm_enabled_flag is set. Ignored otherwise. */
3156a4f78defSmrg    uint8_t log2_min_pcm_luma_coding_block_size_minus3;
3157a4f78defSmrg    /** Only needs to be set if pcm_enabled_flag is set. Ignored otherwise. */
3158a4f78defSmrg    uint8_t log2_diff_max_min_pcm_luma_coding_block_size;
3159a4f78defSmrg    /** Only needs to be set if pcm_enabled_flag is set. Ignored otherwise. */
3160a4f78defSmrg    uint8_t pcm_loop_filter_disabled_flag;
3161a4f78defSmrg    /** Per spec, when zero, assume short_term_ref_pic_set_sps_flag
3162a4f78defSmrg        is also zero. */
3163a4f78defSmrg    uint8_t num_short_term_ref_pic_sets;
3164a4f78defSmrg    uint8_t long_term_ref_pics_present_flag;
3165a4f78defSmrg    /** Only needed if long_term_ref_pics_present_flag is set. Ignored
3166a4f78defSmrg        otherwise. */
3167a4f78defSmrg    uint8_t num_long_term_ref_pics_sps;
3168a4f78defSmrg    uint8_t sps_temporal_mvp_enabled_flag;
3169a4f78defSmrg    uint8_t strong_intra_smoothing_enabled_flag;
3170a4f78defSmrg    /** @} */
3171a4f78defSmrg
3172a4f78defSmrg    /** \name HEVC Picture Parameter Set
3173a4f78defSmrg     *
3174a4f78defSmrg     * Copies of the HEVC Picture Parameter Set bitstream fields.
3175a4f78defSmrg     * @{ */
3176a4f78defSmrg    uint8_t dependent_slice_segments_enabled_flag;
3177a4f78defSmrg    uint8_t output_flag_present_flag;
3178a4f78defSmrg    uint8_t num_extra_slice_header_bits;
3179a4f78defSmrg    uint8_t sign_data_hiding_enabled_flag;
3180a4f78defSmrg    uint8_t cabac_init_present_flag;
3181a4f78defSmrg    uint8_t num_ref_idx_l0_default_active_minus1;
3182a4f78defSmrg    uint8_t num_ref_idx_l1_default_active_minus1;
3183a4f78defSmrg    int8_t init_qp_minus26;
3184a4f78defSmrg    uint8_t constrained_intra_pred_flag;
3185a4f78defSmrg    uint8_t transform_skip_enabled_flag;
3186a4f78defSmrg    uint8_t cu_qp_delta_enabled_flag;
3187a4f78defSmrg    /** Only needed if cu_qp_delta_enabled_flag is set. Ignored otherwise. */
3188a4f78defSmrg    uint8_t diff_cu_qp_delta_depth;
3189a4f78defSmrg    int8_t pps_cb_qp_offset;
3190a4f78defSmrg    int8_t pps_cr_qp_offset;
3191a4f78defSmrg    uint8_t pps_slice_chroma_qp_offsets_present_flag;
3192a4f78defSmrg    uint8_t weighted_pred_flag;
3193a4f78defSmrg    uint8_t weighted_bipred_flag;
3194a4f78defSmrg    uint8_t transquant_bypass_enabled_flag;
3195a4f78defSmrg    uint8_t tiles_enabled_flag;
3196a4f78defSmrg    uint8_t entropy_coding_sync_enabled_flag;
3197a4f78defSmrg    /** Only valid if tiles_enabled_flag is set. Ignored otherwise. */
3198a4f78defSmrg    uint8_t num_tile_columns_minus1;
3199a4f78defSmrg    /** Only valid if tiles_enabled_flag is set. Ignored otherwise. */
3200a4f78defSmrg    uint8_t num_tile_rows_minus1;
3201a4f78defSmrg    /** Only valid if tiles_enabled_flag is set. Ignored otherwise. */
3202a4f78defSmrg    uint8_t uniform_spacing_flag;
3203a4f78defSmrg    /** Only need to set 0..num_tile_columns_minus1. The struct
3204a4f78defSmrg        definition reserves up to the maximum of 20. Invalid values are
3205a4f78defSmrg        ignored. */
3206a4f78defSmrg    uint16_t column_width_minus1[20];
3207a4f78defSmrg    /** Only need to set 0..num_tile_rows_minus1. The struct
3208a4f78defSmrg        definition reserves up to the maximum of 22. Invalid values are
3209a4f78defSmrg        ignored.*/
3210a4f78defSmrg    uint16_t row_height_minus1[22];
3211a4f78defSmrg    /** Only needed if tiles_enabled_flag is set. Invalid values are
3212a4f78defSmrg        ignored. */
3213a4f78defSmrg    uint8_t loop_filter_across_tiles_enabled_flag;
3214a4f78defSmrg    uint8_t pps_loop_filter_across_slices_enabled_flag;
3215a4f78defSmrg    uint8_t deblocking_filter_control_present_flag;
3216a4f78defSmrg    /** Only valid if deblocking_filter_control_present_flag is set. Ignored
3217a4f78defSmrg        otherwise. */
3218a4f78defSmrg    uint8_t deblocking_filter_override_enabled_flag;
3219a4f78defSmrg    /** Only valid if deblocking_filter_control_present_flag is set. Ignored
3220a4f78defSmrg        otherwise. */
3221a4f78defSmrg    uint8_t pps_deblocking_filter_disabled_flag;
3222a4f78defSmrg    /** Only valid if deblocking_filter_control_present_flag is set and
3223a4f78defSmrg        pps_deblocking_filter_disabled_flag is not set. Ignored otherwise.*/
3224a4f78defSmrg    int8_t pps_beta_offset_div2;
3225a4f78defSmrg    /** Only valid if deblocking_filter_control_present_flag is set and
3226a4f78defSmrg        pps_deblocking_filter_disabled_flag is not set. Ignored otherwise. */
3227a4f78defSmrg    int8_t pps_tc_offset_div2;
3228a4f78defSmrg    uint8_t lists_modification_present_flag;
3229a4f78defSmrg    uint8_t log2_parallel_merge_level_minus2;
3230a4f78defSmrg    uint8_t slice_segment_header_extension_present_flag;
3231a4f78defSmrg
3232a4f78defSmrg    /** \name HEVC Slice Segment Header
3233a4f78defSmrg     *
3234a4f78defSmrg     * Copies of the HEVC Slice Segment Header bitstream fields and calculated
3235a4f78defSmrg     * values detailed in the specification.
3236a4f78defSmrg     * @{ */
3237a4f78defSmrg    /** Set to 1 if nal_unit_type is equal to IDR_W_RADL or IDR_N_LP.
3238a4f78defSmrg        Set to zero otherwise. */
3239a4f78defSmrg    uint8_t IDRPicFlag;
3240a4f78defSmrg    /** Set to 1 if nal_unit_type in the range of BLA_W_LP to
3241a4f78defSmrg        RSV_IRAP_VCL23, inclusive. Set to zero otherwise.*/
3242a4f78defSmrg    uint8_t RAPPicFlag;
3243a4f78defSmrg    /** See section 7.4.7.1 of the specification. */
3244a4f78defSmrg    uint8_t CurrRpsIdx;
3245a4f78defSmrg    /** See section 7.4.7.2 of the specification. */
3246a4f78defSmrg    uint32_t NumPocTotalCurr;
3247a4f78defSmrg    /** Corresponds to specification field, NumDeltaPocs[RefRpsIdx].
3248a4f78defSmrg        Only applicable when short_term_ref_pic_set_sps_flag == 0.
3249a4f78defSmrg        Implementations will ignore this value in other cases. See 7.4.8. */
3250a4f78defSmrg    uint32_t NumDeltaPocsOfRefRpsIdx;
3251a4f78defSmrg    /** Section 7.6.3.1 of the H.265/HEVC Specification defines the syntax of
3252a4f78defSmrg        the slice_segment_header. This header contains information that
3253a4f78defSmrg        some VDPAU implementations may choose to skip. The VDPAU API
3254a4f78defSmrg        requires client applications to track the number of bits used in the
3255a4f78defSmrg        slice header for structures associated with short term and long term
3256a4f78defSmrg        reference pictures. First, VDPAU requires the number of bits used by
3257a4f78defSmrg        the short_term_ref_pic_set array in the slice_segment_header. */
3258a4f78defSmrg    uint32_t NumShortTermPictureSliceHeaderBits;
3259a4f78defSmrg    /** Second, VDPAU requires the number of bits used for long term reference
3260a4f78defSmrg        pictures in the slice_segment_header. This is equal to the number
3261a4f78defSmrg        of bits used for the contents of the block beginning with
3262a4f78defSmrg        "if(long_term_ref_pics_present_flag)". */
3263a4f78defSmrg    uint32_t NumLongTermPictureSliceHeaderBits;
3264a4f78defSmrg    /** @} */
3265a4f78defSmrg
3266a4f78defSmrg    /** Slice Decoding Process - Picture Order Count */
3267a4f78defSmrg    /** The value of PicOrderCntVal of the picture in the access unit
3268a4f78defSmrg        containing the SEI message. The picture being decoded. */
3269a4f78defSmrg    int32_t CurrPicOrderCntVal;
3270a4f78defSmrg
3271a4f78defSmrg    /** Slice Decoding Process - Reference Picture Sets */
3272a4f78defSmrg    /** Array of video reference surfaces.
3273a4f78defSmrg        Set any unused positions to VDP_INVALID_HANDLE. */
3274a4f78defSmrg    VdpVideoSurface RefPics[16];
3275a4f78defSmrg    /** Array of picture order counts. These correspond to positions
3276a4f78defSmrg        in the RefPics array. */
3277a4f78defSmrg    int32_t PicOrderCntVal[16];
3278a4f78defSmrg    /** Array used to specify whether a particular RefPic is
3279a4f78defSmrg        a long term reference. A value of "1" indicates a long-term
3280a4f78defSmrg        reference. */
3281a4f78defSmrg    uint8_t IsLongTerm[16];
3282a4f78defSmrg    /** Copy of specification field, see Section 8.3.2 of the
3283a4f78defSmrg        H.265/HEVC Specification. */
3284a4f78defSmrg    uint8_t NumPocStCurrBefore;
3285a4f78defSmrg    /** Copy of specification field, see Section 8.3.2 of the
3286a4f78defSmrg        H.265/HEVC Specification. */
3287a4f78defSmrg    uint8_t NumPocStCurrAfter;
3288a4f78defSmrg    /** Copy of specification field, see Section 8.3.2 of the
3289a4f78defSmrg        H.265/HEVC Specification. */
3290a4f78defSmrg    uint8_t NumPocLtCurr;
3291a4f78defSmrg    /** Reference Picture Set list, one of the short-term RPS. These
3292a4f78defSmrg        correspond to positions in the RefPics array. */
3293a4f78defSmrg    uint8_t RefPicSetStCurrBefore[8];
3294a4f78defSmrg    /** Reference Picture Set list, one of the short-term RPS. These
3295a4f78defSmrg        correspond to positions in the RefPics array. */
3296a4f78defSmrg    uint8_t RefPicSetStCurrAfter[8];
3297a4f78defSmrg    /** Reference Picture Set list, one of the long-term RPS. These
3298a4f78defSmrg        correspond to positions in the RefPics array. */
3299a4f78defSmrg    uint8_t RefPicSetLtCurr[8];
3300a4f78defSmrg} VdpPictureInfoHEVC;
3301a4f78defSmrg
3302a4f78defSmrg/**
3303a4f78defSmrg * \brief Decode a compressed field/frame and render the result
3304a4f78defSmrg *        into a \ref VdpVideoSurface "VdpVideoSurface".
3305a4f78defSmrg * \param[in] decoder The decoder object that will perform the
3306a4f78defSmrg *       decode operation.
3307a4f78defSmrg * \param[in] target The video surface to render to.
3308a4f78defSmrg * \param[in] picture_info A (pointer to a) structure containing
3309a4f78defSmrg *       information about the picture to be decoded. Note that
3310a4f78defSmrg *       the appropriate type of VdpPictureInfo* structure must
3311a4f78defSmrg *       be provided to match to profile that the decoder was
3312a4f78defSmrg *       created for.
3313a4f78defSmrg * \param[in] bitstream_buffer_count The number of bitstream
3314a4f78defSmrg *       buffers containing compressed data for this picture.
3315a4f78defSmrg * \param[in] bitstream_buffers An array of bitstream buffers.
3316a4f78defSmrg * \return VdpStatus The completion status of the operation.
3317a4f78defSmrg *
3318a4f78defSmrg * See \ref video_mixer_usage for additional information.
3319a4f78defSmrg */
3320a4f78defSmrgtypedef VdpStatus VdpDecoderRender(
3321a4f78defSmrg    VdpDecoder                 decoder,
3322a4f78defSmrg    VdpVideoSurface            target,
3323a4f78defSmrg    VdpPictureInfo const *     picture_info,
3324a4f78defSmrg    uint32_t                   bitstream_buffer_count,
3325a4f78defSmrg    VdpBitstreamBuffer const * bitstream_buffers
3326a4f78defSmrg);
3327a4f78defSmrg
3328a4f78defSmrg/*@}*/
3329a4f78defSmrg
3330a4f78defSmrg/**
3331a4f78defSmrg * \defgroup VdpVideoMixer VdpVideoMixer; Video Post-processing \
3332a4f78defSmrg *           and Compositing object
3333a4f78defSmrg *
3334a4f78defSmrg * VdpVideoMixer can perform some subset of the following
3335a4f78defSmrg * post-processing steps on video:
3336a4f78defSmrg * - De-interlacing
3337a4f78defSmrg *   - Various types, with or without inverse telecine
3338a4f78defSmrg * - Noise-reduction
3339a4f78defSmrg * - Sharpness adjustment
3340a4f78defSmrg * - Color space conversion to RGB
3341a4f78defSmrg * - Chroma format upscaling to 4:4:4
3342a4f78defSmrg *
3343a4f78defSmrg * A VdpVideoMixer takes a source \ref VdpVideoSurface
3344a4f78defSmrg * "VdpVideoSurface" VdpVideoSurface and performs various video
3345a4f78defSmrg * processing steps on it (potentially using information from
3346a4f78defSmrg * past or future video surfaces). It scales the video and
3347a4f78defSmrg * converts it to RGB, then optionally composites it with
3348a4f78defSmrg * multiple auxiliary \ref VdpOutputSurface "VdpOutputSurface"s
3349a4f78defSmrg * before writing the result to the destination \ref
3350a4f78defSmrg * VdpOutputSurface "VdpOutputSurface".
3351a4f78defSmrg *
3352a4f78defSmrg * The video mixer compositing model is as follows:
3353a4f78defSmrg *
3354a4f78defSmrg * - A rectangle will be rendered on an output surface. No
3355a4f78defSmrg *   pixels will be rendered outside of this output rectangle.
3356a4f78defSmrg *   The contents of this rectangle will be a composite of many
3357a4f78defSmrg *   layers.
3358a4f78defSmrg *
3359a4f78defSmrg * - The first layer is the background color. The background
3360a4f78defSmrg *   color will fill the entire rectangle.
3361a4f78defSmrg *
3362a4f78defSmrg * - The second layer is the processed video which has been
3363a4f78defSmrg *   converted to RGB. These pixels will overwrite the
3364a4f78defSmrg *   background color of the first layer except where the second
3365a4f78defSmrg *   layer's rectangle does not completely cover the output
3366a4f78defSmrg *   rectangle. In those regions the background color will
3367a4f78defSmrg *   continue to show. If any portion of the second layer's
3368a4f78defSmrg *   output rectangle is outside of the output rectangle, those
3369a4f78defSmrg *   portions will be clipped.
3370a4f78defSmrg *
3371a4f78defSmrg * - The third layer contains some number of auxiliary layers
3372a4f78defSmrg *   (in the form of \ref VdpOutputSurface "VdpOutputSurface"s)
3373a4f78defSmrg *   which will be composited using the alpha value from the
3374a4f78defSmrg *   those surfaces. The compositing operations are equivalent
3375a4f78defSmrg *   to rendering with \ref VdpOutputSurfaceRenderOutputSurface
3376a4f78defSmrg *   using a source blend factor of SOURCE_ALPHA, a destination
3377a4f78defSmrg *   blend factor of ONE_MINUS_SOURCE_ALPHA and an equation of
3378a4f78defSmrg *   ADD.
3379a4f78defSmrg *
3380a4f78defSmrg * @{
3381a4f78defSmrg */
3382a4f78defSmrg
3383a4f78defSmrg/**
3384a4f78defSmrg * \brief A VdpVideoMixer feature that must be requested at
3385a4f78defSmrg *        creation time to be used.
3386a4f78defSmrg *
3387a4f78defSmrg * Certain advanced VdpVideoMixer features are optional, and the
3388a4f78defSmrg * ability to use those features at all must be requested when
3389a4f78defSmrg * the VdpVideoMixer object is created. Each feature is named via
3390a4f78defSmrg * a specific VdpVideoMixerFeature value.
3391a4f78defSmrg *
3392a4f78defSmrg * Once requested, these features are permanently available
3393a4f78defSmrg * within that specific VdpVideoMixer object. All features that
3394a4f78defSmrg * are not explicitly requested at creation time default to
3395a4f78defSmrg * being permanently unavailable.
3396a4f78defSmrg *
3397a4f78defSmrg * Even when requested, all features default to being initially
3398a4f78defSmrg * disabled. However, applications can subsequently enable and
3399a4f78defSmrg * disable features at any time. See \ref
3400a4f78defSmrg * VdpVideoMixerSetFeatureEnables.
3401a4f78defSmrg *
3402a4f78defSmrg * Some features allow configuration of their operation. Each
3403a4f78defSmrg * configurable item is an \ref VdpVideoMixerAttribute. These
3404a4f78defSmrg * attributes may be manipulated at any time using \ref
3405a4f78defSmrg * VdpVideoMixerSetAttributeValues.
3406a4f78defSmrg */
3407a4f78defSmrgtypedef uint32_t VdpVideoMixerFeature;
3408a4f78defSmrg
3409a4f78defSmrg/**
3410a4f78defSmrg * \hideinitializer
3411a4f78defSmrg * \brief A VdpVideoMixerFeature.
3412a4f78defSmrg *
3413a4f78defSmrg * When requested and enabled, motion adaptive temporal
3414a4f78defSmrg * deinterlacing will be used on interlaced content.
3415a4f78defSmrg *
3416a4f78defSmrg * When multiple de-interlacing options are requested and
3417a4f78defSmrg * enabled, the back-end implementation chooses the best
3418a4f78defSmrg * algorithm to apply.
3419a4f78defSmrg */
3420a4f78defSmrg#define VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL         ((VdpVideoMixerFeature)0)
3421a4f78defSmrg/**
3422a4f78defSmrg * \hideinitializer
3423a4f78defSmrg * \brief A VdpVideoMixerFeature.
3424a4f78defSmrg *
3425a4f78defSmrg * When requested and enabled, this enables a more advanced
3426a4f78defSmrg * version of temporal de-interlacing, that additionally uses
3427a4f78defSmrg * edge-guided spatial interpolation.
3428a4f78defSmrg *
3429a4f78defSmrg * When multiple de-interlacing options are requested and
3430a4f78defSmrg * enabled, the back-end implementation chooses the best
3431a4f78defSmrg * algorithm to apply.
3432a4f78defSmrg */
3433a4f78defSmrg#define VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL ((VdpVideoMixerFeature)1)
3434a4f78defSmrg/**
3435a4f78defSmrg * \hideinitializer
3436a4f78defSmrg * \brief A VdpVideoMixerFeature.
3437a4f78defSmrg *
3438a4f78defSmrg * When requested and enabled, cadence detection will be enabled
3439a4f78defSmrg * on interlaced content and the video mixer will try to extract
3440a4f78defSmrg * progressive frames from pull-down material.
3441a4f78defSmrg */
3442a4f78defSmrg#define VDP_VIDEO_MIXER_FEATURE_INVERSE_TELECINE             ((VdpVideoMixerFeature)2)
3443a4f78defSmrg/**
3444a4f78defSmrg * \hideinitializer
3445a4f78defSmrg * \brief A VdpVideoMixerFeature.
3446a4f78defSmrg *
3447a4f78defSmrg * When requested and enabled, a noise reduction algorithm will
3448a4f78defSmrg * be applied to the video.
3449a4f78defSmrg */
3450a4f78defSmrg#define VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION              ((VdpVideoMixerFeature)3)
3451a4f78defSmrg/**
3452a4f78defSmrg * \hideinitializer
3453a4f78defSmrg * \brief A VdpVideoMixerFeature.
3454a4f78defSmrg *
3455a4f78defSmrg * When requested and enabled, a sharpening algorithm will be
3456a4f78defSmrg * applied to the video.
3457a4f78defSmrg */
3458a4f78defSmrg#define VDP_VIDEO_MIXER_FEATURE_SHARPNESS                    ((VdpVideoMixerFeature)4)
3459a4f78defSmrg/**
3460a4f78defSmrg * \hideinitializer
3461a4f78defSmrg * \brief A VdpVideoMixerFeature.
3462a4f78defSmrg *
3463a4f78defSmrg * When requested and enabled, the alpha of the rendered
3464a4f78defSmrg * surface, which is normally set to the alpha of the background
3465a4f78defSmrg * color, will be forced to 0.0 on pixels corresponding to
3466a4f78defSmrg * source video surface luminance values in the range specified
3467a4f78defSmrg * by attributes \ref VDP_VIDEO_MIXER_ATTRIBUTE_LUMA_KEY_MIN_LUMA
3468a4f78defSmrg * to \ref VDP_VIDEO_MIXER_ATTRIBUTE_LUMA_KEY_MAX_LUMA. This
3469a4f78defSmrg * keying is performed after scaling and de-interlacing.
3470a4f78defSmrg */
3471a4f78defSmrg#define VDP_VIDEO_MIXER_FEATURE_LUMA_KEY                     ((VdpVideoMixerFeature)5)
3472a4f78defSmrg/**
3473a4f78defSmrg * \hideinitializer
3474a4f78defSmrg * \brief A VdpVideoMixerFeature.
3475a4f78defSmrg *
3476a4f78defSmrg * A VDPAU implementation may support multiple scaling algorithms of
3477a4f78defSmrg * differing quality, and may potentially support a different subset
3478a4f78defSmrg * of algorithms on different hardware.
3479a4f78defSmrg *
3480a4f78defSmrg * In some cases, higher quality algorithms may require more resources
3481a4f78defSmrg * (memory size, memory bandwidth, etc.) to operate. Hence, these high
3482a4f78defSmrg * quality algorithms must be explicitly requested and enabled by the client
3483a4f78defSmrg * application. This allows applications operating in a resource-constrained
3484a4f78defSmrg * environment to have some level of control over resource usage.
3485a4f78defSmrg *
3486a4f78defSmrg * Basic scaling is always built into any video mixer, and is known as
3487a4f78defSmrg * level 0. Scaling quality increases beginning with optional level 1,
3488a4f78defSmrg * through optional level 9.
3489a4f78defSmrg *
3490a4f78defSmrg * If an application requests and enables multiple high quality scaling
3491a4f78defSmrg * algorithms, the highest level enabled scaling algorithm will be used.
3492a4f78defSmrg */
3493a4f78defSmrg#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1      ((VdpVideoMixerFeature)11)
3494a4f78defSmrg/**
3495a4f78defSmrg * \hideinitializer
3496a4f78defSmrg * \brief A VdpVideoMixerFeature.
3497a4f78defSmrg *
3498a4f78defSmrg * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
3499a4f78defSmrg */
3500a4f78defSmrg#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L2      ((VdpVideoMixerFeature)12)
3501a4f78defSmrg/**
3502a4f78defSmrg * \hideinitializer
3503a4f78defSmrg * \brief A VdpVideoMixerFeature.
3504a4f78defSmrg *
3505a4f78defSmrg * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
3506a4f78defSmrg */
3507a4f78defSmrg#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L3      ((VdpVideoMixerFeature)13)
3508a4f78defSmrg/**
3509a4f78defSmrg * \hideinitializer
3510a4f78defSmrg * \brief A VdpVideoMixerFeature.
3511a4f78defSmrg *
3512a4f78defSmrg * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
3513a4f78defSmrg */
3514a4f78defSmrg#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L4      ((VdpVideoMixerFeature)14)
3515a4f78defSmrg/**
3516a4f78defSmrg * \hideinitializer
3517a4f78defSmrg * \brief A VdpVideoMixerFeature.
3518a4f78defSmrg *
3519a4f78defSmrg * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
3520a4f78defSmrg */
3521a4f78defSmrg#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L5      ((VdpVideoMixerFeature)15)
3522a4f78defSmrg/**
3523a4f78defSmrg * \hideinitializer
3524a4f78defSmrg * \brief A VdpVideoMixerFeature.
3525a4f78defSmrg *
3526a4f78defSmrg * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
3527a4f78defSmrg */
3528a4f78defSmrg#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L6      ((VdpVideoMixerFeature)16)
3529a4f78defSmrg/**
3530a4f78defSmrg * \hideinitializer
3531a4f78defSmrg * \brief A VdpVideoMixerFeature.
3532a4f78defSmrg *
3533a4f78defSmrg * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
3534a4f78defSmrg */
3535a4f78defSmrg#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L7      ((VdpVideoMixerFeature)17)
3536a4f78defSmrg/**
3537a4f78defSmrg * \hideinitializer
3538a4f78defSmrg * \brief A VdpVideoMixerFeature.
3539a4f78defSmrg *
3540a4f78defSmrg * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
3541a4f78defSmrg */
3542a4f78defSmrg#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L8      ((VdpVideoMixerFeature)18)
3543a4f78defSmrg/**
3544a4f78defSmrg * \hideinitializer
3545a4f78defSmrg * \brief A VdpVideoMixerFeature.
3546a4f78defSmrg *
3547a4f78defSmrg * See \ref VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 for details.
3548a4f78defSmrg */
3549a4f78defSmrg#define VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L9      ((VdpVideoMixerFeature)19)
3550a4f78defSmrg
3551a4f78defSmrg/**
3552a4f78defSmrg * \brief A VdpVideoMixer creation parameter.
3553a4f78defSmrg *
3554a4f78defSmrg * When a VdpVideoMixer is created, certain parameters may be
3555a4f78defSmrg * supplied. Each parameter is named via a specific
3556a4f78defSmrg * VdpVideoMixerParameter value.
3557a4f78defSmrg *
3558a4f78defSmrg * Each parameter has a specific type, and specific default
3559a4f78defSmrg * value if not specified at VdpVideoMixer creation time. The
3560a4f78defSmrg * application may query the legal supported range for some
3561a4f78defSmrg * parameters.
3562a4f78defSmrg */
3563a4f78defSmrgtypedef uint32_t VdpVideoMixerParameter;
3564a4f78defSmrg
3565a4f78defSmrg/**
3566a4f78defSmrg * \hideinitializer
3567a4f78defSmrg * \brief The exact width of input video surfaces.
3568a4f78defSmrg *
3569a4f78defSmrg * This parameter's type is uint32_t.
3570a4f78defSmrg *
3571a4f78defSmrg * This parameter defaults to 0 if not specified, which entails
3572a4f78defSmrg * that it must be specified.
3573a4f78defSmrg *
3574a4f78defSmrg * The application may query this parameter's supported
3575a4f78defSmrg * range.
3576a4f78defSmrg */
3577a4f78defSmrg#define VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_WIDTH  ((VdpVideoMixerParameter)0)
3578a4f78defSmrg/**
3579a4f78defSmrg * \hideinitializer
3580a4f78defSmrg * \brief The exact height of input video surfaces.
3581a4f78defSmrg *
3582a4f78defSmrg * This parameter's type is uint32_t.
3583a4f78defSmrg *
3584a4f78defSmrg * This parameter defaults to 0 if not specified, which entails
3585a4f78defSmrg * that it must be specified.
3586a4f78defSmrg *
3587a4f78defSmrg * The application may query this parameter's supported
3588a4f78defSmrg * range.
3589a4f78defSmrg */
3590a4f78defSmrg#define VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_HEIGHT ((VdpVideoMixerParameter)1)
3591a4f78defSmrg/**
3592a4f78defSmrg * \hideinitializer
3593a4f78defSmrg * \brief The chroma type of the input video surfaces the will
3594a4f78defSmrg *        process.
3595a4f78defSmrg *
3596a4f78defSmrg * This parameter's type is VdpChromaType.
3597a4f78defSmrg *
3598a4f78defSmrg * If not specified, this parameter defaults to
3599a4f78defSmrg * VDP_CHROMA_TYPE_420.
3600a4f78defSmrg *
3601a4f78defSmrg * The application may not query this application's supported
3602a4f78defSmrg * range, since it is a potentially disjoint enumeration.
3603a4f78defSmrg */
3604a4f78defSmrg#define VDP_VIDEO_MIXER_PARAMETER_CHROMA_TYPE          ((VdpVideoMixerParameter)2)
3605a4f78defSmrg/**
3606a4f78defSmrg * \hideinitializer
3607a4f78defSmrg * \brief The number of auxiliary layers in the mixer's
3608a4f78defSmrg *        compositing model.
3609a4f78defSmrg *
3610a4f78defSmrg * Note that this indicates the maximum number of layers that
3611a4f78defSmrg * may be processed by a given \ref VdpVideoMixer "VdpVideoMixer"
3612a4f78defSmrg * object. Each individual \ref VdpVideoMixerRender invocation
3613a4f78defSmrg * may choose to use a different number of actual layers, from 0
3614a4f78defSmrg * up to this limit.
3615a4f78defSmrg *
3616a4f78defSmrg * This attribute's type is uint32_t.
3617a4f78defSmrg *
3618a4f78defSmrg * If not specified, this parameter defaults to 0.
3619a4f78defSmrg *
3620a4f78defSmrg * The application may query this parameter's supported
3621a4f78defSmrg * range.
3622a4f78defSmrg */
3623a4f78defSmrg#define VDP_VIDEO_MIXER_PARAMETER_LAYERS               ((VdpVideoMixerParameter)3)
3624a4f78defSmrg
3625a4f78defSmrg/**
3626a4f78defSmrg * \brief An adjustable attribute of VdpVideoMixer operation.
3627a4f78defSmrg *
3628a4f78defSmrg * Various attributes of VdpVideoMixer operation may be adjusted
3629a4f78defSmrg * at any time. Each attribute is named via a specific
3630a4f78defSmrg * VdpVideoMixerAttribute value.
3631a4f78defSmrg *
3632a4f78defSmrg * Each attribute has a specific type, and specific default
3633a4f78defSmrg * value if not specified at VdpVideoMixer creation time. The
3634a4f78defSmrg * application may query the legal supported range for some
3635a4f78defSmrg * attributes.
3636a4f78defSmrg */
3637a4f78defSmrgtypedef uint32_t VdpVideoMixerAttribute;
3638a4f78defSmrg
3639a4f78defSmrg/**
3640a4f78defSmrg * \hideinitializer
3641a4f78defSmrg * \brief The background color in the VdpVideoMixer's compositing
3642a4f78defSmrg *        model.
3643a4f78defSmrg *
3644a4f78defSmrg * This attribute's type is VdpColor.
3645a4f78defSmrg *
3646a4f78defSmrg * This parameter defaults to black (all color components 0.0
3647a4f78defSmrg * and alpha 1.0).
3648a4f78defSmrg *
3649a4f78defSmrg * The application may not query this parameter's supported
3650a4f78defSmrg * range, since the type is not scalar.
3651a4f78defSmrg */
3652a4f78defSmrg#define VDP_VIDEO_MIXER_ATTRIBUTE_BACKGROUND_COLOR      ((VdpVideoMixerAttribute)0)
3653a4f78defSmrg/**
3654a4f78defSmrg * \hideinitializer
3655a4f78defSmrg * \brief The color-space conversion matrix used by the
3656a4f78defSmrg *        VdpVideoMixer.
3657a4f78defSmrg *
3658a4f78defSmrg * This attribute's type is \ref VdpCSCMatrix.
3659a4f78defSmrg *
3660a4f78defSmrg * Note: When using \ref VdpVideoMixerGetAttributeValues to retrieve the
3661a4f78defSmrg * current CSC matrix, the attribute_values array must contain a pointer to
3662a4f78defSmrg * a pointer a VdpCSCMatrix (VdpCSCMatrix** as a void *). The get function will
3663a4f78defSmrg * either initialize the referenced CSC matrix to the current value, *or*
3664a4f78defSmrg * clear the supplied pointer to NULL, if the previous set call supplied a
3665a4f78defSmrg * value of NULL in parameter_values, to request the default matrix.
3666a4f78defSmrg *
3667a4f78defSmrg * \code
3668a4f78defSmrg * VdpCSCMatrix   matrix;
3669a4f78defSmrg * VdpCSCMatrix * matrix_ptr;
3670a4f78defSmrg * void * attribute_values[] = {&matrix_ptr};
3671a4f78defSmrg * VdpStatus st = vdp_video_mixer_get_attribute_values(..., attribute_values, ...);
3672a4f78defSmrg * \endcode
3673a4f78defSmrg *
3674a4f78defSmrg * This parameter defaults to a matrix suitable for ITU-R BT.601
3675a4f78defSmrg * input surfaces, with no procamp adjustments.
3676a4f78defSmrg *
3677a4f78defSmrg * The application may not query this parameter's supported
3678a4f78defSmrg * range, since the type is not scalar.
3679a4f78defSmrg */
3680a4f78defSmrg#define VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX            ((VdpVideoMixerAttribute)1)
3681a4f78defSmrg/**
3682a4f78defSmrg * \hideinitializer
3683a4f78defSmrg * \brief The amount of noise reduction algorithm to apply.
3684a4f78defSmrg *
3685a4f78defSmrg * This attribute's type is float.
3686a4f78defSmrg *
3687a4f78defSmrg * This parameter defaults to 0.0, which equates to no noise
3688a4f78defSmrg * reduction.
3689a4f78defSmrg *
3690a4f78defSmrg * The application may query this parameter's supported range.
3691a4f78defSmrg * However, the range is fixed as 0.0...1.0.
3692a4f78defSmrg */
3693a4f78defSmrg#define VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL ((VdpVideoMixerAttribute)2)
3694a4f78defSmrg/**
3695a4f78defSmrg * \hideinitializer
3696a4f78defSmrg * \brief The amount of sharpening, or blurring, to apply.
3697a4f78defSmrg *
3698a4f78defSmrg * This attribute's type is float.
3699a4f78defSmrg *
3700a4f78defSmrg * This parameter defaults to 0.0, which equates to no
3701a4f78defSmrg * sharpening.
3702a4f78defSmrg *
3703a4f78defSmrg * Positive values request sharpening. Negative values request
3704a4f78defSmrg * blurring.
3705a4f78defSmrg *
3706a4f78defSmrg * The application may query this parameter's supported range.
3707a4f78defSmrg * However, the range is fixed as -1.0...1.0.
3708a4f78defSmrg */
3709a4f78defSmrg#define VDP_VIDEO_MIXER_ATTRIBUTE_SHARPNESS_LEVEL       ((VdpVideoMixerAttribute)3)
3710a4f78defSmrg/**
3711a4f78defSmrg * \hideinitializer
3712a4f78defSmrg * \brief The minimum luma value for the luma key algorithm.
3713a4f78defSmrg *
3714a4f78defSmrg * This attribute's type is float.
3715a4f78defSmrg *
3716a4f78defSmrg * This parameter defaults to 0.0.
3717a4f78defSmrg *
3718a4f78defSmrg * The application may query this parameter's supported range.
3719a4f78defSmrg * However, the range is fixed as 0.0...1.0.
3720a4f78defSmrg */
3721a4f78defSmrg#define VDP_VIDEO_MIXER_ATTRIBUTE_LUMA_KEY_MIN_LUMA     ((VdpVideoMixerAttribute)4)
3722a4f78defSmrg/**
3723a4f78defSmrg * \hideinitializer
3724a4f78defSmrg * \brief The maximum luma value for the luma key algorithm.
3725a4f78defSmrg *
3726a4f78defSmrg * This attribute's type is float.
3727a4f78defSmrg *
3728a4f78defSmrg * This parameter defaults to 1.0.
3729a4f78defSmrg *
3730a4f78defSmrg * The application may query this parameter's supported range.
3731a4f78defSmrg * However, the range is fixed as 0.0...1.0.
3732a4f78defSmrg */
3733a4f78defSmrg#define VDP_VIDEO_MIXER_ATTRIBUTE_LUMA_KEY_MAX_LUMA     ((VdpVideoMixerAttribute)5)
3734a4f78defSmrg/**
3735a4f78defSmrg * \hideinitializer
3736a4f78defSmrg * \brief Whether de-interlacers should operate solely on luma, and bob chroma.
3737a4f78defSmrg *
3738a4f78defSmrg * Note: This attribute only affects advanced de-interlacing algorithms, not
3739a4f78defSmrg * bob or weave.
3740a4f78defSmrg *
3741a4f78defSmrg * This attribute's type is uint8_t.
3742a4f78defSmrg *
3743a4f78defSmrg * This parameter defaults to 0.
3744a4f78defSmrg *
3745a4f78defSmrg * The application may query this parameter's supported range.
3746a4f78defSmrg * However, the range is fixed as 0 (no/off) ... 1 (yes/on).
3747a4f78defSmrg */
3748a4f78defSmrg#define VDP_VIDEO_MIXER_ATTRIBUTE_SKIP_CHROMA_DEINTERLACE ((VdpVideoMixerAttribute)6)
3749a4f78defSmrg
3750a4f78defSmrg/**
3751a4f78defSmrg * \brief Query the implementation's support for a specific
3752a4f78defSmrg *        feature.
3753a4f78defSmrg * \param[in] device The device to query.
3754a4f78defSmrg * \param[in] feature The feature for which support is to be
3755a4f78defSmrg *       queried.
3756a4f78defSmrg * \param[out] is_supported Is the specified feature supported?
3757a4f78defSmrg * \return VdpStatus The completion status of the operation.
3758a4f78defSmrg */
3759a4f78defSmrgtypedef VdpStatus VdpVideoMixerQueryFeatureSupport(
3760a4f78defSmrg    VdpDevice            device,
3761a4f78defSmrg    VdpVideoMixerFeature feature,
3762a4f78defSmrg    /* output parameters follow */
3763a4f78defSmrg    VdpBool *            is_supported
3764a4f78defSmrg);
3765a4f78defSmrg
3766a4f78defSmrg/**
3767a4f78defSmrg * \brief Query the implementation's support for a specific
3768a4f78defSmrg *        parameter.
3769a4f78defSmrg * \param[in] device The device to query.
3770a4f78defSmrg * \param[in] parameter The parameter for which support is to be
3771a4f78defSmrg *       queried.
3772a4f78defSmrg * \param[out] is_supported Is the specified parameter
3773a4f78defSmrg *       supported?
3774a4f78defSmrg * \return VdpStatus The completion status of the operation.
3775a4f78defSmrg */
3776a4f78defSmrgtypedef VdpStatus VdpVideoMixerQueryParameterSupport(
3777a4f78defSmrg    VdpDevice              device,
3778a4f78defSmrg    VdpVideoMixerParameter parameter,
3779a4f78defSmrg    /* output parameters follow */
3780a4f78defSmrg    VdpBool *              is_supported
3781a4f78defSmrg);
3782a4f78defSmrg
3783a4f78defSmrg/**
3784a4f78defSmrg * \brief Query the implementation's support for a specific
3785a4f78defSmrg *        attribute.
3786a4f78defSmrg * \param[in] device The device to query.
3787a4f78defSmrg * \param[in] feature The feature for which support is to be
3788a4f78defSmrg *       queried.
3789a4f78defSmrg * \param[out] is_supported Is the specified feature supported?
3790a4f78defSmrg * \return VdpStatus The completion status of the operation.
3791a4f78defSmrg */
3792a4f78defSmrgtypedef VdpStatus VdpVideoMixerQueryAttributeSupport(
3793a4f78defSmrg    VdpDevice              device,
3794a4f78defSmrg    VdpVideoMixerAttribute attribute,
3795a4f78defSmrg    /* output parameters follow */
3796a4f78defSmrg    VdpBool *              is_supported
3797a4f78defSmrg);
3798a4f78defSmrg
3799a4f78defSmrg/**
3800a4f78defSmrg * \brief Query the implementation's supported for a specific
3801a4f78defSmrg *        parameter.
3802a4f78defSmrg * \param[in] device The device to query.
3803a4f78defSmrg * \param[in] parameter The parameter for which support is to be
3804a4f78defSmrg *       queried.
3805a4f78defSmrg * \param[out] min_value The minimum supported value.
3806a4f78defSmrg * \param[out] max_value The maximum supported value.
3807a4f78defSmrg * \return VdpStatus The completion status of the operation.
3808a4f78defSmrg */
3809a4f78defSmrgtypedef VdpStatus VdpVideoMixerQueryParameterValueRange(
3810a4f78defSmrg    VdpDevice              device,
3811a4f78defSmrg    VdpVideoMixerParameter parameter,
3812a4f78defSmrg    /* output parameters follow */
3813a4f78defSmrg    void *                min_value,
3814a4f78defSmrg    void *                max_value
3815a4f78defSmrg);
3816a4f78defSmrg
3817a4f78defSmrg/**
3818a4f78defSmrg * \brief Query the implementation's supported for a specific
3819a4f78defSmrg *        attribute.
3820a4f78defSmrg * \param[in] device The device to query.
3821a4f78defSmrg * \param[in] attribute The attribute for which support is to be
3822a4f78defSmrg *       queried.
3823a4f78defSmrg * \param[out] min_value The minimum supported value.
3824a4f78defSmrg * \param[out] max_value The maximum supported value.
3825a4f78defSmrg * \return VdpStatus The completion status of the operation.
3826a4f78defSmrg */
3827a4f78defSmrgtypedef VdpStatus VdpVideoMixerQueryAttributeValueRange(
3828a4f78defSmrg    VdpDevice              device,
3829a4f78defSmrg    VdpVideoMixerAttribute attribute,
3830a4f78defSmrg    /* output parameters follow */
3831a4f78defSmrg    void *                min_value,
3832a4f78defSmrg    void *                max_value
3833a4f78defSmrg);
3834a4f78defSmrg
3835a4f78defSmrg/**
3836a4f78defSmrg * \brief An opaque handle representing a VdpVideoMixer object.
3837a4f78defSmrg */
3838a4f78defSmrgtypedef uint32_t VdpVideoMixer;
3839a4f78defSmrg
3840a4f78defSmrg/**
3841a4f78defSmrg * \brief Create a VdpVideoMixer.
3842a4f78defSmrg * \param[in] device The device that will contain the mixer.
3843a4f78defSmrg * \param[in] feature_count The number of features to request.
3844a4f78defSmrg * \param[in] features The list of features to request.
3845a4f78defSmrg * \param[in] parameter_count The number of parameters to set.
3846a4f78defSmrg * \param[in] parameters The list of parameters to set.
3847a4f78defSmrg * \param[in] parameter_values The values for the parameters. Note that each
3848a4f78defSmrg *     entry in the value array is a pointer to the actual value. In other
3849a4f78defSmrg *     words, the values themselves are not cast to "void *" and passed
3850a4f78defSmrg *     "inside" the array.
3851a4f78defSmrg * \param[out] mixer The new mixer's handle.
3852a4f78defSmrg * \return VdpStatus The completion status of the operation.
3853a4f78defSmrg *
3854a4f78defSmrg * Initially, all requested features will be disabled. They can
3855a4f78defSmrg * be enabled using \ref VdpVideoMixerSetFeatureEnables.
3856a4f78defSmrg *
3857a4f78defSmrg * Initially, all attributes will have default values. Values
3858a4f78defSmrg * can be changed using \ref VdpVideoMixerSetAttributeValues.
3859a4f78defSmrg */
3860a4f78defSmrgtypedef VdpStatus VdpVideoMixerCreate(
3861a4f78defSmrg    VdpDevice                      device,
3862a4f78defSmrg    // The set of features to request
3863a4f78defSmrg    uint32_t                       feature_count,
3864a4f78defSmrg    VdpVideoMixerFeature const *   features,
3865a4f78defSmrg    // The parameters used during creation
3866a4f78defSmrg    uint32_t                       parameter_count,
3867a4f78defSmrg    VdpVideoMixerParameter const * parameters,
3868a4f78defSmrg    void const * const *           parameter_values,
3869a4f78defSmrg    /* output parameters follow */
3870a4f78defSmrg    VdpVideoMixer *                mixer
3871a4f78defSmrg);
3872a4f78defSmrg
3873a4f78defSmrg/**
3874a4f78defSmrg * \brief Enable or disable features.
3875a4f78defSmrg * \param[in] mixer The mixer to manipulate.
3876a4f78defSmrg * \param[in] feature_count The number of features to
3877a4f78defSmrg *       enable/disable.
3878a4f78defSmrg * \param[in] features The list of features to enable/disable.
3879a4f78defSmrg * \param[in] feature_enables The list of new feature enable
3880a4f78defSmrg *       values.
3881a4f78defSmrg * \return VdpStatus The completion status of the operation.
3882a4f78defSmrg */
3883a4f78defSmrgtypedef VdpStatus VdpVideoMixerSetFeatureEnables(
3884a4f78defSmrg    VdpVideoMixer                mixer,
3885a4f78defSmrg    uint32_t                     feature_count,
3886a4f78defSmrg    VdpVideoMixerFeature const * features,
3887a4f78defSmrg    VdpBool const *              feature_enables
3888a4f78defSmrg);
3889a4f78defSmrg
3890a4f78defSmrg/**
3891a4f78defSmrg * \brief Set attribute values
3892a4f78defSmrg * \param[in] mixer The mixer to manipulate.
3893a4f78defSmrg * \param[in] attribute_count The number of attributes to set.
3894a4f78defSmrg * \param[in] attributes The list of attributes to set.
3895a4f78defSmrg * \param[in] attribute_values The values for the attributes. Note that each
3896a4f78defSmrg *     entry in the value array is a pointer to the actual value. In other
3897a4f78defSmrg *     words, the values themselves are not cast to "void *" and passed
3898a4f78defSmrg *     "inside" the array. A NULL pointer requests that the default value be
3899a4f78defSmrg *     set for that attribute.
3900a4f78defSmrg * \return VdpStatus The completion status of the operation.
3901a4f78defSmrg */
3902a4f78defSmrgtypedef VdpStatus VdpVideoMixerSetAttributeValues(
3903a4f78defSmrg    VdpVideoMixer                  mixer,
3904a4f78defSmrg    uint32_t                       attribute_count,
3905a4f78defSmrg    VdpVideoMixerAttribute const * attributes,
3906a4f78defSmrg    void const * const *           attribute_values
3907a4f78defSmrg);
3908a4f78defSmrg
3909a4f78defSmrg/**
3910a4f78defSmrg * \brief Retrieve whether features were requested at creation
3911a4f78defSmrg *        time.
3912a4f78defSmrg * \param[in] mixer The mixer to query.
3913a4f78defSmrg * \param[in] feature_count The number of features to query.
3914a4f78defSmrg * \param[in] features The list of features to query.
3915a4f78defSmrg * \param[out] feature_supported A list of values indicating
3916a4f78defSmrg *       whether the feature was requested, and hence is
3917a4f78defSmrg *       available.
3918a4f78defSmrg * \return VdpStatus The completion status of the operation.
3919a4f78defSmrg */
3920a4f78defSmrgtypedef VdpStatus VdpVideoMixerGetFeatureSupport(
3921a4f78defSmrg    VdpVideoMixer                mixer,
3922a4f78defSmrg    uint32_t                     feature_count,
3923a4f78defSmrg    VdpVideoMixerFeature const * features,
3924a4f78defSmrg    /* output parameters follow */
3925a4f78defSmrg    VdpBool *                    feature_supports
3926a4f78defSmrg);
3927a4f78defSmrg
3928a4f78defSmrg/**
3929a4f78defSmrg * \brief Retrieve whether features are enabled.
3930a4f78defSmrg * \param[in] mixer The mixer to manipulate.
3931a4f78defSmrg * \param[in] feature_count The number of features to query.
3932a4f78defSmrg * \param[in] features The list of features to query.
3933a4f78defSmrg * \param[out] feature_enabled A list of values indicating
3934a4f78defSmrg *       whether the feature is enabled.
3935a4f78defSmrg * \return VdpStatus The completion status of the operation.
3936a4f78defSmrg */
3937a4f78defSmrgtypedef VdpStatus VdpVideoMixerGetFeatureEnables(
3938a4f78defSmrg    VdpVideoMixer                mixer,
3939a4f78defSmrg    uint32_t                     feature_count,
3940a4f78defSmrg    VdpVideoMixerFeature const * features,
3941a4f78defSmrg    /* output parameters follow */
3942a4f78defSmrg    VdpBool *                    feature_enables
3943a4f78defSmrg);
3944a4f78defSmrg
3945a4f78defSmrg/**
3946a4f78defSmrg * \brief Retrieve parameter values given at creation time.
3947a4f78defSmrg * \param[in] mixer The mixer to manipulate.
3948a4f78defSmrg * \param[in] parameter_count The number of parameters to query.
3949a4f78defSmrg * \param[in] parameters The list of parameters to query.
3950a4f78defSmrg * \param[out] parameter_values The list of current values for
3951a4f78defSmrg *     the parameters. Note that each entry in the value array is a pointer to
3952a4f78defSmrg *     storage that will receive the actual value. If the attribute's type is
3953a4f78defSmrg *     a pointer itself, please closely read the documentation for that
3954a4f78defSmrg *     attribute type for any other data passing requirements.
3955a4f78defSmrg * \return VdpStatus The completion status of the operation.
3956a4f78defSmrg */
3957a4f78defSmrgtypedef VdpStatus VdpVideoMixerGetParameterValues(
3958a4f78defSmrg    VdpVideoMixer                  mixer,
3959a4f78defSmrg    uint32_t                       parameter_count,
3960a4f78defSmrg    VdpVideoMixerParameter const * parameters,
3961a4f78defSmrg    /* output parameters follow */
3962a4f78defSmrg    void * const *                 parameter_values
3963a4f78defSmrg);
3964a4f78defSmrg
3965a4f78defSmrg/**
3966a4f78defSmrg * \brief Retrieve current attribute values.
3967a4f78defSmrg * \param[in] mixer The mixer to manipulate.
3968a4f78defSmrg * \param[in] attribute_count The number of attributes to query.
3969a4f78defSmrg * \param[in] attributes The list of attributes to query.
3970a4f78defSmrg * \param[out] attribute_values The list of current values for
3971a4f78defSmrg *     the attributes. Note that each entry in the value array is a pointer to
3972a4f78defSmrg *     storage that will receive the actual value. If the attribute's type is
3973a4f78defSmrg *     a pointer itself, please closely read the documentation for that
3974a4f78defSmrg *     attribute type for any other data passing requirements.
3975a4f78defSmrg * \return VdpStatus The completion status of the operation.
3976a4f78defSmrg */
3977a4f78defSmrgtypedef VdpStatus VdpVideoMixerGetAttributeValues(
3978a4f78defSmrg    VdpVideoMixer                  mixer,
3979a4f78defSmrg    uint32_t                       attribute_count,
3980a4f78defSmrg    VdpVideoMixerAttribute const * attributes,
3981a4f78defSmrg    /* output parameters follow */
3982a4f78defSmrg    void * const *                 attribute_values
3983a4f78defSmrg);
3984a4f78defSmrg
3985a4f78defSmrg/**
3986a4f78defSmrg * \brief Destroy a VdpVideoMixer.
3987a4f78defSmrg * \param[in] device The device to destroy.
3988a4f78defSmrg * \return VdpStatus The completion status of the operation.
3989a4f78defSmrg */
3990a4f78defSmrgtypedef VdpStatus VdpVideoMixerDestroy(
3991a4f78defSmrg    VdpVideoMixer mixer
3992a4f78defSmrg);
3993a4f78defSmrg
3994a4f78defSmrg/**
3995a4f78defSmrg * \hideinitializer
3996a4f78defSmrg * \brief The structure of the picture present in a \ref
3997a4f78defSmrg *        VdpVideoSurface "VdpVideoSurface".
3998a4f78defSmrg */
3999a4f78defSmrgtypedef enum {
4000a4f78defSmrg    /**
4001a4f78defSmrg     * The picture is a field, and is the top field of the surface.
4002a4f78defSmrg     */
4003a4f78defSmrg    VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD,
4004a4f78defSmrg    /**
4005a4f78defSmrg     * The picture is a field, and is the bottom field of the
4006a4f78defSmrg     * surface.
4007a4f78defSmrg     */
4008a4f78defSmrg    VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD,
4009a4f78defSmrg    /**
4010a4f78defSmrg     * The picture is a frame, and hence is the entire surface.
4011a4f78defSmrg     */
4012a4f78defSmrg    VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME,
4013a4f78defSmrg} VdpVideoMixerPictureStructure;
4014a4f78defSmrg
4015a4f78defSmrg#define VDP_LAYER_VERSION 0
4016a4f78defSmrg
4017a4f78defSmrg/**
4018a4f78defSmrg * \brief Definition of an additional \ref VdpOutputSurface
4019a4f78defSmrg *        "VdpOutputSurface" layer in the composting model.
4020a4f78defSmrg */
4021a4f78defSmrgtypedef struct {
4022a4f78defSmrg    /**
4023a4f78defSmrg     * This field must be filled with VDP_LAYER_VERSION
4024a4f78defSmrg     */
4025a4f78defSmrg    uint32_t struct_version;
4026a4f78defSmrg    /**
4027a4f78defSmrg     * The surface to composite from.
4028a4f78defSmrg     */
4029a4f78defSmrg    VdpOutputSurface source_surface;
4030a4f78defSmrg    /**
4031a4f78defSmrg     * The sub-rectangle of the source surface to use. If NULL, the
4032a4f78defSmrg     * entire source surface will be used.
4033a4f78defSmrg     */
4034a4f78defSmrg    VdpRect const *  source_rect;
4035a4f78defSmrg    /**
4036a4f78defSmrg     * The sub-rectangle of the destination surface to map
4037a4f78defSmrg     * this layer into. This rectangle is relative to the entire
4038a4f78defSmrg     * destination surface. This rectangle will be clipped by \ref
4039a4f78defSmrg     * VdpVideoMixerRender's \b destination_rect. If NULL, the
4040a4f78defSmrg     * destination rectangle will be sized to match the source
4041a4f78defSmrg     * rectangle, and will be located at the origin.
4042a4f78defSmrg     */
4043a4f78defSmrg     VdpRect const * destination_rect;
4044a4f78defSmrg} VdpLayer;
4045a4f78defSmrg
4046a4f78defSmrg/**
4047a4f78defSmrg * \brief Perform a video post-processing and compositing
4048a4f78defSmrg *        operation.
4049a4f78defSmrg * \param[in] mixer The mixer object that will perform the
4050a4f78defSmrg *       mixing/rendering operation.
4051a4f78defSmrg * \param[in] background_surface A background image. If set to any value other
4052a4f78defSmrg *       than VDP_INVALID_HANDLE, the specific surface will be used instead of
4053a4f78defSmrg *       the background color as the first layer in the mixer's compositing
4054a4f78defSmrg *       process.
4055a4f78defSmrg * \param[in] background_source_rect When background_surface is specified,
4056a4f78defSmrg *       this parameter indicates the portion of background_surface that will
4057a4f78defSmrg *       be used as the background layer. The specified region will be
4058a4f78defSmrg *       extracted and scaled to match the size of destination_rect. If NULL,
4059a4f78defSmrg *       the entire background_surface will be used.
4060a4f78defSmrg * \param[in] current_picture_structure The picture structure of
4061a4f78defSmrg *       the field/frame to be processed. This field/frame is
4062a4f78defSmrg *       presented in the \b video_surface_current parameter. If
4063a4f78defSmrg *       frame, then all \b video_surface_* parameters are
4064a4f78defSmrg *       assumed to be frames. If field, then all
4065a4f78defSmrg *       video_surface_* parameters are assumed to be fields,
4066a4f78defSmrg *       with alternating top/bottom-ness derived from
4067a4f78defSmrg *       video_surface_current.
4068a4f78defSmrg * \param[in] video_surfaces_past_count The number of provided
4069a4f78defSmrg *       fields/frames prior to the current picture.
4070a4f78defSmrg * \param[in] video_surfaces_past The fields/frames prior to the
4071a4f78defSmrg *       current field/frame. Note that array index 0 is the
4072a4f78defSmrg *       field/frame temporally nearest to the current
4073a4f78defSmrg *       field/frame, with increasing array indices used for
4074a4f78defSmrg *       older frames. Unavailable entries may be set to
4075a4f78defSmrg *       \ref VDP_INVALID_HANDLE.
4076a4f78defSmrg * \param[in] video_surface_current The field/frame to be
4077a4f78defSmrg *       processed.
4078a4f78defSmrg * \param[in] video_surfaces_future_count The number of provided
4079a4f78defSmrg *       fields/frames following the current picture.
4080a4f78defSmrg * \param[in] video_surfaces_future The fields/frames that
4081a4f78defSmrg *       follow the current field/frame. Note that array index 0
4082a4f78defSmrg *       is the field/frame temporally nearest to the current
4083a4f78defSmrg *       field/frame, with increasing array indices used for
4084a4f78defSmrg *       newer frames. Unavailable entries may be set to \ref
4085a4f78defSmrg *       VDP_INVALID_HANDLE.
4086a4f78defSmrg * \param[in] video_source_rect The sub-rectangle of the source
4087a4f78defSmrg *       video surface to extract and process. If NULL, the
4088a4f78defSmrg *       entire surface will be used. Left/right and/or top/bottom
4089a4f78defSmrg *       co-ordinates may be swapped to flip the source. Values
4090a4f78defSmrg *       from outside the video surface are valid and samples
4091a4f78defSmrg *       at those locations will be taken from the nearest edge.
4092a4f78defSmrg * \param[in] destination_surface
4093a4f78defSmrg * \param[in] destination_rect The sub-rectangle of the
4094a4f78defSmrg *       destination surface to modify. Note that rectangle clips
4095a4f78defSmrg *       all other actions.
4096a4f78defSmrg * \param[in] destination_video_rect The sub-rectangle of the
4097a4f78defSmrg *       destination surface that will contain the processed
4098a4f78defSmrg *       video. This rectangle is relative to the entire
4099a4f78defSmrg *       destination surface. This rectangle is clipped by \b
4100a4f78defSmrg *       destination_rect. If NULL, the destination rectangle
4101a4f78defSmrg *       will be sized to match the source rectangle, and will
4102a4f78defSmrg *       be located at the origin.
4103a4f78defSmrg * \param[in] layer_count The number of additional layers to
4104a4f78defSmrg *       composite above the video.
4105a4f78defSmrg * \param[in] layers The array of additional layers to composite
4106a4f78defSmrg *       above the video.
4107a4f78defSmrg * \return VdpStatus The completion status of the operation.
4108a4f78defSmrg *
4109a4f78defSmrg * For a complete discussion of how to use this API, please see
4110a4f78defSmrg * \ref video_mixer_usage.
4111a4f78defSmrg */
4112a4f78defSmrgtypedef VdpStatus VdpVideoMixerRender(
4113a4f78defSmrg    VdpVideoMixer                 mixer,
4114a4f78defSmrg    VdpOutputSurface              background_surface,
4115a4f78defSmrg    VdpRect const *               background_source_rect,
4116a4f78defSmrg    VdpVideoMixerPictureStructure current_picture_structure,
4117a4f78defSmrg    uint32_t                      video_surface_past_count,
4118a4f78defSmrg    VdpVideoSurface const *       video_surface_past,
4119a4f78defSmrg    VdpVideoSurface               video_surface_current,
4120a4f78defSmrg    uint32_t                      video_surface_future_count,
4121a4f78defSmrg    VdpVideoSurface const *       video_surface_future,
4122a4f78defSmrg    VdpRect const *               video_source_rect,
4123a4f78defSmrg    VdpOutputSurface              destination_surface,
4124a4f78defSmrg    VdpRect const *               destination_rect,
4125a4f78defSmrg    VdpRect const *               destination_video_rect,
4126a4f78defSmrg    uint32_t                      layer_count,
4127a4f78defSmrg    VdpLayer const *              layers
4128a4f78defSmrg);
4129a4f78defSmrg
4130a4f78defSmrg/*@}*/
4131a4f78defSmrg
4132a4f78defSmrg/**
4133a4f78defSmrg * \defgroup VdpPresentationQueue VdpPresentationQueue; Video \
4134a4f78defSmrg *           presentation (display) object
4135a4f78defSmrg *
4136a4f78defSmrg * The VdpPresentationQueue manages a queue of surfaces and
4137a4f78defSmrg * associated timestamps. For each surface in the queue, once
4138a4f78defSmrg * the associated timestamp is reached, the surface is displayed
4139a4f78defSmrg * to the user. This timestamp-based approach yields high
4140a4f78defSmrg * quality video delivery.
4141a4f78defSmrg *
4142a4f78defSmrg * The exact location of the displayed content is Window System
4143a4f78defSmrg * specific. For this reason, the \ref api_winsys provides an
4144a4f78defSmrg * API to create a \ref VdpPresentationQueueTarget object (e.g.
4145a4f78defSmrg * via \ref VdpPresentationQueueTargetCreateX11) which
4146a4f78defSmrg * encapsulates this information.
4147a4f78defSmrg *
4148a4f78defSmrg * Note that the presentation queue performs no scaling of
4149a4f78defSmrg * surfaces to match the display target's size, aspect ratio,
4150a4f78defSmrg * etc.
4151a4f78defSmrg *
4152a4f78defSmrg * Surfaces that are too large to fit into the display target
4153a4f78defSmrg * will be clipped. Surfaces that are too small to fill the
4154a4f78defSmrg * display target will be aligned to the top-left corner of the
4155a4f78defSmrg * display target, with the balance of the display target being
4156a4f78defSmrg * filled with a constant configurable "background" color.
4157a4f78defSmrg *
4158a4f78defSmrg * Note that the presentation queue operates in a manner that is
4159a4f78defSmrg * semantically equivalent to an overlay surface, with any
4160a4f78defSmrg * required color key painting hidden internally. However,
4161a4f78defSmrg * implementations are free to use whatever semantically
4162a4f78defSmrg * equivalent technique they wish. Note that implementations
4163a4f78defSmrg * that actually use color-keyed overlays will typically use
4164a4f78defSmrg * the "background" color as the overlay color key value, so
4165a4f78defSmrg * this color should be chosen with care.
4166a4f78defSmrg *
4167a4f78defSmrg * @{
4168a4f78defSmrg */
4169a4f78defSmrg
4170a4f78defSmrg/**
4171a4f78defSmrg * \brief The representation of a point in time.
4172a4f78defSmrg *
4173a4f78defSmrg * VdpTime timestamps are intended to be a high-precision timing
4174a4f78defSmrg * system, potentially independent from any other time domain in
4175a4f78defSmrg * the system.
4176a4f78defSmrg *
4177a4f78defSmrg * Time is represented in units of nanoseconds. The origin
4178a4f78defSmrg * (i.e. the time represented by a value of 0) is implementation
4179a4f78defSmrg * dependent.
4180a4f78defSmrg */
4181a4f78defSmrgtypedef uint64_t VdpTime;
4182a4f78defSmrg
4183a4f78defSmrg/**
4184a4f78defSmrg * \brief An opaque handle representing the location where
4185a4f78defSmrg *        video will be presented.
4186a4f78defSmrg *
4187a4f78defSmrg * VdpPresentationQueueTarget are created using a \ref api_winsys
4188a4f78defSmrg * specific API, such as \ref
4189a4f78defSmrg * VdpPresentationQueueTargetCreateX11.
4190a4f78defSmrg */
4191a4f78defSmrgtypedef uint32_t VdpPresentationQueueTarget;
4192a4f78defSmrg
4193a4f78defSmrg/**
4194a4f78defSmrg * \brief Destroy a VdpPresentationQueueTarget.
4195a4f78defSmrg * \param[in] presentation_queue_target The target to destroy.
4196a4f78defSmrg * \return VdpStatus The completion status of the operation.
4197a4f78defSmrg */
4198a4f78defSmrgtypedef VdpStatus VdpPresentationQueueTargetDestroy(
4199a4f78defSmrg    VdpPresentationQueueTarget presentation_queue_target
4200a4f78defSmrg);
4201a4f78defSmrg
4202a4f78defSmrg/**
4203a4f78defSmrg * \brief An opaque handle representing a presentation queue
4204a4f78defSmrg *        object.
4205a4f78defSmrg */
4206a4f78defSmrgtypedef uint32_t VdpPresentationQueue;
4207a4f78defSmrg
4208a4f78defSmrg/**
4209a4f78defSmrg * \brief Create a VdpPresentationQueue.
4210a4f78defSmrg * \param[in] device The device that will contain the queue.
4211a4f78defSmrg * \param[in] presentation_queue_target The location to display
4212a4f78defSmrg *       the content.
4213a4f78defSmrg * \param[out] presentation_queue The new queue's handle.
4214a4f78defSmrg * \return VdpStatus The completion status of the operation.
4215a4f78defSmrg *
4216a4f78defSmrg * Note: The initial value for the background color will be set to
4217a4f78defSmrg * an implementation-defined value.
4218a4f78defSmrg */
4219a4f78defSmrgtypedef VdpStatus VdpPresentationQueueCreate(
4220a4f78defSmrg    VdpDevice                  device,
4221a4f78defSmrg    VdpPresentationQueueTarget presentation_queue_target,
4222a4f78defSmrg    /* output parameters follow */
4223a4f78defSmrg    VdpPresentationQueue *     presentation_queue
4224a4f78defSmrg);
4225a4f78defSmrg
4226a4f78defSmrg/**
4227a4f78defSmrg * \brief Destroy a VdpPresentationQueue.
4228a4f78defSmrg * \param[in] presentation_queue The queue to destroy.
4229a4f78defSmrg * \return VdpStatus The completion status of the operation.
4230a4f78defSmrg */
4231a4f78defSmrgtypedef VdpStatus VdpPresentationQueueDestroy(
4232a4f78defSmrg    VdpPresentationQueue presentation_queue
4233a4f78defSmrg);
4234a4f78defSmrg
4235a4f78defSmrg/**
4236a4f78defSmrg * \brief Configure the background color setting.
4237a4f78defSmrg * \param[in] presentation_queue The queue to manipulate.
4238a4f78defSmrg * \param[in] background_color The new background color.
4239a4f78defSmrg *
4240a4f78defSmrg * Note: Implementations may choose whether to apply the
4241a4f78defSmrg * new background color value immediately, or defer it until
4242a4f78defSmrg * the next surface is presented.
4243a4f78defSmrg */
4244a4f78defSmrgtypedef VdpStatus VdpPresentationQueueSetBackgroundColor(
4245a4f78defSmrg    VdpPresentationQueue presentation_queue,
4246a4f78defSmrg    VdpColor * const     background_color
4247a4f78defSmrg);
4248a4f78defSmrg
4249a4f78defSmrg/**
4250a4f78defSmrg * \brief Retrieve the current background color setting.
4251a4f78defSmrg * \param[in] presentation_queue The queue to query.
4252a4f78defSmrg * \param[out] background_color The current background color.
4253a4f78defSmrg */
4254a4f78defSmrgtypedef VdpStatus VdpPresentationQueueGetBackgroundColor(
4255a4f78defSmrg    VdpPresentationQueue presentation_queue,
4256a4f78defSmrg    VdpColor *           background_color
4257a4f78defSmrg);
4258a4f78defSmrg
4259a4f78defSmrg/**
4260a4f78defSmrg * \brief Retrieve the presentation queue's "current" time.
4261a4f78defSmrg * \param[in] presentation_queue The queue to query.
4262a4f78defSmrg * \param[out] current_time The current time, which may
4263a4f78defSmrg *       represent a point between display VSYNC events.
4264a4f78defSmrg * \return VdpStatus The completion status of the operation.
4265a4f78defSmrg */
4266a4f78defSmrgtypedef VdpStatus VdpPresentationQueueGetTime(
4267a4f78defSmrg    VdpPresentationQueue presentation_queue,
4268a4f78defSmrg    /* output parameters follow */
4269a4f78defSmrg    VdpTime *            current_time
4270a4f78defSmrg);
4271a4f78defSmrg
4272a4f78defSmrg/**
4273a4f78defSmrg * \brief Enter a surface into the presentation queue.
4274a4f78defSmrg * \param[in] presentation_queue The queue to query.
4275a4f78defSmrg * \param[in] surface The surface to enter into the queue.
4276a4f78defSmrg * \param[in] clip_width If set to a non-zero value, the presentation queue
4277a4f78defSmrg *       will display only clip_width pixels of the surface (anchored to the
4278a4f78defSmrg *       top-left corner of the surface.
4279a4f78defSmrg * \param[in] clip_height If set to a non-zero value, the presentation queue
4280a4f78defSmrg *       will display only clip_height lines of the surface (anchored to the
4281a4f78defSmrg *       top-left corner of the surface.
4282a4f78defSmrg * \param[in] earliest_presentation_time The timestamp
4283a4f78defSmrg *       associated with the surface. The presentation queue
4284a4f78defSmrg *       will not display the surface until the presentation
4285a4f78defSmrg *       queue's current time is at least this value.
4286a4f78defSmrg * \return VdpStatus The completion status of the operation.
4287a4f78defSmrg *
4288a4f78defSmrg * Applications may choose to allow resizing of the presentation queue target
4289a4f78defSmrg * (which may be e.g. a regular Window when using an X11-based
4290a4f78defSmrg * implementation).
4291a4f78defSmrg *
4292a4f78defSmrg * \b clip_width and \b clip_height may be used to limit the size of the
4293a4f78defSmrg * displayed region of a surface, in order to match the specific region that
4294a4f78defSmrg * was rendered to.
4295a4f78defSmrg *
4296a4f78defSmrg * In turn, this allows the application to allocate over-sized (e.g.
4297a4f78defSmrg * screen-sized) surfaces, but render to a region that matches the current
4298a4f78defSmrg * size of the video window.
4299a4f78defSmrg *
4300a4f78defSmrg * Using this technique, an application's response to window resizing may
4301a4f78defSmrg * simply be to render to, and display, a different region of the surface,
4302a4f78defSmrg * rather than de-/re-allocation of surfaces to match the updated window size.
4303a4f78defSmrg *
4304a4f78defSmrg * Implementations may impose an upper bound on the number of entries
4305a4f78defSmrg * contained by the presentation queue at a given time. This limit is likely
4306a4f78defSmrg * different to the number of \ref VdpOutputSurface "VdpOutputSurface"s that
4307a4f78defSmrg * may be allocated at a given time. This limit applies to entries in the
4308a4f78defSmrg * QUEUED or VISIBLE state only. In other words, entries that have
4309a4f78defSmrg * transitioned from a QUEUED or VISIBLE state to an IDLE state do not count
4310a4f78defSmrg * toward this limit.
4311a4f78defSmrg */
4312a4f78defSmrgtypedef VdpStatus VdpPresentationQueueDisplay(
4313a4f78defSmrg    VdpPresentationQueue presentation_queue,
4314a4f78defSmrg    VdpOutputSurface     surface,
4315a4f78defSmrg    uint32_t             clip_width,
4316a4f78defSmrg    uint32_t             clip_height,
4317a4f78defSmrg    VdpTime              earliest_presentation_time
4318a4f78defSmrg);
4319a4f78defSmrg
4320a4f78defSmrg/**
4321a4f78defSmrg * \brief Wait for a surface to finish being displayed.
4322a4f78defSmrg * \param[in] presentation_queue The queue to query.
4323a4f78defSmrg * \param[in] surface The surface to wait for.
4324a4f78defSmrg * \param[out] first_presentation_time The timestamp of the
4325a4f78defSmrg *       VSYNC at which this surface was first displayed. Note
4326a4f78defSmrg *       that 0 means the surface was never displayed.
4327a4f78defSmrg * \return VdpStatus The completion status of the operation.
4328a4f78defSmrg *
4329a4f78defSmrg * Note that this API would block forever if queried about the surface most
4330a4f78defSmrg * recently added to a presentation queue. That is because there would be no
4331a4f78defSmrg * other surface that could possibly replace that surface as the currently
4332a4f78defSmrg * displayed surface, and hence that surface would never become idle. For
4333a4f78defSmrg * that reason, this function will return an error in that case.
4334a4f78defSmrg */
4335a4f78defSmrgtypedef VdpStatus VdpPresentationQueueBlockUntilSurfaceIdle(
4336a4f78defSmrg    VdpPresentationQueue presentation_queue,
4337a4f78defSmrg    VdpOutputSurface     surface,
4338a4f78defSmrg    /* output parameters follow */
4339a4f78defSmrg    VdpTime *            first_presentation_time
4340a4f78defSmrg);
4341a4f78defSmrg
4342a4f78defSmrg/**
4343a4f78defSmrg * \hideinitializer
4344a4f78defSmrg * \brief The status of a surface within a presentation queue.
4345a4f78defSmrg */
4346a4f78defSmrgtypedef enum {
4347a4f78defSmrg    /** The surface is not queued or currently visible. */
4348a4f78defSmrg    VDP_PRESENTATION_QUEUE_STATUS_IDLE,
4349a4f78defSmrg    /** The surface is in the queue, and not currently visible. */
4350a4f78defSmrg    VDP_PRESENTATION_QUEUE_STATUS_QUEUED,
4351a4f78defSmrg    /** The surface is the currently visible surface. */
4352a4f78defSmrg    VDP_PRESENTATION_QUEUE_STATUS_VISIBLE,
4353a4f78defSmrg} VdpPresentationQueueStatus;
4354a4f78defSmrg
4355a4f78defSmrg/**
4356a4f78defSmrg * \brief Poll the current queue status of a surface.
4357a4f78defSmrg * \param[in] presentation_queue The queue to query.
4358a4f78defSmrg * \param[in] surface The surface to query.
4359a4f78defSmrg * \param[out] status The current status of the surface within
4360a4f78defSmrg *       the queue.
4361a4f78defSmrg * \param[out] first_presentation_time The timestamp of the
4362a4f78defSmrg *       VSYNC at which this surface was first displayed. Note
4363a4f78defSmrg *       that 0 means the surface was never displayed.
4364a4f78defSmrg * \return VdpStatus The completion status of the operation.
4365a4f78defSmrg */
4366a4f78defSmrgtypedef VdpStatus VdpPresentationQueueQuerySurfaceStatus(
4367a4f78defSmrg    VdpPresentationQueue         presentation_queue,
4368a4f78defSmrg    VdpOutputSurface             surface,
4369a4f78defSmrg    /* output parameters follow */
4370a4f78defSmrg    VdpPresentationQueueStatus * status,
4371a4f78defSmrg    VdpTime *                    first_presentation_time
4372a4f78defSmrg);
4373a4f78defSmrg
4374a4f78defSmrg/*@}*/
4375a4f78defSmrg
4376a4f78defSmrg/**
4377a4f78defSmrg * \defgroup display_preemption Display Preemption
4378a4f78defSmrg *
4379a4f78defSmrg * The Window System may operate within a frame-work (such as
4380a4f78defSmrg * Linux's VT switching) where the display is shared between the
4381a4f78defSmrg * Window System (e.g. X) and some other output mechanism (e.g.
4382a4f78defSmrg * the VT.) Given this scenario, the Window System's control of
4383a4f78defSmrg * the display could be preempted, and restored, at any time.
4384a4f78defSmrg *
4385a4f78defSmrg * VDPAU does not mandate that implementations hide such
4386a4f78defSmrg * preemptions from VDPAU client applications; doing so may
4387a4f78defSmrg * impose extreme burdens upon VDPAU implementations. Equally,
4388a4f78defSmrg * however, implementations are free to hide such preemptions
4389a4f78defSmrg * from client applications.
4390a4f78defSmrg *
4391a4f78defSmrg * VDPAU allows implementations to inform the client application
4392a4f78defSmrg * when such a preemption has occurred, and then refuse to
4393a4f78defSmrg * continue further operation.
4394a4f78defSmrg *
4395a4f78defSmrg * Similarly, some form of fatal hardware error could prevent further
4396a4f78defSmrg * operation of the VDPAU implementation, without a complete
4397a4f78defSmrg * re-initialization.
4398a4f78defSmrg *
4399a4f78defSmrg * The following discusses the behavior of implementations that
4400a4f78defSmrg * choose not to hide preemption from client applications.
4401a4f78defSmrg *
4402a4f78defSmrg * When preemption occurs, VDPAU internally destroys all
4403a4f78defSmrg * objects; the client application need not do this. However, if
4404a4f78defSmrg * the client application wishes to continue operation, it must
4405a4f78defSmrg * recreate all objects that it uses. It is probable that this
4406a4f78defSmrg * recreation will not succeed until the display ownership is
4407a4f78defSmrg * restored to the Window System.
4408a4f78defSmrg *
4409a4f78defSmrg * Once preemption has occurred, all VDPAU entry points will
4410a4f78defSmrg * return the specific error code \ref
4411a4f78defSmrg * VDP_STATUS_DISPLAY_PREEMPTED.
4412a4f78defSmrg *
4413a4f78defSmrg * VDPAU client applications may also be notified of such
4414a4f78defSmrg * preemptions and fatal errors via a callback. See \ref
4415a4f78defSmrg * VdpPreemptionCallbackRegister for more details.
4416a4f78defSmrg *
4417a4f78defSmrg * @{
4418a4f78defSmrg */
4419a4f78defSmrg
4420a4f78defSmrg/**
4421a4f78defSmrg * \brief A callback to notify the client application that a
4422a4f78defSmrg *        device's display has been preempted.
4423a4f78defSmrg * \param[in] device The device that had its display preempted.
4424a4f78defSmrg * \param[in] context The client-supplied callback context
4425a4f78defSmrg *       information.
4426a4f78defSmrg * \return void No return value
4427a4f78defSmrg */
4428a4f78defSmrgtypedef void VdpPreemptionCallback(
4429a4f78defSmrg    VdpDevice device,
4430a4f78defSmrg    void *   context
4431a4f78defSmrg);
4432a4f78defSmrg
4433a4f78defSmrg/**
4434a4f78defSmrg * \brief Configure the display preemption callback.
4435a4f78defSmrg * \param[in] device The device to be monitored for preemption.
4436a4f78defSmrg * \param[in] callback The client application's callback
4437a4f78defSmrg *       function. If NULL, the callback is unregistered.
4438a4f78defSmrg * \param[in] context The client-supplied callback context
4439a4f78defSmrg *       information. This information will be passed to the
4440a4f78defSmrg *       callback function if/when invoked.
4441a4f78defSmrg * \return VdpStatus The completion status of the operation.
4442a4f78defSmrg */
4443a4f78defSmrgtypedef VdpStatus VdpPreemptionCallbackRegister(
4444a4f78defSmrg    VdpDevice             device,
4445a4f78defSmrg    VdpPreemptionCallback callback,
4446a4f78defSmrg    void *               context
4447a4f78defSmrg);
4448a4f78defSmrg
4449a4f78defSmrg/*@}*/
4450a4f78defSmrg
4451a4f78defSmrg/**
4452a4f78defSmrg * \defgroup get_proc_address Entry Point Retrieval
4453a4f78defSmrg *
4454a4f78defSmrg * In order to facilitate multiple implementations of VDPAU
4455a4f78defSmrg * co-existing within a single process, all functionality is
4456a4f78defSmrg * available via function pointers. The mechanism to retrieve
4457a4f78defSmrg * those function pointers is described below.
4458a4f78defSmrg *
4459a4f78defSmrg * @{
4460a4f78defSmrg */
4461a4f78defSmrg
4462a4f78defSmrg/**
4463a4f78defSmrg * \brief A type suitable for \ref VdpGetProcAddress
4464a4f78defSmrg *        "VdpGetProcAddress"'s \b function_id parameter.
4465a4f78defSmrg */
4466a4f78defSmrgtypedef uint32_t VdpFuncId;
4467a4f78defSmrg
4468a4f78defSmrg/** \hideinitializer */
4469a4f78defSmrg#define VDP_FUNC_ID_GET_ERROR_STRING                                            ((VdpFuncId)0)
4470a4f78defSmrg/** \hideinitializer */
4471a4f78defSmrg#define VDP_FUNC_ID_GET_PROC_ADDRESS                                            ((VdpFuncId)1)
4472a4f78defSmrg/** \hideinitializer */
4473a4f78defSmrg#define VDP_FUNC_ID_GET_API_VERSION                                             ((VdpFuncId)2)
4474a4f78defSmrg/** \hideinitializer */
4475a4f78defSmrg#define VDP_FUNC_ID_GET_INFORMATION_STRING                                      ((VdpFuncId)4)
4476a4f78defSmrg/** \hideinitializer */
4477a4f78defSmrg#define VDP_FUNC_ID_DEVICE_DESTROY                                              ((VdpFuncId)5)
4478a4f78defSmrg/** \hideinitializer */
4479a4f78defSmrg#define VDP_FUNC_ID_GENERATE_CSC_MATRIX                                         ((VdpFuncId)6)
4480a4f78defSmrg/** \hideinitializer */
4481a4f78defSmrg#define VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES                            ((VdpFuncId)7)
4482a4f78defSmrg/** \hideinitializer */
4483a4f78defSmrg#define VDP_FUNC_ID_VIDEO_SURFACE_QUERY_GET_PUT_BITS_Y_CB_CR_CAPABILITIES       ((VdpFuncId)8)
4484a4f78defSmrg/** \hideinitializer */
4485a4f78defSmrg#define VDP_FUNC_ID_VIDEO_SURFACE_CREATE                                        ((VdpFuncId)9)
4486a4f78defSmrg/** \hideinitializer */
4487a4f78defSmrg#define VDP_FUNC_ID_VIDEO_SURFACE_DESTROY                                       ((VdpFuncId)10)
4488a4f78defSmrg/** \hideinitializer */
4489a4f78defSmrg#define VDP_FUNC_ID_VIDEO_SURFACE_GET_PARAMETERS                                ((VdpFuncId)11)
4490a4f78defSmrg/** \hideinitializer */
4491a4f78defSmrg#define VDP_FUNC_ID_VIDEO_SURFACE_GET_BITS_Y_CB_CR                              ((VdpFuncId)12)
4492a4f78defSmrg/** \hideinitializer */
4493a4f78defSmrg#define VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR                              ((VdpFuncId)13)
4494a4f78defSmrg/** \hideinitializer */
4495a4f78defSmrg#define VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_CAPABILITIES                           ((VdpFuncId)14)
4496a4f78defSmrg/** \hideinitializer */
4497a4f78defSmrg#define VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_GET_PUT_BITS_NATIVE_CAPABILITIES       ((VdpFuncId)15)
4498a4f78defSmrg/** \hideinitializer */
4499a4f78defSmrg#define VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_PUT_BITS_INDEXED_CAPABILITIES          ((VdpFuncId)16)
4500a4f78defSmrg/** \hideinitializer */
4501a4f78defSmrg#define VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_PUT_BITS_Y_CB_CR_CAPABILITIES          ((VdpFuncId)17)
4502a4f78defSmrg/** \hideinitializer */
4503a4f78defSmrg#define VDP_FUNC_ID_OUTPUT_SURFACE_CREATE                                       ((VdpFuncId)18)
4504a4f78defSmrg/** \hideinitializer */
4505a4f78defSmrg#define VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY                                      ((VdpFuncId)19)
4506a4f78defSmrg/** \hideinitializer */
4507a4f78defSmrg#define VDP_FUNC_ID_OUTPUT_SURFACE_GET_PARAMETERS                               ((VdpFuncId)20)
4508a4f78defSmrg/** \hideinitializer */
4509a4f78defSmrg#define VDP_FUNC_ID_OUTPUT_SURFACE_GET_BITS_NATIVE                              ((VdpFuncId)21)
4510a4f78defSmrg/** \hideinitializer */
4511a4f78defSmrg#define VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_NATIVE                              ((VdpFuncId)22)
4512a4f78defSmrg/** \hideinitializer */
4513a4f78defSmrg#define VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_INDEXED                             ((VdpFuncId)23)
4514a4f78defSmrg/** \hideinitializer */
4515a4f78defSmrg#define VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_Y_CB_CR                             ((VdpFuncId)24)
4516a4f78defSmrg/** \hideinitializer */
4517a4f78defSmrg#define VDP_FUNC_ID_BITMAP_SURFACE_QUERY_CAPABILITIES                           ((VdpFuncId)25)
4518a4f78defSmrg/** \hideinitializer */
4519a4f78defSmrg#define VDP_FUNC_ID_BITMAP_SURFACE_CREATE                                       ((VdpFuncId)26)
4520a4f78defSmrg/** \hideinitializer */
4521a4f78defSmrg#define VDP_FUNC_ID_BITMAP_SURFACE_DESTROY                                      ((VdpFuncId)27)
4522a4f78defSmrg/** \hideinitializer */
4523a4f78defSmrg#define VDP_FUNC_ID_BITMAP_SURFACE_GET_PARAMETERS                               ((VdpFuncId)28)
4524a4f78defSmrg/** \hideinitializer */
4525a4f78defSmrg#define VDP_FUNC_ID_BITMAP_SURFACE_PUT_BITS_NATIVE                              ((VdpFuncId)29)
4526a4f78defSmrg/** \hideinitializer */
4527a4f78defSmrg#define VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_OUTPUT_SURFACE                        ((VdpFuncId)33)
4528a4f78defSmrg/** \hideinitializer */
4529a4f78defSmrg#define VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_BITMAP_SURFACE                        ((VdpFuncId)34)
4530a4f78defSmrg/** \hideinitializer */
4531a4f78defSmrg#define VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_VIDEO_SURFACE_LUMA                    ((VdpFuncId)35)
4532a4f78defSmrg/** \hideinitializer */
4533a4f78defSmrg#define VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES                                  ((VdpFuncId)36)
4534a4f78defSmrg/** \hideinitializer */
4535a4f78defSmrg#define VDP_FUNC_ID_DECODER_CREATE                                              ((VdpFuncId)37)
4536a4f78defSmrg/** \hideinitializer */
4537a4f78defSmrg#define VDP_FUNC_ID_DECODER_DESTROY                                             ((VdpFuncId)38)
4538a4f78defSmrg/** \hideinitializer */
4539a4f78defSmrg#define VDP_FUNC_ID_DECODER_GET_PARAMETERS                                      ((VdpFuncId)39)
4540a4f78defSmrg/** \hideinitializer */
4541a4f78defSmrg#define VDP_FUNC_ID_DECODER_RENDER                                              ((VdpFuncId)40)
4542a4f78defSmrg/** \hideinitializer */
4543a4f78defSmrg#define VDP_FUNC_ID_VIDEO_MIXER_QUERY_FEATURE_SUPPORT                           ((VdpFuncId)41)
4544a4f78defSmrg/** \hideinitializer */
4545a4f78defSmrg#define VDP_FUNC_ID_VIDEO_MIXER_QUERY_PARAMETER_SUPPORT                         ((VdpFuncId)42)
4546a4f78defSmrg/** \hideinitializer */
4547a4f78defSmrg#define VDP_FUNC_ID_VIDEO_MIXER_QUERY_ATTRIBUTE_SUPPORT                         ((VdpFuncId)43)
4548a4f78defSmrg/** \hideinitializer */
4549a4f78defSmrg#define VDP_FUNC_ID_VIDEO_MIXER_QUERY_PARAMETER_VALUE_RANGE                     ((VdpFuncId)44)
4550a4f78defSmrg/** \hideinitializer */
4551a4f78defSmrg#define VDP_FUNC_ID_VIDEO_MIXER_QUERY_ATTRIBUTE_VALUE_RANGE                     ((VdpFuncId)45)
4552a4f78defSmrg/** \hideinitializer */
4553a4f78defSmrg#define VDP_FUNC_ID_VIDEO_MIXER_CREATE                                          ((VdpFuncId)46)
4554a4f78defSmrg/** \hideinitializer */
4555a4f78defSmrg#define VDP_FUNC_ID_VIDEO_MIXER_SET_FEATURE_ENABLES                             ((VdpFuncId)47)
4556a4f78defSmrg/** \hideinitializer */
4557a4f78defSmrg#define VDP_FUNC_ID_VIDEO_MIXER_SET_ATTRIBUTE_VALUES                            ((VdpFuncId)48)
4558a4f78defSmrg/** \hideinitializer */
4559a4f78defSmrg#define VDP_FUNC_ID_VIDEO_MIXER_GET_FEATURE_SUPPORT                             ((VdpFuncId)49)
4560a4f78defSmrg/** \hideinitializer */
4561a4f78defSmrg#define VDP_FUNC_ID_VIDEO_MIXER_GET_FEATURE_ENABLES                             ((VdpFuncId)50)
4562a4f78defSmrg/** \hideinitializer */
4563a4f78defSmrg#define VDP_FUNC_ID_VIDEO_MIXER_GET_PARAMETER_VALUES                            ((VdpFuncId)51)
4564a4f78defSmrg/** \hideinitializer */
4565a4f78defSmrg#define VDP_FUNC_ID_VIDEO_MIXER_GET_ATTRIBUTE_VALUES                            ((VdpFuncId)52)
4566a4f78defSmrg/** \hideinitializer */
4567a4f78defSmrg#define VDP_FUNC_ID_VIDEO_MIXER_DESTROY                                         ((VdpFuncId)53)
4568a4f78defSmrg/** \hideinitializer */
4569a4f78defSmrg#define VDP_FUNC_ID_VIDEO_MIXER_RENDER                                          ((VdpFuncId)54)
4570a4f78defSmrg/** \hideinitializer */
4571a4f78defSmrg#define VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_DESTROY                           ((VdpFuncId)55)
4572a4f78defSmrg/** \hideinitializer */
4573a4f78defSmrg#define VDP_FUNC_ID_PRESENTATION_QUEUE_CREATE                                   ((VdpFuncId)56)
4574a4f78defSmrg/** \hideinitializer */
4575a4f78defSmrg#define VDP_FUNC_ID_PRESENTATION_QUEUE_DESTROY                                  ((VdpFuncId)57)
4576a4f78defSmrg/** \hideinitializer */
4577a4f78defSmrg#define VDP_FUNC_ID_PRESENTATION_QUEUE_SET_BACKGROUND_COLOR                     ((VdpFuncId)58)
4578a4f78defSmrg/** \hideinitializer */
4579a4f78defSmrg#define VDP_FUNC_ID_PRESENTATION_QUEUE_GET_BACKGROUND_COLOR                     ((VdpFuncId)59)
4580a4f78defSmrg/** \hideinitializer */
4581a4f78defSmrg#define VDP_FUNC_ID_PRESENTATION_QUEUE_GET_TIME                                 ((VdpFuncId)62)
4582a4f78defSmrg/** \hideinitializer */
4583a4f78defSmrg#define VDP_FUNC_ID_PRESENTATION_QUEUE_DISPLAY                                  ((VdpFuncId)63)
4584a4f78defSmrg/** \hideinitializer */
4585a4f78defSmrg#define VDP_FUNC_ID_PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE                 ((VdpFuncId)64)
4586a4f78defSmrg/** \hideinitializer */
4587a4f78defSmrg#define VDP_FUNC_ID_PRESENTATION_QUEUE_QUERY_SURFACE_STATUS                     ((VdpFuncId)65)
4588a4f78defSmrg/** \hideinitializer */
4589a4f78defSmrg#define VDP_FUNC_ID_PREEMPTION_CALLBACK_REGISTER                                ((VdpFuncId)66)
4590a4f78defSmrg
4591a4f78defSmrg#define VDP_FUNC_ID_BASE_WINSYS 0x1000
4592a4f78defSmrg
4593a4f78defSmrg/**
4594a4f78defSmrg * \brief Retrieve a VDPAU function pointer.
4595a4f78defSmrg * \param[in] device The device that the function will operate
4596a4f78defSmrg *       against.
4597a4f78defSmrg * \param[in] function_id The specific function to retrieve.
4598a4f78defSmrg * \param[out] function_pointer The actual pointer for the
4599a4f78defSmrg *       application to call.
4600a4f78defSmrg * \return VdpStatus The completion status of the operation.
4601a4f78defSmrg */
4602a4f78defSmrgtypedef VdpStatus VdpGetProcAddress(
4603a4f78defSmrg    VdpDevice device,
4604a4f78defSmrg    VdpFuncId function_id,
4605a4f78defSmrg    /* output parameters follow */
4606a4f78defSmrg    void * *  function_pointer
4607a4f78defSmrg);
4608a4f78defSmrg
4609a4f78defSmrg/*@}*/
4610a4f78defSmrg/*@}*/
4611a4f78defSmrg
4612a4f78defSmrg/**
4613a4f78defSmrg * \defgroup api_winsys Window System Integration Layer
4614a4f78defSmrg *
4615a4f78defSmrg * The set of VDPAU functionality specific to an individual
4616a4f78defSmrg * Windowing System.
4617a4f78defSmrg */
4618a4f78defSmrg
4619a4f78defSmrg#ifdef __cplusplus
4620a4f78defSmrg}
4621a4f78defSmrg#endif
4622a4f78defSmrg
4623a4f78defSmrg#endif
4624a4f78defSmrg
4625