Simd Library Documentation.

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

Functions for other image format conversions. More...

Functions

SIMD_API void SimdBgr48pToBgra32 (const uint8_t *blue, size_t blueStride, size_t width, size_t height, const uint8_t *green, size_t greenStride, const uint8_t *red, size_t redStride, uint8_t *bgra, size_t bgraStride, uint8_t alpha)
 Converts 48-bit planar BGR image to 32-bit BGRA image. More...
 
SIMD_API void SimdDeinterleaveUv (const uint8_t *uv, size_t uvStride, size_t width, size_t height, uint8_t *u, size_t uStride, uint8_t *v, size_t vStride)
 Deinterleaves 16-bit UV interleaved image into separated 8-bit U and V planar images. More...
 
SIMD_API void SimdDeinterleaveBgr (const uint8_t *bgr, size_t bgrStride, size_t width, size_t height, uint8_t *b, size_t bStride, uint8_t *g, size_t gStride, uint8_t *r, size_t rStride)
 Deinterleaves 24-bit BGR interleaved image into separated 8-bit Blue, Green and Red planar images. More...
 
SIMD_API void SimdDeinterleaveBgra (const uint8_t *bgra, size_t bgraStride, size_t width, size_t height, uint8_t *b, size_t bStride, uint8_t *g, size_t gStride, uint8_t *r, size_t rStride, uint8_t *a, size_t aStride)
 Deinterleaves 32-bit BGRA interleaved image into separated 8-bit Blue, Green, Red and Alpha planar images. More...
 
SIMD_API void SimdFloat32ToUint8 (const float *src, size_t size, const float *lower, const float *upper, uint8_t *dst)
 Converts numbers in the array from 32-bit float to 8-bit unsigned integer format. More...
 
SIMD_API void SimdUint8ToFloat32 (const uint8_t *src, size_t size, const float *lower, const float *upper, float *dst)
 Converts numbers in the array from 8-bit unsigned integer to 32-bit float format. More...
 
SIMD_API void SimdInt16ToGray (const uint8_t *src, size_t width, size_t height, size_t srcStride, uint8_t *dst, size_t dstStride)
 Converts 16-bit signed integer image to 8-bit gray image with saturation. More...
 
SIMD_API void SimdInterleaveUv (const uint8_t *u, size_t uStride, const uint8_t *v, size_t vStride, size_t width, size_t height, uint8_t *uv, size_t uvStride)
 Interleaves 8-bit U and V planar images into one 16-bit UV interleaved image. More...
 
SIMD_API void SimdInterleaveBgr (const uint8_t *b, size_t bStride, const uint8_t *g, size_t gStride, const uint8_t *r, size_t rStride, size_t width, size_t height, uint8_t *bgr, size_t bgrStride)
 Interleaves 8-bit Blue, Green and Red planar images into one 24-bit BGR interleaved image. More...
 
SIMD_API void SimdInterleaveBgra (const uint8_t *b, size_t bStride, const uint8_t *g, size_t gStride, const uint8_t *r, size_t rStride, const uint8_t *a, size_t aStride, size_t width, size_t height, uint8_t *bgra, size_t bgraStride)
 Interleaves 8-bit Blue, Green, Red and Alpha planar images into one 32-bit BGRA interleaved image. More...
 
template<template< class > class A>
SIMD_INLINE void Bgr48pToBgra32 (const View< A > &blue, const View< A > &green, const View< A > &red, View< A > &bgra, uint8_t alpha=0xFF)
 Converts 48-bit planar BGR image to 32-bit BGRA image. More...
 
template<template< class > class A>
SIMD_INLINE void DeinterleaveUv (const View< A > &uv, View< A > &u, View< A > &v)
 Deinterleaves 16-bit UV interleaved image into separated 8-bit U and V planar images. More...
 
template<template< class > class A>
SIMD_INLINE void DeinterleaveBgr (const View< A > &bgr, View< A > &b, View< A > &g, View< A > &r)
 Deinterleaves 24-bit BGR interleaved image into separated 8-bit Blue, Green and Red planar images. More...
 
