Capture Sharpening: some code cleanups

This commit is contained in:
Ingo Weyrich 2019-09-14 19:35:19 +02:00
parent aadeb539a9
commit 51daaf5fa1

View File

@ -19,7 +19,6 @@
#include <cmath> #include <cmath>
#include <iostream> #include <iostream>
#include "jaggedarray.h"
#include "rtengine.h" #include "rtengine.h"
#include "rawimagesource.h" #include "rawimagesource.h"
#include "rt_math.h" #include "rt_math.h"
@ -121,18 +120,12 @@ inline void gauss3x3div (float** RESTRICT src, float** RESTRICT dst, float** RES
} }
dst[i][W - 1] = 1.f; dst[i][W - 1] = 1.f;
} }
// first and last rows // first and last row
{
for (int i = 0; i < 1; ++i) {
for (int j = 0; j < W; ++j) { for (int j = 0; j < W; ++j) {
dst[i][j] = 1.f; dst[0][j] = 1.f;
} }
}
for (int i = H - 1 ; i < H; ++i) {
for (int j = 0; j < W; ++j) { for (int j = 0; j < W; ++j) {
dst[i][j] = 1.f; dst[H - 1][j] = 1.f;
}
}
} }
} }
@ -161,7 +154,6 @@ inline void gauss5x5div (float** RESTRICT src, float** RESTRICT dst, float** RES
} }
// first and last rows // first and last rows
{
for (int i = 0; i < 2; ++i) { for (int i = 0; i < 2; ++i) {
for (int j = 0; j < W; ++j) { for (int j = 0; j < W; ++j) {
dst[i][j] = 1.f; dst[i][j] = 1.f;
@ -172,7 +164,6 @@ inline void gauss5x5div (float** RESTRICT src, float** RESTRICT dst, float** RES
dst[i][j] = 1.f; dst[i][j] = 1.f;
} }
} }
}
} }
inline void gauss7x7div(float** RESTRICT src, float** RESTRICT dst, float** RESTRICT divBuffer, const int W, const int H, const float kernel[7][7]) inline void gauss7x7div(float** RESTRICT src, float** RESTRICT dst, float** RESTRICT divBuffer, const int W, const int H, const float kernel[7][7])
@ -206,7 +197,6 @@ inline void gauss7x7div(float** RESTRICT src, float** RESTRICT dst, float** REST
} }
// first and last rows // first and last rows
{
for (int i = 0; i < 3; ++i) { for (int i = 0; i < 3; ++i) {
for (int j = 0; j < W; ++j) { for (int j = 0; j < W; ++j) {
dst[i][j] = 1.f; dst[i][j] = 1.f;
@ -217,7 +207,6 @@ inline void gauss7x7div(float** RESTRICT src, float** RESTRICT dst, float** REST
dst[i][j] = 1.f; dst[i][j] = 1.f;
} }
} }
}
} }
inline void gauss3x3mult(float** RESTRICT src, float** RESTRICT dst, const int W, const int H, const float kernel[3][3]) inline void gauss3x3mult(float** RESTRICT src, float** RESTRICT dst, const int W, const int H, const float kernel[3][3])
@ -300,7 +289,6 @@ void buildClipMaskBayer(const float * const *rawData, int W, int H, float** clip
clipMask[row][col] = 1.f; clipMask[row][col] = 1.f;
} }
} }
#ifdef _OPENMP #ifdef _OPENMP
#pragma omp parallel for schedule(dynamic, 16) #pragma omp parallel for schedule(dynamic, 16)
#endif #endif
@ -552,9 +540,9 @@ BENCHFUN
#endif #endif
{ {
int progresscounter = 0; int progresscounter = 0;
rtengine::JaggedArray<float> tmpIThr(fullTileSize, fullTileSize); array2D<float> tmpIThr(fullTileSize, fullTileSize);
rtengine::JaggedArray<float> tmpThr(fullTileSize, fullTileSize); array2D<float> tmpThr(fullTileSize, fullTileSize);
rtengine::JaggedArray<float> lumThr(fullTileSize, fullTileSize); array2D<float> lumThr(fullTileSize, fullTileSize);
#pragma omp for schedule(dynamic,2) collapse(2) #pragma omp for schedule(dynamic,2) collapse(2)
for (int i = border; i < H - border; i+= tileSize) { for (int i = border; i < H - border; i+= tileSize) {
for(int j = border; j < W - border; j+= tileSize) { for(int j = border; j < W - border; j+= tileSize) {