Simd Library Documentation.

Home | Release Notes | Download | Documentation | Issues | GitHub
Operations

Various mathematical operations with images. More...

Functions

SIMD_API void SimdOperationBinary8u (const uint8_t *a, size_t aStride, const uint8_t *b, size_t bStride, size_t width, size_t height, size_t channelCount, uint8_t *dst, size_t dstStride, SimdOperationBinary8uType type)
 Performs an element-wise binary operation between two 8-bit images. More...
 
SIMD_API void SimdOperationBinary16i (const uint8_t *a, size_t aStride, const uint8_t *b, size_t bStride, size_t width, size_t height, uint8_t *dst, size_t dstStride, SimdOperationBinary16iType type)
 Performs an element-wise binary operation between two signed 16-bit images. More...
 
SIMD_API void SimdVectorProduct (const uint8_t *vertical, const uint8_t *horizontal, uint8_t *dst, size_t stride, size_t width, size_t height)
 Calculates an 8-bit gray image as the normalized outer product of two 8-bit vectors. More...
 
template<template< class > class A>
SIMD_INLINE void OperationBinary8u (const View< A > &a, const View< A > &b, View< A > &dst, SimdOperationBinary8uType type)
 Performs given operation between two images. More...
 
template<template< class > class A>
SIMD_INLINE void OperationBinary16i (const View< A > &a, const View< A > &b, View< A > &dst, SimdOperationBinary16iType type)
 Performs given operation between two images. More...
 
template<template< class > class A>
SIMD_INLINE void VectorProduct (const uint8_t *vertical, const uint8_t *horizontal, View< A > &dst)
 Calculates result 8-bit gray image as product of two vectors. More...
 

Detailed Description

Various mathematical operations with images.

Function Documentation

◆ SimdOperationBinary8u()

void SimdOperationBinary8u ( const uint8_t *  a,
size_t  aStride,
const uint8_t *  b,
size_t  bStride,
size_t  width,
size_t  height,
size_t  channelCount,
uint8_t *  dst,
size_t  dstStride,
SimdOperationBinary8uType  type 
)

Performs an element-wise binary operation between two 8-bit images.

All images must have the same width, height and number of channels. The function processes width*channelCount unsigned 8-bit values in every row; every channel is handled independently. The exact operation is selected by type (average, bitwise AND/OR, maximum, minimum, saturated subtraction or saturated addition).

Note
This function has a C++ wrapper: Simd::OperationBinary8u(const View<A>& a, const View<A>& b, View<A>& dst, SimdOperationBinary8uType type).
Parameters
[in]a- a pointer to pixels data of the first input image.
[in]aStride- a row size of the first image.
[in]b- a pointer to pixels data of the second input image.
[in]bStride- a row size of the second image.
[in]width- an image width.
[in]height- an image height.
[in]channelCount- a number of 8-bit channels per pixel.
[out]dst- a pointer to pixels data of the output image.
[in]dstStride- a row size of the output image.
[in]type- a type of operation (see SimdOperationBinary8uType).

◆ SimdOperationBinary16i()

void SimdOperationBinary16i ( const uint8_t *  a,
size_t  aStride,
const uint8_t *  b,
size_t  bStride,
size_t  width,
size_t  height,
uint8_t *  dst,
size_t  dstStride,
SimdOperationBinary16iType  type 
)

Performs an element-wise binary operation between two signed 16-bit images.

All images must have the same width, height and SimdPixelFormatInt16 pixel format. The function treats every row as an array of width signed 16-bit values and applies the non-saturated operation selected by type (addition or subtraction). Strides are specified in bytes and must be multiples of sizeof(int16_t).

Note
This function has a C++ wrapper: Simd::OperationBinary16i(const View<A>& a, const View<A>& b, View<A>& dst, SimdOperationBinary16iType type).
Parameters
[in]a- a pointer to pixels data of the first input image.
[in]aStride- a row size of the first image.
[in]b- a pointer to pixels data of the second input image.
[in]bStride- a row size of the second image.
[in]width- an image width.
[in]height- an image height.
[out]dst- a pointer to pixels data of the output image.
[in]dstStride- a row size of the output image.
[in]type- a type of operation (see SimdOperationBinary16iType).

◆ SimdVectorProduct()

void SimdVectorProduct ( const uint8_t *  vertical,
const uint8_t *  horizontal,
uint8_t *  dst,
size_t  stride,
size_t  width,
size_t  height 
)

Calculates an 8-bit gray image as the normalized outer product of two 8-bit vectors.

For all points:

dst[x, y] = DivideBy255(horizontal[x]*vertical[y]);
where DivideBy255(v) = (v + 1 + (v >> 8)) >> 8.
Note
This function has a C++ wrapper: Simd::VectorProduct(const uint8_t * vertical, const uint8_t * horizontal, View<A>& dst).
Parameters
[in]vertical- a pointer to the vertical vector. Its length must be equal to the output image height.
[in]horizontal- a pointer to the horizontal vector. Its length must be equal to the output image width.
[out]dst- a pointer to pixels data of the output image.
[in]stride- a row size of the output image in bytes.
[in]width- a width of the output image.
[in]height- a height of the output image.

◆ OperationBinary8u()

void OperationBinary8u ( const View< A > &  a,
const View< A > &  b,
View< A > &  dst,
SimdOperationBinary8uType  type 
)

Performs given operation between two images.

All images must have the same width, height and format (8-bit gray, 16-bit UV (UV plane of NV12 pixel format), 24-bit BGR or 32-bit BGRA).

Note
This function is a C++ wrapper for function SimdOperationBinary8u.
Parameters
[in]a- a first input image.
[in]b- a second input image.
[out]dst- an output image.
[in]type- a type of operation (see SimdOperationBinary8uType).

◆ OperationBinary16i()

void OperationBinary16i ( const View< A > &  a,
const View< A > &  b,
View< A > &  dst,
SimdOperationBinary16iType  type 
)

Performs given operation between two images.

All images must have the same width, height and Simd::View::Int16 pixel format.

Note
This function is a C++ wrapper for function SimdOperationBinary16i.
Parameters
[in]a- a first input image.
[in]b- a second input image.
[out]dst- an output image.
[in]type- a type of operation (see SimdOperationBinary16iType).

◆ VectorProduct()

void VectorProduct ( const uint8_t *  vertical,
const uint8_t *  horizontal,
View< A > &  dst 
)

Calculates result 8-bit gray image as product of two vectors.

For all points:

dst[x, y] = horizontal[x]*vertical[y]/255;
Note
This function is a C++ wrapper for function SimdVectorProduct.
Parameters
[in]vertical- a pointer to pixels data of vertical vector. It length is equal to result image height.
[in]horizontal- a pointer to pixels data of horizontal vector. It length is equal to result image width.
[out]dst- a result image.