|
Simple Graphics Library 1.0.0.0
Runtime-independent image processing primitives
|
Saturating scalar helpers for Q11 and Q16 values. More...
Typedefs | |
| typedef sgl_int16_t | sgl_q11_t |
| Signed Q11 value stored in 16 bits. | |
| typedef sgl_int32_t | sgl_q11_ext_t |
| Extended signed Q11 value stored in 32 bits. | |
| typedef sgl_int32_t | sgl_q16_t |
| Signed Q16 value stored in 32 bits. | |
| typedef sgl_int64_t | sgl_q16_ext_t |
| Extended signed Q16 value stored in 64 bits. | |
| typedef int16x8_t | sgl_simd_q11_t |
| Eight signed 16-bit Q11 lanes. | |
| typedef int32x4_t | sgl_simd_q11_ext_t |
| Four signed 32-bit extended Q11 lanes. | |
Functions | |
| static sgl_int32_t | sgl_fixed_clamp_i64_to_i32 (sgl_int64_t value) |
| Saturates a signed 64-bit value to the signed 32-bit range. | |
| static sgl_int16_t | sgl_fixed_clamp_i32_to_i16 (sgl_int32_t value) |
| Saturates a signed 32-bit value to the signed 16-bit range. | |
| static sgl_int64_t | sgl_fixed_div_pow2_i64 (sgl_int64_t value, sgl_uint32_t shift) |
| Divides by a power of two with C99 signed-division semantics. | |
| static sgl_int64_t | sgl_fixed_floor_pow2_i64 (sgl_int64_t value, sgl_uint32_t shift) |
| Divides by a power of two while rounding toward negative infinity. | |
| static sgl_q11_ext_t | sgl_int_to_q11 (sgl_q11_ext_t value) |
| Converts an integer to extended Q11 with saturation. | |
| static sgl_q11_ext_t | sgl_q11_get_int_part (sgl_q11_ext_t value) |
| Extracts the integer part of an extended Q11 value. | |
| static sgl_q11_ext_t | sgl_q11_get_frac_part (sgl_q11_ext_t value) |
| Extracts the signed fractional part of an extended Q11 value. | |
| static sgl_q11_ext_t | sgl_q11_round_up (sgl_q11_ext_t value) |
| Adds the Q11 half-unit used before rounded conversion. | |
| static sgl_q11_ext_t | sgl_q11_shift_down (sgl_q11_ext_t value) |
| Removes Q11 fractional bits while rounding toward negative infinity. | |
| static sgl_q11_t | sgl_q11_mul (sgl_q11_t a, sgl_q11_t b) |
| Multiplies two Q11 values with rounding and saturation. | |
| static sgl_q11_ext_t | sgl_q11_ext_mul (sgl_q11_ext_t a, sgl_q11_ext_t b) |
| Multiplies two extended Q11 values with rounding and saturation. | |
| static sgl_q16_ext_t | sgl_int_to_q16 (sgl_int32_t value) |
| Converts a signed 32-bit integer to extended Q16. | |
| static sgl_int32_t | sgl_q16_round_to_int32 (sgl_q16_ext_t value) |
| Rounds an extended Q16 value to the nearest signed 32-bit integer. | |
| static sgl_uint8_t | sgl_clamp_u8_i32 (sgl_int32_t val) |
| Saturates a signed 32-bit channel value to 0 through 255. | |
| static sgl_simd_q11_t | sgl_simd_q11_mul (sgl_simd_q11_t a, sgl_simd_q11_t b) |
| Multiplies eight Q11 lane pairs with rounding and saturation. | |
| static sgl_simd_q11_ext_t | sgl_simd_q11_ext_mul (sgl_simd_q11_ext_t a, sgl_simd_q11_ext_t b) |
| Multiplies four extended Q11 lane pairs. | |
| static uint8x8_t | sgl_simd_clamp_u8_i32 (int32x4_t lo, int32x4_t hi) |
| Saturates eight signed 32-bit channel lanes to unsigned bytes. | |
Saturating scalar helpers for Q11 and Q16 values.
|
inlinestatic |
|
inlinestatic |
Saturates a signed 32-bit value to the signed 16-bit range.
| [in] | value | Value to clamp. |
Definition at line 80 of file generic.h.
References SGL_FIXED_INT16_MAX, and SGL_FIXED_INT16_MIN.
Referenced by sgl_q11_mul().
|
inlinestatic |
Saturates a signed 64-bit value to the signed 32-bit range.
| [in] | value | Value to clamp. |
Definition at line 57 of file generic.h.
References SGL_FIXED_INT32_MAX, and SGL_FIXED_INT32_MIN.
Referenced by sgl_int_to_q11(), sgl_q11_ext_mul(), and sgl_q11_round_up().
|
inlinestatic |
Divides by a power of two with C99 signed-division semantics.
| [in] | value | Dividend. |
| [in] | shift | Base-two exponent in the range 0 through 63. |
value / (1 << shift), truncated toward zero, or 0 when shift is outside the supported range.The shift is applied only to an unsigned magnitude, avoiding an implementation-defined right shift of a negative signed integer.
Definition at line 108 of file generic.h.
References SGL_FIXED_I64_BITS.
Referenced by sgl_q11_get_int_part().
|
inlinestatic |
Divides by a power of two while rounding toward negative infinity.
| [in] | value | Dividend. |
| [in] | shift | Base-two exponent. |
Definition at line 139 of file generic.h.
References SGL_FIXED_I64_BITS.
Referenced by sgl_q11_ext_mul().
|
inlinestatic |
Converts an integer to extended Q11 with saturation.
| [in] | value | Integer value. |
value * 2048, saturated to 32 bits. Definition at line 177 of file generic.h.
References sgl_fixed_clamp_i64_to_i32(), and SGL_Q11_ONE.
|
inlinestatic |
Converts a signed 32-bit integer to extended Q16.
| [in] | value | Integer value. |
Definition at line 311 of file generic.h.
References SGL_Q16_ONE.
|
inlinestatic |
Multiplies two extended Q11 values with rounding and saturation.
| [in] | a | First Q11 factor. |
| [in] | b | Second Q11 factor. |
Definition at line 291 of file generic.h.
References sgl_fixed_clamp_i64_to_i32(), sgl_fixed_floor_pow2_i64(), SGL_Q11_FRAC_BITS, and SGL_Q11_HALF.
|
inlinestatic |
Extracts the signed fractional part of an extended Q11 value.
| [in] | value | Extended Q11 value. |
Definition at line 209 of file generic.h.
References sgl_q11_get_int_part(), and SGL_Q11_ONE.
|
inlinestatic |
Extracts the integer part of an extended Q11 value.
| [in] | value | Extended Q11 value. |
Definition at line 193 of file generic.h.
References sgl_fixed_div_pow2_i64(), and SGL_Q11_FRAC_BITS.
Referenced by sgl_q11_get_frac_part().
Multiplies two Q11 values with rounding and saturation.
| [in] | a | First Q11 factor. |
| [in] | b | Second Q11 factor. |
Definition at line 270 of file generic.h.
References sgl_fixed_clamp_i32_to_i16(), sgl_q11_round_up(), and sgl_q11_shift_down().
|
inlinestatic |
Adds the Q11 half-unit used before rounded conversion.
| [in] | value | Extended Q11 value. |
value + 1024, saturated to signed 32 bits. Definition at line 225 of file generic.h.
References sgl_fixed_clamp_i64_to_i32(), and SGL_Q11_HALF.
Referenced by sgl_q11_mul().
|
inlinestatic |
Removes Q11 fractional bits while rounding toward negative infinity.
| [in] | value | Extended Q11 value. |
Definition at line 241 of file generic.h.
References SGL_Q11_FRAC_BITS, and SGL_Q11_MASK.
Referenced by sgl_q11_mul().
|
inlinestatic |
Rounds an extended Q16 value to the nearest signed 32-bit integer.
| [in] | value | Extended Q16 value. |
Definition at line 325 of file generic.h.
References SGL_FIXED_INT32_MAX, SGL_FIXED_INT32_MIN, SGL_Q16_FRAC_BITS, and SGL_Q16_HALF.
|
inlinestatic |
|
inlinestatic |
Multiplies four extended Q11 lane pairs.
| [in] | a | First extended Q11 vector. |
| [in] | b | Second extended Q11 vector. |
Each 32-bit lane stores one Q11 value. Multiplication creates a Q22 intermediate, then a rounding right shift restores the Q11 scale.
Definition at line 60 of file neon.h.
References SGL_Q11_FRAC_BITS.
|
inlinestatic |
Multiplies eight Q11 lane pairs with rounding and saturation.
| [in] | a | First Q11 vector. |
| [in] | b | Second Q11 vector. |
(a * b) >> 11 per lane. Definition at line 28 of file neon.h.
References SGL_Q11_FRAC_BITS.