316a6afcf9408f9afa16ad08026e139462daeb88
[platform/upstream/libva.git] / va / va_vpp.h
1 /*
2  * Copyright (c) 2007-2011 Intel Corporation. All Rights Reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the
6  * "Software"), to deal in the Software without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sub license, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the
13  * next paragraph) shall be included in all copies or substantial portions
14  * of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
19  * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
20  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24
25 /**
26  * \file va_vpp.h
27  * \brief The video processing API
28  *
29  * This file contains the \ref api_vpp "Video processing API".
30  */
31
32 #ifndef VA_VPP_H
33 #define VA_VPP_H
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 /**
40  * \defgroup api_vpp Video processing API
41  *
42  * @{
43  *
44  * The video processing API uses the same paradigm as for decoding:
45  * - Query for supported filters;
46  * - Set up a video processing pipeline;
47  * - Send video processing parameters through VA buffers.
48  *
49  * \section api_vpp_caps Query for supported filters
50  *
51  * Checking whether video processing is supported can be performed
52  * with vaQueryConfigEntrypoints() and the profile argument set to
53  * #VAProfileNone. If video processing is supported, then the list of
54  * returned entry-points will include #VAEntrypointVideoProc.
55  *
56  * \code
57  * VAEntrypoint *entrypoints;
58  * int i, num_entrypoints, supportsVideoProcessing = 0;
59  *
60  * num_entrypoints = vaMaxNumEntrypoints();
61  * entrypoints = malloc(num_entrypoints * sizeof(entrypoints[0]);
62  * vaQueryConfigEntrypoints(va_dpy, VAProfileNone,
63  *     entrypoints, &num_entrypoints);
64  *
65  * for (i = 0; !supportsVideoProcessing && i < num_entrypoints; i++) {
66  *     if (entrypoints[i] == VAEntrypointVideoProc)
67  *         supportsVideoProcessing = 1;
68  * }
69  * \endcode
70  *
71  * Then, the vaQueryVideoProcFilters() function is used to query the
72  * list of video processing filters.
73  *
74  * \code
75  * VAProcFilterType filters[VAProcFilterCount];
76  * unsigned int num_filters = VAProcFilterCount;
77  *
78  * // num_filters shall be initialized to the length of the array
79  * vaQueryVideoProcFilters(va_dpy, vpp_ctx, &pipe_caps, &num_filters);
80  * \endcode
81  *
82  * Finally, individual filter capabilities can be checked with
83  * vaQueryVideoProcFilterCaps().
84  *
85  * \code
86  * VAProcFilterCap denoise_caps;
87  * unsigned int num_denoise_caps = 1;
88  * vaQueryVideoProcFilterCaps(va_dpy, vpp_ctx,
89  *     VAProcFilterNoiseReduction,
90  *     &denoise_caps, &num_denoise_caps
91  * );
92  *
93  * VAProcFilterCapDeinterlacing deinterlacing_caps[VAProcDeinterlacingCount];
94  * unsigned int num_deinterlacing_caps = VAProcDeinterlacingCount;
95  * vaQueryVideoProcFilterCaps(va_dpy, vpp_ctx,
96  *     VAProcFilterDeinterlacing,
97  *     &deinterlacing_caps, &num_deinterlacing_caps
98  * );
99  * \endcode
100  *
101  * \section api_vpp_setup Set up a video processing pipeline
102  *
103  * A video processing pipeline buffer is created for each source
104  * surface we want to process. However, buffers holding filter
105  * parameters can be created once and for all. Rationale is to avoid
106  * multiple creation/destruction chains of filter buffers and also
107  * because filter parameters generally won't change frame after
108  * frame. e.g. this makes it possible to implement a checkerboard of
109  * videos where the same filters are applied to each video source.
110  *
111  * The general control flow is demonstrated by the following pseudo-code:
112  * \code
113  * // Create filters
114  * VABufferID denoise_filter, deint_filter;
115  * VABufferID filter_bufs[VAProcFilterCount];
116  * unsigned int num_filter_bufs;
117  *
118  * for (i = 0; i < num_filters; i++) {
119  *     switch (filters[i]) {
120  *     case VAProcFilterNoiseReduction: {       // Noise reduction filter
121  *         VAProcFilterParameterBuffer denoise;
122  *         denoise.type  = VAProcFilterNoiseReduction;
123  *         denoise.value = 0.5;
124  *         vaCreateBuffer(va_dpy, vpp_ctx,
125  *             VAProcFilterParameterBufferType, sizeof(denoise), 1,
126  *             &denoise, &denoise_filter
127  *         );
128  *         filter_bufs[num_filter_bufs++] = denoise_filter;
129  *         break;
130  *     }
131  *
132  *     case VAProcFilterDeinterlacing:          // Motion-adaptive deinterlacing
133  *         for (j = 0; j < num_deinterlacing_caps; j++) {
134  *             VAProcFilterCapDeinterlacing * const cap = &deinterlacing_caps[j];
135  *             if (cap->type != VAProcDeinterlacingMotionAdaptive)
136  *                 continue;
137  *
138  *             VAProcFilterParameterBufferDeinterlacing deint;
139  *             deint.type                   = VAProcFilterDeinterlacing;
140  *             deint.algorithm              = VAProcDeinterlacingMotionAdaptive;
141  *             deint.forward_references     =
142  *                 malloc(cap->num_forward_references * sizeof(VASurfaceID));
143  *             deint.num_forward_references = 0; // none for now
144  *             deint.backward_references    =
145  *                 malloc(cap->num_backward_references * sizeof(VASurfaceID));
146  *             deint.num_backward_references = 0; // none for now
147  *             vaCreateBuffer(va_dpy, vpp_ctx,
148  *                 VAProcFilterParameterBufferType, sizeof(deint), 1,
149  *                 &deint, &deint_filter
150  *             );
151  *             filter_bufs[num_filter_bufs++] = deint_filter;
152  *         }
153  *     }
154  * }
155  * \endcode
156  *
157  * \section api_vpp_submit Send video processing parameters through VA buffers
158  *
159  * Video processing pipeline parameters are submitted for each source
160  * surface to process. Video filter parameters can also change, per-surface.
161  * e.g. the list of reference frames used for deinterlacing.
162  *
163  * \code
164  * foreach (iteration) {
165  *     vaBeginPicture(va_dpy, vpp_ctx, vpp_surface);
166  *     foreach (surface) {
167  *         VARectangle output_region;
168  *         VABufferID pipeline_buf;
169  *         VAProcPipelineParameterBuffer *pipeline_param;
170  *
171  *         vaCreateBuffer(va_dpy, vpp_ctx,
172  *             VAProcPipelineParameterBuffer, sizeof(*pipeline_param), 1,
173  *             NULL, &pipeline_param
174  *         );
175  *
176  *         // Setup output region for this surface
177  *         // e.g. upper left corner for the first surface
178  *         output_region.x     = BORDER;
179  *         output_region.y     = BORDER;
180  *         output_region.width =
181  *             (vpp_surface_width - (Nx_surfaces + 1) * BORDER) / Nx_surfaces;
182  *         output_region.height =
183  *             (vpp_surface_height - (Ny_surfaces + 1) * BORDER) / Ny_surfaces;
184  *
185  *         vaMapBuffer(va_dpy, pipeline_buf, &pipeline_param);
186  *         pipeline_param->surface              = surface;
187  *         pipeline_param->surface_region       = NULL;
188  *         pipeline_param->output_region        = &output_region;
189  *         pipeline_param->output_background_color = 0;
190  *         if (first surface to render)
191  *             pipeline_param->output_background_color = 0xff000000; // black
192  *         pipeline_param->filter_flags         = VA_FILTER_SCALING_HQ;
193  *         pipeline_param->filters              = filter_bufs;
194  *         pipeline_param->num_filters          = num_filter_bufs;
195  *         vaUnmapBuffer(va_dpy, pipeline_buf);
196  *
197  *         VAProcFilterParameterBufferDeinterlacing *deint_param;
198  *         vaMapBuffer(va_dpy, deint_filter, &deint_param);
199  *         // Update deinterlacing parameters, if necessary
200  *         ...
201  *         vaUnmapBuffer(va_dpy, deint_filter);
202  *
203  *         // Apply filters
204  *         vaRenderPicture(va_dpy, vpp_ctx, &pipeline_buf, 1);
205  *     }
206  *     vaEndPicture(va_dpy, vpp_ctx);
207  * }
208  * \endcode
209  */
210
211 /** \brief Video filter types. */
212 typedef enum _VAProcFilterType {
213     VAProcFilterNone = 0,
214     /** \brief Noise reduction filter. */
215     VAProcFilterNoiseReduction,
216     /** \brief Deinterlacing filter. */
217     VAProcFilterDeinterlacing,
218     /** \brief Sharpening filter. */
219     VAProcFilterSharpening,
220     /** \brief Color balance parameters. */
221     VAProcFilterColorBalance,
222     /** \brief Color standard conversion. */
223     VAProcFilterColorStandard,
224     /** \brief Max number of video filters. */
225     VAProcFilterCount
226 } VAProcFilterType;
227
228 /** \brief Deinterlacing types. */
229 typedef enum _VAProcDeinterlacingType {
230     VAProcDeinterlacingNone = 0,
231     /** \brief Bob deinterlacing algorithm. */
232     VAProcDeinterlacingBob,
233     /** \brief Weave deinterlacing algorithm. */
234     VAProcDeinterlacingWeave,
235     /** \brief Motion adaptive deinterlacing algorithm. */
236     VAProcDeinterlacingMotionAdaptive,
237     /** \brief Motion compensated deinterlacing algorithm. */
238     VAProcDeinterlacingMotionCompensated,
239     /** \brief Max number of deinterlacing algorithms. */
240     VAProcDeinterlacingCount
241 } VAProcDeinterlacingType;
242
243 /** \brief Color balance types. */
244 typedef enum _VAProcColorBalanceType {
245     VAProcColorBalanceNone = 0,
246     /** \brief Hue. */
247     VAProcColorBalanceHue,
248     /** \brief Saturation. */
249     VAProcColorBalanceSaturation,
250     /** \brief Brightness. */
251     VAProcColorBalanceBrightness,
252     /** \brief Contrast. */
253     VAProcColorBalanceContrast,
254     /** \brief Automatically adjusted saturation. */
255     VAProcColorBalanceAutoSaturation,
256     /** \brief Automatically adjusted brightness. */
257     VAProcColorBalanceAutoBrightness,
258     /** \brief Automatically adjusted contrast. */
259     VAProcColorBalanceAutoContrast,
260     /** \brief Max number of color balance operations. */
261     VAProcColorBalanceCount
262 } VAProcColorBalanceType;
263
264 /** \brief Color standard types. */
265 typedef enum _VAProcColorStandardType {
266     VAProcColorStandardNone = 0,
267     /** \brief ITU-R BT.601. */
268     VAProcColorStandardBT601,
269     /** \brief ITU-R BT.709. */
270     VAProcColorStandardBT709,
271     /** \brief ITU-R BT.470-2 System M. */
272     VAProcColorStandardBT470M,
273     /** \brief ITU-R BT.470-2 System B, G. */
274     VAProcColorStandardBT470BG,
275     /** \brief SMPTE-170M. */
276     VAProcColorStandardSMPTE170M,
277     /** \brief SMPTE-240M. */
278     VAProcColorStandardSMPTE240M,
279     /** \brief Generic film. */
280     VAProcColorStandardGenericFilm,
281 } VAProcColorStandardType;
282
283 /** @name Video pipeline flags */
284 /**@{*/
285 /** \brief Specifies whether to apply subpictures when processing a surface. */
286 #define VA_PROC_PIPELINE_SUBPICTURES    0x00000001
287 /**
288  * \brief Specifies whether to apply power or performance
289  * optimizations to a pipeline.
290  *
291  * When processing several surfaces, it may be necessary to prioritize
292  * more certain pipelines than others. This flag is only a hint to the
293  * video processor so that it can omit certain filters to save power
294  * for example. Typically, this flag could be used with video surfaces
295  * decoded from a secondary bitstream.
296  */
297 #define VA_PROC_PIPELINE_FAST           0x00000002
298 /**@}*/
299
300 /** @name Video filter flags */
301 /**@{*/
302 /** \brief Specifies whether the filter shall be present in the pipeline. */
303 #define VA_PROC_FILTER_MANDATORY        0x00000001
304 /**@}*/
305
306 /** \brief Video processing pipeline capabilities. */
307 typedef struct _VAProcPipelineCaps {
308     /** \brief Video filter flags. See video pipeline flags. */
309     unsigned int        flags;
310     /** \brief Pipeline flags. See VAProcPipelineParameterBuffer::pipeline_flags. */
311     unsigned int        pipeline_flags;
312     /** \brief Extra filter flags. See VAProcPipelineParameterBuffer::filter_flags. */
313     unsigned int        filter_flags;
314     /** \brief Number of forward reference frames that are needed. */
315     unsigned int        num_forward_references;
316     /** \brief Number of backward reference frames that are needed. */
317     unsigned int        num_backward_references;
318 } VAProcPipelineCaps;
319
320 /** \brief Specification of values supported by the filter. */
321 typedef struct _VAProcFilterValueRange {
322     /** \brief Minimum value supported, inclusive. */
323     float               min_value;
324     /** \brief Maximum value supported, inclusive. */
325     float               max_value;
326     /** \brief Default value. */
327     float               default_value;
328     /** \brief Step value that alters the filter behaviour in a sensible way. */
329     float               step;
330 } VAProcFilterValueRange;
331
332 /**
333  * \brief Video processing pipeline configuration.
334  *
335  * This buffer defines a video processing pipeline. As for any buffer
336  * passed to \c vaRenderPicture(), this is a one-time usage model.
337  * However, the actual filters to be applied are provided in the
338  * \c filters field, so they can be re-used in other processing
339  * pipelines.
340  *
341  * The target surface is specified by the \c render_target argument of
342  * \c vaBeginPicture(). The general usage model is described as follows:
343  * - \c vaBeginPicture(): specify the target surface that receives the
344  *   processed output;
345  * - \c vaRenderPicture(): specify a surface to be processed and composed
346  *   into the \c render_target. Use as many \c vaRenderPicture() calls as
347  *   necessary surfaces to compose ;
348  * - \c vaEndPicture(): tell the driver to start processing the surfaces
349  *   with the requested filters.
350  *
351  * If a filter (e.g. noise reduction) needs to be applied with different
352  * values for multiple surfaces, the application needs to create as many
353  * filter parameter buffers as necessary. i.e. the filter parameters shall
354  * not change between two calls to \c vaRenderPicture().
355  *
356  * For composition usage models, the first surface to process will generally
357  * use an opaque background color, i.e. \c output_background_color set with
358  * the most significant byte set to \c 0xff. For instance, \c 0xff000000 for
359  * a black background. Then, subsequent surfaces would use a transparent
360  * background color.
361  */
362 typedef struct _VAProcPipelineParameterBuffer {
363     /**
364      * \brief Source surface ID.
365      *
366      * ID of the source surface to process. If subpictures are associated
367      * with the video surfaces then they shall be rendered to the target
368      * surface, if the #VA_PROC_PIPELINE_SUBPICTURES pipeline flag is set.
369      */
370     VASurfaceID         surface;
371     /**
372      * \brief Region within the source surface to be processed.
373      *
374      * Pointer to a #VARectangle defining the region within the source
375      * surface to be processed. If NULL, \c surface_region implies the
376      * whole surface.
377      */
378     const VARectangle  *surface_region;
379     /**
380      * \brief Region within the output surface.
381      *
382      * Pointer to a #VARectangle defining the region within the output
383      * surface that receives the processed pixels. If NULL, \c output_region
384      * implies the whole surface. 
385      *
386      * Note that any pixels residing outside the specified region will
387      * be filled in with the \ref output_background_color.
388      */
389     const VARectangle  *output_region;
390     /**
391      * \brief Background color.
392      *
393      * Background color used to fill in pixels that reside outside of the
394      * specified \ref output_region. The color is specified in ARGB format:
395      * [31:24] alpha, [23:16] red, [15:8] green, [7:0] blue.
396      *
397      * Unless the alpha value is zero or the \ref output_region represents
398      * the whole target surface size, implementations shall not render the
399      * source surface to the target surface directly. Rather, in order to
400      * maintain the exact semantics of \ref output_background_color, the
401      * driver shall use a temporary surface and fill it in with the
402      * appropriate background color. Next, the driver will blend this
403      * temporary surface into the target surface.
404      */
405     unsigned int        output_background_color;
406     /**
407      * \brief Pipeline filters. See video pipeline flags.
408      *
409      * Flags to control the pipeline, like whether to apply subpictures
410      * or not, notify the driver that it can opt for power optimizations,
411      * should this be needed.
412      */
413     unsigned int        pipeline_flags;
414     /**
415      * \brief Extra filter flags. See vaPutSurface() flags.
416      *
417      * Filter flags are used as a fast path, wherever possible, to use
418      * vaPutSurface() flags instead of explicit filter parameter buffers.
419      *
420      * Allowed filter flags API-wise. Use vaQueryVideoProcPipelineCaps()
421      * to check for implementation details:
422      * - Bob-deinterlacing: \c VA_FRAME_PICTURE, \c VA_TOP_FIELD,
423      *   \c VA_BOTTOM_FIELD. Note that any deinterlacing filter
424      *   (#VAProcFilterDeinterlacing) will override those flags.
425      * - Color space conversion: \c VA_SRC_BT601, \c VA_SRC_BT709,
426      *   \c VA_SRC_SMPTE_240. Note that any color standard filter
427      *   (#VAProcFilterColorStandard) will override those flags.
428      * - Scaling: \c VA_FILTER_SCALING_DEFAULT, \c VA_FILTER_SCALING_FAST,
429      *   \c VA_FILTER_SCALING_HQ, \c VA_FILTER_SCALING_NL_ANAMORPHIC.
430      */
431     unsigned int        filter_flags;
432     /**
433      * \brief Array of filters to apply to the surface.
434      *
435      * The list of filters shall be ordered in the same way the driver expects
436      * them. i.e. as was returned from vaQueryVideoProcFilters().
437      * Otherwise, a #VA_STATUS_ERROR_INVALID_FILTER_CHAIN is returned
438      * from vaRenderPicture() with this buffer.
439      *
440      * #VA_STATUS_ERROR_UNSUPPORTED_FILTER is returned if the list
441      * contains an unsupported filter.
442      *
443      * Note: no filter buffer is destroyed after a call to vaRenderPicture(),
444      * only this pipeline buffer will be destroyed as per the core API
445      * specification. This allows for flexibility in re-using the filter for
446      * other surfaces to be processed.
447      */
448     VABufferID         *filters;
449     /** \brief Actual number of filters. */
450     unsigned int        num_filters;
451 } VAProcPipelineParameterBuffer;
452
453 /**
454  * \brief Filter parameter buffer base.
455  *
456  * This is a helper structure used by driver implementations only.
457  * Users are not supposed to allocate filter parameter buffers of this
458  * type.
459  */
460 typedef struct _VAProcFilterParameterBufferBase {
461     /** \brief Filter type. */
462     VAProcFilterType    type;
463 } VAProcFilterParameterBufferBase;
464
465 /**
466  * \brief Default filter parametrization.
467  *
468  * Unless there is a filter-specific parameter buffer,
469  * #VAProcFilterParameterBuffer is the default type to use.
470  */
471 typedef struct _VAProcFilterParameterBuffer {
472     /** \brief Filter type. */
473     VAProcFilterType    type;
474     /** \brief Value. */
475     float               value;
476 } VAProcFilterParameterBuffer;
477
478 /** \brief Deinterlacing filter parametrization. */
479 typedef struct _VAProcFilterParameterBufferDeinterlacing {
480     /** \brief Filter type. Shall be set to #VAProcFilterDeinterlacing. */
481     VAProcFilterType            type;
482     /** \brief Deinterlacing algorithm. */
483     VAProcDeinterlacingType     algorithm;
484     /** \brief Array of forward reference frames. */
485     VASurfaceID                *forward_references;
486     /** \brief Number of forward reference frames that were supplied. */
487     unsigned int                num_forward_references;
488     /** \brief Array of backward reference frames. */
489     VASurfaceID                *backward_references;
490     /** \brief Number of backward reference frames that were supplied. */
491     unsigned int                num_backward_references;
492 } VAProcFilterParameterBufferDeinterlacing;
493
494 /**
495  * \brief Color balance filter parametrization.
496  *
497  * This buffer defines color balance attributes. A VA buffer can hold
498  * several color balance attributes by creating a VA buffer of desired
499  * number of elements. This can be achieved by the following pseudo-code:
500  *
501  * \code
502  * enum { kHue, kSaturation, kBrightness, kContrast };
503  *
504  * // Initial color balance parameters
505  * static const VAProcFilterParameterBufferColorBalance colorBalanceParams[4] =
506  * {
507  *     [kHue] =
508  *         { VAProcFilterColorBalance, VAProcColorBalanceHue, 0.5 },
509  *     [kSaturation] =
510  *         { VAProcFilterColorBalance, VAProcColorBalanceSaturation, 0.5 },
511  *     [kBrightness] =
512  *         { VAProcFilterColorBalance, VAProcColorBalanceBrightness, 0.5 },
513  *     [kSaturation] =
514  *         { VAProcFilterColorBalance, VAProcColorBalanceSaturation, 0.5 }
515  * };
516  *
517  * // Create buffer
518  * VABufferID colorBalanceBuffer;
519  * vaCreateBuffer(va_dpy, vpp_ctx,
520  *     VAProcFilterParameterBufferType, sizeof(*pColorBalanceParam), 4,
521  *     colorBalanceParams,
522  *     &colorBalanceBuffer
523  * );
524  *
525  * VAProcFilterParameterBufferColorBalance *pColorBalanceParam;
526  * vaMapBuffer(va_dpy, colorBalanceBuffer, &pColorBalanceParam);
527  * {
528  *     // Change brightness only
529  *     pColorBalanceBuffer[kBrightness].value = 0.75;
530  * }
531  * vaUnmapBuffer(va_dpy, colorBalanceBuffer);
532  * \endcode
533  */
534 typedef struct _VAProcFilterParameterBufferColorBalance {
535     /** \brief Filter type. Shall be set to #VAProcFilterColorBalance. */
536     VAProcFilterType            type;
537     /** \brief Color balance attribute. */
538     VAProcColorBalanceType      attrib;
539     /**
540      * \brief Color balance value.
541      *
542      * Special case for automatically adjusted attributes. e.g. 
543      * #VAProcColorBalanceAutoSaturation,
544      * #VAProcColorBalanceAutoBrightness,
545      * #VAProcColorBalanceAutoContrast.
546      * - If \ref value is \c 1.0 +/- \c FLT_EPSILON, the attribute is
547      *   automatically adjusted and overrides any other attribute of
548      *   the same type that would have been set explicitly;
549      * - If \ref value is \c 0.0 +/- \c FLT_EPSILON, the attribute is
550      *   disabled and other attribute of the same type is used instead.
551      */
552     float                       value;
553 } VAProcFilterParameterBufferColorBalance;
554
555 /** \brief Color standard filter parametrization. */
556 typedef struct _VAProcFilterParameterBufferColorStandard {
557     /** \brief Filter type. Shall be set to #VAProcFilterColorStandard. */
558     VAProcFilterType            type;
559     /** \brief Color standard to use. */
560     VAProcColorStandardType     standard;
561 } VAProcFilterParameterBufferColorStandard;
562
563 /**
564  * \brief Default filter cap specification (single range value).
565  *
566  * Unless there is a filter-specific cap structure, #VAProcFilterCap is the
567  * default type to use for output caps from vaQueryVideoProcFilterCaps().
568  */
569 typedef struct _VAProcFilterCap {
570     /** \brief Range of supported values for the filter. */
571     VAProcFilterValueRange      range;
572 } VAProcFilterCap;
573
574 /** \brief Capabilities specification for the deinterlacing filter. */
575 typedef struct _VAProcFilterCapDeinterlacing {
576     /** \brief Deinterlacing algorithm. */
577     VAProcDeinterlacingType     type;
578     /** \brief Number of forward references needed for deinterlacing. */
579     unsigned int                num_forward_references;
580     /** \brief Number of backward references needed for deinterlacing. */
581     unsigned int                num_backward_references;
582 } VAProcFilterCapDeinterlacing;
583
584 /** \brief Capabilities specification for the color balance filter. */
585 typedef struct _VAProcFilterCapColorBalance {
586     /** \brief Color balance operation. */
587     VAProcColorBalanceType      type;
588     /** \brief Range of supported values for the specified operation. */
589     VAProcFilterValueRange      range;
590 } VAProcFilterCapColorBalance;
591
592 /** \brief Capabilities specification for the color standard filter. */
593 typedef struct _VAProcFilterCapColorStandard {
594     /** \brief Color standard type. */
595     VAProcColorStandardType     type;
596 } VAProcFilterCapColorStandard;
597
598 /**
599  * \brief Queries video processing filters.
600  *
601  * This function returns the list of video processing filters supported
602  * by the driver. The \c filters array is allocated by the user and
603  * \c num_filters shall be initialized to the number of allocated
604  * elements in that array. Upon successful return, the actual number
605  * of filters will be overwritten into \c num_filters. Otherwise,
606  * \c VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned and \c num_filters
607  * is adjusted to the number of elements that would be returned if enough
608  * space was available.
609  *
610  * The list of video processing filters supported by the driver shall
611  * be ordered in the way they can be iteratively applied. This is needed
612  * for both correctness, i.e. some filters would not mean anything if
613  * applied at the beginning of the pipeline; but also for performance
614  * since some filters can be applied in a single pass (e.g. noise
615  * reduction + deinterlacing).
616  *
617  * @param[in] dpy               the VA display
618  * @param[in] context           the video processing context
619  * @param[out] filters          the output array of #VAProcFilterType elements
620  * @param[in,out] num_filters the number of elements allocated on input,
621  *      the number of elements actually filled in on output
622  */
623 VAStatus
624 vaQueryVideoProcFilters(
625     VADisplay           dpy,
626     VAContextID         context,
627     VAProcFilterType   *filters,
628     unsigned int       *num_filters
629 );
630
631 /**
632  * \brief Queries video filter capabilities.
633  *
634  * This function returns the list of capabilities supported by the driver
635  * for a specific video filter. The \c filter_caps array is allocated by
636  * the user and \c num_filter_caps shall be initialized to the number
637  * of allocated elements in that array. Upon successful return, the
638  * actual number of filters will be overwritten into \c num_filter_caps.
639  * Otherwise, \c VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned and
640  * \c num_filter_caps is adjusted to the number of elements that would be
641  * returned if enough space was available.
642  *
643  * @param[in] dpy               the VA display
644  * @param[in] context           the video processing context
645  * @param[in] type              the video filter type
646  * @param[out] filter_caps      the output array of #VAProcFilterCap elements
647  * @param[in,out] num_filter_caps the number of elements allocated on input,
648  *      the number of elements actually filled in output
649  */
650 VAStatus
651 vaQueryVideoProcFilterCaps(
652     VADisplay           dpy,
653     VAContextID         context,
654     VAProcFilterType    type,
655     void               *filter_caps,
656     unsigned int       *num_filter_caps
657 );
658
659 /**
660  * \brief Queries video processing pipeline capabilities.
661  *
662  * This function returns the video processing pipeline capabilities. The
663  * \c filters array defines the video processing pipeline and is an array
664  * of buffers holding filter parameters.
665  *
666  * @param[in] dpy               the VA display
667  * @param[in] context           the video processing context
668  * @param[in] filters           the array of VA buffers defining the video
669  *      processing pipeline
670  * @param[in] num_filters       the number of elements in filters
671  * @param[out] pipeline_caps    the video processing pipeline capabilities
672  */
673 VAStatus
674 vaQueryVideoProcPipelineCaps(
675     VADisplay           dpy,
676     VAContextID         context,
677     VABufferID         *filters,
678     unsigned int        num_filters,
679     VAProcPipelineCaps *pipeline_caps
680 );
681
682 /**@}*/
683
684 #ifdef __cplusplus
685 }
686 #endif
687
688 #endif /* VA_VPP_H */