Dynamic Cropping - Dynamic Cropping - 6.3 English - XD056

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

Document_ID
XD056
Release_Date
2026-09-24
Version
6.3 English

Dynamic cropping is for cropping multiple objects from the input frame. Dynamic crop coordinates must be attached to the input frame as GstVideoRegionOfInterestMeta metadata, and GstVideoRegionOfInterestMeta->roi_type must be set to “roi-crop-meta”. Each instance of GstVideoRegionOfInterestMeta in the buffer represents a single object for dynamic crop.

The vvas_xmulticrop plug-in dynamically crops the object and attaches the cropped objects/buffers to the output buffer in GstVideoRegionOfInterestMeta->params. GstVideoRegionOfInterestMeta->params is a GList* of GstStructure. The dynamically cropped buffer is attached to this field, with the name of the GstStructure as “roi-buffer”. This GstStructure has only one field “sub-buffer”, which is of a type GST_TYPE_BUFFER. You must extract this cropped buffer, use it, and then unref it.

You choose to resize these cropped buffers to some width and height by setting the d-height and d-width properties. If these properties are not set, then cropped buffers will not be resized.

You can also decide the format of dynamically cropped buffers by setting the d-format GStreamer property. If this property is not set, then all cropped buffers will have the same format as of the input buffer format.

The user-specified pre-processing is applied only to dynamically cropped buffers. If you want it to be applied to the output buffer/statically cropped buffer as well, set the ppe-on-main buffer GStreamer property.

Dynamic object is not cropped when crop coordinates or crop resolution is not proper in the attached GstVideoRegionOfInterestMeta metadata and that metadata is skipped in dynamic cropping. The vvas_xmulticrop plug-in might align the crop parameters as per the IP requirement, aligned values are updated in GstVideoRegionOfInterestMeta. GstVideoRegionOfInterestMeta, which are skipped, will have GstVideoRegionOfInterestMeta->params as NULL.

It is possible to perform both static and dynamic cropping simultaneously. As previously explained, the statically cropped buffer is sent on the source pad, while the dynamically cropped buffers are attached as metadata to the output buffer.

vvas_xmulticrop supports at max 39 dynamic crops. The memory for dynamically cropped buffers is allocated from a GStreamer buffer pool, and there is no upper limit on this buffer pool. However, if the buffers are not freed, new buffers will be allocated, potentially leading to increased memory consumption.