# qtimlvconverter
The qtimlvconverter plugin transforms the incoming video buffers into neural-network tensors while performing necessary format conversion and resizing in the process. To achieve these operations, the plugin uses the GPU hardware and ION/DMA allocated buffers.
For floating point tensors, the mean and sigma properties are required to transform the 8-bit unsigned integer images from the video source using the formula:
(channel - mean) × sigma where channel is the value for Red, Green, Blue, or Alpha channels of the color converted input.
For example, the following table lists mean and sigma properties that impact the channel transformation of an image:
| Properties | RGB image with channel transformation |
| --- | --- |
| R=255, G=127, B=0 | R=(255 - 128.0) x 0.75, G=(127 - 156.0) x 0.34, B=(0 - 124.0) x 0.02 |
| mean="<128.0, 156.0, 124.0, 58.0>" | R=(255 - 128.0) x 0.75, G=(127 - 156.0) x 0.34, B=(0 - 124.0) x 0.02 |
| sigma="<0.75, 0.34, 0.02, 0.07>" | R=(255 - 128.0) x 0.75, G=(127 - 156.0) x 0.34, B=(0 - 124.0) x 0.02 |
| | |
| | |
The subpixel-layout property specifies the arrangement of the image pixels in the output tensor.
The plugin uses Qualcomm IB2C library for all conversion operations. This library is wrapped inside the custom GstGlesVideoConverter abstraction layer with APIs to create, configure, and process the incoming and outgoing buffers.
GstMLBufferPool, a custom buffer pool class, can do the following:
- Assign the output buffers.
- Assign ION buffers through IOCTL commands to the kernel.
**Figure : Gstbuffer workflow with qtimlvconverter**
## Inheritance chain
[GObject](https://docs.gtk.org/gobject/) → [GstObject](https://gstreamer.freedesktop.org/documentation/gstreamer/gstobject.html?gi-language=c) → [GstElement](https://gstreamer.freedesktop.org/documentation/gstreamer/gstelement.html?gi-language=c) → [GstBaseTransform](https://gstreamer.freedesktop.org/documentation/base/gstbasetransform.html?gi-language=c) → GstMLVideoConverter
The following tables provide information on pad templates and element properties of qtimlvconverter. For use cases, see [LiteRT use cases](https://docs.qualcomm.com/doc/80-80021-50/topic/tensorflow-lite-use-cases.html) and [Qualcomm Neural Processing SDK use cases](https://docs.qualcomm.com/doc/80-80021-50/topic/qualcomm-neural-processing-sdk-use-cases.html).
## Pad configuration
| **Pad Name** | **Capabilities** | **Capabilities** | **Capabilities** |
| --- | --- | --- | --- |
|
SINK template: 'sink'
Availability: Always
Direction: sink
Availability: Always
Direction: sink
Availability: Always
Direction: source
flags: readable, writable
String. Default: "mlvideoconverter0"
flags: readable, writable
Object of type "GstObject"
flags: readable, writable
Boolean. Default: false
flags: readable, writable
Enum "GstMLVideoPixelLayout" Default: 0, "regular"
(0): regular - Regular subpixel layout. For example, RGB, RGBA, or RGBx.
(1): reverse - Reverse subpixel layout. For example, BGR, BGRA, or BGRx.
flags: readable, writable
GstValueArray of GValues of type "gdouble"
flags: readable, writable
GstValueArray of GValues of type "gdouble"
Value can be "fcv" or "gles"
For Non-GPU device, the default value is fcv. For GPU device, the default value is gles