Merge remote-tracking branch 'origin/dev' into filmnegative

This commit is contained in:
rom9
2019-06-23 23:40:56 +02:00
9 changed files with 759 additions and 705 deletions

View File

@@ -25,82 +25,10 @@
#include "dcraw.h"
#include "imageformat.h"
#include "noncopyable.h"
namespace rtengine
{
struct badPix {
uint16_t x;
uint16_t y;
badPix( uint16_t xc, uint16_t yc ): x(xc), y(yc) {}
};
class PixelsMap :
public NonCopyable
{
int w; // line width in base_t units
int h; // height
typedef unsigned long base_t;
static const size_t base_t_size = sizeof(base_t);
base_t *pm;
public:
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 );
}
~PixelsMap()
{
delete [] pm;
}
int width() const
{
return w;
}
int height() const
{
return h;
}
// 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;
}
// set a pixel
void set(int x, int y)
{
pm[y * w + x / (base_t_size * 8) ] |= (base_t)1 << (x % (base_t_size * 8)) ;
}
// set pixels from a list
int set( std::vector<badPix> &bp)
{
for(std::vector<badPix>::iterator iter = bp.begin(); iter != bp.end(); ++iter) {
set( iter->x, iter->y);
}
return bp.size();
}
void clear()
{
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)
{
return pm[y * w + x / (base_t_size * 8) ] == 0 ? base_t_size * 8 - x % (base_t_size * 8) : 0;
}
};
class RawImage: public DCraw
{
public: