Home

Awesome

Introduction

The Simd Library is a free open source image processing and machine learning library, designed for C and C++ programmers. It provides many useful high performance algorithms for image processing such as: pixel format conversion, image scaling and filtration, extraction of statistic information from images, motion detection, object detection and classification, neural network.

The algorithms are optimized with using of different SIMD CPU extensions. In particular the library supports following CPU extensions: SSE, AVX, AVX-512 and AMX for x86/x64, NEON for ARM.

The Simd Library has C API and also contains useful C++ classes and functions to facilitate access to C API. The library supports dynamic and static linking, 32-bit and 64-bit Windows and Linux, MSVS, G++ and Clang compilers, MSVS project and CMake build systems.

Library folder's structure

The Simd Library has next folder's structure:

Building the library for Windows

To build the library and test application for Windows 32/64 you need to use Microsoft Visual Studio 2022 (or 2015/2017/2019). The project files are in the directory:

simd/prj/vs2022/

By default the library is built as a DLL (Dynamic Linked Library). You also may build it as a static library. To do this you must change appropriate property (Configuration Type) of Simd project and also uncomment #define SIMD_STATIC in file:

simd/src/Simd/SimdConfig.h

Also in order to build the library you can use CMake and MinGW:

mkdir build
cd build
cmake ..\prj\cmake -DSIMD_TOOLCHAIN="your_toolchain\bin\g++" -DSIMD_TARGET="x86_64" -DCMAKE_BUILD_TYPE="Release" -G "MinGW Makefiles"
mingw32-make

Building the library for Linux

To build the library and test application for Linux 32/64 you need to use CMake build systems. Files of CMake build systems are placed in the directory:

simd/prj/cmake/

The library can be built for x86/x64, ARM(32/64) platforms using the G++ or Clang compilers. Using the native compiler (g++) for the current platform is simple:

mkdir build
cd build
cmake ../prj/cmake -DSIMD_TOOLCHAIN="" -DSIMD_TARGET=""
make

To build the library for ARM(32/64) platform you can also use a toolchain for cross compilation. There is an example of using for ARM (32 bit):

mkdir build
cd build
cmake ../prj/cmake -DSIMD_TOOLCHAIN="/your_toolchain/usr/bin/arm-linux-gnueabihf-g++" -DSIMD_TARGET="arm" -DCMAKE_BUILD_TYPE="Release"
make

And for ARM (64 bit):

mkdir build
cd build
cmake ../prj/cmake -DSIMD_TOOLCHAIN="/your_toolchain/usr/bin/aarch64-linux-gnu-g++" -DSIMD_TARGET="aarch64" -DCMAKE_BUILD_TYPE="Release"
make

As result the library and the test application will be built in the current directory.

There are addition build parameters:

Using the library

If you use the library from C code you must include:

#include "Simd/SimdLib.h"

And to use the library from C++ code you must include:

#include "Simd/SimdLib.hpp"

In order to use Simd::Detection you must include:

#include "Simd/SimdDetection.hpp"

In order to use Simd::Neural you must include:

#include "Simd/SimdNeural.hpp"

In order to use Simd::Motion you must include:

#include "Simd/SimdMotion.hpp"

Package Managers

You can download and install simd using the vcpkg dependency manager:

git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install simd

The simd port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the vcpkg repository.

Interaction with OpenCV

If you need to use mutual conversion between Simd and OpenCV types you just have to define macro SIMD_OPENCV_ENABLE before including of Simd headers:

#include <opencv2/core/core.hpp>
#define SIMD_OPENCV_ENABLE
#include "Simd/SimdLib.hpp"

And you can convert next types:

Test Framework

The test suite is needed for testing of correctness of work of the library and also for its performance testing. There is a set of tests for every function from API of the library. There is an example of test application using:

./Test -m=a -tt=1 -f=Sobel -ot=log.txt

Where next parameters were used:

Also you can use parameters: