Simd Library Documentation.

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

Functions for image resizing. More...

Functions

SIMD_API void SimdReduceGray2x2 (const uint8_t *src, size_t srcWidth, size_t srcHeight, size_t srcStride, uint8_t *dst, size_t dstWidth, size_t dstHeight, size_t dstStride)
 Performs reducing and Gaussian blurring (in two time) a 8-bit gray image with using window 2x2. More...
 
SIMD_API void SimdReduceGray3x3 (const uint8_t *src, size_t srcWidth, size_t srcHeight, size_t srcStride, uint8_t *dst, size_t dstWidth, size_t dstHeight, size_t dstStride, int compensation)
 Performs reducing and Gaussian blurring (in two time) a 8-bit gray image with using window 3x3. More...
 
SIMD_API void SimdReduceGray4x4 (const uint8_t *src, size_t srcWidth, size_t srcHeight, size_t srcStride, uint8_t *dst, size_t dstWidth, size_t dstHeight, size_t dstStride)
 Performs reducing and Gaussian blurring (in two time) a 8-bit gray image with using window 4x4. More...
 
SIMD_API void SimdReduceGray5x5 (const uint8_t *src, size_t srcWidth, size_t srcHeight, size_t srcStride, uint8_t *dst, size_t dstWidth, size_t dstHeight, size_t dstStride, int compensation)
 Performs reducing and Gaussian blurring (in two time) a 8-bit gray image with using window 5x5. More...
 
SIMD_API void SimdResizeBilinear (const uint8_t *src, size_t srcWidth, size_t srcHeight, size_t srcStride, uint8_t *dst, size_t dstWidth, size_t dstHeight, size_t dstStride, size_t channelCount)
 Performs resizing of input image with using bilinear interpolation. More...
 
SIMD_API void SimdStretchGray2x2 (const uint8_t *src, size_t srcWidth, size_t srcHeight, size_t srcStride, uint8_t *dst, size_t dstWidth, size_t dstHeight, size_t dstStride)
 Stretches input 8-bit gray image in two times. More...
 
template<template< class > class A>
SIMD_INLINE void ReduceGray2x2 (const View< A > &src, View< A > &dst)
 Performs reducing (in 2 times) and Gaussian blurring a 8-bit gray image with using window 2x2. More...
 
template<template< class > class A>
SIMD_INLINE void ReduceGray3x3 (const View< A > &src, View< A > &dst, bool compensation=true)
 Performs reducing (in 2 times) and Gaussian blurring a 8-bit gray image with using window 3x3. More...
 
template<template< class > class A>
SIMD_INLINE void ReduceGray4x4 (const View< A > &src, View< A > &dst)
 Performs reducing (in 2 times) and Gaussian blurring a 8-bit gray image with using window 4x4. More...
 
template<template< class > class A>
SIMD_INLINE void ReduceGray5x5 (const View< A > &src, View< A > &dst, bool compensation=true)
 Performs reducing (in 2 times) and Gaussian blurring a 8-bit gray image with using window 5x5. More...
 
template<template< class > class A>
SIMD_INLINE void ReduceGray (const View< A > &src, View< A > &dst, ::SimdReduceType reduceType, bool compensation=true)
 Performs reducing (in 2 times) and Gaussian blurring a 8-bit gray image. More...
 
template<template< class > class A>
SIMD_INLINE void ResizeBilinear (const View< A > &src, View< A > &dst)
 Performs resizing of input image with using bilinear interpolation. More...
 
template<template< class > class A>
SIMD_INLINE void StretchGray2x2 (const View< A > &src, View< A > &dst)
 Stretches input 8-bit gray image in two times. More...
 

Detailed Description

Functions for image resizing.

Function Documentation

◆ SimdReduceGray2x2()

void SimdReduceGray2x2 ( const uint8_t *  src,
size_t  srcWidth,
size_t  srcHeight,
size_t  srcStride,
uint8_t *  dst,
size_t  dstWidth,
size_t  dstHeight,
size_t  dstStride 
)

Performs reducing and Gaussian blurring (in two time) a 8-bit gray image with using window 2x2.

For input and output image must be performed: dstWidth = (srcWidth + 1)/2, dstHeight = (srcHeight + 1)/2.

For all points:

