2 * Copyright (c) 2007-2011 Intel Corporation. All Rights Reserved.
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:
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial portions
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.
27 * \brief The video processing API
29 * This file contains the \ref api_vpp "Video processing API".
40 * \defgroup api_vpp Video processing API
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.
49 * \section api_vpp_caps Query for supported filters
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.
57 * VAEntrypoint *entrypoints;
58 * int i, num_entrypoints, supportsVideoProcessing = 0;
60 * num_entrypoints = vaMaxNumEntrypoints();
61 * entrypoints = malloc(num_entrypoints * sizeof(entrypoints[0]);
62 * vaQueryConfigEntrypoints(va_dpy, VAProfileNone,
63 * entrypoints, &num_entrypoints);
65 * for (i = 0; !supportsVideoProcessing && i < num_entrypoints; i++) {
66 * if (entrypoints[i] == VAEntrypointVideoProc)
67 * supportsVideoProcessing = 1;
71 * Then, the vaQueryVideoProcFilters() function is used to query the
72 * list of video processing filters.
75 * VAProcFilterType filters[VAProcFilterCount];
76 * unsigned int num_filters = VAProcFilterCount;
78 * // num_filters shall be initialized to the length of the array
79 * vaQueryVideoProcFilters(va_dpy, vpp_ctx, &filters, &num_filters);
82 * Finally, individual filter capabilities can be checked with
83 * vaQueryVideoProcFilterCaps().
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
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
101 * \section api_vpp_setup Set up a video processing pipeline
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.
111 * The general control flow is demonstrated by the following pseudo-code:
114 * VABufferID denoise_filter, deint_filter;
115 * VABufferID filter_bufs[VAProcFilterCount];
116 * unsigned int num_filter_bufs;
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
128 * filter_bufs[num_filter_bufs++] = denoise_filter;
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)
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
145 * filter_bufs[num_filter_bufs++] = deint_filter;
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
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];
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,
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));
183 * \section api_vpp_submit Send video processing parameters through VA buffers
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.
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;
197 * vaCreateBuffer(va_dpy, vpp_ctx,
198 * VAProcPipelineParameterBuffer, sizeof(*pipeline_param), 1,
199 * NULL, &pipeline_buf
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;
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);
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;
230 * vaRenderPicture(va_dpy, vpp_ctx, &pipeline_buf, 1);
232 * vaEndPicture(va_dpy, vpp_ctx);
237 /** \brief Video filter types. */
238 typedef enum _VAProcFilterType {
239 VAProcFilterNone = 0,
240 /** \brief Noise reduction filter. */
241 VAProcFilterNoiseReduction,
242 /** \brief Deblocking filter. */
243 VAProcFilterDeblocking,
244 /** \brief Deinterlacing filter. */
245 VAProcFilterDeinterlacing,
246 /** \brief Sharpening filter. */
247 VAProcFilterSharpening,
248 /** \brief Color balance parameters. */
249 VAProcFilterColorBalance,
250 /** \brief Color standard conversion. */
251 VAProcFilterColorStandard,
252 /** \brief Frame rate conversion. */
253 VAProcFilterFrameRateConversion,
254 /** \brief Number of video filters. */
258 /** \brief Deinterlacing types. */
259 typedef enum _VAProcDeinterlacingType {
260 VAProcDeinterlacingNone = 0,
261 /** \brief Bob deinterlacing algorithm. */
262 VAProcDeinterlacingBob,
263 /** \brief Weave deinterlacing algorithm. */
264 VAProcDeinterlacingWeave,
265 /** \brief Motion adaptive deinterlacing algorithm. */
266 VAProcDeinterlacingMotionAdaptive,
267 /** \brief Motion compensated deinterlacing algorithm. */
268 VAProcDeinterlacingMotionCompensated,
269 /** \brief Number of deinterlacing algorithms. */
270 VAProcDeinterlacingCount
271 } VAProcDeinterlacingType;
273 /** \brief Color balance types. */
274 typedef enum _VAProcColorBalanceType {
275 VAProcColorBalanceNone = 0,
277 VAProcColorBalanceHue,
278 /** \brief Saturation. */
279 VAProcColorBalanceSaturation,
280 /** \brief Brightness. */
281 VAProcColorBalanceBrightness,
282 /** \brief Contrast. */
283 VAProcColorBalanceContrast,
284 /** \brief Automatically adjusted saturation. */
285 VAProcColorBalanceAutoSaturation,
286 /** \brief Automatically adjusted brightness. */
287 VAProcColorBalanceAutoBrightness,
288 /** \brief Automatically adjusted contrast. */
289 VAProcColorBalanceAutoContrast,
290 /** \brief Number of color balance attributes. */
291 VAProcColorBalanceCount
292 } VAProcColorBalanceType;
294 /** \brief Color standard types. */
295 typedef enum _VAProcColorStandardType {
296 VAProcColorStandardNone = 0,
297 /** \brief ITU-R BT.601. */
298 VAProcColorStandardBT601,
299 /** \brief ITU-R BT.709. */
300 VAProcColorStandardBT709,
301 /** \brief ITU-R BT.470-2 System M. */
302 VAProcColorStandardBT470M,
303 /** \brief ITU-R BT.470-2 System B, G. */
304 VAProcColorStandardBT470BG,
305 /** \brief SMPTE-170M. */
306 VAProcColorStandardSMPTE170M,
307 /** \brief SMPTE-240M. */
308 VAProcColorStandardSMPTE240M,
309 /** \brief Generic film. */
310 VAProcColorStandardGenericFilm,
311 /** \brief Number of color standards. */
312 VAProcColorStandardCount
313 } VAProcColorStandardType;
315 /** @name Video pipeline flags */
317 /** \brief Specifies whether to apply subpictures when processing a surface. */
318 #define VA_PROC_PIPELINE_SUBPICTURES 0x00000001
320 * \brief Specifies whether to apply power or performance
321 * optimizations to a pipeline.
323 * When processing several surfaces, it may be necessary to prioritize
324 * more certain pipelines than others. This flag is only a hint to the
325 * video processor so that it can omit certain filters to save power
326 * for example. Typically, this flag could be used with video surfaces
327 * decoded from a secondary bitstream.
329 #define VA_PROC_PIPELINE_FAST 0x00000002
332 /** @name Video filter flags */
334 /** \brief Specifies whether the filter shall be present in the pipeline. */
335 #define VA_PROC_FILTER_MANDATORY 0x00000001
338 /** @name Pipeline end flags */
340 /** \brief Specifies the pipeline is the last. */
341 #define VA_PIPELINE_FLAG_END 0x00000004
344 /** \brief Video processing pipeline capabilities. */
345 typedef struct _VAProcPipelineCaps {
346 /** \brief Pipeline flags. See VAProcPipelineParameterBuffer::pipeline_flags. */
347 unsigned int pipeline_flags;
348 /** \brief Extra filter flags. See VAProcPipelineParameterBuffer::filter_flags. */
349 unsigned int filter_flags;
351 * \brief Rotation flags.
353 * For each rotation angle supported by the underlying hardware,
354 * the corresponding bit is set in \ref rotation_flags. See
355 * "Rotation angles" for a description of rotation angles.
357 * A value of 0 means the underlying hardware does not support any
358 * rotation. Otherwise, a check for a specific rotation angle can be
359 * performed as follows:
362 * VAProcPipelineCaps pipeline_caps;
364 * vaQueryVideoProcPipelineCaps(va_dpy, vpp_ctx,
365 * filter_bufs, num_filter_bufs,
369 * if (pipeline_caps.rotation_flags & (1 << VA_ROTATION_xxx)) {
370 * // Clockwise rotation by xxx degrees is supported
375 unsigned int rotation_flags;
376 /** \brief Number of forward reference frames that are needed. */
377 unsigned int num_forward_references;
378 /** \brief Number of backward reference frames that are needed. */
379 unsigned int num_backward_references;
380 /** \brief List of color standards supported on input. */
381 VAProcColorStandardType *input_color_standards;
382 /** \brief Number of elements in \ref input_color_standards array. */
383 unsigned int num_input_color_standards;
384 /** \brief List of color standards supported on output. */
385 VAProcColorStandardType *output_color_standards;
386 /** \brief Number of elements in \ref output_color_standards array. */
387 unsigned int num_output_color_standards;
388 } VAProcPipelineCaps;
390 /** \brief Specification of values supported by the filter. */
391 typedef struct _VAProcFilterValueRange {
392 /** \brief Minimum value supported, inclusive. */
394 /** \brief Maximum value supported, inclusive. */
396 /** \brief Default value. */
398 /** \brief Step value that alters the filter behaviour in a sensible way. */
400 } VAProcFilterValueRange;
403 * \brief Video processing pipeline configuration.
405 * This buffer defines a video processing pipeline. As for any buffer
406 * passed to \c vaRenderPicture(), this is a one-time usage model.
407 * However, the actual filters to be applied are provided in the
408 * \c filters field, so they can be re-used in other processing
411 * The target surface is specified by the \c render_target argument of
412 * \c vaBeginPicture(). The general usage model is described as follows:
413 * - \c vaBeginPicture(): specify the target surface that receives the
415 * - \c vaRenderPicture(): specify a surface to be processed and composed
416 * into the \c render_target. Use as many \c vaRenderPicture() calls as
417 * necessary surfaces to compose ;
418 * - \c vaEndPicture(): tell the driver to start processing the surfaces
419 * with the requested filters.
421 * If a filter (e.g. noise reduction) needs to be applied with different
422 * values for multiple surfaces, the application needs to create as many
423 * filter parameter buffers as necessary. i.e. the filter parameters shall
424 * not change between two calls to \c vaRenderPicture().
426 * For composition usage models, the first surface to process will generally
427 * use an opaque background color, i.e. \c output_background_color set with
428 * the most significant byte set to \c 0xff. For instance, \c 0xff000000 for
429 * a black background. Then, subsequent surfaces would use a transparent
432 typedef struct _VAProcPipelineParameterBuffer {
434 * \brief Source surface ID.
436 * ID of the source surface to process. If subpictures are associated
437 * with the video surfaces then they shall be rendered to the target
438 * surface, if the #VA_PROC_PIPELINE_SUBPICTURES pipeline flag is set.
442 * \brief Region within the source surface to be processed.
444 * Pointer to a #VARectangle defining the region within the source
445 * surface to be processed. If NULL, \c surface_region implies the
448 const VARectangle *surface_region;
450 * \brief Requested input color primaries.
452 * Color primaries are implicitly converted throughout the processing
453 * pipeline. The video processor chooses the best moment to apply
454 * this conversion. The set of supported color primaries primaries
455 * for input shall be queried with vaQueryVideoProcPipelineCaps().
457 VAProcColorStandardType surface_color_standard;
459 * \brief Region within the output surface.
461 * Pointer to a #VARectangle defining the region within the output
462 * surface that receives the processed pixels. If NULL, \c output_region
463 * implies the whole surface.
465 * Note that any pixels residing outside the specified region will
466 * be filled in with the \ref output_background_color.
468 const VARectangle *output_region;
470 * \brief Background color.
472 * Background color used to fill in pixels that reside outside of the
473 * specified \ref output_region. The color is specified in ARGB format:
474 * [31:24] alpha, [23:16] red, [15:8] green, [7:0] blue.
476 * Unless the alpha value is zero or the \ref output_region represents
477 * the whole target surface size, implementations shall not render the
478 * source surface to the target surface directly. Rather, in order to
479 * maintain the exact semantics of \ref output_background_color, the
480 * driver shall use a temporary surface and fill it in with the
481 * appropriate background color. Next, the driver will blend this
482 * temporary surface into the target surface.
484 unsigned int output_background_color;
486 * \brief Requested output color primaries.
488 VAProcColorStandardType output_color_standard;
490 * \brief Rotation state. See rotation angles.
492 * The rotation angle is clockwise. There is no specific rotation
493 * center for this operation. Rather, The source \ref surface is
494 * first rotated by the specified angle and then scaled to fit the
495 * \ref output_region.
497 * This means that the top-left hand corner (0,0) of the output
498 * (rotated) surface is expressed as follows:
499 * - \ref VA_ROTATION_NONE: (0,0) is the top left corner of the
500 * source surface -- no rotation is performed ;
501 * - \ref VA_ROTATION_90: (0,0) is the bottom-left corner of the
503 * - \ref VA_ROTATION_180: (0,0) is the bottom-right corner of the
504 * source surface -- the surface is flipped around the X axis ;
505 * - \ref VA_ROTATION_270: (0,0) is the top-right corner of the
508 * Check VAProcPipelineCaps::rotation_flags first prior to
509 * defining a specific rotation angle. Otherwise, the hardware can
510 * perfectly ignore this variable if it does not support any
513 unsigned int rotation_state;
515 * \brief Pipeline filters. See video pipeline flags.
517 * Flags to control the pipeline, like whether to apply subpictures
518 * or not, notify the driver that it can opt for power optimizations,
519 * should this be needed.
521 unsigned int pipeline_flags;
523 * \brief Extra filter flags. See vaPutSurface() flags.
525 * Filter flags are used as a fast path, wherever possible, to use
526 * vaPutSurface() flags instead of explicit filter parameter buffers.
528 * Allowed filter flags API-wise. Use vaQueryVideoProcPipelineCaps()
529 * to check for implementation details:
530 * - Bob-deinterlacing: \c VA_FRAME_PICTURE, \c VA_TOP_FIELD,
531 * \c VA_BOTTOM_FIELD. Note that any deinterlacing filter
532 * (#VAProcFilterDeinterlacing) will override those flags.
533 * - Color space conversion: \c VA_SRC_BT601, \c VA_SRC_BT709,
534 * \c VA_SRC_SMPTE_240. Note that any color standard filter
535 * (#VAProcFilterColorStandard) will override those flags.
536 * - Scaling: \c VA_FILTER_SCALING_DEFAULT, \c VA_FILTER_SCALING_FAST,
537 * \c VA_FILTER_SCALING_HQ, \c VA_FILTER_SCALING_NL_ANAMORPHIC.
539 unsigned int filter_flags;
541 * \brief Array of filters to apply to the surface.
543 * The list of filters shall be ordered in the same way the driver expects
544 * them. i.e. as was returned from vaQueryVideoProcFilters().
545 * Otherwise, a #VA_STATUS_ERROR_INVALID_FILTER_CHAIN is returned
546 * from vaRenderPicture() with this buffer.
548 * #VA_STATUS_ERROR_UNSUPPORTED_FILTER is returned if the list
549 * contains an unsupported filter.
551 * Note: no filter buffer is destroyed after a call to vaRenderPicture(),
552 * only this pipeline buffer will be destroyed as per the core API
553 * specification. This allows for flexibility in re-using the filter for
554 * other surfaces to be processed.
557 /** \brief Actual number of filters. */
558 unsigned int num_filters;
559 /** \brief Array of forward reference frames. */
560 VASurfaceID *forward_references;
561 /** \brief Number of forward reference frames that were supplied. */
562 unsigned int num_forward_references;
563 /** \brief Array of backward reference frames. */
564 VASurfaceID *backward_references;
565 /** \brief Number of backward reference frames that were supplied. */
566 unsigned int num_backward_references;
567 } VAProcPipelineParameterBuffer;
570 * \brief Filter parameter buffer base.
572 * This is a helper structure used by driver implementations only.
573 * Users are not supposed to allocate filter parameter buffers of this
576 typedef struct _VAProcFilterParameterBufferBase {
577 /** \brief Filter type. */
578 VAProcFilterType type;
579 } VAProcFilterParameterBufferBase;
582 * \brief Default filter parametrization.
584 * Unless there is a filter-specific parameter buffer,
585 * #VAProcFilterParameterBuffer is the default type to use.
587 typedef struct _VAProcFilterParameterBuffer {
588 /** \brief Filter type. */
589 VAProcFilterType type;
592 } VAProcFilterParameterBuffer;
594 /** \brief Deinterlacing filter parametrization. */
595 typedef struct _VAProcFilterParameterBufferDeinterlacing {
596 /** \brief Filter type. Shall be set to #VAProcFilterDeinterlacing. */
597 VAProcFilterType type;
598 /** \brief Deinterlacing algorithm. */
599 VAProcDeinterlacingType algorithm;
600 } VAProcFilterParameterBufferDeinterlacing;
603 * \brief Color balance filter parametrization.
605 * This buffer defines color balance attributes. A VA buffer can hold
606 * several color balance attributes by creating a VA buffer of desired
607 * number of elements. This can be achieved by the following pseudo-code:
610 * enum { kHue, kSaturation, kBrightness, kContrast };
612 * // Initial color balance parameters
613 * static const VAProcFilterParameterBufferColorBalance colorBalanceParams[4] =
616 * { VAProcFilterColorBalance, VAProcColorBalanceHue, 0.5 },
618 * { VAProcFilterColorBalance, VAProcColorBalanceSaturation, 0.5 },
620 * { VAProcFilterColorBalance, VAProcColorBalanceBrightness, 0.5 },
622 * { VAProcFilterColorBalance, VAProcColorBalanceSaturation, 0.5 }
626 * VABufferID colorBalanceBuffer;
627 * vaCreateBuffer(va_dpy, vpp_ctx,
628 * VAProcFilterParameterBufferType, sizeof(*pColorBalanceParam), 4,
629 * colorBalanceParams,
630 * &colorBalanceBuffer
633 * VAProcFilterParameterBufferColorBalance *pColorBalanceParam;
634 * vaMapBuffer(va_dpy, colorBalanceBuffer, &pColorBalanceParam);
636 * // Change brightness only
637 * pColorBalanceBuffer[kBrightness].value = 0.75;
639 * vaUnmapBuffer(va_dpy, colorBalanceBuffer);
642 typedef struct _VAProcFilterParameterBufferColorBalance {
643 /** \brief Filter type. Shall be set to #VAProcFilterColorBalance. */
644 VAProcFilterType type;
645 /** \brief Color balance attribute. */
646 VAProcColorBalanceType attrib;
648 * \brief Color balance value.
650 * Special case for automatically adjusted attributes. e.g.
651 * #VAProcColorBalanceAutoSaturation,
652 * #VAProcColorBalanceAutoBrightness,
653 * #VAProcColorBalanceAutoContrast.
654 * - If \ref value is \c 1.0 +/- \c FLT_EPSILON, the attribute is
655 * automatically adjusted and overrides any other attribute of
656 * the same type that would have been set explicitly;
657 * - If \ref value is \c 0.0 +/- \c FLT_EPSILON, the attribute is
658 * disabled and other attribute of the same type is used instead.
661 } VAProcFilterParameterBufferColorBalance;
663 /** \brief Color standard filter parametrization. */
664 typedef struct _VAProcFilterParameterBufferColorStandard {
665 /** \brief Filter type. Shall be set to #VAProcFilterColorStandard. */
666 VAProcFilterType type;
667 /** \brief Color standard to use. */
668 VAProcColorStandardType standard;
669 } VAProcFilterParameterBufferColorStandard;
671 /** \brief Frame rate conversion filter parametrization. */
672 typedef struct _VAProcFilterParamterBufferFrameRateConversion {
673 /** \brief filter type. Shall be set to #VAProcFilterFrameRateConversion. */
674 VAProcFilterType type;
675 /** \brief FPS of input sequence. */
676 unsigned int input_fps;
677 /** \brief FPS of output sequence. */
678 unsigned int output_fps;
679 /** \brief Number of output frames in addition to the first output frame. */
680 unsigned int num_output_frames;
682 * \brief Array to store output frames in addition to the first one.
683 * The first output frame is stored in the render target from vaBeginPicture().
685 VASurfaceID* output_frames;
686 } VAProcFilterParameterBufferFrameRateConversion;
689 * \brief Default filter cap specification (single range value).
691 * Unless there is a filter-specific cap structure, #VAProcFilterCap is the
692 * default type to use for output caps from vaQueryVideoProcFilterCaps().
694 typedef struct _VAProcFilterCap {
695 /** \brief Range of supported values for the filter. */
696 VAProcFilterValueRange range;
699 /** \brief Capabilities specification for the deinterlacing filter. */
700 typedef struct _VAProcFilterCapDeinterlacing {
701 /** \brief Deinterlacing algorithm. */
702 VAProcDeinterlacingType type;
703 } VAProcFilterCapDeinterlacing;
705 /** \brief Capabilities specification for the color balance filter. */
706 typedef struct _VAProcFilterCapColorBalance {
707 /** \brief Color balance operation. */
708 VAProcColorBalanceType type;
709 /** \brief Range of supported values for the specified operation. */
710 VAProcFilterValueRange range;
711 } VAProcFilterCapColorBalance;
713 /** \brief Capabilities specification for the color standard filter. */
714 typedef struct _VAProcFilterCapColorStandard {
715 /** \brief Color standard type. */
716 VAProcColorStandardType type;
717 } VAProcFilterCapColorStandard;
720 * \brief Queries video processing filters.
722 * This function returns the list of video processing filters supported
723 * by the driver. The \c filters array is allocated by the user and
724 * \c num_filters shall be initialized to the number of allocated
725 * elements in that array. Upon successful return, the actual number
726 * of filters will be overwritten into \c num_filters. Otherwise,
727 * \c VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned and \c num_filters
728 * is adjusted to the number of elements that would be returned if enough
729 * space was available.
731 * The list of video processing filters supported by the driver shall
732 * be ordered in the way they can be iteratively applied. This is needed
733 * for both correctness, i.e. some filters would not mean anything if
734 * applied at the beginning of the pipeline; but also for performance
735 * since some filters can be applied in a single pass (e.g. noise
736 * reduction + deinterlacing).
738 * @param[in] dpy the VA display
739 * @param[in] context the video processing context
740 * @param[out] filters the output array of #VAProcFilterType elements
741 * @param[in,out] num_filters the number of elements allocated on input,
742 * the number of elements actually filled in on output
745 vaQueryVideoProcFilters(
748 VAProcFilterType *filters,
749 unsigned int *num_filters
753 * \brief Queries video filter capabilities.
755 * This function returns the list of capabilities supported by the driver
756 * for a specific video filter. The \c filter_caps array is allocated by
757 * the user and \c num_filter_caps shall be initialized to the number
758 * of allocated elements in that array. Upon successful return, the
759 * actual number of filters will be overwritten into \c num_filter_caps.
760 * Otherwise, \c VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned and
761 * \c num_filter_caps is adjusted to the number of elements that would be
762 * returned if enough space was available.
764 * @param[in] dpy the VA display
765 * @param[in] context the video processing context
766 * @param[in] type the video filter type
767 * @param[out] filter_caps the output array of #VAProcFilterCap elements
768 * @param[in,out] num_filter_caps the number of elements allocated on input,
769 * the number of elements actually filled in output
772 vaQueryVideoProcFilterCaps(
775 VAProcFilterType type,
777 unsigned int *num_filter_caps
781 * \brief Queries video processing pipeline capabilities.
783 * This function returns the video processing pipeline capabilities. The
784 * \c filters array defines the video processing pipeline and is an array
785 * of buffers holding filter parameters.
787 * Note: the #VAProcPipelineCaps structure contains user-provided arrays.
788 * If non-NULL, the corresponding \c num_* fields shall be filled in on
789 * input with the number of elements allocated. Upon successful return,
790 * the actual number of elements will be overwritten into the \c num_*
791 * fields. Otherwise, \c VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned
792 * and \c num_* fields are adjusted to the number of elements that would
793 * be returned if enough space was available.
795 * @param[in] dpy the VA display
796 * @param[in] context the video processing context
797 * @param[in] filters the array of VA buffers defining the video
798 * processing pipeline
799 * @param[in] num_filters the number of elements in filters
800 * @param[in,out] pipeline_caps the video processing pipeline capabilities
803 vaQueryVideoProcPipelineCaps(
807 unsigned int num_filters,
808 VAProcPipelineCaps *pipeline_caps
817 #endif /* VA_VPP_H */