Loading...
Searching...
No Matches
volk_8u_x2_add_saturated_8u

Overview

Adds two uint8_t vectors element-wise with saturation. Results are clamped to the range [0, 255] to prevent overflow wraparound.

Dispatcher Prototype

void volk_8u_x2_add_saturated_8u(uint8_t* outVector, const uint8_t* inVectorA, const
uint8_t* inVectorB, unsigned int num_points)

Inputs

- inVectorA: First input vector.
- inVectorB: Second input vector.
- num_points: Vector length.

Outputs

- outVector: Saturated sum output.

Example

unsigned int N = 8;
unsigned int align = volk_get_alignment();
uint8_t* a = (uint8_t*)volk_malloc(N, align);
uint8_t* b = (uint8_t*)volk_malloc(N, align);
uint8_t* result = (uint8_t*)volk_malloc(N, align);
// Values that will cause saturation
a[0] = 200; b[0] = 100; // 300 -> saturates to 255
a[1] = 50; b[1] = 30; // 80 -> no saturation
volk_8u_x2_add_saturated_8u(result, a, b, N);
// result[0] == 255, result[1] == 80
volk_free(a);
volk_free(b);
volk_free(result);