Linear interpolation lookup table (LUT).
More...
#include <stddef.h>
Go to the source code of this file.
|
| float | lut_lookup (const lerp_lut_t *lut, float key) |
| | Lookup a value in a linear interpolation lookup table (LUT).
|
| |
Linear interpolation lookup table (LUT).
- Author
- Irving Wang (irvin.nosp@m.gw@p.nosp@m.urdue.nosp@m..edu)
◆ LERP_LUT_INIT
| #define LERP_LUT_INIT |
( |
| name, |
|
|
| _entries, |
|
|
| _size ) |
Value:
.entries = _entries, \
.size = _size, \
}; \
static_assert(
sizeof(_entries) /
sizeof(
lut_entry_t) == _size, \
"Entries array size must match _size"); \
static_assert(_size > 1, "LUT size must be greater than 1")
◆ lut_lookup()
| float lut_lookup |
( |
const lerp_lut_t * | lut, |
|
|
float | key ) |
Lookup a value in a linear interpolation lookup table (LUT).
This function performs a binary search to find the appropriate interval in the LUT and then linearly interpolates between the two nearest entries.
- Parameters
-
| lut | Pointer to the LUT. |
| key | The key to look up. |
- Returns
- The interpolated value.