Functions for BGRA-32 image conversions. More...
Functions | |
| SIMD_API void | SimdBgraToBayer (const uint8_t *bgra, size_t width, size_t height, size_t bgraStride, uint8_t *bayer, size_t bayerStride, SimdPixelFormatType bayerFormat) |
| Converts a 32-bit BGRA image to an 8-bit Bayer image by sub-sampling color channels. More... | |
| SIMD_API void | SimdBgraToBgr (const uint8_t *bgra, size_t width, size_t height, size_t bgraStride, uint8_t *bgr, size_t bgrStride) |
| Converts a 32-bit BGRA image to a 24-bit BGR image by dropping the alpha channel. More... | |
| SIMD_API void | SimdBgraToGray (const uint8_t *bgra, size_t width, size_t height, size_t bgraStride, uint8_t *gray, size_t grayStride) |
| Converts a 32-bit BGRA image to an 8-bit grayscale image. More... | |
| SIMD_API void | SimdBgraToRgb (const uint8_t *bgra, size_t width, size_t height, size_t bgraStride, uint8_t *rgb, size_t rgbStride) |
| Converts a 32-bit BGRA image to a 24-bit RGB image by swapping the Red and Blue channels and dropping the alpha channel. More... | |
| SIMD_API void | SimdBgraToRgba (const uint8_t *bgra, size_t width, size_t height, size_t bgraStride, uint8_t *rgba, size_t rgbaStride) |
| Converts a 32-bit BGRA image to a 32-bit RGBA image by swapping the Red and Blue channels while preserving the alpha channel. More... | |
| SIMD_API void | SimdBgraToYuv420pV2 (const uint8_t *bgra, size_t bgraStride, size_t width, size_t height, uint8_t *y, size_t yStride, uint8_t *u, size_t uStride, uint8_t *v, size_t vStride, SimdYuvType yuvType) |
| Converts a 32-bit BGRA image to planar YUV420P (4:2:0) and ignores input alpha. More... | |
| SIMD_API void | SimdBgraToYuv422pV2 (const uint8_t *bgra, size_t bgraStride, size_t width, size_t height, uint8_t *y, size_t yStride, uint8_t *u, size_t uStride, uint8_t *v, size_t vStride, SimdYuvType yuvType) |
| Converts a 32-bit BGRA image to planar YUV422P (4:2:2) and ignores input alpha. More... | |
| SIMD_API void | SimdBgraToYuv444pV2 (const uint8_t *bgra, size_t bgraStride, size_t width, size_t height, uint8_t *y, size_t yStride, uint8_t *u, size_t uStride, uint8_t *v, size_t vStride, SimdYuvType yuvType) |
| Converts a 32-bit BGRA image to planar YUV444P (4:4:4) and ignores input alpha. More... | |
| SIMD_API void | SimdBgraToYuva420pV2 (const uint8_t *bgra, size_t bgraStride, size_t width, size_t height, uint8_t *y, size_t yStride, uint8_t *u, size_t uStride, uint8_t *v, size_t vStride, uint8_t *a, size_t aStride, SimdYuvType yuvType) |
| Converts a 32-bit BGRA image to planar YUVA420P (YUV 4:2:0 plus full-size alpha plane). More... | |
| template<template< class > class A> | |
| SIMD_INLINE void | BgraToBayer (const View< A > &bgra, View< A > &bayer) |
| Converts 32-bit BGRA image to 8-bit Bayer image. More... | |
| template<template< class > class A> | |
| SIMD_INLINE void | BgraToBgr (const View< A > &bgra, View< A > &bgr) |
| Converts 32-bit BGRA image to 24-bit BGR image. More... | |
| template<template< class > class A> | |
| SIMD_INLINE void | BgraToGray (const View< A > &bgra, View< A > &gray) |
| Converts 32-bit BGRA image to 8-bit gray image. More... | |
| template<template< class > class A> | |
| SIMD_INLINE void | BgraToRgb (const View< A > &bgra, View< A > &rgb) |
| Converts 32-bit BGRA image to 24-bit RGB image. More... | |
| template<template< class > class A> | |
| SIMD_INLINE void | BgraToRgba (const View< A > &bgra, View< A > &rgba) |
| Converts 32-bit BGRA image to 32-bit RGBA image. More... | |
| template<template< class > class A> | |
| SIMD_INLINE void | BgraToYuv420p (const View< A > &bgra, View< A > &y, View< A > &u, View< A > &v, SimdYuvType yuvType=SimdYuvBt601) |
| Converts 32-bit BGRA image to YUV420P. More... | |
| template<template< class > class A> | |
| SIMD_INLINE void | BgraToYuv422p (const View< A > &bgra, View< A > &y, View< A > &u, View< A > &v, SimdYuvType yuvType=SimdYuvBt601) |
| Converts 32-bit BGRA image to YUV422P. More... | |
| template<template< class > class A> | |
| SIMD_INLINE void | BgraToYuv444p (const View< A > &bgra, View< A > &y, View< A > &u, View< A > &v, SimdYuvType yuvType=SimdYuvBt601) |
| Converts 32-bit BGRA image to YUV444P. More... | |
| template<template< class > class A> | |
| SIMD_INLINE void | BgraToYuva420p (const View< A > &bgra, View< A > &y, View< A > &u, View< A > &v, View< A > &a, SimdYuvType yuvType=SimdYuvBt601) |
| Converts 32-bit BGRA image to YUVA420P. More... | |
Detailed Description
Functions for BGRA-32 image conversions.
Function Documentation
◆ SimdBgraToBayer()
| void SimdBgraToBayer | ( | const uint8_t * | bgra, |
| size_t | width, | ||
| size_t | height, | ||
| size_t | bgraStride, | ||
| uint8_t * | bayer, | ||
| size_t | bayerStride, | ||
| SimdPixelFormatType | bayerFormat | ||
| ) |
Converts a 32-bit BGRA image to an 8-bit Bayer image by sub-sampling color channels.
The function down-samples a full-color 32-bit BGRA image to an 8-bit Bayer-patterned image. For each 2x2 block of BGRA pixels, exactly one color channel value (Blue, Green, or Red) is selected per output pixel according to the specified Bayer pattern. The alpha channel of the input image is ignored. Both images must have the same width and height, and both dimensions must be even.
- Note
- This function has a C++ wrapper Simd::BgraToBayer(const View<A>& bgra, View<A>& bayer).
- Parameters
-
[in] bgra - a pointer to pixels data of input 32-bit BGRA image. [in] width - an image width. Must be even. [in] height - an image height. Must be even. [in] bgraStride - a row size (in bytes) of the bgra image. [out] bayer - a pointer to pixels data of output 8-bit Bayer image. [in] bayerStride - a row size (in bytes) of the bayer image. [in] bayerFormat - a format of the output bayer image. It can be SimdPixelFormatBayerGrbg, SimdPixelFormatBayerGbrg, SimdPixelFormatBayerRggb or SimdPixelFormatBayerBggr.
◆ SimdBgraToBgr()
| void SimdBgraToBgr | ( | const uint8_t * | bgra, |
| size_t | width, | ||
| size_t | height, | ||
| size_t | bgraStride, | ||
| uint8_t * | bgr, | ||
| size_t | bgrStride | ||
| ) |
Converts a 32-bit BGRA image to a 24-bit BGR image by dropping the alpha channel.
The function converts a 32-bit BGRA (Blue, Green, Red, Alpha) image to a 24-bit BGR (Blue, Green, Red) image. The Blue, Green, and Red channels are copied unchanged for each pixel; the alpha channel is discarded. This function can also be used for 32-bit RGBA to 24-bit RGB conversion, since the channel layout operation (dropping the 4th channel) is identical. Both images must have the same width and height.
- Note
- This function has C++ wrappers: Simd::BgraToBgr(const View<A>& bgra, View<A>& bgr) and Simd::RgbaToRgb(const View<A>& rgba, View<A>& rgb).
- Parameters
-
[in] bgra - a pointer to pixels data of input 32-bit BGRA (or 32-bit RGBA) image. [in] width - an image width. [in] height - an image height. [in] bgraStride - a row size (in bytes) of the bgra image. [out] bgr - a pointer to pixels data of output 24-bit BGR (or 24-bit RGB) image. [in] bgrStride - a row size (in bytes) of the bgr image.
◆ SimdBgraToGray()
| void SimdBgraToGray | ( | const uint8_t * | bgra, |
| size_t | width, | ||
| size_t | height, | ||
| size_t | bgraStride, | ||
| uint8_t * | gray, | ||
| size_t | grayStride | ||
| ) |
Converts a 32-bit BGRA image to an 8-bit grayscale image.
The function converts a 32-bit BGRA (Blue, Green, Red, Alpha) image to an 8-bit grayscale image. The alpha channel is ignored. The luminance value of each pixel is calculated from the Blue, Green, and Red channels using the ITU-R BT.601 standard weighted sum:
gray = (0.114 * blue + 0.587 * green + 0.299 * red)
Both images must have the same width and height.
- Note
- This function has a C++ wrapper Simd::BgraToGray(const View<A>& bgra, View<A>& gray).
- Parameters
-
[in] bgra - a pointer to pixels data of input 32-bit BGRA image. [in] width - an image width. [in] height - an image height. [in] bgraStride - a row size (in bytes) of the bgra image. [out] gray - a pointer to pixels data of output 8-bit gray image. [in] grayStride - a row size (in bytes) of the gray image.
◆ SimdBgraToRgb()
| void SimdBgraToRgb | ( | const uint8_t * | bgra, |
| size_t | width, | ||
| size_t | height, | ||
| size_t | bgraStride, | ||
| uint8_t * | rgb, | ||
| size_t | rgbStride | ||
| ) |
Converts a 32-bit BGRA image to a 24-bit RGB image by swapping the Red and Blue channels and dropping the alpha channel.
The function converts a 32-bit BGRA (Blue, Green, Red, Alpha) image to a 24-bit RGB (Red, Green, Blue) image. The Blue and Red channels are swapped, the Green channel is copied unchanged, and the alpha channel is discarded. This function can also be used for 32-bit RGBA to 24-bit BGR conversion, since the channel reordering operation is identical. Both images must have the same width and height.
- Note
- This function has C++ wrappers: Simd::BgraToRgb(const View<A>& bgra, View<A>& rgb) and Simd::RgbaToBgr(const View<A>& rgba, View<A>& bgr).
- Parameters
-
[in] bgra - a pointer to pixels data of input 32-bit BGRA (or 32-bit RGBA) image. [in] width - an image width. [in] height - an image height. [in] bgraStride - a row size (in bytes) of the bgra image. [out] rgb - a pointer to pixels data of output 24-bit RGB (or 24-bit BGR) image. [in] rgbStride - a row size (in bytes) of the rgb image.
◆ SimdBgraToRgba()
| void SimdBgraToRgba | ( | const uint8_t * | bgra, |
| size_t | width, | ||
| size_t | height, | ||
| size_t | bgraStride, | ||
| uint8_t * | rgba, | ||
| size_t | rgbaStride | ||
| ) |
Converts a 32-bit BGRA image to a 32-bit RGBA image by swapping the Red and Blue channels while preserving the alpha channel.
The function converts a 32-bit BGRA (Blue, Green, Red, Alpha) image to a 32-bit RGBA (Red, Green, Blue, Alpha) image. The Blue and Red channels are swapped, while the Green and Alpha channels are copied unchanged for each pixel. This function can also be used for 32-bit RGBA to 32-bit BGRA conversion, since the transformation is its own inverse. Both images must have the same width and height.
- Note
- This function has C++ wrappers: Simd::BgraToRgba(const View<A>& bgra, View<A>& rgba) and Simd::RgbaToBgra(const View<A>& rgba, View<A>& bgra).
- Parameters
-
[in] bgra - a pointer to pixels data of input 32-bit BGRA (or 32-bit RGBA) image. [in] width - an image width. [in] height - an image height. [in] bgraStride - a row size (in bytes) of the bgra image. [out] rgba - a pointer to pixels data of output 32-bit RGBA (or 32-bit BGRA) image. [in] rgbaStride - a row size (in bytes) of the rgba image.
◆ SimdBgraToYuv420pV2()
| void SimdBgraToYuv420pV2 | ( | const uint8_t * | bgra, |
| size_t | bgraStride, | ||
| size_t | width, | ||
| size_t | height, | ||
| uint8_t * | y, | ||
| size_t | yStride, | ||
| uint8_t * | u, | ||
| size_t | uStride, | ||
| uint8_t * | v, | ||
| size_t | vStride, | ||
| SimdYuvType | yuvType | ||
| ) |
Converts a 32-bit BGRA image to planar YUV420P (4:2:0) and ignores input alpha.
Y is computed for every source pixel from its B, G, R values. U and V are computed for every 2x2 block from averaged B, G, R values of this block. The input BGRA and output Y images must have the same width and height. The output U and V images must have half width and half height relative to Y. The width and the height must be even.
- Note
- This function has a C++ wrapper Simd::BgraToYuv420p(const View& bgra, View& y, View& u, View& v, SimdYuvType yuvType = SimdYuvBt601).
- Parameters
-
[in] bgra - a pointer to pixels data of input 32-bit BGRA image. [in] bgraStride - a row size of the BGRA image. [in] width - an image width. [in] height - an image height. [out] y - a pointer to pixels data of output 8-bit image with Y color plane. [in] yStride - a row size of the y image. [out] u - a pointer to pixels data of output 8-bit image with U color plane. [in] uStride - a row size of the u image. [out] v - a pointer to pixels data of output 8-bit image with V color plane. [in] vStride - a row size of the v image. [in] yuvType - a type of output YUV image (see description of SimdYuvType).
◆ SimdBgraToYuv422pV2()
| void SimdBgraToYuv422pV2 | ( | const uint8_t * | bgra, |
| size_t | bgraStride, | ||
| size_t | width, | ||
| size_t | height, | ||
| uint8_t * | y, | ||
| size_t | yStride, | ||
| uint8_t * | u, | ||
| size_t | uStride, | ||
| uint8_t * | v, | ||
| size_t | vStride, | ||
| SimdYuvType | yuvType | ||
| ) |
Converts a 32-bit BGRA image to planar YUV422P (4:2:2) and ignores input alpha.
Y is computed for every source pixel from its B, G, R values. U and V are computed for each horizontal pair of pixels from averaged B, G, R values of this pair. The input BGRA and output Y images must have the same width and height. The output U and V images must have half width and the same height relative to Y. The width must be even.
- Note
- This function has a C++ wrapper Simd::BgraToYuv422p(const View& bgra, View& y, View& u, View& v, SimdYuvType yuvType = SimdYuvBt601).
- Parameters
-
[in] bgra - a pointer to pixels data of input 32-bit BGRA image. [in] bgraStride - a row size of the BGRA image. [in] width - an image width. [in] height - an image height. [out] y - a pointer to pixels data of output 8-bit image with Y color plane. [in] yStride - a row size of the y image. [out] u - a pointer to pixels data of output 8-bit image with U color plane. [in] uStride - a row size of the u image. [out] v - a pointer to pixels data of output 8-bit image with V color plane. [in] vStride - a row size of the v image. [in] yuvType - a type of output YUV image (see description of SimdYuvType).
◆ SimdBgraToYuv444pV2()
| void SimdBgraToYuv444pV2 | ( | const uint8_t * | bgra, |
| size_t | bgraStride, | ||
| size_t | width, | ||
| size_t | height, | ||
| uint8_t * | y, | ||
| size_t | yStride, | ||
| uint8_t * | u, | ||
| size_t | uStride, | ||
| uint8_t * | v, | ||
| size_t | vStride, | ||
| SimdYuvType | yuvType | ||
| ) |
Converts a 32-bit BGRA image to planar YUV444P (4:4:4) and ignores input alpha.
Y, U and V are computed for every source pixel from its B, G, R values. The input BGRA and output Y, U and V images must have the same width and height.
- Note
- This function has a C++ wrapper Simd::BgraToYuv444p(const View& bgra, View& y, View& u, View& v, SimdYuvType yuvType = SimdYuvBt601).
- Parameters
-
[in] bgra - a pointer to pixels data of input 32-bit BGRA image. [in] bgraStride - a row size of the BGRA image. [in] width - an image width. [in] height - an image height. [out] y - a pointer to pixels data of output 8-bit image with Y color plane. [in] yStride - a row size of the y image. [out] u - a pointer to pixels data of output 8-bit image with U color plane. [in] uStride - a row size of the u image. [out] v - a pointer to pixels data of output 8-bit image with V color plane. [in] vStride - a row size of the v image. [in] yuvType - a type of output YUV image (see description of SimdYuvType).
◆ SimdBgraToYuva420pV2()
| void SimdBgraToYuva420pV2 | ( | const uint8_t * | bgra, |
| size_t | bgraStride, | ||
| size_t | width, | ||
| size_t | height, | ||
| uint8_t * | y, | ||
| size_t | yStride, | ||
| uint8_t * | u, | ||
| size_t | uStride, | ||
| uint8_t * | v, | ||
| size_t | vStride, | ||
| uint8_t * | a, | ||
| size_t | aStride, | ||
| SimdYuvType | yuvType | ||
| ) |
Converts a 32-bit BGRA image to planar YUVA420P (YUV 4:2:0 plus full-size alpha plane).
Y is computed for every source pixel from its B, G, R values. U and V are computed for every 2x2 block from averaged B, G, R values of this block. A is copied from the source alpha channel for every pixel without changes. The input BGRA and output Y and A images must have the same width and height. The output U and V images must have half width and half height relative to Y. The width and the height must be even.
- Note
- This function has a C++ wrapper Simd::BgraToYuva420p(const View & bgra, View & y, View & u, View & v, View & a, SimdYuvType yuvType = SimdYuvBt601).
- Parameters
-
[in] bgra - a pointer to pixels data of input 32-bit BGRA image. [in] bgraStride - a row size of the BGRA image. [in] width - an image width. [in] height - an image height. [out] y - a pointer to pixels data of output 8-bit image with Y color plane. [in] yStride - a row size of the y image. [out] u - a pointer to pixels data of output 8-bit image with U color plane. [in] uStride - a row size of the u image. [out] v - a pointer to pixels data of output 8-bit image with V color plane. [in] vStride - a row size of the v image. [out] a - a pointer to pixels data of output 8-bit image with alpha plane. [in] aStride - a row size of the a image. [in] yuvType - a type of output YUV image (see description of SimdYuvType).
◆ BgraToBayer()
Converts 32-bit BGRA image to 8-bit Bayer image.
All images must have the same width and height. The width and the height must be even.
- Note
- This function is a C++ wrapper for function SimdBgraToBayer.
- Parameters
-
[in] bgra - an input 32-bit BGRA image. [out] bayer - an output 8-bit Bayer image.
◆ BgraToBgr()
Converts 32-bit BGRA image to 24-bit BGR image.
All images must have the same width and height.
- Note
- This function is a C++ wrapper for function SimdBgraToBgr.
- Parameters
-
[in] bgra - an input 32-bit BGRA image. [out] bgr - an output 24-bit BGR image.
◆ BgraToGray()
Converts 32-bit BGRA image to 8-bit gray image.
All images must have the same width and height.
- Note
- This function is a C++ wrapper for function SimdBgraToGray.
- Parameters
-
[in] bgra - an input 32-bit BGRA image. [out] gray - an output 8-bit gray image.
◆ BgraToRgb()
Converts 32-bit BGRA image to 24-bit RGB image.
All images must have the same width and height.
- Note
- This function is a C++ wrapper for function SimdBgraToRgb.
- Parameters
-
[in] bgra - an input 32-bit BGRA image. [out] rgb - an output 24-bit RGB image.
◆ BgraToRgba()
Converts 32-bit BGRA image to 32-bit RGBA image.
All images must have the same width and height.
- Note
- This function is a C++ wrapper for function SimdBgraToRgba.
- Parameters
-
[in] bgra - an input 32-bit BGRA image. [out] rgba - an output 32-bit RGBA image.
◆ BgraToYuv420p()
| void BgraToYuv420p | ( | const View< A > & | bgra, |
| View< A > & | y, | ||
| View< A > & | u, | ||
| View< A > & | v, | ||
| SimdYuvType | yuvType = SimdYuvBt601 |
||
| ) |
Converts 32-bit BGRA image to YUV420P.
The input BGRA and output Y images must have the same width and height. The input U and V images must have the same width and height (half size relative to Y component).
- Note
- This function is a C++ wrapper for function SimdBgraToYuv420pV2.
- Parameters
-
[in] bgra - an input 32-bit BGRA image. [out] y - an output 8-bit image with Y color plane. [out] u - an output 8-bit image with U color plane. [out] v - an output 8-bit image with V color plane. [in] yuvType - a type of input YUV image (see description of SimdYuvType). By default it is equal to SimdYuvBt601.
◆ BgraToYuv422p()
| void BgraToYuv422p | ( | const View< A > & | bgra, |
| View< A > & | y, | ||
| View< A > & | u, | ||
| View< A > & | v, | ||
| SimdYuvType | yuvType = SimdYuvBt601 |
||
| ) |
Converts 32-bit BGRA image to YUV422P.
The input BGRA and output Y images must have the same width and height. The input U and V images must have the same width and height (their width is equal to half width of Y component).
- Note
- This function is a C++ wrapper for function SimdBgraToYuv422pV2.
- Parameters
-
[in] bgra - an input 32-bit BGRA image. [out] y - an output 8-bit image with Y color plane. [out] u - an output 8-bit image with U color plane. [out] v - an output 8-bit image with V color plane. [in] yuvType - a type of input YUV image (see description of SimdYuvType). By default it is equal to SimdYuvBt601.
◆ BgraToYuv444p()
| void BgraToYuv444p | ( | const View< A > & | bgra, |
| View< A > & | y, | ||
| View< A > & | u, | ||
| View< A > & | v, | ||
| SimdYuvType | yuvType = SimdYuvBt601 |
||
| ) |
Converts 32-bit BGRA image to YUV444P.
The input BGRA and output Y, U and V images must have the same width and height.
- Note
- This function is a C++ wrapper for function SimdBgraToYuv444pV2.
- Parameters
-
[in] bgra - an input 32-bit BGRA image. [out] y - an output 8-bit image with Y color plane. [out] u - an output 8-bit image with U color plane. [out] v - an output 8-bit image with V color plane. [in] yuvType - a type of input YUV image (see description of SimdYuvType). By default it is equal to SimdYuvBt601.
◆ BgraToYuva420p()
| void BgraToYuva420p | ( | const View< A > & | bgra, |
| View< A > & | y, | ||
| View< A > & | u, | ||
| View< A > & | v, | ||
| View< A > & | a, | ||
| SimdYuvType | yuvType = SimdYuvBt601 |
||
| ) |
Converts 32-bit BGRA image to YUVA420P.
The input BGRA and output Y and A images must have the same width and height. The input U and V images must have the same width and height (half size relative to Y component).
- Note
- This function is a C++ wrapper for function SimdBgraToYuva420pV2.
- Parameters
-
[in] bgra - an input 32-bit BGRA image. [out] y - an output 8-bit image with Y color plane. [out] u - an output 8-bit image with U color plane. [out] v - an output 8-bit image with V color plane. [out] a - an output 8-bit image with alpha plane. [in] yuvType - a type of input YUV image (see description of SimdYuvType). By default it is equal to SimdYuvBt601.