diff options
| author | Jonathan "Geenz" Goodman <geenz@lindenlab.com> | 2025-12-03 11:50:32 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-03 11:50:32 -0500 |
| commit | bf347d15804c27348c84a55ab763f89b718e8aac (patch) | |
| tree | a112d8ef3e65581fb1fae03a093a75637d134756 /indra/llimagej2coj/llimagej2coj.cpp | |
| parent | aec7bf19ebffd9d6b60c68e31de723eabd6aa98a (diff) | |
| parent | ad6008a5880dff8691f5fce56b7fbfc5ea8b1626 (diff) | |
Merge pull request #4853 from secondlife/release/2025.08
Release/2025.08
Diffstat (limited to 'indra/llimagej2coj/llimagej2coj.cpp')
| -rw-r--r-- | indra/llimagej2coj/llimagej2coj.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/indra/llimagej2coj/llimagej2coj.cpp b/indra/llimagej2coj/llimagej2coj.cpp index 5fa53657a0..7cfadb889d 100644 --- a/indra/llimagej2coj/llimagej2coj.cpp +++ b/indra/llimagej2coj/llimagej2coj.cpp @@ -554,11 +554,6 @@ public: } - if (!opj_setup_encoder(encoder, ¶meters, image)) - { - return false; - } - U32 width_tiles = (rawImageIn.getWidth() >> 6); U32 height_tiles = (rawImageIn.getHeight() >> 6); @@ -572,6 +567,19 @@ public: height_tiles = 1; } + if (width_tiles == 1 || height_tiles == 1) + { + // Images with either dimension less than 32 need less number of resolutions otherwise they error + int min_dim = rawImageIn.getWidth() < rawImageIn.getHeight() ? rawImageIn.getWidth() : rawImageIn.getHeight(); + int max_res = 1 + (int)floor(log2(min_dim)); + parameters.numresolution = max_res; + } + + if (!opj_setup_encoder(encoder, ¶meters, image)) + { + return false; + } + U32 tile_count = width_tiles * height_tiles; U32 data_size_guess = tile_count * TILE_SIZE; |