template<template< class > class A>
SIMD_INLINE void DeinterleaveBgra (const View< A > &bgra, View< A > &b, View< A > &g, View< A > &r, View< A > &a)
 Deinterleaves 32-bit BGRA interleaved image into separated 8-bit Blue, Green, Red and Alpha planar images. More...
 
template<template< class > class A>
SIMD_INLINE void Int16ToGray (const View< A > &src, View< A > &dst)
 Converts 16-bit signed integer image to 8-bit gray image with saturation. More...
 
template<template< class > class A>
SIMD_INLINE void InterleaveUv (const View< A > &u, const View< A > &v, View< A > &uv)
 Interleaves 8-bit U and V planar images into one 16-bit UV interleaved image. More...
 
template<template< class > class A>
SIMD_INLINE void InterleaveBgr (const View< A > &b, const View< A > &g, const View< A > &r, View< A > &bgr)
 Interleaves 8-bit Blue, Green and Red planar images into one 24-bit BGR interleaved image. More...
 
template<template< class > class A>
SIMD_INLINE void InterleaveBgra (const View< A > &b, const View< A > &g, const View< A > &r, const View< A > &a, View< A > &bgra)
 Interleaves 8-bit Blue, Green, Red and Alpha planar images into one 32-bit BGRA interleaved image. More...
 

Detailed Description

Functions for other image format conversions.

Function Documentation

◆ SimdBgr48pToBgra32()

void SimdBgr48pToBgra32 ( const uint8_t *  blue,
size_t  blueStride,
size_t  width,
size_t  height,
const uint8_t *  green,
size_t  greenStride,
const uint8_t *  red,
size_t  redStride,
uint8_t *  bgra,
size_t  bgraStride,
uint8_t  alpha 
)

Converts 48-bit planar BGR image to 32-bit BGRA image.

All images must have the same width and height.

Note
This function has a C++ wrapper Simd::Bgr48pToBgra32(const View<A>& blue, const View<A>& green, const View<A>& red, View<A>& bgra, uint8_t alpha).
Parameters
[in]blue- a pointer to pixels data of input 16-bit image with blue color plane.
[in]blueStride- a row size of the blue image.
[in]width- an image width.
[in]height- an image height.
[in]green- a pointer to pixels data of input 16-bit image with green color plane.
[in]greenStride- a row size of the blue image.
[in]red- a pointer to pixels data of input 16-bit image with red color plane.
[in]redStride- a row size of the red image.
[out]bgra- a pointer to pixels data of output 32-bit BGRA image.
[in]bgraStride- a row size of the bgra image.
[in]alpha- a value of alpha channel.

◆ SimdDeinterleaveUv()

void SimdDeinterleaveUv ( const uint8_t *  uv,
size_t  uvStride,
size_t  width,
size_t  height,
uint8_t *  u,
size_t  uStride,
uint8_t *  v,
size_t  vStride 
)

Deinterleaves 16-bit UV interleaved image into separated 8-bit U and V planar images.

All images must have the same width and height. This function used for NV12 to YUV420P conversion.

Note
This function has a C++ wrapper Simd::DeinterleaveUv(const View<A>& uv, View<A>& u, View<A>& v).
Parameters
[in]uv- a pointer to pixels data of input 16-bit UV interleaved image.
[in]uvStride- a row size of the uv image.
[in]width- an image width.
[in]height- an image height.
[out]u- a pointer to pixels data of 8-bit U planar image.
[in]uStride- a row size of the u image.
[out]v- a pointer to pixels data of 8-bit V planar image.
[in]vStride- a row size of the v image.

◆ SimdDeinterleaveBgr()

void SimdDeinterleaveBgr ( const uint8_t *  bgr,
size_t  bgrStride,
size_t  width,
size_t  height,
uint8_t *  b,
size_t  bStride,
uint8_t *  g,
size_t  gStride,
uint8_t *  r,
size_t  rStride 
)

Deinterleaves 24-bit BGR interleaved image into separated 8-bit Blue, Green and Red planar images.

All images must have the same width and height.

