Functions for image resizing. More...
Enumerations | |
enum | SimdResizeChannelType { SimdResizeChannelByte, SimdResizeChannelFloat } |
enum | SimdResizeMethodType { SimdResizeMethodBilinear, SimdResizeMethodCaffeInterp } |
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 * | SimdResizerInit (size_t srcX, size_t srcY, size_t dstX, size_t dstY, size_t channels, SimdResizeChannelType type, SimdResizeMethodType method) |
Creates resize context. More... | |
SIMD_API void | SimdResizerRun (const void *resizer, const uint8_t *src, size_t srcStride, uint8_t *dst, size_t dstStride) |
Performs image resizing. 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 | ResizeAreaGray (const View< A > &src, View< A > &dst) |
Performs resizing of input image with using area 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.
Enumeration Type Documentation
◆ SimdResizeChannelType
◆ SimdResizeMethodType
enum SimdResizeMethodType |
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.
◆ SimdResizerInit()
void * SimdResizerInit | ( | size_t | srcX, |
size_t | srcY, | ||
size_t | dstX, | ||
size_t | dstY, | ||
size_t | channels, | ||
SimdResizeChannelType | type, | ||
SimdResizeMethodType | method | ||
) |
Creates resize context.
- Parameters
-
[in] srcX - a width of the input image. [in] srcY - a height of the input image. [in] dstX - a width of the output image. [in] dstY - a height of the output image. [in] channels - a channel number of input and output image. [in] type - a type of input and output image channel. [in] method - a method used in order to resize image.
- Returns
- a pointer to resize context. On error it returns NULL. This pointer is used in functions SimdResizerRun. It must be released with using of function SimdRelease.
◆ SimdResizerRun()
void SimdResizerRun | ( | const void * | resizer, |
const uint8_t * | src, | ||
size_t | srcStride, | ||
uint8_t * | dst, | ||
size_t | dstStride | ||
) |
Performs image resizing.
- Parameters
-
[in] resizer - a resize context. It must be created by function SimdResizerInit and released by function SimdRelease. [in] src - a pointer to pixels data of the original input image. [in] srcStride - a row size (in bytes) of the input image. [out] dst - a pointer to pixels data of the resized output image. [in] dstStride - a row size (in bytes) of the output image.
◆ 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()
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()
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()
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()
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()
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 resized output image.
◆ ResizeAreaGray()
Performs resizing of input image with using area interpolation.
All images must have the same format (8-bit gray).
- Parameters
-
[in] src - an original input image. [out] dst - a resized output image.
◆ StretchGray2x2()
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.