dst[x, y] = (src[2*x, 2*y] + src[2*x, 2*y + 1] + src[2*x + 1, 2*y] + src[2*x + 1, 2*y + 1] + 2)/4;
Note
This function has a C++ wrappers: Simd::ReduceGray2x2(const View<A>& src, View<A>& dst).
Parameters
[in]src- a pointer to pixels data of the original input image.
[in]srcWidth- a width of the input image.
[in]srcHeight- a height of the input image.
[in]srcStride- a row size of the input image.
[out]dst- a pointer to pixels data of the reduced output image.
[in]dstWidth- a width of the output image.
[in]dstHeight- a height of the output image.
[in]dstStride- a row size of the output image.

◆ SimdReduceGray3x3()

void SimdReduceGray3x3 ( const uint8_t *  src,
size_t  srcWidth,
size_t  srcHeight,
size_t  srcStride,
uint8_t *  dst,
size_t  dstWidth,
size_t  dstHeight,
size_t  dstStride,
int  compensation 
)

Performs reducing and Gaussian blurring (in two time) a 8-bit gray image with using window 3x3.

For input and output image must be performed: dstWidth = (srcWidth + 1)/2, dstHeight = (srcHeight + 1)/2.

For every point:

dst[x, y] = (src[2*x-1, 2*y-1] + 2*src[2*x, 2*y-1] + src[2*x+1, 2*y-1] +
          2*(src[2*x-1, 2*y]   + 2*src[2*x, 2*y]   + src[2*x+1, 2*y]) +
             src[2*x-1, 2*y+1] + 2*src[2*x, 2*y+1] + src[2*x+1, 2*y+1] + compensation ? 8 : 0) / 16;
Note
This function has a C++ wrappers: Simd::ReduceGray3x3(const View<A>& src, View<A>& dst, bool compensation).
Parameters
[in]src- a pointer to pixels data of the original input image.
[in]srcWidth- a width of the input image.
[in]srcHeight- a height of the input image.
[in]srcStride- a row size of the input image.
[out]dst- a pointer to pixels data of the reduced output image.
[in]dstWidth- a width of the output image.
[in]dstHeight- a height of the output image.
[in]dstStride- a row size of the output image.
[in]compensation- a flag of compensation of rounding.

◆ SimdReduceGray4x4()

void SimdReduceGray4x4 ( const uint8_t *  src,
size_t  srcWidth,
size_t  srcHeight,
size_t  srcStride,
uint8_t *  dst,
size_t  dstWidth,
size_t  dstHeight,
size_t  dstStride 
)

Performs reducing and Gaussian blurring (in two time) a 8-bit gray image with using window 4x4.

For input and output image must be performed: dstWidth = (srcWidth + 1)/2, dstHeight = (srcHeight + 1)/2.

For every point:

dst[x, y] = (src[2*x-1, 2*y-1] + 3*src[2*x, 2*y-1] + 3*src[2*x+1, 2*y-1] + src[2*x+2, 2*y-1]
          3*(src[2*x-1, 2*y]   + 3*src[2*x, 2*y]   + 3*src[2*x+1, 2*y]   + src[2*x+2, 2*y]) +
          3*(src[2*x-1, 2*y+1] + 3*src[2*x, 2*y+1] + 3*src[2*x+1, 2*y+1] + src[2*x+2, 2*y+1]) +
             src[2*x-1, 2*y+2] + 3*src[2*x, 2*y+2] + 3*src[2*x+1, 2*y+2] + src[2*x+2, 2*y+2] + 32) / 64;
Note
This function has a C++ wrappers: Simd::ReduceGray4x4(const View<A>& src, View<A>& dst).
Parameters
[in]src- a pointer to pixels data of the original input image.
[in]srcWidth- a width of the input image.
[in]srcHeight- a height of the input image.
[in]srcStride- a row size of the input image.
[out]dst- a pointer to pixels data of the reduced output image.
[in]dstWidth- a width of the output image.
[in]dstHeight- a height of the output image.
[in]dstStride- a row size of the output image.

◆ SimdReduceGray5x5()

void SimdReduceGray5x5 ( const uint8_t *  src,
size_t  srcWidth,
size_t  srcHeight,
size_t  srcStride,
uint8_t *  dst,
size_t  dstWidth,
size_t  dstHeight,
size_t  dstStride,
int  compensation 
)

Performs reducing and Gaussian blurring (in two time) a 8-bit gray image with using window 5x5.

For input and output image must be performed: dstWidth = (srcWidth + 1)/2, dstHeight = (srcHeight + 1)/2.

For every point:

