Move common code out of switch in ImProcFunctions::Median_Denoise()

- Move suggested by @heckflosse
- Use switch/case
- astyle `FTblockDN.cc`
- Whitespace cleanups
- Apply `median()` on `ffmanager.cc`
This commit is contained in:
Flössie 2016-07-09 11:47:47 +02:00
parent c0c82abb32
commit 7f66eb5ec4
3 changed files with 797 additions and 775 deletions

File diff suppressed because it is too large Load Diff

View File

@ -20,14 +20,7 @@
#include "../rtgui/options.h"
#include "rawimage.h"
#include "imagedata.h"
#define PIX_SORT(a,b) { if ((a)>(b)) {temp=(a);(a)=(b);(b)=temp;} }
#define med5(a0,a1,a2,a3,a4,median) { \
p[0]=a0; p[1]=a1; p[2]=a2; p[3]=a3; p[4]=a4; \
PIX_SORT(p[0],p[1]) ; PIX_SORT(p[3],p[4]) ; PIX_SORT(p[0],p[3]) ; \
PIX_SORT(p[1],p[4]) ; PIX_SORT(p[1],p[2]) ; PIX_SORT(p[2],p[3]) ; \
PIX_SORT(p[1],p[2]) ; median=p[2] ;}
#include "median.h"
namespace rtengine
{
@ -217,7 +210,6 @@ void ffInfo::updateRawImage()
#endif
for (int i = 0; i < H; i++) {
int p[5], temp;
int iprev = i < 2 ? i + 2 : i - 2;
int inext = i > H - 3 ? i - 2 : i + 2;
@ -225,8 +217,7 @@ void ffInfo::updateRawImage()
int jprev = j < 2 ? j + 2 : j - 2;
int jnext = j > W - 3 ? j - 2 : j + 2;
med5(ri->data[iprev][j], ri->data[i][jprev], ri->data[i][j],
ri->data[i][jnext], ri->data[inext][j], cfatmp[i * W + j]);
cfatmp[i * W + j] = median(ri->data[iprev][j], ri->data[i][jprev], ri->data[i][j], ri->data[i][jnext], ri->data[inext][j]);
}
}

View File

@ -185,12 +185,12 @@ class ImProcFunctions
public:
enum class Median {
SIZE_3X3_SOFT,
SIZE_3X3_STRONG,
SIZE_5X5_SOFT,
SIZE_5X5_STRONG,
SIZE_7X7,
SIZE_9X9
TYPE_3X3_SOFT,
TYPE_3X3_STRONG,
TYPE_5X5_SOFT,
TYPE_5X5_STRONG,
TYPE_7X7,
TYPE_9X9
};
double lumimul[3];