Compensate for possible low LOD bit allocation shifts

This commit is contained in:
Siana Gearz
2011-06-17 16:04:11 +02:00
parent d1cb6d3335
commit b73a9b9a34
2 changed files with 30 additions and 1 deletions

View File

@@ -381,7 +381,13 @@ S32 LLImageJ2C::calcDataSize(S32 discard_level)
static const LLCachedControl<bool> legacy_size("SianaLegacyJ2CSize", false);
if (legacy_size) {
return calcDataSizeJ2C(getWidth(), getHeight(), getComponents(), discard_level, mRate);
static const LLCachedControl<F32> exponent("SianaJ2CSizeExponent", 1.0f);
static const LLCachedControl<S32> offset("SianaJ2CSizeOffset", 0);
S32 size = calcDataSizeJ2C(getWidth(), getHeight(), getComponents(), discard_level, mRate);
S32 size_d0 = calcDataSizeJ2C(getWidth(), getHeight(), getComponents(), discard_level, mRate);
return pow(size/size_d0, exponent)*size_d0 + offset;
}
discard_level = llclamp(discard_level, 0, MAX_DISCARD_LEVEL);