Note
This function has a C++ wrapper Simd::DeinterleaveBgr(const View<A>& bgr, View<A>& b, View<A>& g, View<A>& r).
Parameters
[in]bgr- a pointer to pixels data of input 24-bit BGR interleaved image.
[in]bgrStride- a row size of the bgr image.
[in]width- an image width.
[in]height- an image height.
[out]b- a pointer to pixels data of 8-bit Blue planar image.
[in]bStride- a row size of the b image.
[out]g- a pointer to pixels data of 8-bit Green planar image.
[in]gStride- a row size of the g image.
[out]r- a pointer to pixels data of 8-bit Red planar image.
[in]rStride- a row size of the r image.

◆ SimdDeinterleaveBgra()

void SimdDeinterleaveBgra ( const uint8_t *  bgra,
size_t  bgraStride,
size_t  width,
size_t  height,
uint8_t *  b,
size_t  bStride,
uint8_t *  g,
size_t  gStride,
uint8_t *  r,
size_t  rStride,
uint8_t *  a,
size_t  aStride 
)

Deinterleaves 32-bit BGRA interleaved image into separated 8-bit Blue, Green, Red and Alpha planar images.

All images must have the same width and height.

Note
This function has a C++ wrapper Simd::DeinterleaveBgra(const View<A>& bgra, View<A>& b, View<A>& g, View<A>& r, View<A>& a).
Parameters
[in]bgra- a pointer to pixels data of input 32-bit BGRA interleaved image.
[in]bgraStride- a row size of the bgra image.
[in]width- an image width.
[in]height- an image height.
[out]b- a pointer to pixels data of 8-bit Blue planar image.
[in]bStride- a row size of the b image.
[out]g- a pointer to pixels data of 8-bit Green planar image.
[in]gStride- a row size of the g image.
[out]r- a pointer to pixels data of 8-bit Red planar image.
[in]rStride- a row size of the r image.
[out]a- a pointer to pixels data of 8-bit Alpha planar image.
[in]aStride- a row size of the a image.

◆ SimdFloat32ToUint8()

void SimdFloat32ToUint8 ( const float *  src,
size_t  size,
const float *  lower,
const float *  upper,
uint8_t *  dst 
)

Converts numbers in the array from 32-bit float to 8-bit unsigned integer format.

For every element:

dst[i] = (min(max(src[i], lower), upper) - lower)*255/(upper - lower);
Parameters
[in]src- a pointer to the input array with 32-bit float point numbers.
[in]size- a size of input and output array.
[in]lower- a pointer to lower saturated bound of the input array.
[in]upper- a pointer to upper saturated bound of the input array.
[out]dst- a pointer to the output array with 8-bit unsigned integer numbers.

◆ SimdUint8ToFloat32()

void SimdUint8ToFloat32 ( const uint8_t *  src,
size_t  size,
const float *  lower,
const float *  upper,
float *  dst 
)

Converts numbers in the array from 8-bit unsigned integer to 32-bit float format.

For every element:

dst[i] = src[i]*(upper - lower)/255 + lower;
Parameters
[in]src- a pointer to the input array with 8-bit unsigned integer numbers.
[in]size- a size of input and output array.
[in]lower- a pointer to lower bound of the output array.
[in]upper- a pointer to upper bound of the output array.
[out]dst- a pointer to the output array with 32-bit float point numbers.

◆ SimdInt16ToGray()

void SimdInt16ToGray ( const uint8_t *  src,
size_t  width,
size_t  height,
size_t  srcStride,
uint8_t *  dst,
size_t  dstStride 
)

Converts 16-bit signed integer image to 8-bit gray image with saturation.

All images must have the same width and height.

For every point:

dst[i] = Max(0, Min(255, src[i]));
Note
This function has a C++ wrapper Simd::Int16ToGray(const View<A> & src, View<A> & dst).
Parameters
[in]src- a pointer to pixels data of input 16-bit signed integer image.
[in]width- an image width.
[in]height- an image height.
[in]srcStride- a row size of the 16-bit signed integer image.
[out]dst- a pointer to pixels data of input 8-bit gray image.
[out]dstStride- a row size of the gray image.

◆ SimdInterleaveUv()

