summaryrefslogtreecommitdiff
path: root/indra/llimagej2coj/llimagej2coj.cpp
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2026-07-24 11:24:12 +0800
committerErik Kundiman <erik@megapahit.org>2026-07-24 11:24:12 +0800
commitfc46ce4c0c7d81349d55933fb4bef3260f79ac8b (patch)
tree42b81558404432b253684661136dcd38722f59a7 /indra/llimagej2coj/llimagej2coj.cpp
parentffd174763119879d8be376c7c94b58e1961a7ebd (diff)
parentbcfda3b68a95bbbfb8b53f6313929fc5aeaa591c (diff)
Merge tag 'Second_Life_Release#bcfda3b6-26.3' into 26.3
Diffstat (limited to 'indra/llimagej2coj/llimagej2coj.cpp')
-rw-r--r--indra/llimagej2coj/llimagej2coj.cpp29
1 files changed, 0 insertions, 29 deletions
diff --git a/indra/llimagej2coj/llimagej2coj.cpp b/indra/llimagej2coj/llimagej2coj.cpp
index 488c07e1c9..7cfadb889d 100644
--- a/indra/llimagej2coj/llimagej2coj.cpp
+++ b/indra/llimagej2coj/llimagej2coj.cpp
@@ -919,32 +919,3 @@ bool LLImageJ2COJ::getMetadata(LLImageJ2C &base)
base.setSize(width, height, components);
return true;
}
-
-
-// OpenJPEG-tuned byte estimator. Conservative pyramid walk that accounts for
-// OJ's whole-code-block decode behavior (even with strict mode off). Larger
-// images get a per-resolution multiplier so the byte range lands inside the
-// last needed code-block boundary.
-S32 LLImageJ2COJ::estimateDataSize(S32 w, S32 h, S32 comp, S32 discard_level, F32 rate) const
-{
- constexpr S32 precision = 8;
- constexpr S32 max_components = 4;
- S32 width = (w > 0) ? w : 2048;
- S32 height = (h > 0) ? h : 2048;
- S32 max_dimension = llmax(width, height);
- S32 block_area = MAX_BLOCK_SIZE * MAX_BLOCK_SIZE;
- S32 max_layers = (S32)llmax(llround(log2f((float)max_dimension) - log2f((float)MAX_BLOCK_SIZE)), 4);
- block_area *= llmax(max_layers, 1);
- S32 totalbytes = (S32)(MIN_LAYER_SIZE * max_components * precision);
- S32 block_layers = 0;
- while (block_layers <= max_layers)
- {
- if (block_layers <= (5 - discard_level))
- totalbytes += (S32)(block_area * max_components * precision * rate);
- block_layers++;
- block_area *= 4;
- }
- totalbytes /= 8;
- totalbytes += LLImageJ2C::calcHeaderSizeJ2C();
- return totalbytes;
-}