diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2024-09-05 08:40:49 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2024-09-05 08:40:49 -0400 |
commit | 22a47eee84dbaa5c731c000c6013ca558bd15892 (patch) | |
tree | 8b3128fdb91731d95025b86701431826c441c5ba /indra/llkdu | |
parent | a6b85244a6f943a4598ff9b7b8a3343eb1e0d11e (diff) | |
parent | 7ac4c3b56e5246fceaa73e7c9c665d3c04827d6c (diff) |
Merge branch 'release/luau-scripting' into lua-resultset
Diffstat (limited to 'indra/llkdu')
-rw-r--r-- | indra/llkdu/llimagej2ckdu.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/indra/llkdu/llimagej2ckdu.cpp b/indra/llkdu/llimagej2ckdu.cpp index c51650a470..bf7cfbe071 100644 --- a/indra/llkdu/llimagej2ckdu.cpp +++ b/indra/llkdu/llimagej2ckdu.cpp @@ -277,6 +277,8 @@ void transfer_bytes(kdu_byte *dest, kdu_line_buf &src, int gap, int precision); // as well, when that still existed, with keep_codestream true and MODE_FAST. void LLImageJ2CKDU::setupCodeStream(LLImageJ2C &base, bool keep_codestream, ECodeStreamMode mode) { + LLImageDataLock lock(&base); + S32 data_size = base.getDataSize(); S32 max_bytes = (base.getMaxBytes() ? base.getMaxBytes() : data_size); @@ -512,8 +514,13 @@ bool LLImageJ2CKDU::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco bool LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; + + LLImageDataLock lockIn(&base); + LLImageDataLock lockOut(&raw_image); + ECodeStreamMode mode = MODE_FAST; + bool limit_time = decode_time > 0.0f; LLTimer decode_timer; if (!mCodeStreamp->exists()) @@ -528,7 +535,7 @@ bool LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco // These can probably be grabbed from what's saved in the class. kdu_dims dims; - mCodeStreamp->get_dims(0,dims); + mCodeStreamp->get_dims(0, dims); // Now we are ready to walk through the tiles processing them one-by-one. kdu_byte *buffer = raw_image.getData(); @@ -578,16 +585,18 @@ bool LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco mCodeStreamp.get())); } // Do the actual processing - F32 remaining_time = decode_time - decode_timer.getElapsedTimeF32(); + F32 remaining_time = limit_time ? decode_time - decode_timer.getElapsedTimeF32().value() : 0.0f; // This is where we do the actual decode. If we run out of time, return false. - if (mDecodeState->processTileDecode(remaining_time, (decode_time > 0.0f))) + if (mDecodeState->processTileDecode(remaining_time, limit_time)) { mDecodeState.reset(); } else { // Not finished decoding yet. - // setLastError("Ran out of time while decoding"); + base.setLastError("Ran out of time while decoding"); + base.decodeFailed(); + cleanupCodeStream(); return false; } } |