ARM NEON Compositor
master
Fast SIMD alpha overlay and blending for ARM
|
Functions for overlaying a foreground image with an alpha channel on top of a background channel. More...
Modules | |
Rescale | |
Functions to rescale the color values by dividing by 255. | |
C Wrappers | |
C language wrappers for the alpha overlay functions. | |
Functions | |
template<RescaleType rescale_type = RescaleType::Div255_Round> | |
void | overlay_alpha_fast (const uint8_t *bg_img, const uint8_t *fg_img, uint8_t *out_img, size_t n) |
Fast function to overlay two images of the same size, where the number of pixels is a multiple of 8. More... | |
template<RescaleType rescale_type = RescaleType::Div255_Round> | |
void | overlay_alpha_stride (const uint8_t *bg_img, const uint8_t *fg_img, uint8_t *out_img, size_t bg_full_cols, size_t fg_rows, size_t fg_cols, size_t fg_full_cols) |
Overlay a smaller image with an alpha channel over a larger background image. More... | |
void | overlay_alpha_stride (const uint8_t(&bg_img)[4], const uint8_t(&fg_img)[4], uint8_t(&out_img)[4], size_t bg_full_cols, size_t fg_rows, size_t fg_cols, size_t fg_full_cols) |
Overlay a smaller image with an alpha channel over a larger background image. More... | |
Functions for overlaying a foreground image with an alpha channel on top of a background channel.
void overlay_alpha_fast | ( | const uint8_t * | bg_img, |
const uint8_t * | fg_img, | ||
uint8_t * | out_img, | ||
size_t | n | ||
) |
Fast function to overlay two images of the same size, where the number of pixels is a multiple of 8.
This function writes the blended color values of the background and the foreground to the output image.
The alpha channel of the background image is copied to the output unaltered.
(R
= red, G
= green, B
= blue, A
= alpha)
By default, the division is rounded. By specifying a different rescale_type
, you can disable rounding, use a faster, approximating rounding division by 255, or approximate even more by using a division by 256 instead of 255.
All images should be passed to this function as contiguous arrays of bytes with the colors as [B, G, R, A] or ARGB as a little-Endian 32-bit number.
bg_img | A pointer to the image data of the background image. |
fg_img | A pointer to the image data of the foreground image. |
out_img | A pointer to the image data of the output image. May be the same as bg_img . |
n | The number of pixels. Must be a multiple of eight. |
rescale_type | The rescaling mode to use. See RescaleType. |
Definition at line 101 of file src/alpha-lib/src/overlay_alpha.cpp.
void overlay_alpha_stride | ( | const uint8_t * | bg_img, |
const uint8_t * | fg_img, | ||
uint8_t * | out_img, | ||
size_t | bg_full_cols, | ||
size_t | fg_rows, | ||
size_t | fg_cols, | ||
size_t | fg_full_cols | ||
) |
Overlay a smaller image with an alpha channel over a larger background image.
This function writes the mixed color values of the background and the foreground to the output image.
The alpha channel of the background image is copied to the output unaltered.
(R
= red, G
= green, B
= blue, A
= alpha)
By default, the division is rounded. By specifying a different rescale_type
, you can disable rounding, use a faster, approximating rounding division by 255, or approximate even more by using a division by 256 instead of 255.
All images should be passed to this function as contiguous arrays of bytes in column major order, with the colors as [B, G, R, A] or ARGB as a little-Endian 32-bit number.
bg_img | A pointer to the image data of the background image. |
fg_img | A pointer to the image data of the foreground image. |
out_img | A pointer to the image data of the output image. May be the same as bg_img . |
bg_full_cols | The total number of columns of the background and the output image. Used as the stride/leading dimension. |
fg_rows | The number of rows of the foreground image to overlay. |
fg_cols | The number of columns of the foreground image to overlay. |
fg_full_cols | The total number of columns of the foreground image. Used as the stride/leading dimension. |
rescale_type | The rescaling mode to use. See RescaleType. |
Definition at line 124 of file src/alpha-lib/src/overlay_alpha.cpp.
|
inline |
Overlay a smaller image with an alpha channel over a larger background image.
This function writes the mixed color values of the background and the foreground to the output image.
The alpha channel of the background image is copied to the output unaltered.
(R
= red, G
= green, B
= blue, A
= alpha)
By default, the division is rounded. By specifying a different rescale_type
, you can disable rounding, use a faster, approximating rounding division by 255, or approximate even more by using a division by 256 instead of 255.
All images should be passed to this function as contiguous arrays of bytes in column major order, with the colors as [B, G, R, A] or ARGB as a little-Endian 32-bit number.
bg_img | A pointer to the image data of the background image. |
fg_img | A pointer to the image data of the foreground image. |
out_img | A pointer to the image data of the output image. May be the same as bg_img . |
bg_full_cols | The total number of columns of the background and the output image. Used as the stride/leading dimension. |
fg_rows | The number of rows of the foreground image to overlay. |
fg_cols | The number of columns of the foreground image to overlay. |
fg_full_cols | The total number of columns of the foreground image. Used as the stride/leading dimension. |
rescale_type | The rescaling mode to use. See RescaleType. |
This overload uses references to a specific pixel in the images.
You can use it with the result of cv::Mat::at<uint8_t[4]>(row, col)
.
Definition at line 119 of file overlay_alpha.hpp.