void SimdInterleaveUv ( const uint8_t *  u,
size_t  uStride,
const uint8_t *  v,
size_t  vStride,
size_t  width,
size_t  height,
uint8_t *  uv,
size_t  uvStride 
)

Interleaves 8-bit U and V planar images into one 16-bit UV interleaved image.

All images must have the same width and height. This function used for YUV420P to NV12 conversion.

Note
This function has a C++ wrapper Simd::InterleaveUv(const View<A>& u, const View<A>& v, View<A>& uv).
Parameters
[in]u- a pointer to pixels data of input 8-bit U planar image.
[in]uStride- a row size of the u image.
[in]v- a pointer to pixels data of input 8-bit V planar image.
[in]vStride- a row size of the v image.
[in]width- an image width.
[in]height- an image height.
[out]uv- a pointer to pixels data of output 16-bit UV interleaved image.
[in]uvStride- a row size of the uv image.

◆ SimdInterleaveBgr()

void SimdInterleaveBgr ( const uint8_t *  b,
size_t  bStride,
const uint8_t *  g,
size_t  gStride,
const uint8_t *  r,
size_t  rStride,
size_t  width,
size_t  height,
uint8_t *  bgr,
size_t  bgrStride 
)

Interleaves 8-bit Blue, Green and Red planar images into one 24-bit BGR interleaved image.

All images must have the same width and height.

Note
This function has a C++ wrapper Simd::InterleaveBgr(const View<A>& b, const View<A>& g, const View<A>& r, View<A>& bgr).
Parameters
[in]b- a pointer to pixels data of input 8-bit Blue planar image.
[in]bStride- a row size of the b image.
[in]g- a pointer to pixels data of input 8-bit Green planar image.
[in]gStride- a row size of the g image.
[in]r- a pointer to pixels data of input 8-bit Red planar image.
[in]rStride- a row size of the r image.
[in]width- an image width.
[in]height- an image height.
[out]bgr- a pointer to pixels data of output 24-bit BGR interleaved image.
[in]bgrStride- a row size of the bgr image.

◆ SimdInterleaveBgra()

void SimdInterleaveBgra ( const uint8_t *  b,
size_t  bStride,
const uint8_t *  g,
size_t  gStride,
const uint8_t *  r,
size_t  rStride,
const uint8_t *  a,
size_t  aStride,
size_t  width,
size_t  height,
uint8_t *  bgra,
size_t  bgraStride 
)

Interleaves 8-bit Blue, Green, Red and Alpha planar images into one 32-bit BGRA interleaved image.

All images must have the same width and height.

Note
This function has a C++ wrapper Simd::InterleaveBgra(const View<A>& b, const View<A>& g, const View<A>& r, const View<A>& a, View<A>& bgra).
Parameters
[in]b- a pointer to pixels data of input 8-bit Blue planar image.
[in]bStride- a row size of the b image.
[in]g- a pointer to pixels data of input 8-bit Green planar image.
[in]gStride- a row size of the g image.
[in]r- a pointer to pixels data of input 8-bit Red planar image.
[in]rStride- a row size of the r image.
[in]a- a pointer to pixels data of input 8-bit Alpha planar image.
[in]aStride- a row size of the a image.
[in]width- an image width.
[in]height- an image height.
[out]bgra- a pointer to pixels data of output 32-bit BGRA interleaved image.
[in]bgraStride- a row size of the bgr image.

◆ Bgr48pToBgra32()

void Bgr48pToBgra32 ( const View< A > &  blue,
const View< A > &  green,
const View< A > &  red,
View< A > &  bgra,
uint8_t  alpha = 0xFF 
)

Converts 48-bit planar BGR image to 32-bit BGRA image.

All images must have the same width and height.

Note
This function is a C++ wrapper for function SimdBgr48pToBgra32.
Parameters
[in]blue- an input 16-bit image with blue color plane.
[in]green- an input 16-bit image with green color plane.
[in]red- an input 16-bit image with red color plane.
[out]bgra- an output 32-bit BGRA image.
[in]alpha- a value of alpha channel. It is equal to 256 by default.