dst[x, y] = (
       src[2*x-2, 2*y-2] + 4*src[2*x-1, 2*y-2] + 6*src[2*x, 2*y-2] + 4*src[2*x+1, 2*y-2] + src[2*x+2, 2*y-2] +
    4*(src[2*x-2, 2*y-1] + 4*src[2*x-1, 2*y-1] + 6*src[2*x, 2*y-1] + 4*src[2*x+1, 2*y-1] + src[2*x+2, 2*y-1]) +
    6*(src[2*x-2, 2*y]   + 4*src[2*x-1, 2*y]   + 6*src[2*x, 2*y]   + 4*src[2*x+1, 2*y]   + src[2*x+2, 2*y]) +
    4*(src[2*x-2, 2*y+1] + 4*src[2*x-1, 2*y+1] + 6*src[2*x, 2*y+1] + 4*src[2*x+1, 2*y+1] + src[2*x+2, 2*y+1]) +
       src[2*x-2, 2*y+2] + 4*src[2*x-1, 2*y+2] + 6*src[2*x, 2*y+2] + 4*src[2*x+1, 2*y+2] + src[2*x+2, 2*y+2] +
    compensation ? 128 : 0) / 256;
Note
This function has a C++ wrappers: Simd::ReduceGray5x5(const Viewc<A>& src, View<A>& dst, bool compensation).
Parameters
[in]src- a pointer to pixels data of the original input image.
[in]srcWidth- a width of the input image.
[in]srcHeight- a height of the input image.
[in]srcStride- a row size of the input image.
[out]dst- a pointer to pixels data of the reduced output image.
[in]dstWidth- a width of the output image.
[in]dstHeight- a height of the output image.
[in]dstStride- a row size of the output image.
[in]compensation- a flag of compensation of rounding.

◆ SimdResizeBilinear()

void SimdResizeBilinear ( const uint8_t *  src,
size_t  srcWidth,
size_t  srcHeight,
size_t  srcStride,
uint8_t *  dst,
size_t  dstWidth,
size_t  dstHeight,
size_t  dstStride,
size_t  channelCount 
)

Performs resizing of input image with using bilinear interpolation.

All images must have the same format (8-bit gray, 16-bit UV, 24-bit BGR or 32-bit BGRA).

Note
This function has a C++ wrappers: Simd::ResizeBilinear(const View<A>& src, View<A>& dst).
Parameters
[in]src- a pointer to pixels data of the original input image.
[in]srcWidth- a width of the input image.
[in]srcHeight- a height of the input image.
[in]srcStride- a row size of the input image.
[out]dst- a pointer to pixels data of the reduced output image.
[in]dstWidth- a width of the output image.
[in]dstHeight- a height of the output image.
[in]dstStride- a row size of the output image.
[in]channelCount- a channel count.

◆ SimdStretchGray2x2()

void SimdStretchGray2x2 ( const uint8_t *  src,
size_t  srcWidth,
size_t  srcHeight,
size_t  srcStride,
uint8_t *  dst,
size_t  dstWidth,
size_t  dstHeight,
size_t  dstStride 
)

Stretches input 8-bit gray image in two times.

Note
This function has a C++ wrappers: Simd::StretchGray2x2(const View<A>& src, View<A>& dst).
Parameters
[in]src- a pointer to pixels data of the original input image.
[in]srcWidth- a width of the input image.
[in]srcHeight- a height of the input image.
[in]srcStride- a row size of the input image.
[out]dst- a pointer to pixels data of the stretched output image.
[in]dstWidth- a width of the output image.
[in]dstHeight- a height of the output image.
[in]dstStride- a row size of the output image.

◆ ReduceGray2x2()

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

Performs reducing (in 2 times) and Gaussian blurring a 8-bit gray image with using window 2x2.

For input and output image must be performed: dst.width = (src.width + 1)/2, dst.height = (src.height + 1)/2.

For all points:

dst[x, y] = (src[2*x, 2*y] + src[2*x, 2*y + 1] + src[2*x + 1, 2*y] + src[2*x + 1, 2*y + 1] + 2)/4;
Note
This function is a C++ wrapper for function SimdReduceGray2x2.
Parameters
[in]src- an original input image.
[out]dst- a reduced output image.

◆ ReduceGray3x3()

void ReduceGray3x3 ( const View< A > &  src,
View< A > &  dst,
bool  compensation = true 
)

Performs reducing (in 2 times) and Gaussian blurring a 8-bit gray image with using window 3x3.

For input and output image must be performed: dst.width = (src.width + 1)/2, dst.height = (src.height + 1)/2.

For every point:

dst[x, y] = (src[2*x-1, 2*y-1] + 2*src[2*x, 2*y-1] + src[2*x+1, 2*y-1] +
          2*(src[2*x-1, 2*y]   + 2*src[2*x, 2*y]   + src[2*x+1, 2*y]) +
             src[2*x-1, 2*y+1] + 2*src[2*x, 2*y+1] + src[2*x+1, 2*y+1] + compensation ? 8 : 0) / 16;
