hardware/intel/libva
修訂 | 0c097f5d09b400527c29d8b100f01dfafa2c2438 (tree) |
---|---|
時間 | 2013-05-28 17:32:18 |
作者 | Gwenole Beauchesne <gwenole.beauchesne@inte...> |
Commiter | Xiang, Haihao |
API: add video processing interfaces.
@@ -45,6 +45,7 @@ libva_source_h = \ | ||
45 | 45 | va_enc_mpeg2.h \ |
46 | 46 | va_tpi.h \ |
47 | 47 | va_version.h \ |
48 | + va_vpp.h \ | |
48 | 49 | $(NULL) |
49 | 50 | |
50 | 51 | libva_source_h_priv = \ |
@@ -142,6 +142,10 @@ typedef int VAStatus; /* Return status type from functions */ | ||
142 | 142 | * of generic attribute values. |
143 | 143 | */ |
144 | 144 | #define VA_STATUS_ERROR_INVALID_VALUE 0x00000019 |
145 | +/** \brief An unsupported filter was supplied. */ | |
146 | +#define VA_STATUS_ERROR_UNSUPPORTED_FILTER 0x00000020 | |
147 | +/** \brief An invalid filter chain was supplied. */ | |
148 | +#define VA_STATUS_ERROR_INVALID_FILTER_CHAIN 0x00000021 | |
145 | 149 | /** \brief Indicate HW busy (e.g. run multiple encoding simultaneously). */ |
146 | 150 | #define VA_STATUS_ERROR_HW_BUSY 0x00000022 |
147 | 151 | #define VA_STATUS_ERROR_UNKNOWN 0xFFFFFFFF |
@@ -236,6 +240,8 @@ VAPrivFunc vaGetLibFunc ( | ||
236 | 240 | /* Currently defined profiles */ |
237 | 241 | typedef enum |
238 | 242 | { |
243 | + /** \brief Profile ID used for video processing. */ | |
244 | + VAProfileNone = -1, | |
239 | 245 | VAProfileMPEG2Simple = 0, |
240 | 246 | VAProfileMPEG2Main = 1, |
241 | 247 | VAProfileMPEG4Simple = 2, |
@@ -263,7 +269,8 @@ typedef enum | ||
263 | 269 | VAEntrypointMoComp = 4, |
264 | 270 | VAEntrypointDeblocking = 5, |
265 | 271 | VAEntrypointEncSlice = 6, /* slice level encode */ |
266 | - VAEntrypointEncPicture = 7 /* pictuer encode, JPEG, etc */ | |
272 | + VAEntrypointEncPicture = 7, /* pictuer encode, JPEG, etc */ | |
273 | + VAEntrypointVideoProc = 10, /**< Video pre/post-processing. */ | |
267 | 274 | } VAEntrypoint; |
268 | 275 | |
269 | 276 | /* Currently defined configuration attribute types */ |
@@ -681,6 +688,27 @@ typedef enum | ||
681 | 688 | VAEncPackedHeaderDataBufferType = 26, |
682 | 689 | VAEncMiscParameterBufferType = 27, |
683 | 690 | VAEncMacroblockParameterBufferType = 28, |
691 | +/* Following are video processing buffer types */ | |
692 | + /** | |
693 | + * \brief Video processing pipeline parameter buffer. | |
694 | + * | |
695 | + * This buffer describes the video processing pipeline. See | |
696 | + * #VAProcPipelineParameterBuffer for details. | |
697 | + */ | |
698 | + VAProcPipelineParameterBufferType = 31, | |
699 | + /** | |
700 | + * \brief Video filter parameter buffer. | |
701 | + * | |
702 | + * This buffer describes the video filter parameters. All buffers | |
703 | + * inherit from #VAProcFilterParameterBufferBase, thus including | |
704 | + * a unique filter buffer type. | |
705 | + * | |
706 | + * The default buffer used by most filters is #VAProcFilterParameterBuffer. | |
707 | + * Filters requiring advanced parameters include, but are not limited to, | |
708 | + * deinterlacing (#VAProcFilterParameterBufferDeinterlacing), | |
709 | + * color balance (#VAProcFilterParameterBufferColorBalance), etc. | |
710 | + */ | |
711 | + VAProcFilterParameterBufferType = 32, | |
684 | 712 | VABufferTypeMax = 0xff |
685 | 713 | } VABufferType; |
686 | 714 |
@@ -0,0 +1,594 @@ | ||
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 capabilities; | |
46 | + * - Set up a video processing pipeline; | |
47 | + * - Send video processing parameters through VA buffers. | |
48 | + * | |
49 | + * \section api_vpp_caps Query for supported capabilities | |
50 | + * | |
51 | + * Checking whether video processing is supported can be performed | |
52 | + * with vaQueryConfigEntrypoints() and the profile argument set to | |
53 | + * #VAProfileNone. | |
54 | + * | |
55 | + * \code | |
56 | + * VAEntrypoint *entrypoints; | |
57 | + * int i, num_entrypoints, supportsVideoProcessing = 0; | |
58 | + * | |
59 | + * num_entrypoints = vaMaxNumEntrypoints(); | |
60 | + * entrypoints = malloc(num_entrypoints * sizeof(entrypoints[0]); | |
61 | + * vaQueryConfigEntrypoints(va_dpy, VAProfileNone, | |
62 | + * entrypoints, &num_entrypoints); | |
63 | + * | |
64 | + * for (i = 0; !supportsVideoProcessing && i < num_entrypoints; i++) { | |
65 | + * if (entrypoints[i] == VAEntrypointVideoProc) | |
66 | + * supportsVideoProcessing = 1; | |
67 | + * } | |
68 | + * \endcode | |
69 | + * | |
70 | + * Then, video processing pipeline capabilities, i.e. which video | |
71 | + * filters does the driver support, can be checked with the | |
72 | + * vaQueryVideoProcPipelineCaps() function. | |
73 | + * | |
74 | + * \code | |
75 | + * VAProcPipelineCap pipeline_caps[VAProcFilterCount]; | |
76 | + * unsigned int num_pipeline_caps = VAProcFilterCount; | |
77 | + * | |
78 | + * // num_pipeline_caps shall be initialized to the length of the array | |
79 | + * vaQueryVideoProcPipelineCaps(va_dpy, vpp_ctx, &pipe_caps, &num_pipeline_caps); | |
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_pipeline_caps; i++) { | |
119 | + * VAProcPipelineCap * const pipeline_cap = &pipeline_caps[i]; | |
120 | + * switch (pipeline_cap->type) { | |
121 | + * case VAProcFilterNoiseReduction: { // Noise reduction filter | |
122 | + * VAProcFilterParameterBuffer denoise; | |
123 | + * denoise.type = VAProcFilterNoiseReduction; | |
124 | + * denoise.value = 0.5; | |
125 | + * vaCreateBuffer(va_dpy, vpp_ctx, | |
126 | + * VAProcFilterParameterBufferType, sizeof(denoise), 1, | |
127 | + * &denoise, &denoise_filter | |
128 | + * ); | |
129 | + * filter_bufs[num_filter_bufs++] = denoise_filter; | |
130 | + * break; | |
131 | + * } | |
132 | + * | |
133 | + * case VAProcFilterDeinterlacing: // Motion-adaptive deinterlacing | |
134 | + * for (j = 0; j < num_deinterlacing_caps; j++) { | |
135 | + * VAProcFilterCapDeinterlacing * const cap = &deinterlacing_caps[j]; | |
136 | + * if (cap->type != VAProcDeinterlacingMotionAdaptive) | |
137 | + * continue; | |
138 | + * | |
139 | + * VAProcFilterParameterBufferDeinterlacing deint; | |
140 | + * deint.type = VAProcFilterDeinterlacing; | |
141 | + * deint.algorithm = VAProcDeinterlacingMotionAdaptive; | |
142 | + * deint.forward_references = | |
143 | + * malloc(cap->num_forward_references * sizeof(VASurfaceID)); | |
144 | + * deint.num_forward_references = 0; // none for now | |
145 | + * deint.backward_references = | |
146 | + * malloc(cap->num_backward_references * sizeof(VASurfaceID)); | |
147 | + * deint.num_backward_references = 0; // none for now | |
148 | + * vaCreateBuffer(va_dpy, vpp_ctx, | |
149 | + * VAProcFilterParameterBufferType, sizeof(deint), 1, | |
150 | + * &deint, &deint_filter | |
151 | + * ); | |
152 | + * filter_bufs[num_filter_bufs++] = deint_filter; | |
153 | + * } | |
154 | + * } | |
155 | + * } | |
156 | + * \endcode | |
157 | + * | |
158 | + * \section api_vpp_submit Send video processing parameters through VA buffers | |
159 | + * | |
160 | + * Video processing pipeline parameters are submitted for each source | |
161 | + * surface to process. Video filter parameters can also change, per-surface. | |
162 | + * e.g. the list of reference frames used for deinterlacing. | |
163 | + * | |
164 | + * \code | |
165 | + * foreach (iteration) { | |
166 | + * vaBeginPicture(va_dpy, vpp_ctx, vpp_surface); | |
167 | + * foreach (surface) { | |
168 | + * VARectangle output_region; | |
169 | + * VABufferID pipeline_buf; | |
170 | + * VAProcPipelineParameterBuffer *pipeline_param; | |
171 | + * | |
172 | + * vaCreateBuffer(va_dpy, vpp_ctx, | |
173 | + * VAProcPipelineParameterBuffer, sizeof(*pipeline_param), 1, | |
174 | + * NULL, &pipeline_param | |
175 | + * ); | |
176 | + * | |
177 | + * // Setup output region for this surface | |
178 | + * // e.g. upper left corner for the first surface | |
179 | + * output_region.x = BORDER; | |
180 | + * output_region.y = BORDER; | |
181 | + * output_region.width = | |
182 | + * (vpp_surface_width - (Nx_surfaces + 1) * BORDER) / Nx_surfaces; | |
183 | + * output_region.height = | |
184 | + * (vpp_surface_height - (Ny_surfaces + 1) * BORDER) / Ny_surfaces; | |
185 | + * | |
186 | + * vaMapBuffer(va_dpy, pipeline_buf, &pipeline_param); | |
187 | + * pipeline_param->surface = surface; | |
188 | + * pipeline_param->surface_region = NULL; | |
189 | + * pipeline_param->output_region = &output_region; | |
190 | + * pipeline_param->output_background_color = 0; | |
191 | + * if (first surface to render) | |
192 | + * pipeline_param->output_background_color = 0xff000000; // black | |
193 | + * pipeline_param->flags = VA_FILTER_SCALING_HQ; | |
194 | + * pipeline_param->filters = filter_bufs; | |
195 | + * pipeline_param->num_filters = num_filter_bufs; | |
196 | + * vaUnmapBuffer(va_dpy, pipeline_buf); | |
197 | + * | |
198 | + * VAProcFilterParameterBufferDeinterlacing *deint_param; | |
199 | + * vaMapBuffer(va_dpy, deint_filter, &deint_param); | |
200 | + * // Update deinterlacing parameters, if necessary | |
201 | + * ... | |
202 | + * vaUnmapBuffer(va_dpy, deint_filter); | |
203 | + * | |
204 | + * // Apply filters | |
205 | + * vaRenderPicture(va_dpy, vpp_ctx, &pipeline_buf, 1); | |
206 | + * } | |
207 | + * vaEndPicture(va_dpy, vpp_ctx); | |
208 | + * } | |
209 | + * \endcode | |
210 | + */ | |
211 | + | |
212 | +#if 0 | |
213 | + /* Surfaces composition */ | |
214 | + VAProcPipelineParameterBuffer *pipeline_param; | |
215 | + pipeline_param->surface = VA_INVALID_SURFACE; | |
216 | + pipeline_param->surface_region = surface_region; | |
217 | + pipeline_param->output_region = output_region; | |
218 | + pipeline_param->output_background_color = output_background_color; | |
219 | + pipeline_param->flags = VA_FILTER_SCALING_HQ; | |
220 | + pipeline_param->filters = filters; | |
221 | + pipeline_param->num_filters = num_filters; | |
222 | + | |
223 | + VAProcPipelineID vpp_proc; | |
224 | + VAProcPipelineParameterBuffer | |
225 | + | |
226 | + VAProcFilterParameterBuffer filter; | |
227 | + | |
228 | + vaBeginPicture(va_dpy, vpp_context, vpp_surface); | |
229 | + { | |
230 | + vaRenderPicture(va_dpy, | |
231 | + } | |
232 | + vaEndPicture(va_dpy, vpp_context); | |
233 | +#endif | |
234 | + | |
235 | +/** \brief Video filter types. */ | |
236 | +typedef enum _VAProcFilterType { | |
237 | + VAProcFilterNone = 0, | |
238 | + /** \brief Noise reduction filter. */ | |
239 | + VAProcFilterNoiseReduction, | |
240 | + /** \brief Deinterlacing filter. */ | |
241 | + VAProcFilterDeinterlacing, | |
242 | + /** \brief Sharpening filter. */ | |
243 | + VAProcFilterSharpening, | |
244 | + /** \brief Color balance parameters. */ | |
245 | + VAProcFilterColorBalance, | |
246 | + /** \brief Color standard conversion. */ | |
247 | + VAProcFilterColorStandard, | |
248 | + /** \brief Max number of video filters. */ | |
249 | + VAProcFilterCount | |
250 | +} VAProcFilterType; | |
251 | + | |
252 | +/** \brief Deinterlacing types. */ | |
253 | +typedef enum _VAProcDeinterlacingType { | |
254 | + VAProcDeinterlacingNone = 0, | |
255 | + /** \brief Bob deinterlacing algorithm. */ | |
256 | + VAProcDeinterlacingBob, | |
257 | + /** \brief Weave deinterlacing algorithm. */ | |
258 | + VAProcDeinterlacingWeave, | |
259 | + /** \brief Motion adaptive deinterlacing algorithm. */ | |
260 | + VAProcDeinterlacingMotionAdaptive, | |
261 | + /** \brief Motion compensated deinterlacing algorithm. */ | |
262 | + VAProcDeinterlacingMotionCompensated, | |
263 | + /** \brief Max number of deinterlacing algorithms. */ | |
264 | + VAProcDeinterlacingCount | |
265 | +} VAProcDeinterlacingType; | |
266 | + | |
267 | +/** \brief Color balance types. */ | |
268 | +typedef enum _VAProcColorBalanceType { | |
269 | + VAProcColorBalanceNone = 0, | |
270 | + /** \brief Hue. */ | |
271 | + VAProcColorBalanceHue, | |
272 | + /** \brief Saturation. */ | |
273 | + VAProcColorBalanceSaturation, | |
274 | + /** \brief Brightness. */ | |
275 | + VAProcColorBalanceBrightness, | |
276 | + /** \brief Contrast. */ | |
277 | + VAProcColorBalanceContrast, | |
278 | + /** \brief Max number of color balance operations. */ | |
279 | + VAProcColorBalanceCount | |
280 | +} VAProcColorBalanceType; | |
281 | + | |
282 | +/** \brief Color standard types. */ | |
283 | +typedef enum _VAProcColorStandardType { | |
284 | + VAProcColorStandardNone = 0, | |
285 | + /** \brief ITU-R BT.601. */ | |
286 | + VAProcColorStandardBT601, | |
287 | + /** \brief ITU-R BT.709. */ | |
288 | + VAProcColorStandardBT709, | |
289 | + /** \brief ITU-R BT.470-2 System M. */ | |
290 | + VAProcColorStandardBT470M, | |
291 | + /** \brief ITU-R BT.470-2 System B, G. */ | |
292 | + VAProcColorStandardBT470BG, | |
293 | + /** \brief SMPTE-170M. */ | |
294 | + VAProcColorStandardSMPTE170M, | |
295 | + /** \brief SMPTE-240M. */ | |
296 | + VAProcColorStandardSMPTE240M, | |
297 | + /** \brief Generic film. */ | |
298 | + VAProcColorStandardGenericFilm, | |
299 | +} VAProcColorStandardType; | |
300 | + | |
301 | +/** @name Video filter flags */ | |
302 | +/**@{*/ | |
303 | +/** \brief Specifies whether the filter shall be present in the pipeline. */ | |
304 | +#define VA_PROC_FILTER_MANDATORY 0x00000001 | |
305 | +/**@}*/ | |
306 | + | |
307 | +/** \brief Video processing pipeline capabilities. */ | |
308 | +typedef struct _VAProcPipelineCap { | |
309 | + /** \brief Video filter type. */ | |
310 | + VAProcFilterType type; | |
311 | + /** \brief Video filter flags. See video filter flags. */ | |
312 | + unsigned int flags; | |
313 | +} VAProcPipelineCap; | |
314 | + | |
315 | +/** \brief Specification of values supported by the filter. */ | |
316 | +typedef struct _VAProcFilterValueRange { | |
317 | + /** \brief Minimum value supported, inclusive. */ | |
318 | + float min_value; | |
319 | + /** \brief Maximum value supported, inclusive. */ | |
320 | + float max_value; | |
321 | + /** \brief Default value. */ | |
322 | + float default_value; | |
323 | + /** \brief Step value that alters the filter behaviour in a sensible way. */ | |
324 | + float step; | |
325 | +} VAProcFilterValueRange; | |
326 | + | |
327 | +/** \brief Video processing pipeline configuration. */ | |
328 | +struct _VAProcPipelineParameterBuffer { | |
329 | + /** \brief Source surface ID. */ | |
330 | + VASurfaceID surface; | |
331 | + /** | |
332 | + * \brief Region within the source surface to be processed. | |
333 | + * | |
334 | + * Pointer to a #VARectangle defining the region within the source | |
335 | + * surface to be processed. If NULL, \c surface_region implies the | |
336 | + * whole surface. | |
337 | + */ | |
338 | + const VARectangle *surface_region; | |
339 | + /** | |
340 | + * \brief Region within the output surface. | |
341 | + * | |
342 | + * Pointer to a #VARectangle defining the region within the output | |
343 | + * surface that receives the processed pixels. If NULL, \c output_region | |
344 | + * implies the whole surface. | |
345 | + * | |
346 | + * Note that any pixels residing outside the specified region will | |
347 | + * be filled in with the \ref output_background_color. | |
348 | + */ | |
349 | + const VARectangle *output_region; | |
350 | + /** | |
351 | + * \brief Background color. | |
352 | + * | |
353 | + * Background color used to fill in pixels that reside outside of the | |
354 | + * specified \ref output_region. The color is specified in ARGB format: | |
355 | + * [31:24] alpha, [23:16] red, [15:8] green, [7:0] blue. | |
356 | + */ | |
357 | + unsigned int output_background_color; | |
358 | + /** | |
359 | + * \brief Pipeline flags. See vaPutSurface() flags. | |
360 | + * | |
361 | + * Pipeline flags: | |
362 | + * - Bob-deinterlacing: \c VA_FRAME_PICTURE, \c VA_TOP_FIELD, | |
363 | + * \c VA_BOTTOM_FIELD. Note that any deinterlacing filter | |
364 | + * (#VAProcFilterDeinterlacing) will override those flags. | |
365 | + * - Color space conversion: \c VA_SRC_BT601, \c VA_SRC_BT709, | |
366 | + * \c VA_SRC_SMPTE_240. Note that any color standard filter | |
367 | + * (#VAProcFilterColorStandard) will override those flags. | |
368 | + * - Scaling: \c VA_FILTER_SCALING_DEFAULT, \c VA_FILTER_SCALING_FAST, | |
369 | + * \c VA_FILTER_SCALING_HQ, \c VA_FILTER_SCALING_NL_ANAMORPHIC. | |
370 | + */ | |
371 | + unsigned int flags; | |
372 | + /** | |
373 | + * \brief Array of filters to apply to the surface. | |
374 | + * | |
375 | + * The list of filters shall be ordered in the same way the driver expects | |
376 | + * them. i.e. as was returned from vaQueryVideoProcPipelineCaps(). | |
377 | + * Otherwise, a #VA_STATUS_ERROR_INVALID_FILTER_CHAIN is returned | |
378 | + * from vaRenderPicture() with this buffer. | |
379 | + * | |
380 | + * #VA_STATUS_ERROR_UNSUPPORTED_FILTER is returned if the list | |
381 | + * contains an unsupported filter. | |
382 | + * | |
383 | + * Note: no filter buffer is destroyed after a call to vaRenderPicture(), | |
384 | + * only this pipeline buffer will be destroyed as per the core API | |
385 | + * specification. This allows for flexibility in re-using the filter for | |
386 | + * other surfaces to be processed. | |
387 | + */ | |
388 | + VABufferID *filters; | |
389 | + /** \brief Actual number of filters. */ | |
390 | + unsigned int num_filters; | |
391 | +} VAProcPipelineParameterBuffer; | |
392 | + | |
393 | +/** | |
394 | + * \brief Filter parameter buffer base. | |
395 | + * | |
396 | + * This is a helper structure used by driver implementations only. | |
397 | + * Users are not supposed to allocate filter parameter buffers of this | |
398 | + * type. | |
399 | + */ | |
400 | +typedef struct _VAProcFilterParameterBufferBase { | |
401 | + /** \brief Filter type. */ | |
402 | + VAProcFilterType type; | |
403 | +} VAProcFilterParameterBufferBase; | |
404 | + | |
405 | +/** | |
406 | + * \brief Default filter parametrization. | |
407 | + * | |
408 | + * Unless there is a filter-specific parameter buffer, | |
409 | + * #VAProcFilterParameterBuffer is the default type to use. | |
410 | + */ | |
411 | +typedef struct _VAProcFilterParameterBuffer { | |
412 | + /** \brief Filter type. */ | |
413 | + VAProcFilterType type; | |
414 | + /** \brief Value. */ | |
415 | + /* XXX: use VAGenericValue? */ | |
416 | + float value; | |
417 | +} VAProcFilterParameterBuffer; | |
418 | + | |
419 | +/** \brief Deinterlacing filter parametrization. */ | |
420 | +typedef struct _VAProcFilterParameterBufferDeinterlacing { | |
421 | + /** \brief Filter type. Shall be set to #VAProcFilterDeinterlacing. */ | |
422 | + VAProcFilterType type; | |
423 | + /** \brief Deinterlacing algorithm. */ | |
424 | + VAProcDeinterlacingType algorithm; | |
425 | + /** \brief Array of forward reference frames. */ | |
426 | + VASurfaceID *forward_references; | |
427 | + /** \brief Number of forward reference frames that were supplied. */ | |
428 | + unsigned int num_forward_references; | |
429 | + /** \brief Array of backward reference frames. */ | |
430 | + VASurfaceID *backward_references; | |
431 | + /** \brief Number of backward reference frames that were supplied. */ | |
432 | + unsigned int num_backward_references; | |
433 | +} VAProcFilterParameterBufferDeinterlacing; | |
434 | + | |
435 | +/** | |
436 | + * \brief Color balance filter parametrization. | |
437 | + * | |
438 | + * This buffer defines color balance attributes. A VA buffer can hold | |
439 | + * several color balance attributes by creating a VA buffer of desired | |
440 | + * number of elements. This can be achieved by the following pseudo-code: | |
441 | + * | |
442 | + * \code | |
443 | + * enum { kHue, kSaturation, kBrightness, kContrast }; | |
444 | + * | |
445 | + * // Initial color balance parameters | |
446 | + * static const VAProcFilterParameterBufferColorBalance colorBalanceParams[4] = | |
447 | + * { | |
448 | + * [kHue] = | |
449 | + * { VAProcFilterColorBalance, VAProcColorBalanceHue, 0.5 }, | |
450 | + * [kSaturation] = | |
451 | + * { VAProcFilterColorBalance, VAProcColorBalanceSaturation, 0.5 }, | |
452 | + * [kBrightness] = | |
453 | + * { VAProcFilterColorBalance, VAProcColorBalanceBrightness, 0.5 }, | |
454 | + * [kSaturation] = | |
455 | + * { VAProcFilterColorBalance, VAProcColorBalanceSaturation, 0.5 } | |
456 | + * }; | |
457 | + * | |
458 | + * // Create buffer | |
459 | + * VABufferID colorBalanceBuffer; | |
460 | + * vaCreateBuffer(va_dpy, vpp_ctx, | |
461 | + * VAProcFilterParameterBufferType, sizeof(*pColorBalanceParam), 4, | |
462 | + * colorBalanceParams, | |
463 | + * &colorBalanceBuffer | |
464 | + * ); | |
465 | + * | |
466 | + * VAProcFilterParameterBufferColorBalance *pColorBalanceParam; | |
467 | + * vaMapBuffer(va_dpy, colorBalanceBuffer, &pColorBalanceParam); | |
468 | + * { | |
469 | + * // Change brightness only | |
470 | + * pColorBalanceBuffer[kBrightness].value = 0.75; | |
471 | + * } | |
472 | + * vaUnmapBuffer(va_dpy, colorBalanceBuffer); | |
473 | + * \endcode | |
474 | + */ | |
475 | +typedef struct _VAProcFilterParameterBufferColorBalance { | |
476 | + /** \brief Filter type. Shall be set to #VAProcFilterColorBalance. */ | |
477 | + VAProcFilterType type; | |
478 | + /** \brief Color balance attribute. */ | |
479 | + VAProcColorBalanceType attrib; | |
480 | + /** \brief Color balance value. */ | |
481 | + float value; | |
482 | +} VAProcFilterParameterBufferColorBalance; | |
483 | + | |
484 | +/** \brief Color standard filter parametrization. */ | |
485 | +typedef struct _VAProcFilterParameterBufferColorStandard { | |
486 | + /** \brief Filter type. Shall be set to #VAProcFilterColorStandard. */ | |
487 | + VAProcFilterType type; | |
488 | + /** \brief Color standard to use. */ | |
489 | + VAProcColorStandardType standard; | |
490 | +} VAProcFilterParameterBufferColorStandard; | |
491 | + | |
492 | +/** | |
493 | + * \brief Default filter cap specification (single range value). | |
494 | + * | |
495 | + * Unless there is a filter-specific cap structure, #VAProcFilterCap is the | |
496 | + * default type to use for output caps from vaQueryVideoProcFilterCaps(). | |
497 | + */ | |
498 | +typedef struct _VAProcFilterCap { | |
499 | + /** \brief Range of supported values for the filter. */ | |
500 | + VAProcFilterValueRange range; | |
501 | +} VAProcFilterCap; | |
502 | + | |
503 | +/** \brief Capabilities specification for the deinterlacing filter. */ | |
504 | +typedef struct _VAProcFilterCapDeinterlacing { | |
505 | + /** \brief Deinterlacing algorithm. */ | |
506 | + VAProcDeinterlacingType type; | |
507 | + /** \brief Number of forward references needed for deinterlacing. */ | |
508 | + unsigned int num_forward_references; | |
509 | + /** \brief Number of backward references needed for deinterlacing. */ | |
510 | + unsigned int num_backward_references; | |
511 | +} VAProcFilterCapDeinterlacing; | |
512 | + | |
513 | +/** \brief Capabilities specification for the color balance filter. */ | |
514 | +typedef struct _VAProcFilterCapColorBalance { | |
515 | + /** \brief Color balance operation. */ | |
516 | + VAProcColorBalanceType type; | |
517 | + /** \brief Range of supported values for the specified operation. */ | |
518 | + VAProcFilterValueRange range; | |
519 | +} VAProcFilterCapColorBalance; | |
520 | + | |
521 | +/** \brief Capabilities specification for the color standard filter. */ | |
522 | +typedef struct _VAProcFilterCapColorStandard { | |
523 | + /** \brief Color standard type. */ | |
524 | + VAProcColorStandardType type; | |
525 | +} VAProcFilterCapColorStandard; | |
526 | + | |
527 | +/** | |
528 | + * \brief Queries video processing pipeline capabilities. | |
529 | + * | |
530 | + * This function returns the list of video processing filters supported | |
531 | + * by the driver. The \c pipeline_caps array is allocated by the user and | |
532 | + * \c num_pipeline_caps shall be initialized to the number of allocated | |
533 | + * elements in that array. Upon successful return, the actual number | |
534 | + * of filters will be overwritten into \c num_pipeline_caps. Otherwise, | |
535 | + * \c VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned and \c num_pipeline_caps | |
536 | + * is adjusted to the number of elements that would be returned if enough | |
537 | + * space was available. | |
538 | + * | |
539 | + * The list of video processing filters supported by the driver shall | |
540 | + * be ordered in the way they can be iteratively applied. This is needed | |
541 | + * for both correctness, i.e. some filters would not mean anything if | |
542 | + * applied at the beginning of the pipeline; but also for performance | |
543 | + * since some filters can be applied in a single pass (e.g. noise | |
544 | + * reduction + deinterlacing). | |
545 | + * | |
546 | + * @param[in] dpy the VA display | |
547 | + * @param[in] context the video processing context | |
548 | + * @param[out] pipeline_caps the output array of #VAProcPipelineCap elements | |
549 | + * @param[in,out] num_pipeline_caps the number of elements allocated on input, | |
550 | + * the number of elements actually filled in on output | |
551 | + */ | |
552 | +VAStatus | |
553 | +vaQueryVideoProcPipelineCaps( | |
554 | + VADisplay dpy, | |
555 | + VAContextID context, | |
556 | + VAProcPipelineCap *pipeline_caps, | |
557 | + unsigned int *num_pipeline_caps | |
558 | +); | |
559 | + | |
560 | +/** | |
561 | + * \brief Queries video filter capabilities. | |
562 | + * | |
563 | + * This function returns the list of capabilities supported by the driver | |
564 | + * for a specific video filter. The \c filter_caps array is allocated by | |
565 | + * the user and \c num_filter_caps shall be initialized to the number | |
566 | + * of allocated elements in that array. Upon successful return, the | |
567 | + * actual number of filters will be overwritten into \c num_filter_caps. | |
568 | + * Otherwise, \c VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned and | |
569 | + * \c num_filter_caps is adjusted to the number of elements that would be | |
570 | + * returned if enough space was available. | |
571 | + * | |
572 | + * @param[in] dpy the VA display | |
573 | + * @param[in] context the video processing context | |
574 | + * @param[in] type the video filter type | |
575 | + * @param[out] filter_caps the output array of #VAProcFilterCap elements | |
576 | + * @param[in,out] num_filter_caps the number of elements allocated on input, | |
577 | + * the number of elements actually filled in output | |
578 | + */ | |
579 | +VAStatus | |
580 | +vaQueryVideoProcFilterCaps( | |
581 | + VADisplay dpy, | |
582 | + VAContextID context, | |
583 | + VAProcFilterType type, | |
584 | + void *filter_caps, | |
585 | + unsigned int num_filter_caps | |
586 | +); | |
587 | + | |
588 | +/**@}*/ | |
589 | + | |
590 | +#ifdef __cplusplus | |
591 | +} | |
592 | +#endif | |
593 | + | |
594 | +#endif /* VA_VPP_H */ |