Fix LUTInterpolator lookup table position calc

am: 0940834c8c

Change-Id: Ib80c00801473d7e60bae87b3b34a381c7f8e7e68
This commit is contained in:
Doris Liu
2016-12-01 01:33:52 +00:00
committed by android-build-merger
2 changed files with 3 additions and 2 deletions

View File

@@ -97,7 +97,8 @@ LUTInterpolator::~LUTInterpolator() {
}
float LUTInterpolator::interpolate(float input) {
float lutpos = input * mSize;
// lut position should only be at the end of the table when input is 1f.
float lutpos = input * (mSize - 1);
if (lutpos >= (mSize - 1)) {
return mValues[mSize - 1];
}

View File

@@ -104,7 +104,7 @@ public class NativeInterpolatorFactoryHelper_Delegate {
@Override
public float getInterpolation(float input) {
float lutpos = input * mSize;
float lutpos = input * (mSize - 1);
if (lutpos >= (mSize - 1)) {
return mValues[mSize - 1];
}