Replace cuNormalizer holder class with unique_ptr
parent
14d708863d
commit
a0ce9d55cb
|
@ -553,17 +553,18 @@ cuAmpcorChunk::cuAmpcorChunk(cuAmpcorParameter *param_, GDALImage *reference_, G
|
||||||
stream);
|
stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
corrNormalizerRaw = new cuNormalizer(
|
corrNormalizerRaw = std::unique_ptr<cuNormalizeProcessor>(newCuNormalizer(
|
||||||
param->searchWindowSizeHeightRaw,
|
param->searchWindowSizeHeightRaw,
|
||||||
param->searchWindowSizeWidthRaw,
|
param->searchWindowSizeWidthRaw,
|
||||||
param->numberWindowDownInChunk * param->numberWindowAcrossInChunk
|
param->numberWindowDownInChunk * param->numberWindowAcrossInChunk
|
||||||
);
|
));
|
||||||
|
|
||||||
corrNormalizerOverSampled = new cuNormalizer(
|
corrNormalizerOverSampled =
|
||||||
|
std::unique_ptr<cuNormalizeProcessor>(newCuNormalizer(
|
||||||
param->searchWindowSizeHeight,
|
param->searchWindowSizeHeight,
|
||||||
param->searchWindowSizeWidth,
|
param->searchWindowSizeWidth,
|
||||||
param->numberWindowDownInChunk * param->numberWindowAcrossInChunk
|
param->numberWindowDownInChunk * param->numberWindowAcrossInChunk
|
||||||
);
|
));
|
||||||
|
|
||||||
|
|
||||||
#ifdef CUAMPCOR_DEBUG
|
#ifdef CUAMPCOR_DEBUG
|
||||||
|
|
|
@ -66,8 +66,8 @@ private:
|
||||||
cuFreqCorrelator *cuCorrFreqDomain, *cuCorrFreqDomain_OverSampled;
|
cuFreqCorrelator *cuCorrFreqDomain, *cuCorrFreqDomain_OverSampled;
|
||||||
|
|
||||||
// correlation surface normalizer
|
// correlation surface normalizer
|
||||||
cuNormalizer *corrNormalizerRaw;
|
std::unique_ptr<cuNormalizeProcessor> corrNormalizerRaw;
|
||||||
cuNormalizer *corrNormalizerOverSampled;
|
std::unique_ptr<cuNormalizeProcessor> corrNormalizerOverSampled;
|
||||||
|
|
||||||
// save offset results in different stages
|
// save offset results in different stages
|
||||||
cuArrays<int2> *offsetInit;
|
cuArrays<int2> *offsetInit;
|
||||||
|
|
|
@ -7,45 +7,30 @@
|
||||||
#include "cuCorrNormalizer.h"
|
#include "cuCorrNormalizer.h"
|
||||||
#include "cuAmpcorUtil.h"
|
#include "cuAmpcorUtil.h"
|
||||||
|
|
||||||
cuNormalizer::cuNormalizer(int secondaryNX, int secondaryNY, int count)
|
cuNormalizeProcessor*
|
||||||
|
newCuNormalizer(int secondaryNX, int secondaryNY, int count)
|
||||||
{
|
{
|
||||||
// depending on NY, choose different processor
|
// depending on NY, choose different processor
|
||||||
if(secondaryNY <= 64) {
|
if(secondaryNY <= 64) {
|
||||||
processor = new cuNormalizeFixed<64>();
|
return new cuNormalizeFixed<64>();
|
||||||
}
|
}
|
||||||
else if (secondaryNY <= 128) {
|
else if (secondaryNY <= 128) {
|
||||||
processor = new cuNormalizeFixed<128>();
|
return new cuNormalizeFixed<128>();
|
||||||
}
|
}
|
||||||
else if (secondaryNY <= 256) {
|
else if (secondaryNY <= 256) {
|
||||||
processor = new cuNormalizeFixed<256>();
|
return new cuNormalizeFixed<256>();
|
||||||
}
|
}
|
||||||
else if (secondaryNY <= 512) {
|
else if (secondaryNY <= 512) {
|
||||||
processor = new cuNormalizeFixed<512>();
|
return new cuNormalizeFixed<512>();
|
||||||
}
|
}
|
||||||
else if (secondaryNY <= 1024) {
|
else if (secondaryNY <= 1024) {
|
||||||
processor = new cuNormalizeFixed<1024>();
|
return new cuNormalizeFixed<1024>();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
processor = new cuNormalizeSAT(secondaryNX, secondaryNY, count);
|
return new cuNormalizeSAT(secondaryNX, secondaryNY, count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cuNormalizer::~cuNormalizer()
|
|
||||||
{
|
|
||||||
delete processor;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cuNormalizer::execute(cuArrays<float> *correlation,
|
|
||||||
cuArrays<float> *reference, cuArrays<float> *secondary, cudaStream_t stream)
|
|
||||||
{
|
|
||||||
processor->execute(correlation, reference, secondary, stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
|
|
||||||
cuNormalizeSAT::cuNormalizeSAT(int secondaryNX, int secondaryNY, int count)
|
cuNormalizeSAT::cuNormalizeSAT(int secondaryNX, int secondaryNY, int count)
|
||||||
{
|
{
|
||||||
// allocate the work array
|
// allocate the work array
|
||||||
|
|
|
@ -22,26 +22,14 @@
|
||||||
class cuNormalizeProcessor {
|
class cuNormalizeProcessor {
|
||||||
public:
|
public:
|
||||||
// default constructor and destructor
|
// default constructor and destructor
|
||||||
cuNormalizeProcessor() {}
|
cuNormalizeProcessor() = default;
|
||||||
~cuNormalizeProcessor() {}
|
virtual ~cuNormalizeProcessor() = default;
|
||||||
// execute interface
|
// execute interface
|
||||||
virtual void execute(cuArrays<float> * correlation, cuArrays<float> *reference, cuArrays<float> *secondary, cudaStream_t stream) = 0;
|
virtual void execute(cuArrays<float> * correlation, cuArrays<float> *reference, cuArrays<float> *secondary, cudaStream_t stream) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class cuNormalizer {
|
// factory with the secondary dimension
|
||||||
private:
|
cuNormalizeProcessor* newCuNormalizer(int NX, int NY, int count);
|
||||||
cuNormalizeProcessor *processor;
|
|
||||||
public:
|
|
||||||
// disable the default constructor
|
|
||||||
cuNormalizer() = delete;
|
|
||||||
// constructor with the secondary dimension
|
|
||||||
cuNormalizer(int secondaryNX, int secondaryNY, int count);
|
|
||||||
// destructor
|
|
||||||
~cuNormalizer();
|
|
||||||
// execute correlation surface normalization
|
|
||||||
void execute(cuArrays<float> *correlation, cuArrays<float> *reference, cuArrays<float> *secondary,
|
|
||||||
cudaStream_t stream);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
template<int Size>
|
template<int Size>
|
||||||
|
|
Loading…
Reference in New Issue