diff options
author | TommyTheTerrible <81168766+TommyTheTerrible@users.noreply.github.com> | 2024-07-20 06:37:23 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-20 13:37:23 +0300 |
commit | bffd4a12b8e6677d8cd8bec2e38909e5200b69dd (patch) | |
tree | 2194ea33ed413cafb6185e62a8aad0a41e9d99cd /indra | |
parent | ba7e982e686f04a6eef1101e477b435df284bdaf (diff) |
calcDataSizeJ2C adjusted to use maximum possible components (#2073)
Previous pyramid walking calculation (#2032) assumed the incoming components variable can be accurate but unfortunately the needs_aux is only set to true if the face has an alpha mask setting.
Without this information we must assume the J2C files have the maximum component size of four so that alpha channels are found when decoding both the color and aux textures.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llimage/llimagej2c.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index 29449a5d2e..42f3e92257 100644 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -276,14 +276,15 @@ S32 LLImageJ2C::calcDataSizeJ2C(S32 w, S32 h, S32 comp, S32 discard_level, F32 r // Estimate the number of layers. This is consistent with what's done for j2c encoding in LLImageJ2CKDU::encodeImpl(). constexpr S32 precision = 8; // assumed bitrate per component channel, might change in future for HDR support + constexpr S32 max_components = 4; // assumed the file has four components; three color and alpha S32 nb_layers = 1; const S32 surface = w*h; S32 s = 64*64; - S32 totalbytes = (S32)(s * comp * precision * rate); // first level computed before loop + S32 totalbytes = (S32)(s * max_components * precision * rate); // first level computed before loop while (surface > s) { if (nb_layers <= (5 - discard_level)) - totalbytes += (S32)(s * comp * precision * rate); + totalbytes += (S32)(s * max_components * precision * rate); nb_layers++; s *= 4; } |