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);

View File

@@ -37,6 +37,29 @@
</array>
</map>
<key>SianaJ2CSizeExponent</key>
<map>
<key>Comment</key>
<string>Exponent of size estimator. Should be between 0.0 and 1.0</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>0.5</real>
</map>
<key>SianaJ2CSizeOffset</key>
<map>
<key>Comment</key>
<string>Number of bytes to add to size estimator.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>S32</string>
<key>Value</key>
<integer>100</integer>
</map>
<key>SianaLegacyJ2CSize</key>
<map>
<key>Comment</key>