Add inverse to shapemethod - fixed crash retinex inverse

This commit is contained in:
Desmis
2018-01-03 16:47:54 +01:00
parent 63073b470d
commit 7a714e5093
17 changed files with 3583 additions and 3503 deletions

View File

@@ -33,7 +33,7 @@ namespace rtengine
struct badPix {
uint16_t x;
uint16_t y;
badPix( uint16_t xc, uint16_t yc ): x(xc), y(yc) {}
badPix(uint16_t xc, uint16_t yc): x(xc), y(yc) {}
};
class PixelsMap :
@@ -46,12 +46,12 @@ class PixelsMap :
base_t *pm;
public:
PixelsMap(int width, int height )
PixelsMap(int width, int height)
: h(height)
{
w = (width / (base_t_size * 8)) + 1;
pm = new base_t [h * w ];
memset(pm, 0, h * w * base_t_size );
memset(pm, 0, h * w * base_t_size);
}
~PixelsMap()
@@ -70,7 +70,7 @@ public:
// if a pixel is set returns true
bool get(int x, int y)
{
return (pm[y * w + x / (base_t_size * 8) ] & (base_t)1 << (x % (base_t_size * 8)) ) != 0;
return (pm[y * w + x / (base_t_size * 8) ] & (base_t)1 << (x % (base_t_size * 8))) != 0;
}
// set a pixel
@@ -80,10 +80,10 @@ public:
}
// set pixels from a list
int set( std::vector<badPix> &bp)
int set(std::vector<badPix> &bp)
{
for(std::vector<badPix>::iterator iter = bp.begin(); iter != bp.end(); ++iter) {
set( iter->x, iter->y);
for (std::vector<badPix>::iterator iter = bp.begin(); iter != bp.end(); ++iter) {
set(iter->x, iter->y);
}
return bp.size();
@@ -91,7 +91,7 @@ public:
void clear()
{
memset(pm, 0, h * w * base_t_size );
memset(pm, 0, h * w * base_t_size);
}
// return 0 if at least one pixel in the word(base_t) is set, otherwise return the number of pixels to skip to the next word base_t
int skipIfZero(int x, int y)
@@ -105,11 +105,11 @@ class RawImage: public DCraw
{
public:
explicit RawImage( const Glib::ustring &name );
explicit RawImage(const Glib::ustring &name);
~RawImage();
int loadRaw (bool loadData, unsigned int imageNum = 0, bool closeFile = true, ProgressListener *plistener = nullptr, double progressRange = 1.0);
void get_colorsCoeff( float* pre_mul_, float* scale_mul_, float* cblack_, bool forceAutoWB );
int loadRaw(bool loadData, unsigned int imageNum = 0, bool closeFile = true, ProgressListener *plistener = nullptr, double progressRange = 1.0);
void get_colorsCoeff(float* pre_mul_, float* scale_mul_, float* cblack_, bool forceAutoWB);
void set_prefilters()
{
if (isBayer() && get_colors() == 3) {
@@ -124,7 +124,10 @@ public:
float** compress_image(int frameNum, bool freeImage = true); // revert to compressed pixels format and release image data
float** data; // holds pixel values, data[i][j] corresponds to the ith row and jth column
unsigned prefilters; // original filters saved ( used for 4 color processing )
unsigned int getFrameCount() const { return is_raw; }
unsigned int getFrameCount() const
{
return is_raw;
}
protected:
Glib::ustring filename; // complete filename
int rotate_deg; // 0,90,180,270 degree of rotation: info taken by dcraw from exif
@@ -173,8 +176,8 @@ public:
}
eSensorType getSensorType();
void getRgbCam (float rgbcam[3][4]);
void getXtransMatrix ( int xtransMatrix[6][6]);
void getRgbCam(float rgbcam[3][4]);
void getXtransMatrix(int xtransMatrix[6][6]);
unsigned get_filters() const
{
return filters;
@@ -195,7 +198,7 @@ public:
return maximum;
}
}
unsigned short get_whiteSample( int r, int c ) const
unsigned short get_whiteSample(int r, int c) const
{
return white[r][c];
}
@@ -229,13 +232,13 @@ public:
return std::string(model);
}
float get_cam_mul(int c )const
float get_cam_mul(int c)const
{
return cam_mul[c];
}
float get_pre_mul(int c )const
float get_pre_mul(int c)const
{
if(std::isfinite(pre_mul[c])) {
if (std::isfinite(pre_mul[c])) {
return pre_mul[c];
} else {
std::cout << "Failure decoding '" << filename << "', please file a bug report including the raw file and the line below:" << std::endl;
@@ -243,7 +246,7 @@ public:
return 1.f;
}
}
float get_rgb_cam( int r, int c) const
float get_rgb_cam(int r, int c) const
{
return rgb_cam[r][c];
}
@@ -320,7 +323,7 @@ public:
}
public:
bool ISRED (unsigned row, unsigned col) const
bool ISRED(unsigned row, unsigned col) const
{
return ((filters >> ((((row) << 1 & 14) + ((col) & 1)) << 1) & 3) == 0);
}
@@ -328,15 +331,15 @@ public:
{
return ((filters >> ((((row) << 1 & 14) + ((col) & 1)) << 1) & 3) == 1);
}
bool ISBLUE (unsigned row, unsigned col) const
bool ISBLUE(unsigned row, unsigned col) const
{
return ((filters >> ((((row) << 1 & 14) + ((col) & 1)) << 1) & 3) == 2);
}
unsigned FC (unsigned row, unsigned col) const
unsigned FC(unsigned row, unsigned col) const
{
return (filters >> ((((row) << 1 & 14) + ((col) & 1)) << 1) & 3);
}
bool ISXTRANSRED (unsigned row, unsigned col) const
bool ISXTRANSRED(unsigned row, unsigned col) const
{
return ((xtrans[(row) % 6][(col) % 6]) == 0);
}
@@ -344,16 +347,16 @@ public:
{
return ((xtrans[(row) % 6][(col) % 6]) == 1);
}
bool ISXTRANSBLUE (unsigned row, unsigned col) const
bool ISXTRANSBLUE(unsigned row, unsigned col) const
{
return ((xtrans[(row) % 6][(col) % 6]) == 2);
}
unsigned XTRANSFC (unsigned row, unsigned col) const
unsigned XTRANSFC(unsigned row, unsigned col) const
{
return (xtrans[(row) % 6][(col) % 6]);
}
unsigned DNGVERSION ( ) const
unsigned DNGVERSION() const
{
return dng_version;
}