diff options
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/integration_tests/llimage_libtest/brighten.xml | 2 | ||||
-rw-r--r-- | indra/integration_tests/llimage_libtest/colorize.xml | 16 | ||||
-rw-r--r-- | indra/integration_tests/llimage_libtest/contrast.xml | 7 | ||||
-rwxr-xr-x | indra/integration_tests/llimage_libtest/darken.xml | 2 | ||||
-rw-r--r-- | indra/integration_tests/llimage_libtest/gamma.xml | 9 | ||||
-rwxr-xr-x | indra/llimage/llimagefilter.cpp | 13 | ||||
-rwxr-xr-x | indra/llimage/llimagefilter.h | 2 |
7 files changed, 21 insertions, 30 deletions
diff --git a/indra/integration_tests/llimage_libtest/brighten.xml b/indra/integration_tests/llimage_libtest/brighten.xml index d17b96d2d7..9b4232229f 100755 --- a/indra/integration_tests/llimage_libtest/brighten.xml +++ b/indra/integration_tests/llimage_libtest/brighten.xml @@ -2,7 +2,7 @@ <array> <array> <string>brighten</string> - <real>50.0</real> + <real>0.5</real> <real>1.0</real> <real>1.0</real> <real>1.0</real> diff --git a/indra/integration_tests/llimage_libtest/colorize.xml b/indra/integration_tests/llimage_libtest/colorize.xml index 18c6cd3425..72e58b0ffe 100644 --- a/indra/integration_tests/llimage_libtest/colorize.xml +++ b/indra/integration_tests/llimage_libtest/colorize.xml @@ -1,20 +1,24 @@ <llsd> <array> <array> - <string>linearize</string> + <string>stencil</string> + <string>vignette</string> + <string>blend</string> <real>0.0</real> <real>1.0</real> + <real>0.0</real> + <real>0.0</real> <real>1.0</real> - <real>1.0</real> + <real>10.0</real> </array> <array> <string>colorize</string> <real>1.0</real> - <real>1.0</real> - <real>1.0</real> - <real>0.2</real> <real>0.0</real> - <real>0.2</real> + <real>0.0</real> + <real>0.5</real> + <real>0.5</real> + <real>0.0</real> </array> </array> </llsd> diff --git a/indra/integration_tests/llimage_libtest/contrast.xml b/indra/integration_tests/llimage_libtest/contrast.xml index 8dcdd1a9a9..00746b8a9e 100644 --- a/indra/integration_tests/llimage_libtest/contrast.xml +++ b/indra/integration_tests/llimage_libtest/contrast.xml @@ -1,13 +1,6 @@ <llsd> <array> <array> - <string>linearize</string> - <real>0.0</real> - <real>1.0</real> - <real>1.0</real> - <real>1.0</real> - </array> - <array> <string>contrast</string> <real>1.5</real> <real>1.0</real> diff --git a/indra/integration_tests/llimage_libtest/darken.xml b/indra/integration_tests/llimage_libtest/darken.xml index 8d110452e9..5cec3589b6 100755 --- a/indra/integration_tests/llimage_libtest/darken.xml +++ b/indra/integration_tests/llimage_libtest/darken.xml @@ -2,7 +2,7 @@ <array> <array> <string>darken</string> - <real>50.0</real> + <real>0.5</real> <real>1.0</real> <real>1.0</real> <real>1.0</real> diff --git a/indra/integration_tests/llimage_libtest/gamma.xml b/indra/integration_tests/llimage_libtest/gamma.xml index 7505a03027..19af09b046 100644 --- a/indra/integration_tests/llimage_libtest/gamma.xml +++ b/indra/integration_tests/llimage_libtest/gamma.xml @@ -1,15 +1,8 @@ <llsd> <array> <array> - <string>linearize</string> - <real>0.0</real> - <real>1.0</real> - <real>1.0</real> - <real>1.0</real> - </array> - <array> <string>gamma</string> - <real>1.5</real> + <real>1.7</real> <real>1.0</real> <real>1.0</real> <real>1.0</real> diff --git a/indra/llimage/llimagefilter.cpp b/indra/llimage/llimagefilter.cpp index 75661a6d4b..c02679e04f 100755 --- a/indra/llimage/llimagefilter.cpp +++ b/indra/llimage/llimagefilter.cpp @@ -80,7 +80,6 @@ LLImageFilter::~LLImageFilter() * Improve perf: make sure filter is not called more than necessary in viewer (seems to be called 3 times per change) * Make filter definition resolution independent (do not use pixel size anywhere) * Add gradient coloring as a filter - * Add convolve3x3 params: * vignette : center_x, center_y, width, feather @@ -251,12 +250,12 @@ void LLImageFilter::executeFilter(LLPointer<LLImageRaw> raw_image) else if (filter_name == "brighten") { LLColor3 color((float)(mFilterData[i][2].asReal()),(float)(mFilterData[i][3].asReal()),(float)(mFilterData[i][4].asReal())); - filterBrightness((S32)(mFilterData[i][1].asReal()),color); + filterBrightness((float)(mFilterData[i][1].asReal()),color); } else if (filter_name == "darken") { LLColor3 color((float)(mFilterData[i][2].asReal()),(float)(mFilterData[i][3].asReal()),(float)(mFilterData[i][4].asReal())); - filterBrightness((S32)(-mFilterData[i][1].asReal()),color); + filterBrightness((float)(-mFilterData[i][1].asReal()),color); } else if (filter_name == "linearize") { @@ -807,7 +806,7 @@ void LLImageFilter::filterGamma(F32 gamma, const LLColor3& alpha) for (S32 i = 0; i < 256; i++) { - F32 gamma_i = llclampf((float)(powf((float)(i)/255.0,gamma))); + F32 gamma_i = llclampf((float)(powf((float)(i)/255.0,1.0/gamma))); // Blend in with alpha values gamma_red_lut[i] = (U8)((1.0 - alpha.mV[0]) * (float)(i) + alpha.mV[0] * 255.0 * gamma_i); gamma_green_lut[i] = (U8)((1.0 - alpha.mV[1]) * (float)(i) + alpha.mV[1] * 255.0 * gamma_i); @@ -969,15 +968,17 @@ void LLImageFilter::filterContrast(F32 slope, const LLColor3& alpha) colorCorrect(contrast_red_lut,contrast_green_lut,contrast_blue_lut); } -void LLImageFilter::filterBrightness(S32 add, const LLColor3& alpha) +void LLImageFilter::filterBrightness(F32 add, const LLColor3& alpha) { U8 brightness_red_lut[256]; U8 brightness_green_lut[256]; U8 brightness_blue_lut[256]; + S32 add_value = (S32)(add * 255.0); + for (S32 i = 0; i < 256; i++) { - U8 value_i = (U8)(llclampb((S32)((S32)(i) + add))); + U8 value_i = (U8)(llclampb(i + add_value)); // Blend in with alpha values brightness_red_lut[i] = (U8)((1.0 - alpha.mV[0]) * (float)(i) + alpha.mV[0] * value_i); brightness_green_lut[i] = (U8)((1.0 - alpha.mV[1]) * (float)(i) + alpha.mV[1] * value_i); diff --git a/indra/llimage/llimagefilter.h b/indra/llimage/llimagefilter.h index 738c693686..3e3be3d88b 100755 --- a/indra/llimage/llimagefilter.h +++ b/indra/llimage/llimagefilter.h @@ -84,7 +84,7 @@ private: void filterEqualize(S32 nb_classes, const LLColor3& alpha); // Use histogram to equalize constrast between nb_classes throughout the image void filterColorize(const LLColor3& color, const LLColor3& alpha); // Colorize with color and alpha per channel void filterContrast(F32 slope, const LLColor3& alpha); // Change contrast according to slope: > 1.0 more contrast, < 1.0 less contrast - void filterBrightness(S32 add, const LLColor3& alpha); // Change brightness according to add: > 0 brighter, < 0 darker + void filterBrightness(F32 add, const LLColor3& alpha); // Change brightness according to add: > 0 brighter, < 0 darker // Filter Primitives void colorTransform(const LLMatrix3 &transform); |