Note
This function is a C++ wrapper for function SimdReduceGray3x3.
Parameters
[in]src- an original input image.
[out]dst- a reduced output image.
[in]compensation- a flag of compensation of rounding. It is equal to 'true' by default.

◆ ReduceGray4x4()

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

Performs reducing (in 2 times) and Gaussian blurring a 8-bit gray image with using window 4x4.

For input and output image must be performed: dst.width = (src.width + 1)/2, dst.height = (src.height + 1)/2.

For every point:

dst[x, y] =   (src[2*x-1, 2*y-1] + 3*src[2*x, 2*y-1] + 3*src[2*x+1, 2*y-1] + src[2*x+2, 2*y-1]
            3*(src[2*x-1, 2*y]   + 3*src[2*x, 2*y]   + 3*src[2*x+1, 2*y]   + src[2*x+2, 2*y]) +
            3*(src[2*x-1, 2*y+1] + 3*src[2*x, 2*y+1] + 3*src[2*x+1, 2*y+1] + src[2*x+2, 2*y+1]) +
               src[2*x-1, 2*y+2] + 3*src[2*x, 2*y+2] + 3*src[2*x+1, 2*y+2] + src[2*x+2, 2*y+2] + 32) / 64;
Note
This function is a C++ wrapper for function SimdReduceGray4x4.
Parameters
[in]src- an original input image.
[out]dst- a reduced output image.

◆ ReduceGray5x5()

void ReduceGray5x5 ( const View< A > &  src,
View< A > &  dst,
bool  compensation = true 
)

Performs reducing (in 2 times) and Gaussian blurring a 8-bit gray image with using window 5x5.

For input and output image must be performed: dst.width = (src.width + 1)/2, dst.height = (src.height + 1)/2.

For every point:

dst[x, y] = (
       src[2*x-2, 2*y-2] + 4*src[2*x-1, 2*y-2] + 6*src[2*x, 2*y-2] + 4*src[2*x+1, 2*y-2] + src[2*x+2, 2*y-2] +
    4*(src[2*x-2, 2*y-1] + 4*src[2*x-1, 2*y-1] + 6*src[2*x, 2*y-1] + 4*src[2*x+1, 2*y-1] + src[2*x+2, 2*y-1]) +
    6*(src[2*x-2, 2*y]   + 4*src[2*x-1, 2*y]   + 6*src[2*x, 2*y]   + 4*src[2*x+1, 2*y]   + src[2*x+2, 2*y]) +
    4*(src[2*x-2, 2*y+1] + 4*src[2*x-1, 2*y+1] + 6*src[2*x, 2*y+1] + 4*src[2*x+1, 2*y+1] + src[2*x+2, 2*y+1]) +
       src[2*x-2, 2*y+2] + 4*src[2*x-1, 2*y+2] + 6*src[2*x, 2*y+2] + 4*src[2*x+1, 2*y+2] + src[2*x+2, 2*y+2] +
    compensation ? 128 : 0) / 256;
Note
This function is a C++ wrapper for function SimdReduceGray5x5.
Parameters
[in]src- an original input image.
[out]dst- a reduced output image.
[in]compensation- a flag of compensation of rounding. It is equal to 'true' by default.

◆ ReduceGray()

void ReduceGray ( const View< A > &  src,
View< A > &  dst,
::SimdReduceType  reduceType,
bool  compensation = true 
)

Performs reducing (in 2 times) and Gaussian blurring a 8-bit gray image.

For input and output image must be performed: dst.width = (src.width + 1)/2, dst.height = (src.height + 1)/2.

Parameters
[in]src- an original input image.
[out]dst- a reduced output image.
[in]reduceType- a type of function used for image reducing.
[in]compensation- a flag of compensation of rounding. It is relevant only for SimdReduce3x3 and SimdReduce5x5. It is equal to 'true' by default.

◆ ResizeBilinear()

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

Performs resizing of input image with using bilinear interpolation.

All images must have the same format (8-bit gray, 16-bit UV, 24-bit BGR or 32-bit BGRA).

Note
This function is a C++ wrapper for function SimdResizeBilinear.
Parameters
[in]src- an original input image.
[out]dst- a reduced output image.

◆ StretchGray2x2()

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

Stretches input 8-bit gray image in two times.

Note
This function is a C++ wrapper for function SimdStretchGray2x2.
Parameters
[in]src- an original input image.
[out]dst- a stretched output image.