summaryrefslogtreecommitdiff
path: root/indra/llimage/llimagefilter.cpp
diff options
context:
space:
mode:
authorBrad Linden <46733234+brad-linden@users.noreply.github.com>2024-06-12 17:04:34 -0700
committerGitHub <noreply@github.com>2024-06-12 17:04:34 -0700
commit100ebbab2437de7f5d124a0d7b8279a7a7b57656 (patch)
treee8b4200dae16e89698c2f3eadae05634041681a1 /indra/llimage/llimagefilter.cpp
parentf5e2708a0fc4e08d3d0a5dc393bbd4bac09e1c55 (diff)
parentae74ca80692c8bcf157e903033fcfa1778706d64 (diff)
Merge pull request #1745 from secondlife/project/gltf_development
move project/gltf development to develop
Diffstat (limited to 'indra/llimage/llimagefilter.cpp')
-rw-r--r--indra/llimage/llimagefilter.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/indra/llimage/llimagefilter.cpp b/indra/llimage/llimagefilter.cpp
index 1b7835a6ff..0d15906afd 100644
--- a/indra/llimage/llimagefilter.cpp
+++ b/indra/llimage/llimagefilter.cpp
@@ -88,6 +88,8 @@ void LLImageFilter::executeFilter(LLPointer<LLImageRaw> raw_image)
{
mImage = raw_image;
+ LLImageDataLock lock(mImage);
+
//std::cout << "Filter : size = " << mFilterData.size() << std::endl;
for (S32 i = 0; i < mFilterData.size(); ++i)
{
@@ -779,9 +781,9 @@ void LLImageFilter::filterLinearize(F32 tail, const LLColor3& alpha)
// Compute min and max counts minus tail
tail = llclampf(tail);
- S32 total = cumulated_histo[255];
- S32 min_c = (S32)((F32)(total) * tail);
- S32 max_c = (S32)((F32)(total) * (1.0 - tail));
+ U32 total = cumulated_histo[255];
+ U32 min_c = (U32)((F32)(total) * tail);
+ U32 max_c = (U32)((F32)(total) * (1.0 - tail));
// Find min and max values
S32 min_v = 0;
@@ -796,9 +798,9 @@ void LLImageFilter::filterLinearize(F32 tail, const LLColor3& alpha)
}
// Compute linear lookup table
- U8 linear_red_lut[256];
- U8 linear_green_lut[256];
- U8 linear_blue_lut[256];
+ U8 linear_red_lut[256]{};
+ U8 linear_green_lut[256]{};
+ U8 linear_blue_lut[256]{};
if (max_v == min_v)
{
// Degenerated binary split case
@@ -848,16 +850,16 @@ void LLImageFilter::filterEqualize(S32 nb_classes, const LLColor3& alpha)
}
// Compute deltas
- S32 total = cumulated_histo[255];
- S32 delta_count = total / nb_classes;
- S32 current_count = delta_count;
- S32 delta_value = 256 / (nb_classes - 1);
- S32 current_value = 0;
+ U32 total = cumulated_histo[255];
+ U32 delta_count = total / nb_classes;
+ U32 current_count = delta_count;
+ U32 delta_value = 256 / (nb_classes - 1);
+ U32 current_value = 0;
// Compute equalized lookup table
- U8 equalize_red_lut[256];
- U8 equalize_green_lut[256];
- U8 equalize_blue_lut[256];
+ U8 equalize_red_lut[256]{};
+ U8 equalize_green_lut[256]{};
+ U8 equalize_blue_lut[256]{};
for (S32 i = 0; i < 256; i++)
{
// Blend in current_value with alpha values