diff options
author | Merov Linden <merov@lindenlab.com> | 2014-02-06 10:26:25 -0800 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2014-02-06 10:26:25 -0800 |
commit | 9112a47f9be023dd83bf4de72d490d21d85e6b5e (patch) | |
tree | d4a5528403eeb9bbd50bc8193cf080d867959bef /indra | |
parent | 225fb4e782108d83217b587188beb031afb04fef (diff) |
ACME-1301 : Add convolve as a secondary filter command
Diffstat (limited to 'indra')
-rw-r--r-- | indra/integration_tests/llimage_libtest/filters/convolve.xml | 18 | ||||
-rwxr-xr-x | indra/llimage/llimagefilter.cpp | 19 |
2 files changed, 33 insertions, 4 deletions
diff --git a/indra/integration_tests/llimage_libtest/filters/convolve.xml b/indra/integration_tests/llimage_libtest/filters/convolve.xml new file mode 100644 index 0000000000..6e65b5f88a --- /dev/null +++ b/indra/integration_tests/llimage_libtest/filters/convolve.xml @@ -0,0 +1,18 @@ +<llsd> + <array> + <array> + <string>convolve</string> + <real>1.0</real> + <real>0.0</real> + <real>4.0</real> + <real>1.0</real> + <real>4.0</real> + <real>1.0</real> + <real>0.0</real> + <real>1.0</real> + <real>4.0</real> + <real>1.0</real> + <real>4.0</real> + </array> + </array> +</llsd> diff --git a/indra/llimage/llimagefilter.cpp b/indra/llimage/llimagefilter.cpp index 7734b08c18..9093e4b59c 100755 --- a/indra/llimage/llimagefilter.cpp +++ b/indra/llimage/llimagefilter.cpp @@ -230,21 +230,32 @@ void LLImageFilter::executeFilter(LLPointer<LLImageRaw> raw_image) else if (filter_name == "sharpen") { LLMatrix3 kernel; - for (S32 i = 0; i < NUM_VALUES_IN_MAT3; i++) + for (S32 k = 0; k < NUM_VALUES_IN_MAT3; k++) for (S32 j = 0; j < NUM_VALUES_IN_MAT3; j++) - kernel.mMatrix[i][j] = -1.0; + kernel.mMatrix[k][j] = -1.0; kernel.mMatrix[1][1] = 9.0; convolve(kernel,false,false); } else if (filter_name == "gradient") { LLMatrix3 kernel; - for (S32 i = 0; i < NUM_VALUES_IN_MAT3; i++) + for (S32 k = 0; k < NUM_VALUES_IN_MAT3; k++) for (S32 j = 0; j < NUM_VALUES_IN_MAT3; j++) - kernel.mMatrix[i][j] = -1.0; + kernel.mMatrix[k][j] = -1.0; kernel.mMatrix[1][1] = 8.0; convolve(kernel,false,true); } + else if (filter_name == "convolve") + { + LLMatrix3 kernel; + S32 index = 1; + bool normalize = (mFilterData[i][index++].asReal() > 0.0); + bool abs_value = (mFilterData[i][index++].asReal() > 0.0); + for (S32 k = 0; k < NUM_VALUES_IN_MAT3; k++) + for (S32 j = 0; j < NUM_VALUES_IN_MAT3; j++) + kernel.mMatrix[k][j] = mFilterData[i][index++].asReal(); + convolve(kernel,normalize,abs_value); + } else { llwarns << "Filter unknown, cannot execute filter command : " << filter_name << llendl; |