news 2026/10/28 18:29:13

libva中的视频后处理(vpp)模块

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
libva中的视频后处理(vpp)模块

主要内容

本文主要就libva中的视频后处理流程进行简单说明,libva版本位libva-2.6.0(版本号为1.6.0),视频后处理是很多显卡具备的一项基本功能,视频后处理主要包括格式转换,颜色调节,颜色控件转换,视频截图,视频合成,去噪,锐化等操作,不同的硬件厂商提供的功能不一样。

相关术语

VPP:Video Post Process,视频后处理
Pipeline:一系列处理的流程的简称
Filter:过滤器,指的是pipeline中操作的种类
HVS: Human Vision System ,人类视觉系统

相关结构体和接口

VABlendState

typedef struct _VABlendState { //视频混合标志位,可以设置为 //VA_BLEND_GLOBAL_ALPHA,VA_BLEND_PREMULTIPLIED_ALPHA(only RGBA),VA_BLEND_LUMA_KEY(only YUV) unsigned int flags; //当flag是VA_BLEND_GLOBAL_ALPHA时有效,范围为[0.0,1.0] float global_alpha; //当flag是VA_BLEND_LUMA_KEY时有效,范围为[0.0,1.0],应该设置为小于max_luma float min_luma; float max_luma; } VABlendState;

VAProcFilterValueRange

typedef struct _VAProcFilterValueRange { //Filter的值的范围,最大,最小,默认值以及步长 float min_value; float max_value; float default_value; float step; uint32_t va_reserved[VA_PADDING_LOW]; } VAProcFilterValueRange;

VAProcColorProperties

typedef struct _VAProcColorProperties { //色度采样位置,VA_CHROMA_SITING_UNKNOWN, VA_CHROMA_SITING_VERTICAL_TOP VA_CHROMA_SITING_VERTICAL_CENTER, VA_CHROMA_SITING_VERTICAL_BOTTOM, VA_CHROMA_SITING_HORIZONTAL_LEFT, VA_CHROMA_SITING_HORIZONTAL_CENTER uint8_t chroma_sample_location; //颜色范围 VA_SOURCE_RANGE_UNKNOWN,VA_SOURCE_RANGE_REDUCED,VA_SOURCE_RANGE_FULL uint8_t color_range; /** Colour primaries. * * See ISO/IEC 23001-8 or ITU H.273, section 8.1 and table 2. * Only used if the color standard in use is \c VAColorStandardExplicit. * Below list the typical colour primaries for the reference. * --------------------------------------------------------------------------------- * | Value | Primaries | Informative Remark | * -------------------------------------------------------------------------------- * | 1 |primary x y |Rec.ITU-R BT.709-5 | * | |green 0.300 0.600 |IEC 61966-2-1(sRGB or sYCC) | * | |blue 0.150 0.060 | | * | |red 0.640 0.330 | | * | |whiteD65 0.3127 0.3290 | | * --------------------------------------------------------------------------------- * | 6 |primary x y |Rec.ITU-R BT.601-6 525 | * | |green 0.310 0.595 | | * | |blue 0.155 0.070 | | * | |red 0.630 0.340 | | * | |whiteD65 0.3127 0.3290 | | * --------------------------------------------------------------------------------- * | 9 |primary x y |Rec.ITU-R BT.2020 | * | |green 0.170 0.797 | | * | |blue 0.131 0.046 | | * | |red 0.708 0.292 | | * | |whiteD65 0.3127 0.3290 | | * --------------------------------------------------------------------------------- */ //颜色元素[1,6,9] uint8_t colour_primaries; /** Transfer characteristics. * * See ISO/IEC 23001-8 or ITU H.273, section 8.2 and table 3. * Only used if the color standard in use is \c VAColorStandardExplicit. * Below list the typical transfer characteristics for the reference. * ----------------------------------------------------------- * | Value | Informative Remark | * ----------------------------------------------------------- * | 1 |Rec.ITU-R BT.709-5 | * | |colour gamut system | * ----------------------------------------------------------- * | 4 |Assumed display gamma 2.2 | * ----------------------------------------------------------- * | 6 |Rec.ITU-R BT.601-6 525 or 625 | * ----------------------------------------------------------- * | 8 |Linear transfer characteristics | * ----------------------------------------------------------- * | 13 |IEC 61966-2-1(sRGB or sYCC) | * ----------------------------------------------------------- * | 14,15 |Rec.ITU-R BT.2020 | * ----------------------------------------------------------- * | 16 |SMPTE ST 2084 for 10,12,14 and 16bit system | * ----------------------------------------------------------- */ //转换特性[1,4,6,8,13,14,15,16] uint8_t transfer_characteristics; /** Matrix coefficients. * * See ISO/IEC 23001-8 or ITU H.273, section 8.3 and table 4. * Only used if the color standard in use is \c VAColorStandardExplicit. */ //矩阵系数 uint8_t matrix_coefficients; /** Reserved bytes for future use, must be zero. */ uint8_t reserved[3]; } VAProcColorProperties;

VAHdrMetaDataHDR10

typedef struct _VAHdrMetaDataHDR10 { /** * \brief X chromaticity coordinate of the mastering display. * * Index value c equal to 0 should correspond to the green primary. * Index value c equal to 1 should correspond to the blue primary. * Index value c equal to 2 should correspond to the red primary. * The value for display_primaries_x shall be in the range of 0 to 50000 inclusive. */ uint16_t display_primaries_x[3]; /** * \brief Y chromaticity coordinate of the mastering display. * * Index value c equal to 0 should correspond to the green primary. * Index value c equal to 1 should correspond to the blue primary. * Index value c equal to 2 should correspond to the red primary. * The value for display_primaries_y shall be in the range of 0 to 50000 inclusive. */ uint16_t display_primaries_y[3]; /** * \brief X chromaticity coordinate of the white point of the mastering display. * * The value for white_point_x shall be in the range of 0 to 50000 inclusive. */ uint16_t white_point_x; /** * \brief Y chromaticity coordinate of the white point of the mastering display. * * The value for white_point_y shall be in the range of 0 to 50000 inclusive. */ uint16_t white_point_y; /** * \brief The maximum display luminance of the mastering display. * * The value is in units of 0.0001 candelas per square metre. */ uint32_t max_display_mastering_luminance; /** * \brief The minumum display luminance of the mastering display. * * The value is in units of 0.0001 candelas per square metre. */ uint32_t min_display_mastering_luminance; /** * \brief The maximum content light level. * * The value is in units of 0.0001 candelas per square metre. */ uint16_t max_content_light_level; /** * \brief The maximum picture average light level. * * The value is in units of 0.0001 candelas per square metre. */ uint16_t max_pic_average_light_level; /** Resevered */ uint16_t reserved[VA_PADDING_HIGH]; } VAHdrMetaDataHDR10;

VAProcPipelineCaps

typedef struct _VAProcPipelineCaps { //后处理流程标志位 //VA_PROC_PIPELINE_SUBPICTURES(处理surface的时候是否处理subpicture) //VA_PROC_PIPELINE_FAST(选择耗能或者节能模式), //VA_PIPELINE_FLAG_END uint32_t pipeline_flags; //VA_PROC_FILTER_MANDATORY(指定filter是否会在展现在pipeline中) uint32_t filter_flags; //指定前向参考帧的数目 uint32_t num_forward_references; //指定后向参考帧的数目 uint32_t num_backward_references; //指定输入帧的的颜色空间标准 VAProcColorStandardType *input_color_standards; //指定输入帧支持的的颜色空间数目 uint32_t num_input_color_standards; /** \brief List of color standards supported on output. */ //指定输出帧的颜色空间标准 VAProcColorStandardType *output_color_standards; //指定输出帧支持的的颜色空间数目 uint32_t num_output_color_standards; //旋转角度,VA_ROTATION_NONE,VA_ROTATION_90,VA_ROTATION_180,VA_ROTATION_270 uint32_t rotation_flags; //视频混合标志位,可以设置为 //VA_BLEND_GLOBAL_ALPHA,VA_BLEND_PREMULTIPLIED_ALPHA(only RGBA),VA_BLEND_LUMA_KEY(only YUV) uint32_t blend_flags; //镜像方向,VA_MIRROR_NONE,VA_MIRROR_HORIZONTAL,VA_MIRROR_VERTICAL uint32_t mirror_flags; //其他输出surface数组 VASurfaceID *additional_outputs; //其他输出surface数目 uint32_t num_additional_outputs; //输入像素格式的数目 uint32_t num_input_pixel_formats; //输入像素格式的数组(FOURCC格式) uint32_t *input_pixel_format; //输出像素格式的数目 uint32_t num_output_pixel_formats; //输出像素格式的数组(FOURCC格式) uint32_t *output_pixel_format; //最大,最小输入输出的surface的尺寸 uint32_t max_input_width; uint32_t max_input_height; uint32_t min_input_width; uint32_t min_input_height; uint32_t max_output_width; uint32_t max_output_height; uint32_t min_output_width; uint32_t min_output_height; //保留 #if defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__) || defined(__LP64__) uint32_t va_reserved[VA_PADDING_HIGH - 2]; #else uint32_t va_reserved[VA_PADDING_HIGH]; #endif } VAProcPipelineCaps;

VAProcFilterCapHighDynamicRange

typedef struct _VAProcFilterCapHighDynamicRange { /** \brief high dynamic range type. */ VAProcHighDynamicRangeMetadataType metadata_type; /** * \brief flag for high dynamic range tone mapping * * The flag is the combination of VA_TONE_MAPPING_XXX_TO_XXX. * It could be VA_TONE_MAPPING_HDR_TO_HDR | VA_TONE_MAPPING_HDR_TO_SDR. * SDR content to SDR display is always supported by default since it is legacy path. */ uint16_t caps_flag; /** \brief Reserved bytes for future use, must be zero */ uint16_t va_reserved[VA_PADDING_HIGH]; } VAProcFilterCapHighDynamicRange;

VAHdrMetaData

typedef struct _VAHdrMetaData { /** \brief high dynamic range metadata type, HDR10 etc. */ VAProcHighDynamicRangeMetadataType metadata_type; /** * \brief Pointer to high dynamic range metadata. * * The pointer could point to VAHdrMetaDataHDR10 or other HDR meta data. */ void* metadata; /** * \brief Size of high dynamic range metadata. */ uint32_t metadata_size; /** \brief Reserved bytes for future use, must be zero */ uint32_t reserved[VA_PADDING_LOW]; } VAHdrMetaData;

VAProcPipelineParameterBuffer

typedef struct _VAProcPipelineParameterBuffer { //待处理的suface,如果VA_PROC_PIPELINE_SUBPICTURES 被设置, //surface上的subpicture应该一起被处理渲染到targe surface VASurfaceID surface; //待处理surface的范围 const VARectangle *surface_region; //颜色标准 VAProcColorStandardType surface_color_standard; //输出到output surface的范围,此选项可以对源surface进行缩放到目标surface const VARectangle *output_region; //背景色,背景色应该填充到指定输出区域的外部,并且格式为ARGB,[31:24] alpha, [23:16] red, [15:8] green, [7:0] blue. //除非alpha值是0,或者输出区域代表整个target surface的大小,driver实现功能时,不能直接渲染源surface到target surface //driver应该适应一个临时的surface,并用适当的颜色填充它,接下来,driver将其混合到target surface uint32_t output_background_color; /** * \brief Requested output color standard. * * If this is set to VAProcColorStandardExplicit, the color properties * are specified explicitly in output_color_properties instead. */ VAProcColorStandardType output_color_standard; /** * \brief Pipeline filters. See video pipeline flags. * * Flags to control the pipeline, like whether to apply subpictures * or not, notify the driver that it can opt for power optimizations, * should this be needed. */ uint32_t pipeline_flags; /** * \brief Extra filter flags. See vaPutSurface() flags. * * Filter flags are used as a fast path, wherever possible, to use * vaPutSurface() flags instead of explicit filter parameter buffers. * * Allowed filter flags API-wise. Use vaQueryVideoProcPipelineCaps() * to check for implementation details: * - Bob-deinterlacing: \c VA_FRAME_PICTURE, \c VA_TOP_FIELD, * \c VA_BOTTOM_FIELD. Note that any deinterlacing filter * (#VAProcFilterDeinterlacing) will override those flags. * - Color space conversion: \c VA_SRC_BT601, \c VA_SRC_BT709, * \c VA_SRC_SMPTE_240. * - Scaling: \c VA_FILTER_SCALING_DEFAULT, \c VA_FILTER_SCALING_FAST, * \c VA_FILTER_SCALING_HQ, \c VA_FILTER_SCALING_NL_ANAMORPHIC. */ uint32_t filter_flags; /** * \brief Array of filters to apply to the surface. * * The list of filters shall be ordered in the same way the driver expects * them. i.e. as was returned from vaQueryVideoProcFilters(). * Otherwise, a #VA_STATUS_ERROR_INVALID_FILTER_CHAIN is returned * from vaRenderPicture() with this buffer. * * #VA_STATUS_ERROR_UNSUPPORTED_FILTER is returned if the list * contains an unsupported filter. * */ VABufferID *filters; /** \brief Actual number of filters. */ uint32_t num_filters; /** \brief Array of forward reference frames. */ VASurfaceID *forward_references; /** \brief Number of forward reference frames that were supplied. */ uint32_t num_forward_references; /** \brief Array of backward reference frames. */ VASurfaceID *backward_references; /** \brief Number of backward reference frames that were supplied. */ uint32_t num_backward_references; /** * \brief Rotation state. See rotation angles. * * The rotation angle is clockwise. There is no specific rotation * center for this operation. Rather, The source \ref surface is * first rotated by the specified angle and then scaled to fit the * \ref output_region. * * This means that the top-left hand corner (0,0) of the output * (rotated) surface is expressed as follows: * - \ref VA_ROTATION_NONE: (0,0) is the top left corner of the * source surface -- no rotation is performed ; * - \ref VA_ROTATION_90: (0,0) is the bottom-left corner of the * source surface ; * - \ref VA_ROTATION_180: (0,0) is the bottom-right corner of the * source surface -- the surface is flipped around the X axis ; * - \ref VA_ROTATION_270: (0,0) is the top-right corner of the * source surface. * * Check VAProcPipelineCaps::rotation_flags first prior to * defining a specific rotation angle. Otherwise, the hardware can * perfectly ignore this variable if it does not support any * rotation. */ uint32_t rotation_state; /** * \brief blending state. See "Video blending state definition". * * If \ref blend_state is NULL, then default operation mode depends * on the source \ref surface format: * - RGB: per-pixel alpha blending ; * - YUV: no blending, i.e override the underlying pixels. * * Otherwise, \ref blend_state is a pointer to a #VABlendState * structure that shall be live until vaEndPicture(). * * Implementation note: the driver is responsible for checking the * blend state flags against the actual source \ref surface format. * e.g. premultiplied alpha blending is only applicable to RGB * surfaces, and luma keying is only applicable to YUV surfaces. * If a mismatch occurs, then #VA_STATUS_ERROR_INVALID_BLEND_STATE * is returned. */ const VABlendState *blend_state; /** * \bried mirroring state. See "Mirroring directions". * * Mirroring of an image can be performed either along the * horizontal or vertical axis. It is assumed that the rotation * operation is always performed before the mirroring operation. */ uint32_t mirror_state; /** \brief Array of additional output surfaces. */ VASurfaceID *additional_outputs; /** \brief Number of additional output surfaces. */ uint32_t num_additional_outputs; /** * \brief Flag to indicate the input surface flag * * bit0~3: Surface sample type * - 0000: Progressive --> VA_FRAME_PICTURE * - 0001: Single Top Field --> VA_TOP_FIELD * - 0010: Single Bottom Field --> VA_BOTTOM_FIELD * - 0100: Interleaved Top Field First --> VA_TOP_FIELD_FIRST * - 1000: Interleaved Bottom Field First --> VA_BOTTOM_FIELD_FIRST * * For interlaced scaling, examples as follow: * - 1. Interleaved to Interleaved (Suppose input is top field first) * -- set input_surface_flag as VA_TOP_FIELD_FIRST * -- set output_surface_flag as VA_TOP_FIELD_FIRST * - 2. Interleaved to Field (Suppose input is top field first) * An interleaved frame need to be passed twice. * First cycle to get the first field: * -- set input_surface_flag as VA_TOP_FIELD_FIRST * -- set output_surface_flag as VA_TOP_FIELD * Second cycle to get the second field: * -- set input_surface_flag as VA_TOP_FIELD_FIRST * -- set output_surface_flag as VA_BOTTOM_FIELD * - 3. Field to Interleaved (Suppose first field is top field) * -- create two surfaces, one for top field, the other for bottom field * -- set surface with the first field surface id * -- set backward_reference with the second field surface id * -- set input_surface_flag as VA_TOP_FIELD * -- set output_surface_flag as VA_TOP_FIELD_FIRST * - 4. Field to Field: * -- set flag according to each frame. * * bit31: Surface encryption * - 0: non-protected * - 1: protected * * bit4~30 for future */ uint32_t input_surface_flag; /** * \brief Flag to indicate the output surface flag * * bit0~3: Surface sample type * - 0000: Progressive --> VA_FRAME_PICTURE * - 0001: Top Field --> VA_TOP_FIELD * - 0010: Bottom Field --> VA_BOTTOM_FIELD * - 0100: Top Field First --> VA_TOP_FIELD_FIRST * - 1000: Bottom Field First --> VA_BOTTOM_FIELD_FIRST * * bit31: Surface encryption * - 0: non-protected * - 1: protected * * bit4~30 for future */ uint32_t output_surface_flag; /** * \brief Input Color Properties. See "VAProcColorProperties". */ VAProcColorProperties input_color_properties; /** * \brief Output Color Properties. See "VAProcColorProperties". */ VAProcColorProperties output_color_properties; /** * \brief Processing mode. See "VAProcMode". */ VAProcMode processing_mode; /** * \brief Output High Dynamic Metadata. * * If output_metadata is NULL, then output default to SDR. */ VAHdrMetaData *output_hdr_metadata; /** \brief Reserved bytes for future use, must be zero */ #if defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__)|| defined(__LP64__) uint32_t va_reserved[VA_PADDING_LARGE - 16]; #else uint32_t va_reserved[VA_PADDING_LARGE - 13]; #endif } VAProcPipelineParameterBuffer;

VAProcFilterParameterBufferBase

typedef struct _VAProcFilterParameterBufferBase { //Filter类型,此结构体主要用于driver中各项结构体的type的访问,用户层一般不使用 VAProcFilterType type; } VAProcFilterParameterBufferBase;

VAProcFilterParameterBuffer

typedef struct _VAProcFilterParameterBuffer { //Filter类型 VAProcFilterType type; //参数值 float value; //保留 uint32_t va_reserved[VA_PADDING_LOW]; } VAProcFilterParameterBuffer;

VAProcFilterParameterBufferDeinterlacing

typedef struct _VAProcFilterParameterBufferDeinterlacing { //Filter类型,当Filter Type为VAProcFilterDeinterlacing时有效,功能是去交织 VAProcFilterType type; //去交织的算法类型,包括Bob,Weave等 VAProcDeinterlacingType algorithm; //去交织的标志位 uint32_t flags; //保留 uint32_t va_reserved[VA_PADDING_LOW]; } VAProcFilterParameterBufferDeinterlacing;

VAProcFilterParameterBufferColorBalance

typedef struct _VAProcFilterParameterBufferColorBalance { //Filter类型,当Filter Type为VAProcFilterColorBalance时有效,功能是颜色平衡 VAProcFilterType type; //VAProcFilterColorBalance的类型,包括Hue,Brightness,Saturation,Contrast VAProcColorBalanceType attrib; //相关VAProcFilterColorBalance的值,每一种的值的范围不一样 float value; //保留 uint32_t va_reserved[VA_PADDING_LOW]; } VAProcFilterParameterBufferColorBalance;

VAProcFilterParameterBufferTotalColorCorrection

typedef struct _VAProcFilterParameterBufferTotalColorCorrection { //Filter类型,当Filter Type为VAProcFilterTotalColorCorrection时有效,功能是颜色矫正 VAProcFilterType type; //VAProcFilterColorBalance的类型,包括Red,Green,Blue,Yellow VAProcTotalColorCorrectionType attrib; //颜色值 float value; } VAProcFilterParameterBufferTotalColorCorrection;

VAProcFilterParameterBufferHVSNoiseReduction

typedef struct _VAProcFilterParameterBufferHVSNoiseReduction { //Filter类型,当Filter Type为VAProcFilterHVSNoiseReduction时有效,功能是降噪 VAProcFilterType type; //QP值,用于编码 uint16_t qp; //降噪步长,用于控制降噪程度,完全不使用(0),极大程度降噪(16),默认(10) uint16_t strength; //保留 uint16_t va_reserved[VA_PADDING_HIGH]; } VAProcFilterParameterBufferHVSNoiseReduction;

VAProcFilterParameterBufferHDRToneMapping

typedef struct _VAProcFilterParameterBufferHDRToneMapping { //Filter类型,当Filter Type为VAProcFilterHighDynamicRangeToneMapping时有效,功能是HDR映射, //将普通的帧转化为HDR帧 VAProcFilterType type; //HDR的meta数据 VAHdrMetaData data; //保留 uint32_t va_reserved[VA_PADDING_HIGH]; } VAProcFilterParameterBufferHDRToneMapping;

VAProcFilterCap

typedef struct _VAProcFilterCap { //Filter支持的值的范围 VAProcFilterValueRange range; //保留 uint32_t va_reserved[VA_PADDING_LOW]; } VAProcFilterCap;

VAProcFilterCapDeinterlacing

typedef struct _VAProcFilterCapDeinterlacing { //去交织Filter支持的类型 VAProcDeinterlacingType type; uint32_t va_reserved[VA_PADDING_LOW]; } VAProcFilterCapDeinterlacing;

VAProcFilterCapColorBalance

typedef struct _VAProcFilterCapColorBalance { //颜色平衡操作类型 VAProcColorBalanceType type; //颜色平衡操作类型支持的值的范围 VAProcFilterValueRange range; uint32_t va_reserved[VA_PADDING_LOW]; } VAProcFilterCapColorBalance;

VAProcFilterCapTotalColorCorrection

typedef struct _VAProcFilterCapTotalColorCorrection { //颜色矫正的类型 VAProcTotalColorCorrectionType type; VAProcFilterValueRange range; } VAProcFilterCapTotalColorCorrection;

API

API说明其他
vaQueryVideoProcFilters查询VPP的Filter
vaQueryVideoProcFilterCaps查询VPP的Filter的能力
vaQueryVideoProcPipelineCaps查询VPP的pipeline的种类

使用流程

VAEntrypoint entrypoints; int i, num_entrypoints, supportsVideoProcessing = 0; num_entrypoints = vaMaxNumEntrypoints(); entrypoints = malloc(num_entrypoints sizeof(entrypoints[0]); vaQueryConfigEntrypoints(va_dpy, VAProfileNone, entrypoints, &num_entrypoints); for (i = 0; !supportsVideoProcessing && i < num_entrypoints; i++) { if (entrypoints[i] == VAEntrypointVideoProc) supportsVideoProcessing = 1; } VAProcFilterType filters[VAProcFilterCount]; unsigned int num_filters = VAProcFilterCount; vaQueryVideoProcFilters(va_dpy, vpp_ctx, &filters, &num_filters); VAProcFilterCap denoise_caps; unsigned int num_denoise_caps = 1; vaQueryVideoProcFilterCaps(va_dpy, vpp_ctx, VAProcFilterNoiseReduction, &denoise_caps, &num_denoise_caps ); VAProcFilterCapDeinterlacing deinterlacing_caps[VAProcDeinterlacingCount]; unsigned int num_deinterlacing_caps = VAProcDeinterlacingCount; vaQueryVideoProcFilterCaps(va_dpy, vpp_ctx, VAProcFilterDeinterlacing, &deinterlacing_caps, &num_deinterlacing_caps ); // Create filters VABufferID denoise_filter, deint_filter; VABufferID filter_bufs[VAProcFilterCount]; unsigned int num_filter_bufs; for (i = 0; i < num_filters; i++) { switch (filters[i]) { case VAProcFilterNoiseReduction: { // Noise reduction filter VAProcFilterParameterBuffer denoise; denoise.type = VAProcFilterNoiseReduction; denoise.value = 0.5; vaCreateBuffer(va_dpy, vpp_ctx, VAProcFilterParameterBufferType, sizeof(denoise), 1, &denoise, &denoise_filter ); filter_bufs[num_filter_bufs++] = denoise_filter; break; } case VAProcFilterDeinterlacing: // Motion-adaptive deinterlacing for (j = 0; j < num_deinterlacing_caps; j++) { VAProcFilterCapDeinterlacing const cap = &deinterlacing_caps[j]; if (cap->type != VAProcDeinterlacingMotionAdaptive) continue; VAProcFilterParameterBufferDeinterlacing deint; deint.type = VAProcFilterDeinterlacing; deint.algorithm = VAProcDeinterlacingMotionAdaptive; vaCreateBuffer(va_dpy, vpp_ctx, VAProcFilterParameterBufferType, sizeof(deint), 1, &deint, &deint_filter ); filter_bufs[num_filter_bufs++] = deint_filter; } } } VAProcPipelineCaps pipeline_caps; VASurfaceID forward_references; unsigned int num_forward_references; VASurfaceID backward_references; unsigned int num_backward_references; VAProcColorStandardType in_color_standards[VAProcColorStandardCount]; VAProcColorStandardType out_color_standards[VAProcColorStandardCount]; pipeline_caps.input_color_standards = NULL; pipeline_caps.num_input_color_standards = ARRAY_ELEMS(in_color_standards); pipeline_caps.output_color_standards = NULL; pipeline_caps.num_output_color_standards = ARRAY_ELEMS(out_color_standards); vaQueryVideoProcPipelineCaps(va_dpy, vpp_ctx, filter_bufs, num_filter_bufs, &pipeline_caps ); num_forward_references = pipeline_caps.num_forward_references; forward_references = malloc(num__forward_references sizeof(VASurfaceID)); num_backward_references = pipeline_caps.num_backward_references; backward_references = malloc(num_backward_references sizeof(VASurfaceID)); foreach (iteration) { vaBeginPicture(va_dpy, vpp_ctx, vpp_surface); foreach (surface) { VARectangle output_region; VABufferID pipeline_buf; VAProcPipelineParameterBuffer pipeline_param; vaCreateBuffer(va_dpy, vpp_ctx, VAProcPipelineParameterBuffer, sizeof(pipeline_param), 1, NULL, &pipeline_buf ); // Setup output region for this surface // e.g. upper left corner for the first surface output_region.x = BORDER; output_region.y = BORDER; output_region.width = (vpp_surface_width - (Nx_surfaces + 1) BORDER) / Nx_surfaces; output_region.height = (vpp_surface_height - (Ny_surfaces + 1) BORDER) / Ny_surfaces; vaMapBuffer(va_dpy, pipeline_buf, &pipeline_param); pipeline_param->surface = surface; pipeline_param->surface_region = NULL; pipeline_param->output_region = &output_region; pipeline_param->output_background_color = 0; if (first surface to render) pipeline_param->output_background_color = 0xff000000; // black pipeline_param->filter_flags = VA_FILTER_SCALING_HQ; pipeline_param->filters = filter_bufs; pipeline_param->num_filters = num_filter_bufs; vaUnmapBuffer(va_dpy, pipeline_buf); // Update reference frames for deinterlacing, if necessary pipeline_param->forward_references = forward_references; pipeline_param->num_forward_references = num_forward_references_used; pipeline_param->backward_references = backward_references; pipeline_param->num_backward_references = num_bacward_references_used; // Apply filters vaRenderPicture(va_dpy, vpp_ctx, &pipeline_buf, 1); } vaEndPicture(va_dpy, vpp_ctx); }
版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/10/28 18:27:25

智能机器人核心技术演进与应用实践

1. 智能机器人技术演进全景2026年的智能机器人正在经历一场由内而外的全面革新。不同于早期只能执行固定程序的机械臂&#xff0c;新一代机器人融合了多模态感知、自主决策和柔性交互三大核心能力。我在参与某工业质检机器人项目时&#xff0c;亲眼见证了一套视觉系统从只能识别…

作者头像 李华
网站建设 2026/10/28 18:26:38

Python 调用 MaxScript:MXSPyCOM 跨进程实战

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

作者头像 李华
网站建设 2026/10/28 18:25:50

自动驾驶SoC:行泊一体提速,存算一体与Chiplet技术变革

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

作者头像 李华
网站建设 2026/10/28 18:24:27

FlexiTac开源:触觉传感规模化与机器人学习基础设施

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

作者头像 李华
网站建设 2026/10/28 18:24:25

YOLOv7与四种多目标跟踪算法离线对比:从数据转换到评测避坑

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

作者头像 李华
网站建设 2026/10/28 18:22:24

基于PSoC CLB-MACO的LLC软启动谐振电流限制方案

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

作者头像 李华