MLmicrocontrast, eliminated one loop
This commit is contained in:
@@ -622,7 +622,6 @@ BENCHFUN
|
|||||||
#pragma omp parallel
|
#pragma omp parallel
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
float signs[25];
|
|
||||||
|
|
||||||
#ifdef _OPENMP
|
#ifdef _OPENMP
|
||||||
#pragma omp for schedule(dynamic,16)
|
#pragma omp for schedule(dynamic,16)
|
||||||
@@ -641,13 +640,6 @@ BENCHFUN
|
|||||||
for(int i = k, offset = j * width + i; i < width - k; i++, offset++) {
|
for(int i = k, offset = j * width + i; i < width - k; i++, offset++) {
|
||||||
float v = LM[offset];
|
float v = LM[offset];
|
||||||
|
|
||||||
for(int row = j - k, n = 0; row <= j + k; row++) {
|
|
||||||
for(int offset2 = row * width + i - k; offset2 <= row * width + i + k; offset2++) {
|
|
||||||
signs[n] = SGN(v - LM[offset2]);
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
float contrast;
|
float contrast;
|
||||||
if (k == 1) {
|
if (k == 1) {
|
||||||
contrast = sqrtf(SQR(LM[offset + 1] - LM[offset - 1]) + SQR(LM[offset + width] - LM[offset - width])) * 0.125f; //for 3x3
|
contrast = sqrtf(SQR(LM[offset + 1] - LM[offset - 1]) + SQR(LM[offset + width] - LM[offset - width])) * 0.125f; //for 3x3
|
||||||
@@ -678,13 +670,10 @@ BENCHFUN
|
|||||||
|
|
||||||
temp = std::max(temp, 0.f);
|
temp = std::max(temp, 0.f);
|
||||||
|
|
||||||
|
|
||||||
v = temp;
|
|
||||||
|
|
||||||
for(int row = j + k, n = SQR(2*k+1) - 1; row >= j - k; row--) {
|
for(int row = j + k, n = SQR(2*k+1) - 1; row >= j - k; row--) {
|
||||||
for(int offset2 = row * width + i + k; offset2 >= row * width + i - k; offset2--) {
|
for(int offset2 = row * width + i + k; offset2 >= row * width + i - k; offset2--) {
|
||||||
if((LM[offset2] - v) * signs[n] > 0.f) {
|
if((LM[offset2] - temp) * SGN(v - LM[offset2]) > 0.f) {
|
||||||
temp = intp(0.75f, v, LM[offset2]);
|
temp = intp(0.75f, temp, LM[offset2]);
|
||||||
goto breakout;
|
goto breakout;
|
||||||
}
|
}
|
||||||
n--;
|
n--;
|
||||||
|
Reference in New Issue
Block a user