◆ DeinterleaveUv()

void DeinterleaveUv ( const View< A > &  uv,
View< A > &  u,
View< A > &  v 
)

Deinterleaves 16-bit UV interleaved image into separated 8-bit U and V planar images.

All images must have the same width and height. This function used for NV12 to YUV420P conversion.

Note
This function is a C++ wrapper for function SimdDeinterleaveUv.
Parameters
[in]uv- an input 16-bit UV interleaved image.
[out]u- an output 8-bit U planar image.
[out]v- an output 8-bit V planar image.

◆ DeinterleaveBgr()

void DeinterleaveBgr ( const View< A > &  bgr,
View< A > &  b,
View< A > &  g,
View< A > &  r 
)

Deinterleaves 24-bit BGR interleaved image into separated 8-bit Blue, Green and Red planar images.

All images must have the same width and height.

Note
This function is a C++ wrapper for function SimdDeinterleaveBgr.
Parameters
[in]bgr- an input 24-bit BGR interleaved image.
[out]b- an output 8-bit Blue planar image.
[out]g- an output 8-bit Green planar image.
[out]r- an output 8-bit Red planar image.

◆ DeinterleaveBgra()

void DeinterleaveBgra ( const View< A > &  bgra,
View< A > &  b,
View< A > &  g,
View< A > &  r,
View< A > &  a 
)

Deinterleaves 32-bit BGRA interleaved image into separated 8-bit Blue, Green, Red and Alpha planar images.

All images must have the same width and height.

Note
This function is a C++ wrapper for function SimdDeinterleaveBgra.
Parameters
[in]bgra- an input 32-bit BGRA interleaved image.
[out]b- an output 8-bit Blue planar image.
[out]g- an output 8-bit Green planar image.
[out]r- an output 8-bit Red planar image.
[out]a- an output 8-bit Alpha planar image.

◆ Int16ToGray()

void Int16ToGray ( const View< A > &  src,
View< A > &  dst 
)

Converts 16-bit signed integer image to 8-bit gray image with saturation.

All images must have the same width and height.

For every point:

dst[i] = Max(0, Min(255, src[i]));
Note
This function is a C++ wrapper for function SimdInt16ToGray.
Parameters
[in]src- an input 16-bit signed integer image
[out]dst- an output 8-bit gray image.

◆ InterleaveUv()

void InterleaveUv ( const View< A > &  u,
const View< A > &  v,
View< A > &  uv 
)

Interleaves 8-bit U and V planar images into one 16-bit UV interleaved image.

All images must have the same width and height. This function used for YUV420P to NV12 conversion.

Note
This function is a C++ wrapper for function SimdInterleaveUv.
Parameters
[in]u- an input 8-bit U planar image.
[in]v- an input 8-bit V planar image.
[out]uv- an output 16-bit UV interleaved image.

◆ InterleaveBgr()

void InterleaveBgr ( const View< A > &  b,
const View< A > &  g,
const View< A > &  r,
View< A > &  bgr 
)

Interleaves 8-bit Blue, Green and Red planar images into one 24-bit BGR interleaved image.

All images must have the same width and height.

Note
This function is a C++ wrapper for function SimdInterleaveBgr.
Parameters
[in]b- an input 8-bit Blue planar image.
[in]g- an input 8-bit Green planar image.
[in]r- an input 8-bit Red planar image.
[out]bgr- an output 24-bit BGR interleaved image.

◆ InterleaveBgra()

void InterleaveBgra ( const View< A > &  b,
const View< A > &  g,
const View< A > &  r,
const View< A > &  a,
View< A > &  bgra 
)

Interleaves 8-bit Blue, Green, Red and Alpha planar images into one 32-bit BGRA interleaved image.

All images must have the same width and height.

Note
This function is a C++ wrapper for function SimdInterleaveBgra.
Parameters
[in]b- an input 8-bit Blue planar image.
[in]g- an input 8-bit Green planar image.
[in]r- an input 8-bit Red planar image.
[in]a- an input 8-bit Alpha planar image.
[out]bgra- an output 32-bit BGRA interleaved image.