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 blending flags */
317 /** \brief Global alpha blending. */
318 #define VA_BLEND_GLOBAL_ALPHA 0x0002
319 /** \brief Premultiplied alpha blending (RGBA surfaces only). */
320 #define VA_BLEND_PREMULTIPLIED_ALPHA 0x0008
321 /** \brief Luma color key (YUV surfaces only). */
322 #define VA_BLEND_LUMA_KEY 0x0010
325 /** \brief Video blending state definition. */
326 typedef struct _VABlendState {
327 /** \brief Video blending flags. */
330 * \brief Global alpha value.
332 * Valid if \flags has VA_BLEND_GLOBAL_ALPHA.
333 * Valid range is 0.0 to 1.0 inclusive.
337 * \brief Minimum luma value.
339 * Valid if \flags has VA_BLEND_LUMA_KEY.
340 * Valid range is 0.0 to 1.0 inclusive.
341 * \ref min_luma shall be set to a sensible value lower than \ref max_luma.
345 * \brief Maximum luma value.
347 * Valid if \flags has VA_BLEND_LUMA_KEY.
348 * Valid range is 0.0 to 1.0 inclusive.
349 * \ref max_luma shall be set to a sensible value larger than \ref min_luma.
354 /** @name Video pipeline flags */
356 /** \brief Specifies whether to apply subpictures when processing a surface. */
357 #define VA_PROC_PIPELINE_SUBPICTURES 0x00000001
359 * \brief Specifies whether to apply power or performance
360 * optimizations to a pipeline.
362 * When processing several surfaces, it may be necessary to prioritize
363 * more certain pipelines than others. This flag is only a hint to the
364 * video processor so that it can omit certain filters to save power
365 * for example. Typically, this flag could be used with video surfaces
366 * decoded from a secondary bitstream.
368 #define VA_PROC_PIPELINE_FAST 0x00000002
371 /** @name Video filter flags */
373 /** \brief Specifies whether the filter shall be present in the pipeline. */
374 #define VA_PROC_FILTER_MANDATORY 0x00000001
377 /** @name Pipeline end flags */
379 /** \brief Specifies the pipeline is the last. */
380 #define VA_PIPELINE_FLAG_END 0x00000004
383 /** \brief Video processing pipeline capabilities. */
384 typedef struct _VAProcPipelineCaps {
385 /** \brief Pipeline flags. See VAProcPipelineParameterBuffer::pipeline_flags. */
386 unsigned int pipeline_flags;
387 /** \brief Extra filter flags. See VAProcPipelineParameterBuffer::filter_flags. */
388 unsigned int filter_flags;
389 /** \brief Number of forward reference frames that are needed. */
390 unsigned int num_forward_references;
391 /** \brief Number of backward reference frames that are needed. */
392 unsigned int num_backward_references;
393 /** \brief List of color standards supported on input. */
394 VAProcColorStandardType *input_color_standards;
395 /** \brief Number of elements in \ref input_color_standards array. */
396 unsigned int num_input_color_standards;
397 /** \brief List of color standards supported on output. */
398 VAProcColorStandardType *output_color_standards;
399 /** \brief Number of elements in \ref output_color_standards array. */
400 unsigned int num_output_color_standards;
402 * \brief Rotation flags.
404 * For each rotation angle supported by the underlying hardware,
405 * the corresponding bit is set in \ref rotation_flags. See
406 * "Rotation angles" for a description of rotation angles.
408 * A value of 0 means the underlying hardware does not support any
409 * rotation. Otherwise, a check for a specific rotation angle can be
410 * performed as follows:
413 * VAProcPipelineCaps pipeline_caps;
415 * vaQueryVideoProcPipelineCaps(va_dpy, vpp_ctx,
416 * filter_bufs, num_filter_bufs,
420 * if (pipeline_caps.rotation_flags & (1 << VA_ROTATION_xxx)) {
421 * // Clockwise rotation by xxx degrees is supported
426 unsigned int rotation_flags;
427 /** \brief Blend flags. See "Video blending flags". */
428 unsigned int blend_flags;
429 } VAProcPipelineCaps;
431 /** \brief Specification of values supported by the filter. */
432 typedef struct _VAProcFilterValueRange {
433 /** \brief Minimum value supported, inclusive. */
435 /** \brief Maximum value supported, inclusive. */
437 /** \brief Default value. */
439 /** \brief Step value that alters the filter behaviour in a sensible way. */
441 } VAProcFilterValueRange;
444 * \brief Video processing pipeline configuration.
446 * This buffer defines a video processing pipeline. As for any buffer
447 * passed to \c vaRenderPicture(), this is a one-time usage model.
448 * However, the actual filters to be applied are provided in the
449 * \c filters field, so they can be re-used in other processing
452 * The target surface is specified by the \c render_target argument of
453 * \c vaBeginPicture(). The general usage model is described as follows:
454 * - \c vaBeginPicture(): specify the target surface that receives the
456 * - \c vaRenderPicture(): specify a surface to be processed and composed
457 * into the \c render_target. Use as many \c vaRenderPicture() calls as
458 * necessary surfaces to compose ;
459 * - \c vaEndPicture(): tell the driver to start processing the surfaces
460 * with the requested filters.
462 * If a filter (e.g. noise reduction) needs to be applied with different
463 * values for multiple surfaces, the application needs to create as many
464 * filter parameter buffers as necessary. i.e. the filter parameters shall
465 * not change between two calls to \c vaRenderPicture().
467 * For composition usage models, the first surface to process will generally
468 * use an opaque background color, i.e. \c output_background_color set with
469 * the most significant byte set to \c 0xff. For instance, \c 0xff000000 for
470 * a black background. Then, subsequent surfaces would use a transparent
473 typedef struct _VAProcPipelineParameterBuffer {
475 * \brief Source surface ID.
477 * ID of the source surface to process. If subpictures are associated
478 * with the video surfaces then they shall be rendered to the target
479 * surface, if the #VA_PROC_PIPELINE_SUBPICTURES pipeline flag is set.
483 * \brief Region within the source surface to be processed.
485 * Pointer to a #VARectangle defining the region within the source
486 * surface to be processed. If NULL, \c surface_region implies the
489 const VARectangle *surface_region;
491 * \brief Requested input color primaries.
493 * Color primaries are implicitly converted throughout the processing
494 * pipeline. The video processor chooses the best moment to apply
495 * this conversion. The set of supported color primaries primaries
496 * for input shall be queried with vaQueryVideoProcPipelineCaps().
498 VAProcColorStandardType surface_color_standard;
500 * \brief Region within the output surface.
502 * Pointer to a #VARectangle defining the region within the output
503 * surface that receives the processed pixels. If NULL, \c output_region
504 * implies the whole surface.
506 * Note that any pixels residing outside the specified region will
507 * be filled in with the \ref output_background_color.
509 const VARectangle *output_region;
511 * \brief Background color.
513 * Background color used to fill in pixels that reside outside of the
514 * specified \ref output_region. The color is specified in ARGB format:
515 * [31:24] alpha, [23:16] red, [15:8] green, [7:0] blue.
517 * Unless the alpha value is zero or the \ref output_region represents
518 * the whole target surface size, implementations shall not render the
519 * source surface to the target surface directly. Rather, in order to
520 * maintain the exact semantics of \ref output_background_color, the
521 * driver shall use a temporary surface and fill it in with the
522 * appropriate background color. Next, the driver will blend this
523 * temporary surface into the target surface.
525 unsigned int output_background_color;
527 * \brief Requested output color primaries.
529 VAProcColorStandardType output_color_standard;
531 * \brief Pipeline filters. See video pipeline flags.
533 * Flags to control the pipeline, like whether to apply subpictures
534 * or not, notify the driver that it can opt for power optimizations,
535 * should this be needed.
537 unsigned int pipeline_flags;
539 * \brief Extra filter flags. See vaPutSurface() flags.
541 * Filter flags are used as a fast path, wherever possible, to use
542 * vaPutSurface() flags instead of explicit filter parameter buffers.
544 * Allowed filter flags API-wise. Use vaQueryVideoProcPipelineCaps()
545 * to check for implementation details:
546 * - Bob-deinterlacing: \c VA_FRAME_PICTURE, \c VA_TOP_FIELD,
547 * \c VA_BOTTOM_FIELD. Note that any deinterlacing filter
548 * (#VAProcFilterDeinterlacing) will override those flags.
549 * - Color space conversion: \c VA_SRC_BT601, \c VA_SRC_BT709,
550 * \c VA_SRC_SMPTE_240. Note that any color standard filter
551 * (#VAProcFilterColorStandard) will override those flags.
552 * - Scaling: \c VA_FILTER_SCALING_DEFAULT, \c VA_FILTER_SCALING_FAST,
553 * \c VA_FILTER_SCALING_HQ, \c VA_FILTER_SCALING_NL_ANAMORPHIC.
555 unsigned int filter_flags;
557 * \brief Array of filters to apply to the surface.
559 * The list of filters shall be ordered in the same way the driver expects
560 * them. i.e. as was returned from vaQueryVideoProcFilters().
561 * Otherwise, a #VA_STATUS_ERROR_INVALID_FILTER_CHAIN is returned
562 * from vaRenderPicture() with this buffer.
564 * #VA_STATUS_ERROR_UNSUPPORTED_FILTER is returned if the list
565 * contains an unsupported filter.
567 * Note: no filter buffer is destroyed after a call to vaRenderPicture(),
568 * only this pipeline buffer will be destroyed as per the core API
569 * specification. This allows for flexibility in re-using the filter for
570 * other surfaces to be processed.
573 /** \brief Actual number of filters. */
574 unsigned int num_filters;
575 /** \brief Array of forward reference frames. */
576 VASurfaceID *forward_references;
577 /** \brief Number of forward reference frames that were supplied. */
578 unsigned int num_forward_references;
579 /** \brief Array of backward reference frames. */
580 VASurfaceID *backward_references;
581 /** \brief Number of backward reference frames that were supplied. */
582 unsigned int num_backward_references;
584 * \brief Rotation state. See rotation angles.
586 * The rotation angle is clockwise. There is no specific rotation
587 * center for this operation. Rather, The source \ref surface is
588 * first rotated by the specified angle and then scaled to fit the
589 * \ref output_region.
591 * This means that the top-left hand corner (0,0) of the output
592 * (rotated) surface is expressed as follows:
593 * - \ref VA_ROTATION_NONE: (0,0) is the top left corner of the
594 * source surface -- no rotation is performed ;
595 * - \ref VA_ROTATION_90: (0,0) is the bottom-left corner of the
597 * - \ref VA_ROTATION_180: (0,0) is the bottom-right corner of the
598 * source surface -- the surface is flipped around the X axis ;
599 * - \ref VA_ROTATION_270: (0,0) is the top-right corner of the
602 * Check VAProcPipelineCaps::rotation_flags first prior to
603 * defining a specific rotation angle. Otherwise, the hardware can
604 * perfectly ignore this variable if it does not support any
607 unsigned int rotation_state;
609 * \brief blending state. See "Video blending state definition".
611 * If \ref blend_state is NULL, then default operation mode depends
612 * on the source \ref surface format:
613 * - RGB: per-pixel alpha blending ;
614 * - YUV: no blending, i.e override the underlying pixels.
616 * Otherwise, \ref blend_state is a pointer to a #VABlendState
617 * structure that shall be live until vaEndPicture().
619 * Implementation note: the driver is responsible for checking the
620 * blend state flags against the actual source \ref surface format.
621 * e.g. premultiplied alpha blending is only applicable to RGB
622 * surfaces, and luma keying is only applicable to YUV surfaces.
623 * If a mismatch occurs, then #VA_STATUS_ERROR_INVALID_BLEND_STATE
626 const VABlendState *blend_state;
627 } VAProcPipelineParameterBuffer;
630 * \brief Filter parameter buffer base.
632 * This is a helper structure used by driver implementations only.
633 * Users are not supposed to allocate filter parameter buffers of this
636 typedef struct _VAProcFilterParameterBufferBase {
637 /** \brief Filter type. */
638 VAProcFilterType type;
639 } VAProcFilterParameterBufferBase;
642 * \brief Default filter parametrization.
644 * Unless there is a filter-specific parameter buffer,
645 * #VAProcFilterParameterBuffer is the default type to use.
647 typedef struct _VAProcFilterParameterBuffer {
648 /** \brief Filter type. */
649 VAProcFilterType type;
652 } VAProcFilterParameterBuffer;
654 /** @name De-interlacing flags */
657 * \brief Bottom field first in the input frame.
658 * if this is not set then assums top field first.
660 #define VA_DEINTERLACING_INPUT_BOTTOM_FIELD_FIRST 0x0001
662 * \brief Bottom field used in BOB deinterlacing.
663 * if this is not set then assums top field is used.
665 #define VA_DEINTERLACING_BOB_BOTTOM_FIELD 0x0002
668 /** \brief Deinterlacing filter parametrization. */
669 typedef struct _VAProcFilterParameterBufferDeinterlacing {
670 /** \brief Filter type. Shall be set to #VAProcFilterDeinterlacing. */
671 VAProcFilterType type;
672 /** \brief Deinterlacing algorithm. */
673 VAProcDeinterlacingType algorithm;
674 /** \brief Deinterlacing flags. */
676 } VAProcFilterParameterBufferDeinterlacing;
679 * \brief Color balance filter parametrization.
681 * This buffer defines color balance attributes. A VA buffer can hold
682 * several color balance attributes by creating a VA buffer of desired
683 * number of elements. This can be achieved by the following pseudo-code:
686 * enum { kHue, kSaturation, kBrightness, kContrast };
688 * // Initial color balance parameters
689 * static const VAProcFilterParameterBufferColorBalance colorBalanceParams[4] =
692 * { VAProcFilterColorBalance, VAProcColorBalanceHue, 0.5 },
694 * { VAProcFilterColorBalance, VAProcColorBalanceSaturation, 0.5 },
696 * { VAProcFilterColorBalance, VAProcColorBalanceBrightness, 0.5 },
698 * { VAProcFilterColorBalance, VAProcColorBalanceSaturation, 0.5 }
702 * VABufferID colorBalanceBuffer;
703 * vaCreateBuffer(va_dpy, vpp_ctx,
704 * VAProcFilterParameterBufferType, sizeof(*pColorBalanceParam), 4,
705 * colorBalanceParams,
706 * &colorBalanceBuffer
709 * VAProcFilterParameterBufferColorBalance *pColorBalanceParam;
710 * vaMapBuffer(va_dpy, colorBalanceBuffer, &pColorBalanceParam);
712 * // Change brightness only
713 * pColorBalanceBuffer[kBrightness].value = 0.75;
715 * vaUnmapBuffer(va_dpy, colorBalanceBuffer);
718 typedef struct _VAProcFilterParameterBufferColorBalance {
719 /** \brief Filter type. Shall be set to #VAProcFilterColorBalance. */
720 VAProcFilterType type;
721 /** \brief Color balance attribute. */
722 VAProcColorBalanceType attrib;
724 * \brief Color balance value.
726 * Special case for automatically adjusted attributes. e.g.
727 * #VAProcColorBalanceAutoSaturation,
728 * #VAProcColorBalanceAutoBrightness,
729 * #VAProcColorBalanceAutoContrast.
730 * - If \ref value is \c 1.0 +/- \c FLT_EPSILON, the attribute is
731 * automatically adjusted and overrides any other attribute of
732 * the same type that would have been set explicitly;
733 * - If \ref value is \c 0.0 +/- \c FLT_EPSILON, the attribute is
734 * disabled and other attribute of the same type is used instead.
737 } VAProcFilterParameterBufferColorBalance;
739 /** \brief Color standard filter parametrization. */
740 typedef struct _VAProcFilterParameterBufferColorStandard {
741 /** \brief Filter type. Shall be set to #VAProcFilterColorStandard. */
742 VAProcFilterType type;
743 /** \brief Color standard to use. */
744 VAProcColorStandardType standard;
745 } VAProcFilterParameterBufferColorStandard;
747 /** \brief Frame rate conversion filter parametrization. */
748 typedef struct _VAProcFilterParamterBufferFrameRateConversion {
749 /** \brief filter type. Shall be set to #VAProcFilterFrameRateConversion. */
750 VAProcFilterType type;
751 /** \brief FPS of input sequence. */
752 unsigned int input_fps;
753 /** \brief FPS of output sequence. */
754 unsigned int output_fps;
755 /** \brief Number of output frames in addition to the first output frame. */
756 unsigned int num_output_frames;
758 * \brief Array to store output frames in addition to the first one.
759 * The first output frame is stored in the render target from vaBeginPicture().
761 VASurfaceID* output_frames;
762 } VAProcFilterParameterBufferFrameRateConversion;
765 * \brief Default filter cap specification (single range value).
767 * Unless there is a filter-specific cap structure, #VAProcFilterCap is the
768 * default type to use for output caps from vaQueryVideoProcFilterCaps().
770 typedef struct _VAProcFilterCap {
771 /** \brief Range of supported values for the filter. */
772 VAProcFilterValueRange range;
775 /** \brief Capabilities specification for the deinterlacing filter. */
776 typedef struct _VAProcFilterCapDeinterlacing {
777 /** \brief Deinterlacing algorithm. */
778 VAProcDeinterlacingType type;
779 } VAProcFilterCapDeinterlacing;
781 /** \brief Capabilities specification for the color balance filter. */
782 typedef struct _VAProcFilterCapColorBalance {
783 /** \brief Color balance operation. */
784 VAProcColorBalanceType type;
785 /** \brief Range of supported values for the specified operation. */
786 VAProcFilterValueRange range;
787 } VAProcFilterCapColorBalance;
789 /** \brief Capabilities specification for the color standard filter. */
790 typedef struct _VAProcFilterCapColorStandard {
791 /** \brief Color standard type. */
792 VAProcColorStandardType type;
793 } VAProcFilterCapColorStandard;
796 * \brief Queries video processing filters.
798 * This function returns the list of video processing filters supported
799 * by the driver. The \c filters array is allocated by the user and
800 * \c num_filters shall be initialized to the number of allocated
801 * elements in that array. Upon successful return, the actual number
802 * of filters will be overwritten into \c num_filters. Otherwise,
803 * \c VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned and \c num_filters
804 * is adjusted to the number of elements that would be returned if enough
805 * space was available.
807 * The list of video processing filters supported by the driver shall
808 * be ordered in the way they can be iteratively applied. This is needed
809 * for both correctness, i.e. some filters would not mean anything if
810 * applied at the beginning of the pipeline; but also for performance
811 * since some filters can be applied in a single pass (e.g. noise
812 * reduction + deinterlacing).
814 * @param[in] dpy the VA display
815 * @param[in] context the video processing context
816 * @param[out] filters the output array of #VAProcFilterType elements
817 * @param[in,out] num_filters the number of elements allocated on input,
818 * the number of elements actually filled in on output
821 vaQueryVideoProcFilters(
824 VAProcFilterType *filters,
825 unsigned int *num_filters
829 * \brief Queries video filter capabilities.
831 * This function returns the list of capabilities supported by the driver
832 * for a specific video filter. The \c filter_caps array is allocated by
833 * the user and \c num_filter_caps shall be initialized to the number
834 * of allocated elements in that array. Upon successful return, the
835 * actual number of filters will be overwritten into \c num_filter_caps.
836 * Otherwise, \c VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned and
837 * \c num_filter_caps is adjusted to the number of elements that would be
838 * returned if enough space was available.
840 * @param[in] dpy the VA display
841 * @param[in] context the video processing context
842 * @param[in] type the video filter type
843 * @param[out] filter_caps the output array of #VAProcFilterCap elements
844 * @param[in,out] num_filter_caps the number of elements allocated on input,
845 * the number of elements actually filled in output
848 vaQueryVideoProcFilterCaps(
851 VAProcFilterType type,
853 unsigned int *num_filter_caps
857 * \brief Queries video processing pipeline capabilities.
859 * This function returns the video processing pipeline capabilities. The
860 * \c filters array defines the video processing pipeline and is an array
861 * of buffers holding filter parameters.
863 * Note: the #VAProcPipelineCaps structure contains user-provided arrays.
864 * If non-NULL, the corresponding \c num_* fields shall be filled in on
865 * input with the number of elements allocated. Upon successful return,
866 * the actual number of elements will be overwritten into the \c num_*
867 * fields. Otherwise, \c VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned
868 * and \c num_* fields are adjusted to the number of elements that would
869 * be returned if enough space was available.
871 * @param[in] dpy the VA display
872 * @param[in] context the video processing context
873 * @param[in] filters the array of VA buffers defining the video
874 * processing pipeline
875 * @param[in] num_filters the number of elements in filters
876 * @param[in,out] pipeline_caps the video processing pipeline capabilities
879 vaQueryVideoProcPipelineCaps(
883 unsigned int num_filters,
884 VAProcPipelineCaps *pipeline_caps
893 #endif /* VA_VPP_H */