Correction of a little bug in the Slicer class (OpenMP) + code cleanup
This commit is contained in:
@@ -18,8 +18,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#ifdef _OPENMP
|
||||||
#include <omp.h>
|
#include <omp.h>
|
||||||
|
#endif
|
||||||
#include <slicer.h>
|
#include <slicer.h>
|
||||||
|
#include <gtkmm.h>
|
||||||
|
|
||||||
using namespace rtengine;
|
using namespace rtengine;
|
||||||
|
|
||||||
@@ -67,9 +70,9 @@ Slicer::Slicer(unsigned int imageWidth, unsigned int imageHeight, Block *subRegi
|
|||||||
|
|
||||||
//total number of core/processor
|
//total number of core/processor
|
||||||
#ifdef _OPENMP
|
#ifdef _OPENMP
|
||||||
procNumber = omp_get_num_procs();
|
unsigned int procNumber = omp_get_num_procs();
|
||||||
#else
|
#else
|
||||||
procNumber = 1;
|
unsigned int procNumber = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//calculate the number of block
|
//calculate the number of block
|
||||||
@@ -88,9 +91,6 @@ Slicer::Slicer(unsigned int imageWidth, unsigned int imageHeight, Block *subRegi
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Slicer::~Slicer() {
|
|
||||||
}
|
|
||||||
|
|
||||||
// return the absolute position and size of the requested block
|
// return the absolute position and size of the requested block
|
||||||
void Slicer::get_block(unsigned int numBlock, Block *block) {
|
void Slicer::get_block(unsigned int numBlock, Block *block) {
|
||||||
double roundingTradeOff = (hBlockNumber - (double)((int)hBlockNumber)) == 0.5 ? 2.1 : 2.0;
|
double roundingTradeOff = (hBlockNumber - (double)((int)hBlockNumber)) == 0.5 ? 2.1 : 2.0;
|
||||||
|
@@ -21,13 +21,7 @@
|
|||||||
|
|
||||||
//The image is divided in blocks even on single processor machine, mainly to decrease memory consumption
|
//The image is divided in blocks even on single processor machine, mainly to decrease memory consumption
|
||||||
//maximum number of pixel per block
|
//maximum number of pixel per block
|
||||||
#define PIXELS_PER_BLOCK 1000000
|
#define PIXELS_PER_BLOCK 250000
|
||||||
|
|
||||||
// DEBUG!
|
|
||||||
#include <glibmm.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
//#include <glib/gstdio.h>
|
|
||||||
|
|
||||||
|
|
||||||
namespace rtengine {
|
namespace rtengine {
|
||||||
|
|
||||||
@@ -52,7 +46,6 @@ class Block {
|
|||||||
class Slicer {
|
class Slicer {
|
||||||
protected:
|
protected:
|
||||||
bool portrait; // Orientation of the sub-region
|
bool portrait; // Orientation of the sub-region
|
||||||
unsigned int procNumber; // Number of processor
|
|
||||||
unsigned int imWidth; // Image width
|
unsigned int imWidth; // Image width
|
||||||
unsigned int imHeight; // Image height
|
unsigned int imHeight; // Image height
|
||||||
Block region; // Sub-region to process
|
Block region; // Sub-region to process
|
||||||
@@ -64,7 +57,6 @@ class Slicer {
|
|||||||
unsigned int blockNumber; // number of block for the sub-region
|
unsigned int blockNumber; // number of block for the sub-region
|
||||||
unsigned int maxPixelNumber; // number of pixel of the biggest block (for memory allocation purpose)
|
unsigned int maxPixelNumber; // number of pixel of the biggest block (for memory allocation purpose)
|
||||||
Slicer(unsigned int imageWidth, unsigned int imageHeight, Block *subRegion, unsigned int pixels, const char* nomFichier);
|
Slicer(unsigned int imageWidth, unsigned int imageHeight, Block *subRegion, unsigned int pixels, const char* nomFichier);
|
||||||
~Slicer(void);
|
|
||||||
void get_block(unsigned int blockId, Block *block);
|
void get_block(unsigned int blockId, Block *block);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user