> ## Documentation Index
> Fetch the complete documentation index at: https://docs.t3gemstone.org/llms.txt
> Use this file to discover all available pages before exploring further.

# VXLIB

> Using image processing functions with acceleration chips

<Tip>C7-based MCU projects using VXLIB run via the DSP accelerator core within the processor. This allows
image processing, filtering, feature extraction, and intensive matrix/pixel operations to be hardware-accelerated,
significantly boosting performance in real-time applications.</Tip>

VXLIB provides the following core image processing capabilities:

* Image filtering
* Statistical information extraction
* Feature detection
* Tracking and recognition
* Low-level pixel processing

These cores can be used as fundamental building blocks in the following application areas:

* Video Analytics
* Video Surveillance
* Automotive Image Processing
* Embedded Image Processing
* Gaming and Entertainment Imaging Systems
* Industrial Machine Vision
* Consumer Electronics
* Augmented Reality

## Example Project

A working example project that you can examine as a reference for VXLIB library integration is provided
in the `MCU` directory within T3 Gemstone's GitHub `examples` repository.

While inside the `devbox shell` within the examples repository, you should run the following command.

```bash theme={"system"}
PROJECT=mcu task clean build
```

The `vxlib_demo.out` file located in `examples/mcu/vxlib_demo/j722s-evm/c75ss0-0_freertos/ti-c7000` and
`examples/mcu/vxlib_demo/j722s-evm/c75ss1-0_freertos/ti-c7000` is now ready to run on the C7 cores.

To run it on the development board, you can follow the steps in the
[Running the compiled project at the U-Boot stage](/en/boards/o1/peripherals/mcu#2-8-running-the-compiled-project-at-the-u-boot-stage) section.

In this example project, the generated outputs are transmitted via the UART1 interface.
You can find the related pin connections in the [Pinout documentation](/en/boards/o1/peripherals/introduction#1-pinout).

The terminal output of the VXLIB example project is as follows.

```bash theme={"system"}
VXLIB Demo start

------------------------
 T3 Gemstone VXLIB Test              
------------------------

Non-Padded 3x3 Box Filter

Input Image

1, 2, 3, 4, 5, 
6, 7, 8, 9, 10, 
11, 12, 13, 14, 15, 
16, 17, 18, 19, 20, 
21, 22, 23, 24, 25, 

Output Image

6, 7, 8, 
11, 12, 13, 
16, 17, 18, 
```

## Integrating into an Existing MCU Project via MakeFile

To integrate the VXLIB library into your existing MCU project, you need to define the root directory path of
the SDK and the `.cpp` file you will use.

```makefile theme={"system"}
SDK_ROOT_PATH := ${MCU_PLUS_SDK_PATH}/..

FILES_cpp := \
	vxlib_demo.cpp \
```

Then, you should add VXLIB's `src` and `src/common` directories to the list of included
folders (`INCLUDES_common` variable) as follows. You may need to adjust the path according to your VXLIB version.

```makefile theme={"system"}
	-I${SDK_ROOT_PATH}/vxlib_10_01_00_02/src \
	-I${SDK_ROOT_PATH}/vxlib_10_01_00_02/src/common \
```

You must add the following necessary definitions to the compiler FLAGS parameters (`CFLAGS_common` variable)
for the library to compile correctly.

```makefile theme={"system"}
-DMCU_PLUS_SDK \
-DBUILD_C7X \
-DSOC=j722s \
--silicon_version=7524 \
```

You should add VXLIB's compiled library directory to the library path definitions (`LIBS_PATH_common` variable).

```makefile theme={"system"}
-i${SDK_ROOT_PATH}/vxlib_10_01_00_02/lib/Release \
```

You need to add the name of the VXLIB library to the list of included library files (`LIBS_common` variable) as follows.

```makefile theme={"system"}
-lVXLIB_C7524.lib \
-lVXLIB_common_C7524.lib \
```

To enable the compilation of .cpp files in the project, the following additions must be made right below the
line where `OBJS` and `DEPS` definitions are made.

```makefile theme={"system"}
OBJS += $(FILES_cpp:%.cpp=%.obj)
DEPS := $(FILES:%.cpp=%.dpp)
vpath %.cpp $(FILES_PATH)

$(OBJDIR)/%.obj %.obj: %.cpp
	@echo  Compiling: j722s:c75ss0-0:freertos:ti-c7000 $(OUTNAME): $<
	$(CC) $(CFLAGS) $(INCLUDES) $(DEFINES) -ppd=$(OBJDIR)/$(basename $@).dpp -ppa -fr=$(OBJDIR)/ -fp=$<
```

Upon completion of these steps, the VXLIB library will be successfully integrated into the project via Makefile.

## Integrating VXLIB into an Existing CPP File

After completing the necessary configurations via Makefile, to use the VXLIB library, you need to include its
header file in the .cpp file within your project. Following this step, you can directly use VXLIB's functions
and definitions within your existing project.

You can access all modules available in the VXLIB library via
[this link](https://software-dl.ti.com/jacinto7/esd/processor-sdk-rtos-j722s/10_01_00_04/exports/docs/vxlib_10_01_00_02/docs/user_guide/index.html).

```cpp theme={"system"}
#include <VXLIB_bufParams.h>
#include <VXLIB_types.h>
#include <vxlib.h>
```

With this process, the VXLIB integration will be complete.
