OSDN Git Service

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