OSDN Git Service

Remove restrictions on vaSetDriverName()
[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, &filters, &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_buf
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 Skin Tone Enhancement. */
249     VAProcFilterSkinToneEnhancement,
250     /** \brief Total Color Correction. */
251     VAProcFilterTotalColorCorrection,
252     /** \brief Human Vision System(HVS) Noise reduction filter. */
253     VAProcFilterHVSNoiseReduction,
254     /** \brief High Dynamic Range Tone Mapping. */
255     VAProcFilterHighDynamicRangeToneMapping,
256     /** \brief Number of video filters. */
257     VAProcFilterCount
258 } VAProcFilterType;
259
260 /** \brief Deinterlacing types. */
261 typedef enum _VAProcDeinterlacingType {
262     VAProcDeinterlacingNone = 0,
263     /** \brief Bob deinterlacing algorithm. */
264     VAProcDeinterlacingBob,
265     /** \brief Weave deinterlacing algorithm. */
266     VAProcDeinterlacingWeave,
267     /** \brief Motion adaptive deinterlacing algorithm. */
268     VAProcDeinterlacingMotionAdaptive,
269     /** \brief Motion compensated deinterlacing algorithm. */
270     VAProcDeinterlacingMotionCompensated,
271     /** \brief Number of deinterlacing algorithms. */
272     VAProcDeinterlacingCount
273 } VAProcDeinterlacingType;
274
275 /** \brief Color balance types. */
276 typedef enum _VAProcColorBalanceType {
277     VAProcColorBalanceNone = 0,
278     /** \brief Hue. */
279     VAProcColorBalanceHue,
280     /** \brief Saturation. */
281     VAProcColorBalanceSaturation,
282     /** \brief Brightness. */
283     VAProcColorBalanceBrightness,
284     /** \brief Contrast. */
285     VAProcColorBalanceContrast,
286     /** \brief Automatically adjusted saturation. */
287     VAProcColorBalanceAutoSaturation,
288     /** \brief Automatically adjusted brightness. */
289     VAProcColorBalanceAutoBrightness,
290     /** \brief Automatically adjusted contrast. */
291     VAProcColorBalanceAutoContrast,
292     /** \brief Number of color balance attributes. */
293     VAProcColorBalanceCount
294 } VAProcColorBalanceType;
295
296 /** \brief Color standard types.
297  *
298  * These define a set of color properties corresponding to particular
299  * video standards.
300  *
301  * Where matrix_coefficients is specified, it applies only to YUV data -
302  * RGB data always use the identity matrix (matrix_coefficients = 0).
303  */
304 typedef enum _VAProcColorStandardType {
305     VAProcColorStandardNone = 0,
306     /** \brief ITU-R BT.601.
307      *
308      * It is unspecified whether this will use 525-line or 625-line values;
309      * specify the colour primaries and matrix coefficients explicitly if
310      * it is known which one is required.
311      *
312      * Equivalent to:
313      *   colour_primaries = 5 or 6
314      *   transfer_characteristics = 6
315      *   matrix_coefficients = 5 or 6
316      */
317     VAProcColorStandardBT601,
318     /** \brief ITU-R BT.709.
319      *
320      * Equivalent to:
321      *   colour_primaries = 1
322      *   transfer_characteristics = 1
323      *   matrix_coefficients = 1
324      */
325     VAProcColorStandardBT709,
326     /** \brief ITU-R BT.470-2 System M.
327      *
328      * Equivalent to:
329      *   colour_primaries = 4
330      *   transfer_characteristics = 4
331      *   matrix_coefficients = 4
332      */
333     VAProcColorStandardBT470M,
334     /** \brief ITU-R BT.470-2 System B, G.
335      *
336      * Equivalent to:
337      *   colour_primaries = 5
338      *   transfer_characteristics = 5
339      *   matrix_coefficients = 5
340      */
341     VAProcColorStandardBT470BG,
342     /** \brief SMPTE-170M.
343      *
344      * Equivalent to:
345      *   colour_primaries = 6
346      *   transfer_characteristics = 6
347      *   matrix_coefficients = 6
348      */
349     VAProcColorStandardSMPTE170M,
350     /** \brief SMPTE-240M.
351      *
352      * Equivalent to:
353      *   colour_primaries = 7
354      *   transfer_characteristics = 7
355      *   matrix_coefficients = 7
356      */
357     VAProcColorStandardSMPTE240M,
358     /** \brief Generic film.
359      *
360      * Equivalent to:
361      *   colour_primaries = 8
362      *   transfer_characteristics = 1
363      *   matrix_coefficients = 1
364      */
365     VAProcColorStandardGenericFilm,
366     /** \brief sRGB.
367      *
368      * Equivalent to:
369      *   colour_primaries = 1
370      *   transfer_characteristics = 13
371      *   matrix_coefficients = 0
372      */
373     VAProcColorStandardSRGB,
374     /** \brief stRGB.
375      *
376      * ???
377      */
378     VAProcColorStandardSTRGB,
379     /** \brief xvYCC601.
380      *
381      * Equivalent to:
382      *   colour_primaries = 1
383      *   transfer_characteristics = 11
384      *   matrix_coefficients = 5
385      */
386     VAProcColorStandardXVYCC601,
387     /** \brief xvYCC709.
388      *
389      * Equivalent to:
390      *   colour_primaries = 1
391      *   transfer_characteristics = 11
392      *   matrix_coefficients = 1
393      */
394     VAProcColorStandardXVYCC709,
395     /** \brief ITU-R BT.2020.
396      *
397      * Equivalent to:
398      *   colour_primaries = 9
399      *   transfer_characteristics = 14
400      *   matrix_coefficients = 9
401      */
402     VAProcColorStandardBT2020,
403     /** \brief Explicitly specified color properties.
404      *
405      * Use corresponding color properties section.
406      * For example, HDR10 content:
407      *   colour_primaries = 9 (BT2020)
408      *   transfer_characteristics = 16 (SMPTE ST2084)
409      *   matrix_coefficients = 9
410      */
411     VAProcColorStandardExplicit,
412     /** \brief Number of color standards. */
413     VAProcColorStandardCount
414 } VAProcColorStandardType;
415
416 /** \brief Total color correction types. */
417 typedef enum _VAProcTotalColorCorrectionType {
418     VAProcTotalColorCorrectionNone = 0,
419     /** \brief Red Saturation. */
420     VAProcTotalColorCorrectionRed,
421     /** \brief Green Saturation. */
422     VAProcTotalColorCorrectionGreen,
423     /** \brief Blue Saturation. */
424     VAProcTotalColorCorrectionBlue,
425     /** \brief Cyan Saturation. */
426     VAProcTotalColorCorrectionCyan,
427     /** \brief Magenta Saturation. */
428     VAProcTotalColorCorrectionMagenta,
429     /** \brief Yellow Saturation. */
430     VAProcTotalColorCorrectionYellow,
431     /** \brief Number of color correction attributes. */
432     VAProcTotalColorCorrectionCount
433 } VAProcTotalColorCorrectionType;
434
435 /** \brief High Dynamic Range Metadata types. */
436 typedef enum _VAProcHighDynamicRangeMetadataType {
437     VAProcHighDynamicRangeMetadataNone = 0,
438     /** \brief Metadata type for HDR10. */
439     VAProcHighDynamicRangeMetadataHDR10
440 } VAProcHighDynamicRangeMetadataType;
441
442 /** \brief Video Processing Mode. */
443 typedef enum _VAProcMode {
444     /**
445      * \brief Default Mode.
446      * In this mode, pipeline is decided in driver to the appropriate mode.
447      * e.g. a mode that's a balance between power and performance.
448      */
449     VAProcDefaultMode = 0,
450     /**
451      * \brief Power Saving Mode.
452      * In this mode, pipeline is optimized for power saving.
453      */
454     VAProcPowerSavingMode,
455     /**
456      * \brief Performance Mode.
457      * In this mode, pipeline is optimized for performance.
458      */
459     VAProcPerformanceMode
460 } VAProcMode;
461
462 /** @name Video blending flags */
463 /**@{*/
464 /** \brief Global alpha blending. */
465 #define VA_BLEND_GLOBAL_ALPHA           0x0001
466 /** \brief Premultiplied alpha blending (RGBA surfaces only). */
467 #define VA_BLEND_PREMULTIPLIED_ALPHA    0x0002
468 /** \brief Luma color key (YUV surfaces only). */
469 #define VA_BLEND_LUMA_KEY               0x0010
470 /**@}*/
471
472 /** \brief Video blending state definition. */
473 typedef struct _VABlendState {
474     /** \brief Video blending flags. */
475     unsigned int        flags;
476     /**
477      * \brief Global alpha value.
478      *
479      * Valid if \flags has VA_BLEND_GLOBAL_ALPHA.
480      * Valid range is 0.0 to 1.0 inclusive.
481      */
482     float               global_alpha;
483     /**
484      * \brief Minimum luma value.
485      *
486      * Valid if \flags has VA_BLEND_LUMA_KEY.
487      * Valid range is 0.0 to 1.0 inclusive.
488      * \ref min_luma shall be set to a sensible value lower than \ref max_luma.
489      */
490     float               min_luma;
491     /**
492      * \brief Maximum luma value.
493      *
494      * Valid if \flags has VA_BLEND_LUMA_KEY.
495      * Valid range is 0.0 to 1.0 inclusive.
496      * \ref max_luma shall be set to a sensible value larger than \ref min_luma.
497      */
498     float               max_luma;
499 } VABlendState;
500
501 /** @name Video pipeline flags */
502 /**@{*/
503 /** \brief Specifies whether to apply subpictures when processing a surface. */
504 #define VA_PROC_PIPELINE_SUBPICTURES    0x00000001
505 /**
506  * \brief Specifies whether to apply power or performance
507  * optimizations to a pipeline.
508  *
509  * When processing several surfaces, it may be necessary to prioritize
510  * more certain pipelines than others. This flag is only a hint to the
511  * video processor so that it can omit certain filters to save power
512  * for example. Typically, this flag could be used with video surfaces
513  * decoded from a secondary bitstream.
514  */
515 #define VA_PROC_PIPELINE_FAST           0x00000002
516 /**@}*/
517
518 /** @name Video filter flags */
519 /**@{*/
520 /** \brief Specifies whether the filter shall be present in the pipeline. */
521 #define VA_PROC_FILTER_MANDATORY        0x00000001
522 /**@}*/
523
524 /** @name Pipeline end flags */
525 /**@{*/
526 /** \brief Specifies the pipeline is the last. */
527 #define VA_PIPELINE_FLAG_END            0x00000004
528 /**@}*/
529
530 /** @name Chroma Siting flag */
531 /**@{*/
532 /** vertical chroma sitting take bit 0-1, horizontal chroma sitting take bit 2-3
533  * vertical chromma siting | horizontal chroma sitting to be chroma sitting */
534 #define VA_CHROMA_SITING_UNKNOWN              0x00
535 /** \brief Chroma samples are co-sited vertically on the top with the luma samples. */
536 #define VA_CHROMA_SITING_VERTICAL_TOP         0x01
537 /** \brief Chroma samples are not co-sited vertically with the luma samples. */
538 #define VA_CHROMA_SITING_VERTICAL_CENTER      0x02
539 /** \brief Chroma samples are co-sited vertically on the bottom with the luma samples. */
540 #define VA_CHROMA_SITING_VERTICAL_BOTTOM      0x03
541 /** \brief Chroma samples are co-sited horizontally on the left with the luma samples. */
542 #define VA_CHROMA_SITING_HORIZONTAL_LEFT      0x04
543 /** \brief Chroma samples are not co-sited horizontally with the luma samples. */
544 #define VA_CHROMA_SITING_HORIZONTAL_CENTER    0x08
545 /**@}*/
546
547 /**
548  * This is to indicate that the color-space conversion uses full range or reduced range.
549  * VA_SOURCE_RANGE_FULL(Full range): Y/Cb/Cr is in [0, 255]. It is mainly used
550  *      for JPEG/JFIF formats. The combination with the BT601 flag means that
551  *      JPEG/JFIF color-space conversion matrix is used.
552  * VA_SOURCE_RANGE_REDUCED(Reduced range): Y is in [16, 235] and Cb/Cr is in [16, 240].
553  *      It is mainly used for the YUV->RGB color-space conversion in SDTV/HDTV/UHDTV.
554  */
555 #define VA_SOURCE_RANGE_UNKNOWN         0
556 #define VA_SOURCE_RANGE_REDUCED         1
557 #define VA_SOURCE_RANGE_FULL            2
558
559 /** @name Tone Mapping flags multiple HDR mode*/
560 /**@{*/
561 /** \brief Tone Mapping from HDR content to HDR display. */
562 #define VA_TONE_MAPPING_HDR_TO_HDR      0x0001
563 /** \brief Tone Mapping from HDR content to SDR display. */
564 #define VA_TONE_MAPPING_HDR_TO_SDR      0x0002
565 /** \brief Tone Mapping from HDR content to EDR display. */
566 #define VA_TONE_MAPPING_HDR_TO_EDR      0x0004
567 /** \brief Tone Mapping from SDR content to HDR display. */
568 #define VA_TONE_MAPPING_SDR_TO_HDR      0x0008
569 /**@}*/
570
571 /** \brief Video processing pipeline capabilities. */
572 typedef struct _VAProcPipelineCaps {
573     /** \brief Pipeline flags. See VAProcPipelineParameterBuffer::pipeline_flags. */
574     uint32_t        pipeline_flags;
575     /** \brief Extra filter flags. See VAProcPipelineParameterBuffer::filter_flags. */
576     uint32_t        filter_flags;
577     /** \brief Number of forward reference frames that are needed. */
578     uint32_t        num_forward_references;
579     /** \brief Number of backward reference frames that are needed. */
580     uint32_t        num_backward_references;
581     /** \brief List of color standards supported on input. */
582     VAProcColorStandardType *input_color_standards;
583     /** \brief Number of elements in \ref input_color_standards array. */
584     uint32_t        num_input_color_standards;
585     /** \brief List of color standards supported on output. */
586     VAProcColorStandardType *output_color_standards;
587     /** \brief Number of elements in \ref output_color_standards array. */
588     uint32_t        num_output_color_standards;
589
590     /**
591      * \brief Rotation flags.
592      *
593      * For each rotation angle supported by the underlying hardware,
594      * the corresponding bit is set in \ref rotation_flags. See
595      * "Rotation angles" for a description of rotation angles.
596      *
597      * A value of 0 means the underlying hardware does not support any
598      * rotation. Otherwise, a check for a specific rotation angle can be
599      * performed as follows:
600      *
601      * \code
602      * VAProcPipelineCaps pipeline_caps;
603      * ...
604      * vaQueryVideoProcPipelineCaps(va_dpy, vpp_ctx,
605      *     filter_bufs, num_filter_bufs,
606      *     &pipeline_caps
607      * );
608      * ...
609      * if (pipeline_caps.rotation_flags & (1 << VA_ROTATION_xxx)) {
610      *     // Clockwise rotation by xxx degrees is supported
611      *     ...
612      * }
613      * \endcode
614      */
615     uint32_t        rotation_flags;
616     /** \brief Blend flags. See "Video blending flags". */
617     uint32_t        blend_flags;
618     /**
619      * \brief Mirroring flags.
620      *
621      * For each mirroring direction supported by the underlying hardware,
622      * the corresponding bit is set in \ref mirror_flags. See
623      * "Mirroring directions" for a description of mirroring directions.
624      *
625      */
626     uint32_t        mirror_flags;
627     /** \brief Number of additional output surfaces supported by the pipeline  */
628     uint32_t        num_additional_outputs;
629
630     /** \brief Number of elements in \ref input_pixel_format array. */
631     uint32_t        num_input_pixel_formats;
632     /** \brief List of input pixel formats in fourcc. */
633     uint32_t        *input_pixel_format;
634     /** \brief Number of elements in \ref output_pixel_format array. */
635     uint32_t        num_output_pixel_formats;
636     /** \brief List of output pixel formats in fourcc. */
637     uint32_t        *output_pixel_format;
638
639     /** \brief Max supported input width in pixels. */
640     uint32_t        max_input_width;
641     /** \brief Max supported input height in pixels. */
642     uint32_t        max_input_height;
643     /** \brief Min supported input width in pixels. */
644     uint32_t        min_input_width;
645     /** \brief Min supported input height in pixels. */
646     uint32_t        min_input_height;
647
648     /** \brief Max supported output width in pixels. */
649     uint32_t        max_output_width;
650     /** \brief Max supported output height in pixels. */
651     uint32_t        max_output_height;
652     /** \brief Min supported output width in pixels. */
653     uint32_t        min_output_width;
654     /** \brief Min supported output height in pixels. */
655     uint32_t        min_output_height;
656     /** \brief Reserved bytes for future use, must be zero */
657     #if defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__) || defined(__LP64__)
658     uint32_t        va_reserved[VA_PADDING_HIGH - 2];
659     #else
660     uint32_t        va_reserved[VA_PADDING_HIGH];
661     #endif
662 } VAProcPipelineCaps;
663
664 /** \brief Specification of values supported by the filter. */
665 typedef struct _VAProcFilterValueRange {
666     /** \brief Minimum value supported, inclusive. */
667     float               min_value;
668     /** \brief Maximum value supported, inclusive. */
669     float               max_value;
670     /** \brief Default value. */
671     float               default_value;
672     /** \brief Step value that alters the filter behaviour in a sensible way. */
673     float               step;
674
675     /** \brief Reserved bytes for future use, must be zero */
676     uint32_t            va_reserved[VA_PADDING_LOW];
677 } VAProcFilterValueRange;
678
679 typedef struct _VAProcColorProperties {
680     /** Chroma sample location.\c VA_CHROMA_SITING_VERTICAL_XXX | VA_CHROMA_SITING_HORIZONTAL_XXX */
681     uint8_t chroma_sample_location;
682     /** Chroma sample location. \c VA_SOURCE_RANGE_XXX*/
683     uint8_t color_range;
684     /** Colour primaries.
685      *
686      * See ISO/IEC 23001-8 or ITU H.273, section 8.1 and table 2.
687      * Only used if the color standard in use is \c VAColorStandardExplicit.
688      */
689     uint8_t colour_primaries;
690     /** Transfer characteristics.
691      *
692      * See ISO/IEC 23001-8 or ITU H.273, section 8.2 and table 3.
693      * Only used if the color standard in use is \c VAColorStandardExplicit.
694      */
695     uint8_t transfer_characteristics;
696     /** Matrix coefficients.
697      *
698      * See ISO/IEC 23001-8 or ITU H.273, section 8.3 and table 4.
699      * Only used if the color standard in use is \c VAColorStandardExplicit.
700      */
701     uint8_t matrix_coefficients;
702     /** Reserved bytes for future use, must be zero. */
703     uint8_t reserved[3];
704 } VAProcColorProperties;
705
706 /** \berief Describes High Dynamic Range Meta Data for HDR10. */
707 typedef struct _VAHdrMetaDataHDR10
708 {
709     /**
710      * \brief X chromaticity coordinate of the mastering display.
711      *
712      * Index value c equal to 0 should correspond to the green primary.
713      * Index value c equal to 1 should correspond to the blue primary.
714      * Index value c equal to 2 should correspond to the red primary.
715      * The value for display_primaries_x shall be in the range of 0 to 50000 inclusive.
716      */
717     uint16_t    display_primaries_x[3];
718     /**
719      * \brief Y chromaticity coordinate of the mastering display.
720      *
721      * Index value c equal to 0 should correspond to the green primary.
722      * Index value c equal to 1 should correspond to the blue primary.
723      * Index value c equal to 2 should correspond to the red primary.
724      * The value for display_primaries_y shall be in the range of 0 to 50000 inclusive.
725      */
726     uint16_t    display_primaries_y[3];
727     /**
728      * \brief X chromaticity coordinate of the white point of the mastering display.
729      *
730      * The value for white_point_x shall be in the range of 0 to 50000 inclusive.
731      */
732     uint16_t    white_point_x;
733     /**
734      * \brief Y chromaticity coordinate of the white point of the mastering display.
735      *
736      * The value for white_point_y shall be in the range of 0 to 50000 inclusive.
737      */
738     uint16_t    white_point_y;
739     /**
740      * \brief The maximum display luminance of the mastering display.
741      *
742      * The value is in units of 0.0001 candelas per square metre.
743      */
744     uint32_t    max_display_mastering_luminance;
745     /**
746      * \brief The minumum display luminance of the mastering display.
747      *
748      * The value is in units of 0.0001 candelas per square metre.
749      */
750     uint32_t    min_display_mastering_luminance;
751     /**
752      * \brief The maximum content light level.
753      *
754      * The value is in units of 0.0001 candelas per square metre.
755      */
756     uint16_t    max_content_light_level;
757     /**
758      * \brief The maximum picture average light level.
759      *
760      * The value is in units of 0.0001 candelas per square metre.
761      */
762     uint16_t    max_pic_average_light_level;
763     /** Resevered */
764     uint16_t    reserved[VA_PADDING_HIGH];
765 } VAHdrMetaDataHDR10;
766
767 /** \brief Capabilities specification for the High Dynamic Range filter. */
768 typedef struct _VAProcFilterCapHighDynamicRange {
769     /** \brief high dynamic range type. */
770     VAProcHighDynamicRangeMetadataType     metadata_type;
771     /**
772      * \brief flag for high dynamic range tone mapping
773      *
774      * The flag is the combination of VA_TONE_MAPPING_XXX_TO_XXX.
775      * It could be VA_TONE_MAPPING_HDR_TO_HDR | VA_TONE_MAPPING_HDR_TO_SDR.
776      * SDR content to SDR display is always supported by default since it is legacy path.
777      */
778     uint16_t                               caps_flag;
779     /** \brief Reserved bytes for future use, must be zero */
780     uint16_t                               va_reserved[VA_PADDING_HIGH];
781 } VAProcFilterCapHighDynamicRange;
782
783 /** \brief High Dynamic Range Meta Data. */
784 typedef struct _VAHdrMetaData
785 {
786     /** \brief high dynamic range metadata type, HDR10 etc. */
787     VAProcHighDynamicRangeMetadataType       metadata_type;
788     /**
789      *  \brief Pointer to high dynamic range metadata.
790      *
791      *  The pointer could point to VAHdrMetaDataHDR10 or other HDR meta data.
792      */
793     void*                                    metadata;
794     /**
795      *  \brief Size of high dynamic range metadata.
796      */
797     uint32_t                                 metadata_size;
798     /** \brief Reserved bytes for future use, must be zero */
799     uint32_t                                 reserved[VA_PADDING_LOW];
800 } VAHdrMetaData;
801
802 /**
803  * \brief Video processing pipeline configuration.
804  *
805  * This buffer defines a video processing pipeline. The actual filters to
806  * be applied are provided in the \c filters field, they can be re-used
807  * in other processing pipelines.
808  *
809  * The target surface is specified by the \c render_target argument of
810  * \c vaBeginPicture(). The general usage model is described as follows:
811  * - \c vaBeginPicture(): specify the target surface that receives the
812  *   processed output;
813  * - \c vaRenderPicture(): specify a surface to be processed and composed
814  *   into the \c render_target. Use as many \c vaRenderPicture() calls as
815  *   necessary surfaces to compose ;
816  * - \c vaEndPicture(): tell the driver to start processing the surfaces
817  *   with the requested filters.
818  *
819  * If a filter (e.g. noise reduction) needs to be applied with different
820  * values for multiple surfaces, the application needs to create as many
821  * filter parameter buffers as necessary. i.e. the filter parameters shall
822  * not change between two calls to \c vaRenderPicture().
823  *
824  * For composition usage models, the first surface to process will generally
825  * use an opaque background color, i.e. \c output_background_color set with
826  * the most significant byte set to \c 0xff. For instance, \c 0xff000000 for
827  * a black background. Then, subsequent surfaces would use a transparent
828  * background color.
829  */
830 typedef struct _VAProcPipelineParameterBuffer {
831     /**
832      * \brief Source surface ID.
833      *
834      * ID of the source surface to process. If subpictures are associated
835      * with the video surfaces then they shall be rendered to the target
836      * surface, if the #VA_PROC_PIPELINE_SUBPICTURES pipeline flag is set.
837      */
838     VASurfaceID         surface;
839     /**
840      * \brief Region within the source surface to be processed.
841      *
842      * Pointer to a #VARectangle defining the region within the source
843      * surface to be processed. If NULL, \c surface_region implies the
844      * whole surface.
845      */
846     const VARectangle  *surface_region;
847     /**
848      * \brief Requested input color standard.
849      *
850      * Color properties are implicitly converted throughout the processing
851      * pipeline. The video processor chooses the best moment to apply
852      * this conversion. The set of supported color standards for input shall
853      * be queried with vaQueryVideoProcPipelineCaps().
854      *
855      * If this is set to VAProcColorStandardExplicit, the color properties
856      * are specified explicitly in surface_color_properties instead.
857      */
858     VAProcColorStandardType surface_color_standard;
859     /**
860      * \brief Region within the output surface.
861      *
862      * Pointer to a #VARectangle defining the region within the output
863      * surface that receives the processed pixels. If NULL, \c output_region
864      * implies the whole surface.
865      *
866      * Note that any pixels residing outside the specified region will
867      * be filled in with the \ref output_background_color.
868      */
869     const VARectangle  *output_region;
870     /**
871      * \brief Background color.
872      *
873      * Background color used to fill in pixels that reside outside of the
874      * specified \ref output_region. The color is specified in ARGB format:
875      * [31:24] alpha, [23:16] red, [15:8] green, [7:0] blue.
876      *
877      * Unless the alpha value is zero or the \ref output_region represents
878      * the whole target surface size, implementations shall not render the
879      * source surface to the target surface directly. Rather, in order to
880      * maintain the exact semantics of \ref output_background_color, the
881      * driver shall use a temporary surface and fill it in with the
882      * appropriate background color. Next, the driver will blend this
883      * temporary surface into the target surface.
884      */
885     uint32_t        output_background_color;
886     /**
887      * \brief Requested output color standard.
888      *
889      * If this is set to VAProcColorStandardExplicit, the color properties
890      * are specified explicitly in output_color_properties instead.
891      */
892     VAProcColorStandardType output_color_standard;
893     /**
894      * \brief Pipeline filters. See video pipeline flags.
895      *
896      * Flags to control the pipeline, like whether to apply subpictures
897      * or not, notify the driver that it can opt for power optimizations,
898      * should this be needed.
899      */
900     uint32_t        pipeline_flags;
901     /**
902      * \brief Extra filter flags. See vaPutSurface() flags.
903      *
904      * Filter flags are used as a fast path, wherever possible, to use
905      * vaPutSurface() flags instead of explicit filter parameter buffers.
906      *
907      * Allowed filter flags API-wise. Use vaQueryVideoProcPipelineCaps()
908      * to check for implementation details:
909      * - Bob-deinterlacing: \c VA_FRAME_PICTURE, \c VA_TOP_FIELD,
910      *   \c VA_BOTTOM_FIELD. Note that any deinterlacing filter
911      *   (#VAProcFilterDeinterlacing) will override those flags.
912      * - Color space conversion: \c VA_SRC_BT601, \c VA_SRC_BT709,
913      *   \c VA_SRC_SMPTE_240.
914      * - Scaling: \c VA_FILTER_SCALING_DEFAULT, \c VA_FILTER_SCALING_FAST,
915      *   \c VA_FILTER_SCALING_HQ, \c VA_FILTER_SCALING_NL_ANAMORPHIC.
916      */
917     uint32_t        filter_flags;
918     /**
919      * \brief Array of filters to apply to the surface.
920      *
921      * The list of filters shall be ordered in the same way the driver expects
922      * them. i.e. as was returned from vaQueryVideoProcFilters().
923      * Otherwise, a #VA_STATUS_ERROR_INVALID_FILTER_CHAIN is returned
924      * from vaRenderPicture() with this buffer.
925      *
926      * #VA_STATUS_ERROR_UNSUPPORTED_FILTER is returned if the list
927      * contains an unsupported filter.
928      *
929      */
930     VABufferID         *filters;
931     /** \brief Actual number of filters. */
932     uint32_t           num_filters;
933     /** \brief Array of forward reference frames. */
934     VASurfaceID        *forward_references;
935     /** \brief Number of forward reference frames that were supplied. */
936     uint32_t           num_forward_references;
937     /** \brief Array of backward reference frames. */
938     VASurfaceID        *backward_references;
939     /** \brief Number of backward reference frames that were supplied. */
940     uint32_t           num_backward_references;
941     /**
942      * \brief Rotation state. See rotation angles.
943      *
944      * The rotation angle is clockwise. There is no specific rotation
945      * center for this operation. Rather, The source \ref surface is
946      * first rotated by the specified angle and then scaled to fit the
947      * \ref output_region.
948      *
949      * This means that the top-left hand corner (0,0) of the output
950      * (rotated) surface is expressed as follows:
951      * - \ref VA_ROTATION_NONE: (0,0) is the top left corner of the
952      *   source surface -- no rotation is performed ;
953      * - \ref VA_ROTATION_90: (0,0) is the bottom-left corner of the
954      *   source surface ;
955      * - \ref VA_ROTATION_180: (0,0) is the bottom-right corner of the
956      *   source surface -- the surface is flipped around the X axis ;
957      * - \ref VA_ROTATION_270: (0,0) is the top-right corner of the
958      *   source surface.
959      *
960      * Check VAProcPipelineCaps::rotation_flags first prior to
961      * defining a specific rotation angle. Otherwise, the hardware can
962      * perfectly ignore this variable if it does not support any
963      * rotation.
964      */
965     uint32_t        rotation_state;
966     /**
967      * \brief blending state. See "Video blending state definition".
968      *
969      * If \ref blend_state is NULL, then default operation mode depends
970      * on the source \ref surface format:
971      * - RGB: per-pixel alpha blending ;
972      * - YUV: no blending, i.e override the underlying pixels.
973      *
974      * Otherwise, \ref blend_state is a pointer to a #VABlendState
975      * structure that shall be live until vaEndPicture().
976      *
977      * Implementation note: the driver is responsible for checking the
978      * blend state flags against the actual source \ref surface format.
979      * e.g. premultiplied alpha blending is only applicable to RGB
980      * surfaces, and luma keying is only applicable to YUV surfaces.
981      * If a mismatch occurs, then #VA_STATUS_ERROR_INVALID_BLEND_STATE
982      * is returned.
983      */
984     const VABlendState *blend_state;
985     /**
986      * \bried mirroring state. See "Mirroring directions".
987      *
988      * Mirroring of an image can be performed either along the
989      * horizontal or vertical axis. It is assumed that the rotation
990      * operation is always performed before the mirroring operation.
991      */
992     uint32_t      mirror_state;
993     /** \brief Array of additional output surfaces. */
994     VASurfaceID        *additional_outputs;
995     /** \brief Number of additional output surfaces. */
996     uint32_t        num_additional_outputs;
997     /**
998      * \brief Flag to indicate the input surface flag
999      *
1000      * bit0: 0 non-protected 1: protected
1001      * bit 1~31 for future
1002      */
1003     uint32_t        input_surface_flag;
1004     /**
1005      * \brief Flag to indicate the output surface flag
1006      *
1007      * bit0: 0 non-protected  1: protected
1008      * bit 1~31 for future
1009      */
1010     uint32_t        output_surface_flag;
1011     /**
1012      * \brief Input Color Properties. See "VAProcColorProperties".
1013      */
1014     VAProcColorProperties  input_color_properties;
1015     /**
1016      * \brief Output Color Properties. See "VAProcColorProperties".
1017      */
1018     VAProcColorProperties  output_color_properties;
1019     /**
1020      * \brief Processing mode. See "VAProcMode".
1021      */
1022     VAProcMode             processing_mode;
1023     /**
1024      * \brief Output High Dynamic Metadata.
1025      *
1026      * If output_metadata is NULL, then output default to SDR.
1027      */
1028     VAHdrMetaData          *output_hdr_metadata;
1029
1030     /** \brief Reserved bytes for future use, must be zero */
1031     #if defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__)|| defined(__LP64__)
1032     uint32_t                va_reserved[VA_PADDING_LARGE - 16];
1033     #else
1034     uint32_t                va_reserved[VA_PADDING_LARGE - 13];
1035     #endif
1036 } VAProcPipelineParameterBuffer;
1037
1038 /**
1039  * \brief Filter parameter buffer base.
1040  *
1041  * This is a helper structure used by driver implementations only.
1042  * Users are not supposed to allocate filter parameter buffers of this
1043  * type.
1044  */
1045 typedef struct _VAProcFilterParameterBufferBase {
1046     /** \brief Filter type. */
1047     VAProcFilterType    type;
1048 } VAProcFilterParameterBufferBase;
1049
1050 /**
1051  * \brief Default filter parametrization.
1052  *
1053  * Unless there is a filter-specific parameter buffer,
1054  * #VAProcFilterParameterBuffer is the default type to use.
1055  */
1056 typedef struct _VAProcFilterParameterBuffer {
1057     /** \brief Filter type. */
1058     VAProcFilterType    type;
1059     /** \brief Value. */
1060     float               value;
1061
1062     /** \brief Reserved bytes for future use, must be zero */
1063     uint32_t                va_reserved[VA_PADDING_LOW];
1064 } VAProcFilterParameterBuffer;
1065
1066 /** @name De-interlacing flags */
1067 /**@{*/
1068 /** 
1069  * \brief Bottom field first in the input frame. 
1070  * if this is not set then assumes top field first.
1071  */
1072 #define VA_DEINTERLACING_BOTTOM_FIELD_FIRST     0x0001
1073 /** 
1074  * \brief Bottom field used in deinterlacing. 
1075  * if this is not set then assumes top field is used.
1076  */
1077 #define VA_DEINTERLACING_BOTTOM_FIELD           0x0002
1078 /** 
1079  * \brief A single field is stored in the input frame. 
1080  * if this is not set then assumes the frame contains two interleaved fields.
1081  */
1082 #define VA_DEINTERLACING_ONE_FIELD              0x0004
1083 /**
1084  * \brief Film Mode Detection is enabled. If enabled, driver performs inverse
1085  * of various pulldowns, such as 3:2 pulldown.
1086  * if this is not set then assumes FMD is disabled.
1087  */
1088 #define VA_DEINTERLACING_FMD_ENABLE             0x0008
1089
1090 //Scene change parameter for ADI on Linux, if enabled, driver use spatial DI(Bob), instead of ADI. if not, use old behavior for ADI
1091 //Input stream is TFF(set flags = 0), SRC0,1,2,3 are interlaced frame (top +bottom fields), DSTs are progressive frames
1092 //30i->30p
1093 //SRC0 -> BOBDI,  no reference, set flag = 0, output DST0
1094 //SRC1 -> ADI, reference frame=SRC0, set flags = 0, call VP, output DST1
1095 //SRC2 -> ADI, reference frame=SRC1, set flags = 0x0010(decimal 16), call VP, output DST2(T4)
1096 //SRC3 -> ADI, reference frame=SRC2, set flags = 0, call VP, output DST3
1097 //30i->60p
1098 //SRC0 -> BOBDI, no reference, set flag = 0, output DST0
1099 //SRC0 -> BOBDI, no reference, set flag =0x0002, output DST1
1100
1101 //SRC1 -> ADI, reference frame =SRC0, set flags = 0, call VP, output DST2
1102 //SRC1 -> ADI, reference frame =SRC0, set flags = 0x0012(decimal18), call VP, output DST3(B3)
1103
1104 //SRC2 -> ADI, reference frame =SRC1, set flags =  0x0010(decimal 16), call VP, output DST4(T4)
1105 //SRC2 -> ADI, reference frame =SRC1, set flags =  0x0002, call VP, output DST5
1106
1107 //SRC3 -> ADI, reference frame =SRC2, set flags =  0, call VP, output DST6
1108 //SRC3 -> ADI, reference frame =SRC1, set flags = 0x0002, call VP, output DST7
1109
1110 #define VA_DEINTERLACING_SCD_ENABLE     0x0010
1111
1112 /**@}*/
1113
1114 /** \brief Deinterlacing filter parametrization. */
1115 typedef struct _VAProcFilterParameterBufferDeinterlacing {
1116     /** \brief Filter type. Shall be set to #VAProcFilterDeinterlacing. */
1117     VAProcFilterType            type;
1118     /** \brief Deinterlacing algorithm. */
1119     VAProcDeinterlacingType     algorithm;
1120     /** \brief Deinterlacing flags. */
1121     uint32_t                    flags;
1122
1123     /** \brief Reserved bytes for future use, must be zero */
1124     uint32_t                va_reserved[VA_PADDING_LOW];
1125 } VAProcFilterParameterBufferDeinterlacing;
1126
1127 /**
1128  * \brief Color balance filter parametrization.
1129  *
1130  * This buffer defines color balance attributes. A VA buffer can hold
1131  * several color balance attributes by creating a VA buffer of desired
1132  * number of elements. This can be achieved by the following pseudo-code:
1133  *
1134  * \code
1135  * enum { kHue, kSaturation, kBrightness, kContrast };
1136  *
1137  * // Initial color balance parameters
1138  * static const VAProcFilterParameterBufferColorBalance colorBalanceParams[4] =
1139  * {
1140  *     [kHue] =
1141  *         { VAProcFilterColorBalance, VAProcColorBalanceHue, 0.5 },
1142  *     [kSaturation] =
1143  *         { VAProcFilterColorBalance, VAProcColorBalanceSaturation, 0.5 },
1144  *     [kBrightness] =
1145  *         { VAProcFilterColorBalance, VAProcColorBalanceBrightness, 0.5 },
1146  *     [kSaturation] =
1147  *         { VAProcFilterColorBalance, VAProcColorBalanceSaturation, 0.5 }
1148  * };
1149  *
1150  * // Create buffer
1151  * VABufferID colorBalanceBuffer;
1152  * vaCreateBuffer(va_dpy, vpp_ctx,
1153  *     VAProcFilterParameterBufferType, sizeof(*pColorBalanceParam), 4,
1154  *     colorBalanceParams,
1155  *     &colorBalanceBuffer
1156  * );
1157  *
1158  * VAProcFilterParameterBufferColorBalance *pColorBalanceParam;
1159  * vaMapBuffer(va_dpy, colorBalanceBuffer, &pColorBalanceParam);
1160  * {
1161  *     // Change brightness only
1162  *     pColorBalanceBuffer[kBrightness].value = 0.75;
1163  * }
1164  * vaUnmapBuffer(va_dpy, colorBalanceBuffer);
1165  * \endcode
1166  */
1167 typedef struct _VAProcFilterParameterBufferColorBalance {
1168     /** \brief Filter type. Shall be set to #VAProcFilterColorBalance. */
1169     VAProcFilterType            type;
1170     /** \brief Color balance attribute. */
1171     VAProcColorBalanceType      attrib;
1172     /**
1173      * \brief Color balance value.
1174      *
1175      * Special case for automatically adjusted attributes. e.g. 
1176      * #VAProcColorBalanceAutoSaturation,
1177      * #VAProcColorBalanceAutoBrightness,
1178      * #VAProcColorBalanceAutoContrast.
1179      * - If \ref value is \c 1.0 +/- \c FLT_EPSILON, the attribute is
1180      *   automatically adjusted and overrides any other attribute of
1181      *   the same type that would have been set explicitly;
1182      * - If \ref value is \c 0.0 +/- \c FLT_EPSILON, the attribute is
1183      *   disabled and other attribute of the same type is used instead.
1184      */
1185     float                       value;
1186
1187     /** \brief Reserved bytes for future use, must be zero */
1188     uint32_t                va_reserved[VA_PADDING_LOW];
1189 } VAProcFilterParameterBufferColorBalance;
1190
1191 /** \brief Total color correction filter parametrization. */
1192 typedef struct _VAProcFilterParameterBufferTotalColorCorrection {
1193     /** \brief Filter type. Shall be set to #VAProcFilterTotalColorCorrection. */
1194     VAProcFilterType                  type;
1195     /** \brief Color to correct. */
1196     VAProcTotalColorCorrectionType    attrib;
1197     /** \brief Color correction value. */
1198     float                             value;
1199 } VAProcFilterParameterBufferTotalColorCorrection;
1200
1201 /** \brief Human Vision System(HVS) Noise reduction filter parametrization. */
1202 typedef struct _VAProcFilterParameterBufferHVSNoiseReduction {
1203     /** \brief Filter type. Shall be set to #VAProcFilterHVSNoiseReduction. */
1204     VAProcFilterType    type;
1205     /** \brief QP for encoding, used for HVS Denoise */
1206     uint16_t            qp;
1207     /**
1208      *  \brief QP to Noise Reduction Strength Mode, used for Human Vision System Based Noise Reduction.
1209      *  Controls Noise Reduction strength of conservative and aggressive mode.
1210      *  It is an integer from [0-16].
1211      *  Value 0 means completely turn off Noise Reduction;
1212      *  Value 16 means the most aggressive mode of Noise Reduction;
1213      *  Value 10 is the default value.
1214      */
1215     uint16_t            strength;
1216     /** \brief Reserved bytes for future use, must be zero */
1217     uint16_t            va_reserved[VA_PADDING_HIGH];
1218 } VAProcFilterParameterBufferHVSNoiseReduction;
1219
1220 /**
1221  * \brief Default filter cap specification (single range value).
1222  *
1223  * Unless there is a filter-specific cap structure, #VAProcFilterCap is the
1224  * default type to use for output caps from vaQueryVideoProcFilterCaps().
1225  */
1226 typedef struct _VAProcFilterCap {
1227     /** \brief Range of supported values for the filter. */
1228     VAProcFilterValueRange      range;
1229
1230     /** \brief Reserved bytes for future use, must be zero */
1231     uint32_t                va_reserved[VA_PADDING_LOW];
1232 } VAProcFilterCap;
1233
1234 /** \brief Capabilities specification for the deinterlacing filter. */
1235 typedef struct _VAProcFilterCapDeinterlacing {
1236     /** \brief Deinterlacing algorithm. */
1237     VAProcDeinterlacingType     type;
1238
1239     /** \brief Reserved bytes for future use, must be zero */
1240     uint32_t                va_reserved[VA_PADDING_LOW];
1241 } VAProcFilterCapDeinterlacing;
1242
1243 /** \brief Capabilities specification for the color balance filter. */
1244 typedef struct _VAProcFilterCapColorBalance {
1245     /** \brief Color balance operation. */
1246     VAProcColorBalanceType      type;
1247     /** \brief Range of supported values for the specified operation. */
1248     VAProcFilterValueRange      range;
1249
1250     /** \brief Reserved bytes for future use, must be zero */
1251     uint32_t                va_reserved[VA_PADDING_LOW];
1252 } VAProcFilterCapColorBalance;
1253
1254 /** \brief Capabilities specification for the Total Color Correction filter. */
1255 typedef struct _VAProcFilterCapTotalColorCorrection {
1256     /** \brief Color to correct. */
1257     VAProcTotalColorCorrectionType    type;
1258     /** \brief Range of supported values for the specified color. */
1259     VAProcFilterValueRange            range;
1260 } VAProcFilterCapTotalColorCorrection;
1261
1262 /**
1263  * \brief Queries video processing filters.
1264  *
1265  * This function returns the list of video processing filters supported
1266  * by the driver. The \c filters array is allocated by the user and
1267  * \c num_filters shall be initialized to the number of allocated
1268  * elements in that array. Upon successful return, the actual number
1269  * of filters will be overwritten into \c num_filters. Otherwise,
1270  * \c VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned and \c num_filters
1271  * is adjusted to the number of elements that would be returned if enough
1272  * space was available.
1273  *
1274  * The list of video processing filters supported by the driver shall
1275  * be ordered in the way they can be iteratively applied. This is needed
1276  * for both correctness, i.e. some filters would not mean anything if
1277  * applied at the beginning of the pipeline; but also for performance
1278  * since some filters can be applied in a single pass (e.g. noise
1279  * reduction + deinterlacing).
1280  *
1281  * @param[in] dpy               the VA display
1282  * @param[in] context           the video processing context
1283  * @param[out] filters          the output array of #VAProcFilterType elements
1284  * @param[in,out] num_filters the number of elements allocated on input,
1285  *      the number of elements actually filled in on output
1286  */
1287 VAStatus
1288 vaQueryVideoProcFilters(
1289     VADisplay           dpy,
1290     VAContextID         context,
1291     VAProcFilterType   *filters,
1292     unsigned int       *num_filters
1293 );
1294
1295 /**
1296  * \brief Queries video filter capabilities.
1297  *
1298  * This function returns the list of capabilities supported by the driver
1299  * for a specific video filter. The \c filter_caps array is allocated by
1300  * the user and \c num_filter_caps shall be initialized to the number
1301  * of allocated elements in that array. Upon successful return, the
1302  * actual number of filters will be overwritten into \c num_filter_caps.
1303  * Otherwise, \c VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned and
1304  * \c num_filter_caps is adjusted to the number of elements that would be
1305  * returned if enough space was available.
1306  *
1307  * @param[in] dpy               the VA display
1308  * @param[in] context           the video processing context
1309  * @param[in] type              the video filter type
1310  * @param[out] filter_caps      the output array of #VAProcFilterCap elements
1311  * @param[in,out] num_filter_caps the number of elements allocated on input,
1312  *      the number of elements actually filled in output
1313  */
1314 VAStatus
1315 vaQueryVideoProcFilterCaps(
1316     VADisplay           dpy,
1317     VAContextID         context,
1318     VAProcFilterType    type,
1319     void               *filter_caps,
1320     unsigned int       *num_filter_caps
1321 );
1322
1323 /**
1324  * \brief Queries video processing pipeline capabilities.
1325  *
1326  * This function returns the video processing pipeline capabilities. The
1327  * \c filters array defines the video processing pipeline and is an array
1328  * of buffers holding filter parameters.
1329  *
1330  * Note: the #VAProcPipelineCaps structure contains user-provided arrays.
1331  * If non-NULL, the corresponding \c num_* fields shall be filled in on
1332  * input with the number of elements allocated. Upon successful return,
1333  * the actual number of elements will be overwritten into the \c num_*
1334  * fields. Otherwise, \c VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned
1335  * and \c num_* fields are adjusted to the number of elements that would
1336  * be returned if enough space was available.
1337  *
1338  * @param[in] dpy               the VA display
1339  * @param[in] context           the video processing context
1340  * @param[in] filters           the array of VA buffers defining the video
1341  *      processing pipeline
1342  * @param[in] num_filters       the number of elements in filters
1343  * @param[in,out] pipeline_caps the video processing pipeline capabilities
1344  */
1345 VAStatus
1346 vaQueryVideoProcPipelineCaps(
1347     VADisplay           dpy,
1348     VAContextID         context,
1349     VABufferID         *filters,
1350     unsigned int        num_filters,
1351     VAProcPipelineCaps *pipeline_caps
1352 );
1353
1354 /**@}*/
1355
1356 #ifdef __cplusplus
1357 }
1358 #endif
1359
1360 #endif /* VA_VPP_H */