2 byte table axis #3045

This commit is contained in:
Andrey 2021-12-19 23:20:21 -05:00
parent 0002570791
commit 3789d570f7
2 changed files with 13 additions and 12 deletions

View File

@ -172,17 +172,6 @@ int findIndex(const float array[], int size, float value) {
return findIndexMsg("", array, size, value);
}
/**
* Sets specified value for specified key in a correction curve
* see also setLinearCurve()
*/
void setCurveValue(float bins[], float values[], int size, float key, float value) {
int index = findIndexMsg("tbVl", bins, size, key);
if (index == -1)
index = 0;
values[index] = value;
}
void initInterpolation() {
#if BINARY_PERF && ! EFI_UNIT_TEST
addConsoleAction("binarytest", testBinary);

View File

@ -143,6 +143,19 @@ float interpolate3d(const VType (&table)[RNum][CNum],
return priv::linterp(left, right, col.Frac);
}
/**
* Sets specified value for specified key in a correction curve
* see also setLinearCurve()
*/
template<typename VType, typename kType>
void setCurveValue(const kType bins[], VType values[], int size, float key, float value) {
int index = findIndexMsg("tbVl", bins, size, key);
if (index == -1)
index = 0;
values[index] = value;
}
/** @brief Binary search
* @returns the highest index within sorted array such that array[i] is greater than or equal to the parameter
* @note If the parameter is smaller than the first element of the array, -1 is returned.
@ -203,7 +216,6 @@ int findIndexMsgExt(const char *msg, const kType array[], int size, kType value)
return middle;
}
void setCurveValue(float bins[], float values[], int size, float key, float value);
void initInterpolation();
class FastInterpolation {