Created
October 18, 2016 17:25
-
-
Save heckflosse/757b98b5bb041fc972959a50e45f9ee8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/rtengine/FTblockDN.cc b/rtengine/FTblockDN.cc | |
index 6bb0c4c..efe9769 100644 | |
--- a/rtengine/FTblockDN.cc | |
+++ b/rtengine/FTblockDN.cc | |
@@ -2102,13 +2102,13 @@ float ImProcFunctions::MadMax(float * DataList, int & max, int datalen) | |
} | |
-float ImProcFunctions::Mad(float * DataList, const int datalen) | |
+float ImProcFunctions::Mad(float * DataList, int datalen) | |
{ | |
if(datalen <= 1) { // Avoid possible buffer underrun | |
return 0; | |
} | |
- //computes Median Absolute Deviation | |
+ //computes Median | |
//DataList values should mostly have abs val < 256 because we are in Lab mode | |
int histo[256] ALIGNED64 = {0}; | |
@@ -2117,8 +2117,9 @@ float ImProcFunctions::Mad(float * DataList, const int datalen) | |
histo[min(255, abs(static_cast<int>(DataList[i])))]++; | |
} | |
- //find median of histogram | |
- int median = 0, count = 0; | |
+ //find median of histogram, but skip first 2 values | |
+ int median = 2, count = 0; | |
+ datalen -= (histo[0] + histo[1]); | |
while (count < datalen / 2) { | |
count += histo[median]; | |
diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h | |
index 7ea7bbe..3fb4d2e 100644 | |
--- a/rtengine/improcfun.h | |
+++ b/rtengine/improcfun.h | |
@@ -324,7 +324,7 @@ public: | |
void Noise_residualAB(wavelet_decomposition &WaveletCoeffs_ab, float &chresid, float &chmaxresid, bool denoiseMethodRgb); | |
void calcautodn_info (float &chaut, float &delta, int Nb, int levaut, float maxmax, float lumema, float chromina, int mode, int lissage, float redyel, float skinc, float nsknc); | |
float MadMax(float * DataList, int &max, int datalen); | |
- float Mad(float * DataList, const int datalen); | |
+ float Mad(float * DataList, int datalen); | |
float MadRgb(float * DataList, const int datalen); | |
// pyramid wavelet |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment