51d1d84b4e80c614ac412f720486463031ba1665
[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  *             vaCreateBuffer(va_dpy, vpp_ctx,
142  *                 VAProcFilterParameterBufferType, sizeof(deint), 1,
143  *                 &deint, &deint_filter
144  *             );
145  *             filter_bufs[num_filter_bufs++] = deint_filter;
146  *         }
147  *     }
148  * }
149  * \endcode
150  *
151  * Once the video processing pipeline is set up, the caller shall check the
152  * implied capabilities and requirements with vaQueryVideoProcPipelineCaps().
153  * This function can be used to validate the number of reference frames are
154  * needed by the specified deinterlacing algorithm, the supported color
155  * primaries, etc.
156  * \code
157  * // Create filters
158  * VAProcPipelineCaps pipeline_caps;
159  * VASurfaceID *forward_references;
160  * unsigned int num_forward_references;
161  * VASurfaceID *backward_references;
162  * unsigned int num_backward_references;
163  *
164  * vaQueryVideoProcPipelineCaps(va_dpy, vpp_ctx,
165  *     filter_bufs, num_filter_bufs,
166  *     &pipeline_caps
167  * );
168  *
169  * num_forward_references  = pipeline_caps.num_forward_references;
170  * forward_references      =
171  *     malloc(num__forward_references * sizeof(VASurfaceID));
172  * num_backward_references = pipeline_caps.num_backward_references;
173  * backward_references     =
174  *     malloc(num_backward_references * sizeof(VASurfaceID));
175  * \endcode
176  *
177  * \section api_vpp_submit Send video processing parameters through VA buffers
178  *
179  * Video processing pipeline parameters are submitted for each source
180  * surface to process. Video filter parameters can also change, per-surface.
181  * e.g. the list of reference frames used for deinterlacing.
182  *
183  * \code
184  * foreach (iteration) {
185  *     vaBeginPicture(va_dpy, vpp_ctx, vpp_surface);
186  *     foreach (surface) {
187  *         VARectangle output_region;
188  *         VABufferID pipeline_buf;
189  *         VAProcPipelineParameterBuffer *pipeline_param;
190  *
191  *         vaCreateBuffer(va_dpy, vpp_ctx,
192  *             VAProcPipelineParameterBuffer, sizeof(*pipeline_param), 1,
193  *             NULL, &pipeline_param
194  *         );
195  *
196  *         // Setup output region for this surface
197  *         // e.g. upper left corner for the first surface
198  *         output_region.x     = BORDER;
199  *         output_region.y     = BORDER;
200  *         output_region.width =
201  *             (vpp_surface_width - (Nx_surfaces + 1) * BORDER) / Nx_surfaces;
202  *         output_region.height =
203  *             (vpp_surface_height - (Ny_surfaces + 1) * BORDER) / Ny_surfaces;
204  *
205  *         vaMapBuffer(va_dpy, pipeline_buf, &pipeline_param);
206  *         pipeline_param->surface              = surface;
207  *         pipeline_param->surface_region       = NULL;
208  *         pipeline_param->output_region        = &output_region;
209  *         pipeline_param->output_background_color = 0;
210  *         if (first surface to render)
211  *             pipeline_param->output_background_color = 0xff000000; // black
212  *         pipeline_param->filter_flags         = VA_FILTER_SCALING_HQ;
213  *         pipeline_param->filters              = filter_bufs;
214  *         pipeline_param->num_filters          = num_filter_bufs;
215  *         vaUnmapBuffer(va_dpy, pipeline_buf);
216  *
217  *         // Update reference frames for deinterlacing, if necessary
218  *         pipeline_param->forward_references      = forward_references;
219  *         pipeline_param->num_forward_references  = num_forward_references_used;
220  *         pipeline_param->backward_references     = backward_references;
221  *         pipeline_param->num_backward_references = num_bacward_references_used;
222  *
223  *         // Apply filters
224  *         vaRenderPicture(va_dpy, vpp_ctx, &pipeline_buf, 1);
225  *     }
226  *     vaEndPicture(va_dpy, vpp_ctx);
227  * }
228  * \endcode
229  */
230
231 /** \brief Video filter types. */
232 typedef enum _VAProcFilterType {
233     VAProcFilterNone = 0,
234     /** \brief Noise reduction filter. */
235     VAProcFilterNoiseReduction,
236     /** \brief Deinterlacing filter. */
237     VAProcFilterDeinterlacing,
238     /** \brief Sharpening filter. */
239     VAProcFilterSharpening,
240     /** \brief Color balance parameters. */
241     VAProcFilterColorBalance,
242     /** \brief Color standard conversion. */
243     VAProcFilterColorStandard,
244     /** \brief Max number of video filters. */
245     VAProcFilterCount
246 } VAProcFilterType;
247
248 /** \brief Deinterlacing types. */
249 typedef enum _VAProcDeinterlacingType {
250     VAProcDeinterlacingNone = 0,
251     /** \brief Bob deinterlacing algorithm. */
252     VAProcDeinterlacingBob,
253     /** \brief Weave deinterlacing algorithm. */
254     VAProcDeinterlacingWeave,
255     /** \brief Motion adaptive deinterlacing algorithm. */
256     VAProcDeinterlacingMotionAdaptive,
257     /** \brief Motion compensated deinterlacing algorithm. */
258     VAProcDeinterlacingMotionCompensated,
259     /** \brief Max number of deinterlacing algorithms. */
260     VAProcDeinterlacingCount
261 } VAProcDeinterlacingType;
262
263 /** \brief Color balance types. */
264 typedef enum _VAProcColorBalanceType {
265     VAProcColorBalanceNone = 0,
266     /** \brief Hue. */
267     VAProcColorBalanceHue,
268     /** \brief Saturation. */
269     VAProcColorBalanceSaturation,
270     /** \brief Brightness. */
271     VAProcColorBalanceBrightness,
272     /** \brief Contrast. */
273     VAProcColorBalanceContrast,
274     /** \brief Automatically adjusted saturation. */
275     VAProcColorBalanceAutoSaturation,
276     /** \brief Automatically adjusted brightness. */
277     VAProcColorBalanceAutoBrightness,
278     /** \brief Automatically adjusted contrast. */
279     VAProcColorBalanceAutoContrast,
280     /** \brief Max number of color balance operations. */
281     VAProcColorBalanceCount
282 } VAProcColorBalanceType;
283
284 /** \brief Color standard types. */
285 typedef enum _VAProcColorStandardType {
286     VAProcColorStandardNone = 0,
287     /** \brief ITU-R BT.601. */
288     VAProcColorStandardBT601,
289     /** \brief ITU-R BT.709. */
290     VAProcColorStandardBT709,
291     /** \brief ITU-R BT.470-2 System M. */
292     VAProcColorStandardBT470M,
293     /** \brief ITU-R BT.470-2 System B, G. */
294     VAProcColorStandardBT470BG,
295     /** \brief SMPTE-170M. */
296     VAProcColorStandardSMPTE170M,
297     /** \brief SMPTE-240M. */
298     VAProcColorStandardSMPTE240M,
299     /** \brief Generic film. */
300     VAProcColorStandardGenericFilm,
301 } VAProcColorStandardType;
302
303 /** @name Video pipeline flags */
304 /**@{*/
305 /** \brief Specifies whether to apply subpictures when processing a surface. */
306 #define VA_PROC_PIPELINE_SUBPICTURES    0x00000001
307 /**
308  * \brief Specifies whether to apply power or performance
309  * optimizations to a pipeline.
310  *
311  * When processing several surfaces, it may be necessary to prioritize
312  * more certain pipelines than others. This flag is only a hint to the
313  * video processor so that it can omit certain filters to save power
314  * for example. Typically, this flag could be used with video surfaces
315  * decoded from a secondary bitstream.
316  */
317 #define VA_PROC_PIPELINE_FAST           0x00000002
318 /**@}*/
319
320 /** @name Video filter flags */
321 /**@{*/
322 /** \brief Specifies whether the filter shall be present in the pipeline. */
323 #define VA_PROC_FILTER_MANDATORY        0x00000001
324 /**@}*/
325
326 /** \brief Video processing pipeline capabilities. */
327 typedef struct _VAProcPipelineCaps {
328     /** \brief Video filter flags. See video pipeline flags. */
329     unsigned int        flags;
330     /** \brief Pipeline flags. See VAProcPipelineParameterBuffer::pipeline_flags. */
331     unsigned int        pipeline_flags;
332     /** \brief Extra filter flags. See VAProcPipelineParameterBuffer::filter_flags. */
333     unsigned int        filter_flags;
334     /** \brief Number of forward reference frames that are needed. */
335     unsigned int        num_forward_references;
336     /** \brief Number of backward reference frames that are needed. */
337     unsigned int        num_backward_references;
338 } VAProcPipelineCaps;
339
340 /** \brief Specification of values supported by the filter. */
341 typedef struct _VAProcFilterValueRange {
342     /** \brief Minimum value supported, inclusive. */
343     float               min_value;
344     /** \brief Maximum value supported, inclusive. */
345     float               max_value;
346     /** \brief Default value. */
347     float               default_value;
348     /** \brief Step value that alters the filter behaviour in a sensible way. */
349     float               step;
350 } VAProcFilterValueRange;
351
352 /**
353  * \brief Video processing pipeline configuration.
354  *
355  * This buffer defines a video processing pipeline. As for any buffer
356  * passed to \c vaRenderPicture(), this is a one-time usage model.
357  * However, the actual filters to be applied are provided in the
358  * \c filters field, so they can be re-used in other processing
359  * pipelines.
360  *
361  * The target surface is specified by the \c render_target argument of
362  * \c vaBeginPicture(). The general usage model is described as follows:
363  * - \c vaBeginPicture(): specify the target surface that receives the
364  *   processed output;
365  * - \c vaRenderPicture(): specify a surface to be processed and composed
366  *   into the \c render_target. Use as many \c vaRenderPicture() calls as
367  *   necessary surfaces to compose ;
368  * - \c vaEndPicture(): tell the driver to start processing the surfaces
369  *   with the requested filters.
370  *
371  * If a filter (e.g. noise reduction) needs to be applied with different
372  * values for multiple surfaces, the application needs to create as many
373  * filter parameter buffers as necessary. i.e. the filter parameters shall
374  * not change between two calls to \c vaRenderPicture().
375  *
376  * For composition usage models, the first surface to process will generally
377  * use an opaque background color, i.e. \c output_background_color set with
378  * the most significant byte set to \c 0xff. For instance, \c 0xff000000 for
379  * a black background. Then, subsequent surfaces would use a transparent
380  * background color.
381  */
382 typedef struct _VAProcPipelineParameterBuffer {
383     /**
384      * \brief Source surface ID.
385      *
386      * ID of the source surface to process. If subpictures are associated
387      * with the video surfaces then they shall be rendered to the target
388      * surface, if the #VA_PROC_PIPELINE_SUBPICTURES pipeline flag is set.
389      */
390     VASurfaceID         surface;
391     /**
392      * \brief Region within the source surface to be processed.
393      *
394      * Pointer to a #VARectangle defining the region within the source
395      * surface to be processed. If NULL, \c surface_region implies the
396      * whole surface.
397      */
398     const VARectangle  *surface_region;
399     /**
400      * \brief Region within the output surface.
401      *
402      * Pointer to a #VARectangle defining the region within the output
403      * surface that receives the processed pixels. If NULL, \c output_region
404      * implies the whole surface. 
405      *
406      * Note that any pixels residing outside the specified region will
407      * be filled in with the \ref output_background_color.
408      */
409     const VARectangle  *output_region;
410     /**
411      * \brief Background color.
412      *
413      * Background color used to fill in pixels that reside outside of the
414      * specified \ref output_region. The color is specified in ARGB format:
415      * [31:24] alpha, [23:16] red, [15:8] green, [7:0] blue.
416      *
417      * Unless the alpha value is zero or the \ref output_region represents
418      * the whole target surface size, implementations shall not render the
419      * source surface to the target surface directly. Rather, in order to
420      * maintain the exact semantics of \ref output_background_color, the
421      * driver shall use a temporary surface and fill it in with the
422      * appropriate background color. Next, the driver will blend this
423      * temporary surface into the target surface.
424      */
425     unsigned int        output_background_color;
426     /**
427      * \brief Pipeline filters. See video pipeline flags.
428      *
429      * Flags to control the pipeline, like whether to apply subpictures
430      * or not, notify the driver that it can opt for power optimizations,
431      * should this be needed.
432      */
433     unsigned int        pipeline_flags;
434     /**
435      * \brief Extra filter flags. See vaPutSurface() flags.
436      *
437      * Filter flags are used as a fast path, wherever possible, to use
438      * vaPutSurface() flags instead of explicit filter parameter buffers.
439      *
440      * Allowed filter flags API-wise. Use vaQueryVideoProcPipelineCaps()
441      * to check for implementation details:
442      * - Bob-deinterlacing: \c VA_FRAME_PICTURE, \c VA_TOP_FIELD,
443      *   \c VA_BOTTOM_FIELD. Note that any deinterlacing filter
444      *   (#VAProcFilterDeinterlacing) will override those flags.
445      * - Color space conversion: \c VA_SRC_BT601, \c VA_SRC_BT709,
446      *   \c VA_SRC_SMPTE_240. Note that any color standard filter
447      *   (#VAProcFilterColorStandard) will override those flags.
448      * - Scaling: \c VA_FILTER_SCALING_DEFAULT, \c VA_FILTER_SCALING_FAST,
449      *   \c VA_FILTER_SCALING_HQ, \c VA_FILTER_SCALING_NL_ANAMORPHIC.
450      */
451     unsigned int        filter_flags;
452     /**
453      * \brief Array of filters to apply to the surface.
454      *
455      * The list of filters shall be ordered in the same way the driver expects
456      * them. i.e. as was returned from vaQueryVideoProcFilters().
457      * Otherwise, a #VA_STATUS_ERROR_INVALID_FILTER_CHAIN is returned
458      * from vaRenderPicture() with this buffer.
459      *
460      * #VA_STATUS_ERROR_UNSUPPORTED_FILTER is returned if the list
461      * contains an unsupported filter.
462      *
463      * Note: no filter buffer is destroyed after a call to vaRenderPicture(),
464      * only this pipeline buffer will be destroyed as per the core API
465      * specification. This allows for flexibility in re-using the filter for
466      * other surfaces to be processed.
467      */
468     VABufferID         *filters;
469     /** \brief Actual number of filters. */
470     unsigned int        num_filters;
471     /** \brief Array of forward reference frames. */
472     VASurfaceID        *forward_references;
473     /** \brief Number of forward reference frames that were supplied. */
474     unsigned int        num_forward_references;
475     /** \brief Array of backward reference frames. */
476     VASurfaceID        *backward_references;
477     /** \brief Number of backward reference frames that were supplied. */
478     unsigned int        num_backward_references;
479 } VAProcPipelineParameterBuffer;
480
481 /**
482  * \brief Filter parameter buffer base.
483  *
484  * This is a helper structure used by driver implementations only.
485  * Users are not supposed to allocate filter parameter buffers of this
486  * type.
487  */
488 typedef struct _VAProcFilterParameterBufferBase {
489     /** \brief Filter type. */
490     VAProcFilterType    type;
491 } VAProcFilterParameterBufferBase;
492
493 /**
494  * \brief Default filter parametrization.
495  *
496  * Unless there is a filter-specific parameter buffer,
497  * #VAProcFilterParameterBuffer is the default type to use.
498  */
499 typedef struct _VAProcFilterParameterBuffer {
500     /** \brief Filter type. */
501     VAProcFilterType    type;
502     /** \brief Value. */
503     float               value;
504 } VAProcFilterParameterBuffer;
505
506 /** \brief Deinterlacing filter parametrization. */
507 typedef struct _VAProcFilterParameterBufferDeinterlacing {
508     /** \brief Filter type. Shall be set to #VAProcFilterDeinterlacing. */
509     VAProcFilterType            type;
510     /** \brief Deinterlacing algorithm. */
511     VAProcDeinterlacingType     algorithm;
512 } VAProcFilterParameterBufferDeinterlacing;
513
514 /**
515  * \brief Color balance filter parametrization.
516  *
517  * This buffer defines color balance attributes. A VA buffer can hold
518  * several color balance attributes by creating a VA buffer of desired
519  * number of elements. This can be achieved by the following pseudo-code:
520  *
521  * \code
522  * enum { kHue, kSaturation, kBrightness, kContrast };
523  *
524  * // Initial color balance parameters
525  * static const VAProcFilterParameterBufferColorBalance colorBalanceParams[4] =
526  * {
527  *     [kHue] =
528  *         { VAProcFilterColorBalance, VAProcColorBalanceHue, 0.5 },
529  *     [kSaturation] =
530  *         { VAProcFilterColorBalance, VAProcColorBalanceSaturation, 0.5 },
531  *     [kBrightness] =
532  *         { VAProcFilterColorBalance, VAProcColorBalanceBrightness, 0.5 },
533  *     [kSaturation] =
534  *         { VAProcFilterColorBalance, VAProcColorBalanceSaturation, 0.5 }
535  * };
536  *
537  * // Create buffer
538  * VABufferID colorBalanceBuffer;
539  * vaCreateBuffer(va_dpy, vpp_ctx,
540  *     VAProcFilterParameterBufferType, sizeof(*pColorBalanceParam), 4,
541  *     colorBalanceParams,
542  *     &colorBalanceBuffer
543  * );
544  *
545  * VAProcFilterParameterBufferColorBalance *pColorBalanceParam;
546  * vaMapBuffer(va_dpy, colorBalanceBuffer, &pColorBalanceParam);
547  * {
548  *     // Change brightness only
549  *     pColorBalanceBuffer[kBrightness].value = 0.75;
550  * }
551  * vaUnmapBuffer(va_dpy, colorBalanceBuffer);
552  * \endcode
553  */
554 typedef struct _VAProcFilterParameterBufferColorBalance {
555     /** \brief Filter type. Shall be set to #VAProcFilterColorBalance. */
556     VAProcFilterType            type;
557     /** \brief Color balance attribute. */
558     VAProcColorBalanceType      attrib;
559     /**
560      * \brief Color balance value.
561      *
562      * Special case for automatically adjusted attributes. e.g. 
563      * #VAProcColorBalanceAutoSaturation,
564      * #VAProcColorBalanceAutoBrightness,
565      * #VAProcColorBalanceAutoContrast.
566      * - If \ref value is \c 1.0 +/- \c FLT_EPSILON, the attribute is
567      *   automatically adjusted and overrides any other attribute of
568      *   the same type that would have been set explicitly;
569      * - If \ref value is \c 0.0 +/- \c FLT_EPSILON, the attribute is
570      *   disabled and other attribute of the same type is used instead.
571      */
572     float                       value;
573 } VAProcFilterParameterBufferColorBalance;
574
575 /** \brief Color standard filter parametrization. */
576 typedef struct _VAProcFilterParameterBufferColorStandard {
577     /** \brief Filter type. Shall be set to #VAProcFilterColorStandard. */
578     VAProcFilterType            type;
579     /** \brief Color standard to use. */
580     VAProcColorStandardType     standard;
581 } VAProcFilterParameterBufferColorStandard;
582
583 /**
584  * \brief Default filter cap specification (single range value).
585  *
586  * Unless there is a filter-specific cap structure, #VAProcFilterCap is the
587  * default type to use for output caps from vaQueryVideoProcFilterCaps().
588  */
589 typedef struct _VAProcFilterCap {
590     /** \brief Range of supported values for the filter. */
591     VAProcFilterValueRange      range;
592 } VAProcFilterCap;
593
594 /** \brief Capabilities specification for the deinterlacing filter. */
595 typedef struct _VAProcFilterCapDeinterlacing {
596     /** \brief Deinterlacing algorithm. */
597     VAProcDeinterlacingType     type;
598 } VAProcFilterCapDeinterlacing;
599
600 /** \brief Capabilities specification for the color balance filter. */
601 typedef struct _VAProcFilterCapColorBalance {
602     /** \brief Color balance operation. */
603     VAProcColorBalanceType      type;
604     /** \brief Range of supported values for the specified operation. */
605     VAProcFilterValueRange      range;
606 } VAProcFilterCapColorBalance;
607
608 /** \brief Capabilities specification for the color standard filter. */
609 typedef struct _VAProcFilterCapColorStandard {
610     /** \brief Color standard type. */
611     VAProcColorStandardType     type;
612 } VAProcFilterCapColorStandard;
613
614 /**
615  * \brief Queries video processing filters.
616  *
617  * This function returns the list of video processing filters supported
618  * by the driver. The \c filters array is allocated by the user and
619  * \c num_filters shall be initialized to the number of allocated
620  * elements in that array. Upon successful return, the actual number
621  * of filters will be overwritten into \c num_filters. Otherwise,
622  * \c VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned and \c num_filters
623  * is adjusted to the number of elements that would be returned if enough
624  * space was available.
625  *
626  * The list of video processing filters supported by the driver shall
627  * be ordered in the way they can be iteratively applied. This is needed
628  * for both correctness, i.e. some filters would not mean anything if
629  * applied at the beginning of the pipeline; but also for performance
630  * since some filters can be applied in a single pass (e.g. noise
631  * reduction + deinterlacing).
632  *
633  * @param[in] dpy               the VA display
634  * @param[in] context           the video processing context
635  * @param[out] filters          the output array of #VAProcFilterType elements
636  * @param[in,out] num_filters the number of elements allocated on input,
637  *      the number of elements actually filled in on output
638  */
639 VAStatus
640 vaQueryVideoProcFilters(
641     VADisplay           dpy,
642     VAContextID         context,
643     VAProcFilterType   *filters,
644     unsigned int       *num_filters
645 );
646
647 /**
648  * \brief Queries video filter capabilities.
649  *
650  * This function returns the list of capabilities supported by the driver
651  * for a specific video filter. The \c filter_caps array is allocated by
652  * the user and \c num_filter_caps shall be initialized to the number
653  * of allocated elements in that array. Upon successful return, the
654  * actual number of filters will be overwritten into \c num_filter_caps.
655  * Otherwise, \c VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned and
656  * \c num_filter_caps is adjusted to the number of elements that would be
657  * returned if enough space was available.
658  *
659  * @param[in] dpy               the VA display
660  * @param[in] context           the video processing context
661  * @param[in] type              the video filter type
662  * @param[out] filter_caps      the output array of #VAProcFilterCap elements
663  * @param[in,out] num_filter_caps the number of elements allocated on input,
664  *      the number of elements actually filled in output
665  */
666 VAStatus
667 vaQueryVideoProcFilterCaps(
668     VADisplay           dpy,
669     VAContextID         context,
670     VAProcFilterType    type,
671     void               *filter_caps,
672     unsigned int       *num_filter_caps
673 );
674
675 /**
676  * \brief Queries video processing pipeline capabilities.
677  *
678  * This function returns the video processing pipeline capabilities. The
679  * \c filters array defines the video processing pipeline and is an array
680  * of buffers holding filter parameters.
681  *
682  * @param[in] dpy               the VA display
683  * @param[in] context           the video processing context
684  * @param[in] filters           the array of VA buffers defining the video
685  *      processing pipeline
686  * @param[in] num_filters       the number of elements in filters
687  * @param[out] pipeline_caps    the video processing pipeline capabilities
688  */
689 VAStatus
690 vaQueryVideoProcPipelineCaps(
691     VADisplay           dpy,
692     VAContextID         context,
693     VABufferID         *filters,
694     unsigned int        num_filters,
695     VAProcPipelineCaps *pipeline_caps
696 );
697
698 /**@}*/
699
700 #ifdef __cplusplus
701 }
702 #endif
703
704 #endif /* VA_VPP_H */