vvas_xabrscaler - vvas_xabrscaler - 6.2 English - XD056

Vitis Video Analytics SDK (VVAS) 6.2 User Guide (XD056)

Document_ID
XD056
Release_Date
2026-06-12
Version
6.2 English

There are certain situations where the available frame resolution and color format might not be suitable for the next component’s consumption. For instance, in machine learning applications, inputs can be sourced from different resolutions and color formats, but the ML models require a fixed resolution and specific color formats. Thus, it becomes necessary to resize the input image to a different resolution and convert its color space, for example, to BGR.

In some adaptive bit rate (ABR) use cases, a single video is encoded at different bit rates to allow streaming under different network bandwidth conditions without artifacts. This requires the input frame to be decoded, resized to different resolutions, and then re-encoded. To accelerate these processes, vvas_xabrscaler is a GStreamer plug-in that can take one input frame and produce multiple output frames with different resolutions and color formats. This plug-in can also perform the pre-processing operations like mean subtraction, normalization, and cropping. This plugin is HW accelerated.

For insight into the implementation details, refer to the vvas_xabrscaler source code located at: <vvas>/vvas-gst-plugins/sys/abrscaler/.

vvas_xabrscaler is based on the VVAS image processing library.

../../../_images/vvas_xabrscaler_blockdiagram.png

This plug-in supports:

  • Single input, multiple output pads

  • Color space conversion

  • Resize

  • Each output pad has independent resolution and color space conversion capability.

  • Crop of input buffer

Prerequisite

To use this plug-in, VvasImageProcess must be available.

To use the libvvas_image_process_hw_lib.so image process library, the hardware design must have the image_processing kernel available, and it must be configured to support the required color formats and maximum resolution for your application. You can find the configuration details for the image_processing kernel, including the supported maximum resolution and color formats, in /run/media/mmcblk0p1/image_processing.cfg on the board.

Input and Output

vvas_xabrscaler queries VvasImageProcess for the supported input and output formats of all available image-process library implementations. The formats accepted on the sink pad and the formats produced on the source pads can be different:

  • Sink pad caps are generated from the selected library’s supported input formats.

  • Source pad caps are generated from the selected library’s supported output formats.

The pad template caps shown by gst-inspect-1.0 are a superset of all available image-process libraries. However, caps negotiation happens only with the caps of the library selected through library-name. For example, if library-name = libvvas_image_process_hw_lib.so, vvas_xabrscaler uses the input and output capabilities of libvvas_image_process_hw_lib.so for caps negotiation.

Hardware Image Process library (libvvas_image_process_hw_lib.so) format support:

  • Input formats are typically integer pixel formats, such as NV12, RGB, BGR, RGBx, BGRx, and I420.

  • Output formats can include integer pixel formats and VVAS-specific tensor formats when the hardware configuration supports pre-processing output for inference.

  • The exact input and output lists are configured separately in image_processing.cfg through [input-color-formats] and [output-color-formats].

  • For the custom tensor format names that may appear on source pads, see Custom AI Tensor Formats.

  • Resolution: [16 x 16] - [3840 x 2160]

Note

Pad template caps shown in gst-inspect-1.0 are superset caps of all the available image process libraries. If any new library is added or removed, then remove the GStreamer plug-in registry cache file and reinspect to create it again.

rm -rf ~/.cache/gstreamer-1.0

If the plug-in registry cache is not removed, caps shown in gst-inspect-1.0 might not reflect the exact caps of the available image process libraries.

Important

Make sure that the color formats and resolution needed for your application are supported by VvasImageProcess.

Control Parameters and Plug-in Properties

The following table lists the GStreamer plug-in properties supported by the vvas_xabrscaler plug-in.

The following default value of interpolation-mode is the default for library-name, that is, libvvas_image_process_hw_lib.so. vvas_xabrscaler queries these values from VvasImageProcess.

Table 3 vvas_xabrscaler Plug-in Properties

Property Name

Type

Range

Default

Description

avoid-output-copy

Boolean

true/false

False

Avoid output frames copy on all source pads even when the downstream does not support the GstVideoMeta metadata.

enable-pipeline

Boolean

true/false

false

Enable buffer pipelining to improve performance in non zero-copy use cases.

in-mem-bank

Unsigned int

0 - 65535

-1

VVAS input memory bank to allocate memory. If not set, it will be queried from the VVAS core module.

out-mem-bank

Unsigned int

0 - 65535

-1

VVAS output memory bank to allocate memory. If not set, it will be queried from the VVAS core module.

xclbin-location

string

N/A

NULL

The location of the xclbin.

library-name

string

N/A

libvvas_image
_process_hw_lib.so

Image Process library name.

library-config

string

N/A

{“kernel-name”:
“image_processing:
{image_processing_1}
“}

Image Process library configuration string. The default value is only valid for the libvvas_image_process_hw_lib.so library.

interpolation-mode

integer

0, 1, 2

0

Interpolation Mode to use: 0: BILINEAR 1: BICUBIC 2: POLYPHASE Default is 0 (BILINEAR) for the hardware image-process library (libvvas_image_process_hw_lib.so).

alpha-b

float

0 to 128

0

Mean subtraction for the blue channel, needed for PPE.

alpha-g

float

0 to 128

0

Mean subtraction for the green channel, needed for PPE.

alpha-r

float

0 to 128

0

Mean subtraction for the red channel, needed for PPE.

beta-b

float

0 to 1

1

Scaling for the blue channel, needed for PPE.

beta-g

float

0 to 1

1

Scaling for the green channel, needed for PPE.

beta-r

float

0 to 1

1

Scaling for the red channel, needed for PPE.

crop-x

unsigned integer

0 to 3840

0

Crop X coordinate.

crop-y

unsigned integer

0 to 2160

0

Crop Y coordinate.

crop-width

unsigned integer

0 to 3840

0

Crop width. If this is 0 or not set, it will be calculated as input width - crop-x.

crop-height

unsigned integer

0 to 2160

0

Crop height. If this is 0 or not set, it will be calculated as input height - crop-y.

software-scaling

Boolean

true/false

false

Retained for GObject compatibility. The software image-process library is not supported in this release; keep false and use libvvas_image_process_hw_lib.so with the image_processing kernel.

maintain-aspect-ratio

Boolean

true/false

false

Maintains the aspect ratio in the output with the aspect ratio of the input video.

quantization-factor

float

1.0 - 256.0

1.0

Quantization factor.

Note

The image-processing library has some alignment requirements, so the user given parameters for crop are aligned as per the library requirement; alignment ensures that it covers the region of crop that you specify, so the final cropped image might have extra pixels cropped.

This plug-in queries the quantization-factor from the downstream vvas_xinfer plug-in (if available) and applies it if you have not set the quantization-factor. You can override the vvas_xinfer suggested values by setting the quantization-factor property. The quantization factor is multiplied to the beta values.

The maximum value of crop-x, crop-y, crop-width, and crop-height are as per the maximum resolution supported by VvasImageProcess. vvas_xabrscaler will query these values from VvasImageProcess and update them accordingly.

Example Pipelines

The following are the example pipelines for single and multiple outputs from scaler plugin.

One input One Output

The following example configures vvas_xabrscaler in one input and one output mode. The input to the library is 1280 x 720, NV12 frames that are resized to 640 x 360 resolution, and the color format is changed from NV12 to BGR. For using the pre-built scaler implementation, the default property values for properties “library-name”, “library-config” etc suffies. Change these properties only if you are using a custom implementation.

gst-launch-1.0 videotestsrc num-buffers=100 \
! "video/x-raw, width=1280, height=720, format=NV12" \
! vvas_xabrscaler xclbin-location=/run/media/mmcblk0p1/x_plus_ml.xclbin \
! "video/x-raw, width=640, height=360, format=BGR" ! filesink location=out_360p.bgr -v

One Input Multiple Output

The following example configures vvas_xabrscaler for one input and three outputs. The input is 1920 x 1080 resolution in a NV12 format. There are three output formats:

  • 1280 x 720 in BGR format

  • 300 x 300 in RGB format

  • 640 x 480 in NV12 format

gst-launch-1.0 videotestsrc num-buffers=100 \
! "video/x-raw, width=1920, height=1080, format=NV12, framerate=60/1" \
! vvas_xabrscaler xclbin-location=/run/media/mmcblk0p1/x_plus_ml.xclbin name=sc sc.src_0 \
! queue \
! "video/x-raw, width=1280, height=720, format=BGR" \
! filesink location=out_720p.bgr sc.src_1 \
! queue \
! "video/x-raw, width=300, height=300, format=RGB" \
! filesink location=out_300p.rgb sc.src_2 \
! queue \
! "video/x-raw, width=640, height=480, format=NV12" \
! filesink location=out_480p.nv12 -v

Crop with Multiple Outputs

The following example configures vvas_xabrscaler for one input and three outputs. The input is 1920 x 1080 resolution in a NV12 format. This input is cropped at X:140, Y:300, Width:640, Height:480.

The cropped input is scaled and converted to the following format:

  • 640 * 480 in RGB format

  • 320 * 240 in RGB format

  • 256 * 256 in NV12 format

gst-launch-1.0 -v \
videotestsrc num-buffers=10 ! video/x-raw,format=NV12,width=1920,height=1080 \
! vvas_xabrscaler xclbin-location=/run/media/mmcblk0p1/x_plus_ml.xclbin crop-x=140 crop-y=300 crop-width=640 crop-height=480 name=sc \
sc.src_0 ! queue ! video/x-raw,format=RGB,width=640,height=480 ! filesink location=out_480p.rgb \
sc.src_1 ! queue ! video/x-raw,format=RGB,width=320,height=240 ! filesink location=out_240p.rgb \
sc.src_2 ! queue ! video/x-raw,format=NV12,width=256,height=256 ! filesink location=out_256p.nv12 -v