Browse Source

add some change

master
mmtalaie 4 years ago
parent
commit
6be62e224e
  1. 104
      MainWindow.cpp
  2. 2
      MainWindow.h
  3. 4
      header/ELogId.h
  4. 2
      header/ESeverityLevel.h
  5. 90
      header/ScenarioParams.h
  6. 2
      header/Utils.h
  7. 35
      header/model/algorithms/ScanConversionAlg.h
  8. 2
      header/model/processor/IProcessStrategy.h
  9. 2
      header/model/processor/strategies/Cri.h
  10. 2
      header/model/processor/strategies/DynCont.h
  11. 2
      header/model/processor/strategies/Enhance.h
  12. 2
      header/model/processor/strategies/GrayMap.h
  13. 2
      header/model/processor/strategies/Persist.h
  14. 2
      header/model/processor/strategies/Rejection.h
  15. 14
      header/model/processor/strategies/ScanConversion.h
  16. 2
      header/model/processor/strategies/Sri.h
  17. 2
      header/model/processor/strategies/TintMap.h
  18. 18
      kernels/ScanConversion.cl
  19. 2
      source/FileHelper.cpp
  20. 518
      source/model/algorithms/ScanConversionAlg.cpp
  21. 11
      source/model/processor/strategies/Cri.cpp
  22. 20
      source/model/processor/strategies/DynCont.cpp
  23. 153
      source/model/processor/strategies/Enhance.cpp
  24. 7
      source/model/processor/strategies/GrayMap.cpp
  25. 9
      source/model/processor/strategies/Persist.cpp
  26. 4
      source/model/processor/strategies/Rejection.cpp
  27. 755
      source/model/processor/strategies/ScanConversion.cpp
  28. 7
      source/model/processor/strategies/Sri.cpp
  29. 7
      source/model/processor/strategies/TintMap.cpp

104
MainWindow.cpp

@ -132,93 +132,111 @@ void MainWindow::readParam(QString path, int mode)
//sc
case 0:
temp = sl[index++].PARSE;
update_field(&_scenGenOutput.linear, INP2MYFLT(temp) == 0);
_scenGenOutput.probe.linear = INP2MYFLT(temp) == 0;
temp = sl[index++].PARSE;
update_field(&_scenGenOutput.depth, INP2MYFLT(temp));
OUT_WIDTH = INP2MYFLT(temp);
temp = sl[index++].PARSE;
update_field(&_scenGenOutput.probeRadius, INP2MYFLT(temp));
OUT_HEIGHT = INP2MYFLT(temp);
if(!_scenGenOutput.probe.linear)
{
temp = sl[index++].PARSE;
_scenGenOutput.probe.radius = INP2MYFLT(temp);
temp = sl[index++].PARSE;
_scenGenOutput.angle = INP2MYFLT(temp);
temp = sl[index++].PARSE;
_scenGenOutput.maxScanAx = INP2MYFLT(temp);
}
temp = sl[index++].PARSE;
update_field(&_scenGenOutput.fieldOfView, INP2MYFLT(temp));
_scenGenOutput.depth = INP2MYFLT(temp);
temp = sl[index++].PARSE;
update_field(&_scenGenOutput.probeFieldOfView, INP2MYFLT(temp));
_scenGenOutput.fieldOfView = INP2MYFLT(temp);
temp = sl[index++].PARSE;
update_field(&_scenGenOutput.virtualOriginalZ, INP2MYFLT(temp));
_scenGenOutput.bMinScanAx = INP2MYFLT(temp);
temp = sl[index++].PARSE;
update_field(&_scenGenOutput.minScanAx, INP2MYFLT(temp));
_scenGenOutput.bMinScanAz = INP2MYFLT(temp);
temp = sl[index++].PARSE;
update_field(&_scenGenOutput.minScanAz, INP2MYFLT(temp));
_scenGenOutput.bMaxScanAx = INP2MYFLT(temp);
temp = sl[index++].PARSE;
update_field(&_scenGenOutput.maxScanAx, INP2MYFLT(temp));
_scenGenOutput.bMaxScanAz = INP2MYFLT(temp);
temp = sl[index++].PARSE;
update_field(&_scenGenOutput.startDepth, INP2MYFLT(temp));
_scenGenOutput.minScanAx = INP2MYFLT(temp);
temp = sl[index++].PARSE;
update_field(&_scenGenOutput.steering, INP2MYFLT(temp));
_scenGenOutput.minScanAz = INP2MYFLT(temp);
temp = sl[index++].PARSE;
update_field<int>(&_scenGenOutput.rxLineNo, INP2MYFLT(temp));
_scenGenOutput.startDepth = INP2MYFLT(temp);
temp = sl[index++].PARSE;
update_field<int>(&_scenGenOutput.rxFocusPointNo, INP2MYFLT(temp));
_scenGenOutput.steering = INP2MYFLT(temp);
temp = sl[index++].PARSE;
update_field(&_scenGenOutput.rxLineDaz, INP2MYFLT(temp));
_scenGenOutput.rxLineNo = INP2MYFLT(temp);
temp = sl[index++].PARSE;
update_field(&_scenGenOutput.rxPointDax, INP2MYFLT(temp));
_scenGenOutput.rxFocusPointNo= INP2MYFLT(temp);
temp = sl[index++].PARSE;
update_field(&_scenGenOutput.virtualConvex, INP2MYFLT(temp) != 0);
_scenGenOutput.rxLineDaz = INP2MYFLT(temp);
temp = sl[index++].PARSE;
update_field(&_scenGenOutput.vcMaxTheta, INP2MYFLT(temp));
_scenGenOutput.rxPointDax = INP2MYFLT(temp);
if(_scenGenOutput.probe.linear)
{
temp = sl[index++].PARSE;
_scenGenOutput.virtualConvex = INP2MYFLT(temp) != 0;
}
temp = sl[index++].PARSE;
update_field(&_scenGenOutput.angle, INP2MYFLT(temp));
_scenGenOutput.hdZoom= INP2MYFLT(temp) != 0;
break;
case 1:
temp = sl[index++].PARSE;
update_field<int>(&_scenGenOutput.rejectThreshold, INP2MYFLT(temp));
_scenGenOutput.rejectThreshold = INP2MYFLT(temp);
break;
case 2:
temp = sl[index++].PARSE;
update_field<int>(&_scenGenOutput.sri, INP2MYFLT(temp));
_scenGenOutput.sri = INP2MYFLT(temp);
break;
case 3:
temp = sl[index++].PARSE;
update_field<int>(&_scenGenOutput.tintMapSelector, INP2MYFLT(temp));
_scenGenOutput.tintMapSelector = INP2MYFLT(temp);
break;
case 4:
temp = sl[index++].PARSE;
update_field<int>(&_scenGenOutput.grayMapSelector, INP2MYFLT(temp));
_scenGenOutput.grayMapSelector = INP2MYFLT(temp);
break;
case 5:
temp = sl[index++].PARSE;
update_field<int>(&_scenGenOutput.dynContSelector, INP2MYFLT(temp));
_scenGenOutput.dynContSelector = INP2MYFLT(temp);
temp = sl[index++].PARSE;
update_field<int>(&_scenGenOutput.dynContGain, INP2MYFLT(temp));
_scenGenOutput.dynContGain = INP2MYFLT(temp);
temp = sl[index++].PARSE;
update_field<int>(&_scenGenOutput.compressionType, INP2MYFLT(temp));
_scenGenOutput.compressionType = INP2MYFLT(temp);
break;
case 6:
temp = sl[index++].PARSE;
update_field<int>(&_scenGenOutput.enhance, INP2MYFLT(temp));
_scenGenOutput.enhance = INP2MYFLT(temp);
update_field<int>(&_scenGenOutput.enhanceAlgorithm, 0);
_scenGenOutput.enhanceAlgorithm = 0;
break;
case 7:
update_field<int>(&_scenGenOutput.persist, 1);
_scenGenOutput.persist = 1;
break;
}
}
@ -290,8 +308,8 @@ void MainWindow::on_btn_test_clicked()
return;
}
OUT_WIDTH = ui->cb_kernelName->currentIndex() ? width : 1000;
OUT_HEIGHT = ui->cb_kernelName->currentIndex() ? height : 1000;
// OUT_WIDTH = ui->cb_kernelName->currentIndex() ? width : 1000;
// OUT_HEIGHT = ui->cb_kernelName->currentIndex() ? height : 1000;
ImageFormat format;
format.image_channel_order = CL_RGBA;
@ -309,19 +327,19 @@ void MainWindow::on_btn_test_clicked()
width * sizeof (myflt),
0,
arr.data());
if(ui->cb_kernelName->currentText() == "Cri")
{
Image2D* criBuffer[16];
auto bufferPath = inputDir.path() + "/buffer";
for (int i = 1; i <= 16; ++i)
{
auto bfname = QString("%1\%2\")
}
}
update_field(&_scenGenOutput.outputWidth, (uint)OUT_WIDTH);
update_field(&_scenGenOutput.outputHeight, (uint)OUT_HEIGHT);
// if(ui->cb_kernelName->currentText() == "Cri")
// {
// Image2D* criBuffer[16];
// auto bufferPath = inputDir.path() + "/buffer";
// for (int i = 1; i <= 16; ++i)
// {
// auto bfname = QString("%1\%2\")
// }
// }
_scenGenOutput.outputWidth = (uint)OUT_WIDTH;
_scenGenOutput.outputHeight = (uint)OUT_HEIGHT;
_strategy->cpuProcess(_scenGenOutput);
auto outFrame = _strategy->processKernel(inFrame, _scratchPad);

2
MainWindow.h

@ -63,7 +63,7 @@ private:
void registerStrategies();
void pushBackStrategy(const QString strategyName, const QString kernelFolder);
IProcessStrategy* _strategy;
ScenGenOutput_t _scenGenOutput;
Input_t _scenGenOutput;
void readParam(QString path, int mode);

4
header/ELogId.h

@ -145,9 +145,9 @@ public:
* Converts the eLogId enumerator to the relevant identification number
*/
static int qtEnumToInt(const eLogId qtEnum)
static int qtEnumToInt(const QString key)
{
return QMetaEnum::fromType<eLogId>().value(qtEnum);
return static_cast<quint8> (QMetaEnum::fromType<eLogId>().keyToValue(key.toStdString().c_str()));
}
};

2
header/ESeverityLevel.h

@ -79,7 +79,7 @@ public:
*/
static QString qtEnumToQString(const eSeverityLevel qtEnum)
{
return QString(QMetaEnum::fromType<eSeverityLevel>().valueToKey(qtEnum));
return QString(QMetaEnum::fromType<eSeverityLevel>().valueToKey(qtEnum));
}
/**

90
header/ScenarioParams.h

@ -3,56 +3,52 @@
#include <QObject>
template<typename T>
struct field_t
typedef struct ProbeProperties_t
{
T value;
bool isUpdated;
};
bool linear;
float radius;
float fieldOfView;
}ProbeProperties_t;
typedef struct ScenGenOutput_t
typedef struct Input_t
{
field_t<bool> linear;
field_t<bool> virtualConvex;
field_t<float> depth;
field_t<float> probeRadius;
field_t<float> fieldOfView;
field_t<float> probeFieldOfView;
field_t<float> startDepth;
field_t<int> rxLineNo;
field_t<int> rxFocusPointNo;
field_t<float> rxLineDaz;
field_t<float> rxPointDax;
field_t<float> vcMaxTheta;
field_t<float> angle;
field_t<float> steering;
field_t<float> minScanAx;
field_t<float> minScanAz;
field_t<float> maxScanAx;
field_t<float> virtualOriginalZ;
field_t<uint> outputWidth;
field_t<uint> outputHeight;
field_t<int> compressionType;
field_t<int> dynContSelector;
field_t<int> dynContGain;
field_t<int> grayMapSelector;
field_t<int> tintMapSelector;
field_t<int> sri;
field_t<int> rejectThreshold;
field_t<int> enhance;
field_t<int> enhanceAlgorithm;
field_t<int> persist;
field_t<int> criFilterMode;//cri
field_t<int> frameCntr;//cri
field_t<int> scenarioFrameNo;//cri
}ScenGenOutput_t;
template<typename T>
void update_field(field_t<T> *t, T value)
{
t->value = value;
t->isUpdated = true;
}
ProbeProperties_t probe;
bool virtualConvex;
bool hdZoom;
float depth;
float fieldOfView;
float startDepth;
int rxLineNo;
int rxFocusPointNo;
float rxLineDaz;
float rxPointDax;
float vcMaxTheta;
float angle;
float steering;
float minScanAx;
float maxScanAx;
float minScanAz;
float bMinScanAx;
float bMinScanAz;
float bMaxScanAx;
float bMaxScanAz;
float virtualOriginalZ;
uint outputWidth;
uint outputHeight;
int compressionType;
int dynContSelector;
int dynContGain;
int grayMapSelector;
int tintMapSelector;
int sri;
int rejectThreshold;
int enhance;
int enhanceAlgorithm;
int persist;
int criFilterMode;//cri
int frameCntr;//cri
int scenarioFrameNo;//cri
}Input_t;
#endif // SCENARIOPARAMS_H

2
header/Utils.h

@ -13,7 +13,7 @@ typedef float myflt;
typedef int myint;
#endif
#define INP2MYFLT(x) *((myflt*)(&x))
#define INP2MYFLT(x) *(reinterpret_cast<float *>(&x))
#ifdef USE_DBL
#define PARSE toULong(Q_NULLPTR, 16)

35
header/model/algorithms/ScanConversionAlg.h

@ -0,0 +1,35 @@
#ifndef SCANCONVERSIONALG_H
#define SCANCONVERSIONALG_H
#include "./ScenarioParams.h"
class ScanConversionAlg
{
private:
static void linear(Input_t params, QVector<float>& scanXPos, QVector<float>& scanZPos,
QVector<float>& gridPixelXPos, QVector<float>& gridPixelZPos);
static void virtualConvex(Input_t params, QVector<float>& scanXPos, QVector<float>& scanZPos,
QVector<float>& gridPixelXPos, QVector<float>& gridPixelZPos);
static void convex(Input_t params, QVector<float>& scanXPos, QVector<float>& scanZPos,
QVector<float>& gridPixelXPos, QVector<float>& gridPixelZPos);
public:
static void scanConversion(Input_t params, QVector<float>& scanXPos, QVector<float>& scanZPos,
QVector<float>& gridPixelXPos, QVector<float>& gridPixelZPos);
static void virtualScanConversion(QVector<float> pixelXPos, QVector<float> pixelZPos,
uint width, uint height,
float steering, float virtualOriginalZ,
float startDepth, float depth, float vcMaxTheta,
QVector<float>& gridPixelR, QVector<float>& gridPixelTheta);
static void convexScanConversion(QVector<float> pixelXPos, QVector<float> pixelZPos,
uint width, uint height,
float steering, float angle, float fieldOfView,
float probeRadius, float startDepth, float depth,
QVector<float>& gridPixelR, QVector<float>& gridPixelTheta);
};
#endif // SCANCONVERSIONALG_H

2
header/model/processor/IProcessStrategy.h

@ -22,7 +22,7 @@ class IProcessStrategy : public QObject
Q_OBJECT
public:
virtual void cpuProcess(ScenGenOutput_t parameters) = 0;
virtual void cpuProcess(Input_t parameters) = 0;
virtual void finalize() = 0;
virtual Image* processKernel(Image* inputFrame, Buffer* scrathPad) = 0;

2
header/model/processor/strategies/Cri.h

@ -23,7 +23,7 @@ class Cri : public IProcessStrategy
Q_OBJECT
public:
Q_INVOKABLE Cri(const Context context, const QString kernelPath, const QObject *parent);
virtual void cpuProcess(ScenGenOutput_t parameters) override;
virtual void cpuProcess(Input_t parameters) override;
virtual void finalize() override;
private:

2
header/model/processor/strategies/DynCont.h

@ -20,7 +20,7 @@ class DynCont : public IProcessStrategy
Q_OBJECT
public:
Q_INVOKABLE DynCont(const Context context, const QString kernelPath, const QObject *parent);
virtual void cpuProcess(ScenGenOutput_t parameters) override;
virtual void cpuProcess(Input_t parameters) override;
virtual void finalize() override;
private:

2
header/model/processor/strategies/Enhance.h

@ -20,7 +20,7 @@ class Enhance : public IProcessStrategy
Q_OBJECT
public:
Q_INVOKABLE Enhance(const Context context, const QString kernelPath, const QObject *parent);
virtual void cpuProcess(ScenGenOutput_t parameters) override;
virtual void cpuProcess(Input_t parameters) override;
virtual void finalize() override;
private:

2
header/model/processor/strategies/GrayMap.h

@ -17,7 +17,7 @@ class GrayMap : public IProcessStrategy
Q_OBJECT
public:
Q_INVOKABLE GrayMap(const Context context, const QString kernelPath, const QObject *parent);
virtual void cpuProcess(ScenGenOutput_t parameters) override;
virtual void cpuProcess(Input_t parameters) override;
virtual void finalize() override;
private:

2
header/model/processor/strategies/Persist.h

@ -20,7 +20,7 @@ class Persist : public IProcessStrategy
Q_OBJECT
public:
Q_INVOKABLE Persist(const Context context, const QString kernelPath, const QObject *parent);
virtual void cpuProcess(ScenGenOutput_t parameters) override;
virtual void cpuProcess(Input_t parameters) override;
virtual void finalize() override;
private:

2
header/model/processor/strategies/Rejection.h

@ -16,7 +16,7 @@ class Rejection : public IProcessStrategy
Q_OBJECT
public:
Q_INVOKABLE Rejection(const Context context, const QString kernelPath);
virtual void cpuProcess(ScenGenOutput_t parameters) override;
virtual void cpuProcess(Input_t parameters) override;
virtual void finalize() override;

14
header/model/processor/strategies/ScanConversion.h

@ -15,11 +15,11 @@ typedef struct ScanConversion_t
class ScanConversion : public IProcessStrategy
{
Q_OBJECT
Q_OBJECT
public:
Q_INVOKABLE ScanConversion(const Context context, const QString kernelPath,
const QObject* parent);
virtual void cpuProcess(ScenGenOutput_t parameters) override;
virtual void cpuProcess(Input_t parameters) override;
virtual void finalize() override;
@ -30,12 +30,10 @@ private:
quint64 _width;
quint64 _height;
myflt* _gridPixelXPos;
myflt* _gridPixelZPos;
myflt* _gridPixelR;
myflt* _gridPixelTheta;
myflt* _scanXPos;
myflt* _scanZPos;
QVector<float> _gridPixelXPos;
QVector<float> _gridPixelZPos;
QVector<float> _scanXPos;
QVector<float> _scanZPos;
Buffer* _gridX;
Buffer* _gridZ;

2
header/model/processor/strategies/Sri.h

@ -20,7 +20,7 @@ class Sri : public IProcessStrategy
Q_OBJECT
public:
Q_INVOKABLE Sri(const Context context, const QString kernelPath, const QObject *parent);
virtual void cpuProcess(ScenGenOutput_t parameters) override;
virtual void cpuProcess(Input_t parameters) override;
virtual void finalize() override;
private:

2
header/model/processor/strategies/TintMap.h

@ -17,7 +17,7 @@ class TintMap : public IProcessStrategy
Q_OBJECT
public:
Q_INVOKABLE TintMap(const Context context, const QString kernelPath, const QObject *parent);
virtual void cpuProcess(ScenGenOutput_t parameters) override;
virtual void cpuProcess(Input_t parameters) override;
virtual void finalize() override;
private:

18
kernels/ScanConversion.cl

@ -1,6 +1,6 @@
#define TEST
#define X 500
#define Y 186
#define X 379
#define Y 142
//#define USE_DBL
#ifdef USE_DBL
@ -70,28 +70,14 @@ kernel void ScanConversion(read_only image2d_t input_frame, read_write image2d_t
if(mabs(z - grid_z[params.grid_z_size - 1]) < EPSILSON)
{
if(gid.x == X && gid.y == Y)
printf("here 1 ");
grid_z_index = params.grid_z_size - 2;
}
else
{
if(gid.x == X && gid.y == Y)
printf("here 2 %0.9f",grid_z[0]);
grid_z_index = floor((z - grid_z[0]) / dz);
}
TYPE_FLT output_data = 0;
if(gid.x == X && gid.y == Y)
{
printf("dx: %.9f | ", dx);
printf("dz: %.9f | ", dz);
printf("x: %.9f | ", x);
printf("z: %.9f | ", z);
printf("grid_x_index: %d | ", grid_x_index);
printf("grid_z_index: %d | ", grid_z_index);
}
if(grid_x_index >= 0 && grid_x_index < params.grid_x_size - 1 &&
grid_z_index >= 0 && grid_z_index < params.grid_z_size - 1)
{

2
source/FileHelper.cpp

@ -64,7 +64,7 @@ bool FileHelper::ReadInputFile(myint *arr, QString path, quint64 *width, quint64
if(str.length() == 0)
break;
(*height)++;
str = str.remove(str.length() - 1, 1);
// str = str.remove(str.length() - 1, 1);
auto sl = str.split(",");
if(first)
{

518
source/model/algorithms/ScanConversionAlg.cpp

@ -0,0 +1,518 @@
#include "model/algorithms/ScanConversionAlg.h"
#include <QtMath>
void ScanConversionAlg::linear(Input_t params, QVector<float> &scanXPos, QVector<float> &scanZPos,
QVector<float> &gridPixelXPos, QVector<float> &gridPixelZPos)
{
//just to map to X Z convention
auto frameMaxXScan = params.bMaxScanAz;
auto frameMinXScan = params.bMinScanAz;
auto frameMaxZScan = params.bMaxScanAx;
auto frameMinZScan = params.bMinScanAx;
auto finalPixelXNo = params.outputWidth;
auto finalPixelZNo = params.outputHeight;
auto pixelXStep = (frameMaxXScan - frameMinXScan) / (finalPixelXNo - 1);
auto pixelZStep = (frameMaxZScan - frameMinZScan) / (finalPixelZNo - 1);
gridPixelXPos.reserve(finalPixelXNo * finalPixelZNo);
gridPixelZPos.reserve(finalPixelXNo * finalPixelZNo);
auto cap = gridPixelXPos.capacity();
for(auto i = 0UL; i < finalPixelZNo; i++)
{
auto temp = frameMinZScan + i * pixelZStep;
for(auto j = 0UL; j < finalPixelXNo; j++)
{
gridPixelZPos.push_back(temp / cosf(params.steering));
gridPixelXPos.push_back((frameMinXScan + j * pixelXStep) -
(temp * tanf(params.steering)));
}
}
for(auto i = 0; i < params.rxLineNo; i++)
{
scanXPos.push_back(params.minScanAz + i * params.rxLineDaz);
}
for(auto i = 0; i < params.rxFocusPointNo; i++)
{
scanZPos.push_back(params.minScanAx + i * params.rxPointDax);
}
}
/*************************************************************************************************/
void ScanConversionAlg::virtualConvex(Input_t params, QVector<float>& scanXPos,
QVector<float>& scanZPos, QVector<float>& gridPixelXPos,
QVector<float>& gridPixelZPos)
{
auto finalPixelXNo = params.outputWidth;
auto finalPixelZNo = params.outputHeight;
auto minAbsScanAz = 0.0f;
if (params.bMaxScanAz > 0 && params.bMinScanAz < 0)
{
minAbsScanAz = 0;
}
else
{
minAbsScanAz = qMin(abs(params.bMinScanAz), abs(params.bMaxScanAz));
}
auto maxAbsScanAz = qMax(abs(params.bMinScanAz), abs(params.bMaxScanAz));
auto frameMaxZScan = params.bMaxScanAx *
cosf(minAbsScanAz / params.fieldOfView * 2 * params.vcMaxTheta);
auto frameMinZScan = params.bMinScanAx *
cosf(maxAbsScanAz / params.fieldOfView * 2 * params.vcMaxTheta);
auto frameMaxXScan = params.bMaxScanAz + params.bMaxScanAx *
sinf(params.bMaxScanAz / params.fieldOfView * 2 * params.vcMaxTheta);
auto frameMinXScan = params.bMinScanAz + params.bMaxScanAx *
sinf(params.bMinScanAz / params.fieldOfView * 2 * params.vcMaxTheta);
auto pixelXStep = (frameMaxXScan - frameMinXScan) / (finalPixelXNo - 1);
auto pixelZStep = (frameMaxZScan - frameMinZScan) / (finalPixelZNo - 1);
auto pixelXPos = QVector<float>();
auto pixelZPos = QVector<float>();
pixelXPos.reserve(finalPixelXNo * finalPixelZNo);
pixelZPos.reserve(finalPixelXNo * finalPixelZNo);
for(auto i = 0UL; i < finalPixelZNo; i++)
{
for(auto j = 0UL; j < finalPixelXNo; j++)
{
pixelZPos.push_back(frameMinZScan + i * pixelZStep);
pixelXPos.push_back(frameMinXScan + j * pixelXStep);
}
}
virtualScanConversion(pixelXPos, pixelZPos, finalPixelXNo, finalPixelZNo, params.steering,
params.virtualOriginalZ, params.startDepth, params.depth,
params.vcMaxTheta, gridPixelZPos, gridPixelXPos);
//scanTheta
for(auto i = 0; i < params.rxLineNo; i++)
{
scanXPos.push_back(params.minScanAz + i * params.rxLineDaz);
}
//scanR
for(auto i = 0; i < params.rxFocusPointNo; i++)
{
scanZPos.push_back(params.minScanAx + i * params.rxPointDax);
}
}
/*************************************************************************************************/
void ScanConversionAlg::convex(Input_t params, QVector<float>& scanXPos, QVector<float>& scanZPos,
QVector<float>& gridPixelXPos, QVector<float>& gridPixelZPos)
{
auto finalPixelXNo = params.outputWidth;
auto finalPixelZNo = params.outputHeight;
auto frameMaxXScan = params.probe.radius * sinf(params.bMaxScanAz) +
params.bMaxScanAx * sinf(params.bMaxScanAz / params.fieldOfView * params.angle);
auto frameMinXScan = params.probe.radius * sinf(params.bMinScanAz) +
params.bMaxScanAx * sinf(params.bMinScanAz / params.fieldOfView * params.angle);
auto minAbsScanAz = 0.0f;
if (params.bMaxScanAz > 0 && params.bMinScanAz < 0)
{
minAbsScanAz = 0;
}
else
{
minAbsScanAz = qMin(abs(params.bMinScanAz), abs(params.bMaxScanAz));
}
auto maxAbsScanAz = qMax(abs(params.bMinScanAz), abs(params.bMaxScanAz));
auto frameMaxZScan = params.probe.radius * cosf(minAbsScanAz) +
params.bMaxScanAx * cosf(minAbsScanAz / params.fieldOfView * params.angle);
auto frameMinZScan = params.probe.radius * cosf(maxAbsScanAz) +
params.bMinScanAx * cosf(maxAbsScanAz / params.fieldOfView * params.angle);
auto pixelXStep = (frameMaxXScan - frameMinXScan) / (finalPixelXNo - 1);
auto pixelZStep = (frameMaxZScan - frameMinZScan) / (finalPixelZNo - 1);
auto pixelXPos = QVector<float>();
auto pixelZPos = QVector<float>();
pixelXPos.reserve(finalPixelXNo * finalPixelZNo);
pixelZPos.reserve(finalPixelXNo * finalPixelZNo);
for(auto i = 0UL; i < finalPixelZNo; i++)
{
for(auto j = 0UL; j < finalPixelXNo; j++)
{
pixelZPos.push_back(frameMinZScan + i * pixelZStep);
pixelXPos.push_back(frameMinXScan + j * pixelXStep);
}
}
convexScanConversion(pixelXPos, pixelZPos, finalPixelXNo, finalPixelZNo, params.steering,
params.angle, params.fieldOfView, params.probe.radius, params.startDepth,
params.depth, gridPixelZPos, gridPixelXPos);
//scanTheta
for(auto i = 0; i < params.rxLineNo; i++)
{
scanXPos.push_back(params.minScanAz + i * params.rxLineDaz + params.probe.radius);
}
//scanR
for(auto i = 0; i < params.rxFocusPointNo; i++)
{
scanZPos.push_back(params.minScanAx + i * params.rxPointDax);
}
}
/*************************************************************************************************/
void ScanConversionAlg::scanConversion(Input_t params, QVector<float>& scanXPos,
QVector<float>& scanZPos, QVector<float>& gridPixelXPos,
QVector<float>& gridPixelZPos)
{
//convex
if(!params.probe.linear)
{
convex(params, scanXPos, scanZPos, gridPixelXPos, gridPixelZPos);
}
//virtual convex
else if(params.virtualConvex)
{
virtualConvex(params, scanXPos, scanZPos, gridPixelXPos, gridPixelZPos);
}
//linear
else
{
linear(params, scanXPos, scanZPos, gridPixelXPos, gridPixelZPos);
}
}
/*************************************************************************************************/
void ScanConversionAlg::virtualScanConversion(QVector<float> pixelXPos, QVector<float> pixelZPos,
uint width, uint height, float steering,
float virtualOriginalZ, float startDepth, float depth,
float vcMaxTheta, QVector<float>& gridPixelR,
QVector<float>& gridPixelTheta)
{
for(auto i = 0U; i < width * height; i++)
{
auto x = pixelXPos[i];
auto z = pixelZPos[i];
auto pixelTheta = atanf(x / (z + virtualOriginalZ));
if(pixelTheta >= -vcMaxTheta - abs(steering) &&
pixelTheta <= vcMaxTheta + abs(steering))
{
if(steering == 0.0f)
{
auto gridPixelAx = sqrtf(powf(x - virtualOriginalZ * tanf(pixelTheta), 2) +
powf(z, 2));
if(gridPixelAx >= startDepth && gridPixelAx <= depth)
{
gridPixelR.push_back(gridPixelAx);
gridPixelTheta.push_back(pixelTheta);
}
else
{
gridPixelR.push_back(0);
gridPixelTheta.push_back(0);
}
}
else
{
auto strTan = tanf(steering);
auto a = virtualOriginalZ * strTan;
auto b = x * strTan + virtualOriginalZ + z;
auto c = x - z * strTan;
auto interceptTheta = atanf((b + sqrtf(powf(b, 2) - 4 * a * c)) / (2 * a));
if(interceptTheta > vcMaxTheta || interceptTheta < -vcMaxTheta)
{
interceptTheta = atanf((b - sqrtf(powf(b, 2) - 4 * a * c)) / (2 * a));
if(interceptTheta > vcMaxTheta || interceptTheta < -vcMaxTheta)
{
gridPixelR.push_back(0);
gridPixelTheta.push_back(0);
}
else
{
auto gridPixelAx =
sqrtf(powf(x - virtualOriginalZ * tanf(interceptTheta), 2) +
powf(z, 2));
if(gridPixelAx >= startDepth && gridPixelAx <= depth)
{
gridPixelR.push_back(gridPixelAx);
gridPixelTheta.push_back(interceptTheta);
}
else
{
gridPixelR.push_back(0);
gridPixelTheta.push_back(0);
}
}
}
else
{
auto gridPixelAx =
sqrtf(powf(x - virtualOriginalZ * tanf(interceptTheta), 2) +
powf(z, 2));
if(gridPixelAx >= startDepth && gridPixelAx <= depth)
{
gridPixelR.push_back(gridPixelAx);
gridPixelTheta.push_back(interceptTheta);
}
else
{
gridPixelR.push_back(0);
gridPixelTheta.push_back(0);
}
}
}//steering = 0
}
else
{
gridPixelR.push_back(0);
gridPixelTheta.push_back(0);
}
}
}
/*************************************************************************************************/
void ScanConversionAlg::convexScanConversion(QVector<float> pixelXPos, QVector<float> pixelZPos,
uint width, uint height, float steering, float angle,
float fieldOfView, float probeRadius, float startDepth,
float depth, QVector<float>& gridPixelR,
QVector<float>& gridPixelTheta)
{
auto virtualOriginalZ = probeRadius *
(cosf(fieldOfView / 2) - sinf(fieldOfView / 2) / tanf(angle / 2));
auto virtualOriginalZ2 = powf(virtualOriginalZ, 2);
auto maxR = probeRadius + depth;
auto minR = probeRadius - virtualOriginalZ + startDepth;
auto minTheta = -angle / 2 - abs(steering);
auto maxTheta = angle / 2 + abs(steering);
auto maxInterceptTheta = fieldOfView / 2;
auto radius2 = powf(probeRadius, 2);
if(steering == 0.0f)
{
for (auto i = 0U; i < width * height; i++)
{
auto x = pixelXPos[i];
auto z = pixelZPos[i];
auto pixelTheta = atan2f(x, z - virtualOriginalZ);
auto pixelR = sqrtf(powf(x, 2) + powf(z - virtualOriginalZ, 2));
if(pixelR >= minR && pixelR <= maxR && pixelTheta >= minTheta && pixelTheta <= maxTheta)
{
auto interceptTheta = 0.0f;
auto interceptX = 0.0f;
auto interceptZ = 0.0f;
auto alpha = 0.0f;
auto beta = 0.0f;
if(x == 0.0f)
interceptTheta = 0;
else
{
alpha = virtualOriginalZ;
beta = (virtualOriginalZ - z) / x;
interceptX = (alpha * beta +
sqrtf(-1 * powf(alpha, 2) + (powf(beta, 2) + 1) * radius2)) /
(powf(beta, 2) + 1);
interceptZ = alpha - beta * interceptX;
interceptTheta = atan2f(interceptX, interceptZ);
}
if(interceptTheta > maxInterceptTheta || interceptTheta < -maxInterceptTheta)
{
interceptX = (alpha * beta -
sqrtf(-1 * powf(alpha, 2) + (powf(beta, 2) + 1) * radius2)) /
(powf(beta, 2) + 1);
interceptZ = alpha - beta * interceptX;
interceptTheta = atan2f(interceptX, interceptZ);
if(interceptTheta > maxInterceptTheta || interceptTheta < -maxInterceptTheta)
{
gridPixelR.push_back(0);
gridPixelTheta.push_back(0);
}
else
{
auto gridPixelAx = sqrtf(powf(x - probeRadius * sinf(interceptTheta), 2) +
powf(z - probeRadius * cosf(interceptTheta), 2));
if(gridPixelAx >= startDepth && gridPixelAx <= depth)
{
gridPixelR.push_back(probeRadius + gridPixelAx);
gridPixelTheta.push_back(interceptTheta);
}
else
{
gridPixelR.push_back(0);
gridPixelTheta.push_back(0);
}
}
}
else
{
auto gridPixelAx = sqrtf(powf(x - probeRadius * sinf(interceptTheta), 2) +
powf(z - probeRadius * cosf(interceptTheta), 2));
if(gridPixelAx >= startDepth && gridPixelAx <= depth)
{
gridPixelR.push_back(probeRadius + gridPixelAx);
gridPixelTheta.push_back(interceptTheta);
}
else
{
gridPixelR.push_back(0);
gridPixelTheta.push_back(0);
}
}
}
else
{
gridPixelR.push_back(0);
gridPixelTheta.push_back(0);
}
}
}
else
{
for (auto i = 0U; i < width * height; i++)
{
auto x = pixelXPos[i];
auto z = pixelZPos[i];
auto pixelTheta = atan2f(x, z - virtualOriginalZ);
auto pixelR = sqrtf(powf(x, 2) + powf(z - virtualOriginalZ, 2));
if(pixelR >= minR && pixelR <= maxR && pixelTheta >= minTheta && pixelTheta <= maxTheta)
{
auto strSin = 2 * sinf(steering);
auto ro = pixelR / strSin;
auto xo = ro * cosf(steering - pixelTheta);
auto zo = ro * sinf(steering - pixelTheta) + virtualOriginalZ;
if(zo == 0.0f)
{
auto interceptX = (radius2 - virtualOriginalZ2) / 2 / xo;
auto interceptZ = sqrtf(radius2 - powf(interceptX , 2));
auto interceptTheta = atan2f(interceptX, interceptZ);
if (interceptTheta > maxInterceptTheta || interceptTheta < -maxInterceptTheta)
{
interceptZ = -sqrtf(radius2 - powf(interceptX , 2));
interceptTheta = atan2f(interceptX, interceptZ);
if(interceptTheta > maxInterceptTheta ||
interceptTheta < -maxInterceptTheta)
{
gridPixelR.push_back(0);
gridPixelTheta.push_back(0);
}
else
{
auto gridPixelAx =
sqrtf(powf(x - probeRadius * sinf(interceptTheta), 2) +
powf(z - probeRadius * cosf(interceptTheta), 2));
if(gridPixelAx >= startDepth && gridPixelAx <= depth)
{
gridPixelR.push_back(probeRadius + gridPixelAx);
gridPixelTheta.push_back(interceptTheta);
}
else
{
gridPixelR.push_back(0);
gridPixelTheta.push_back(0);
}
}
}
else
{
auto gridPixelAx = sqrtf(powf(x - probeRadius * sinf(interceptTheta), 2) +
powf(z - probeRadius * cosf(interceptTheta), 2));
if(gridPixelAx >= startDepth && gridPixelAx <= depth)
{
gridPixelR.push_back(probeRadius + gridPixelAx);
gridPixelTheta.push_back(interceptTheta);
}
else
{
gridPixelR.push_back(0);
gridPixelTheta.push_back(0);
}
}
}
else
{
auto alpha = (radius2 - virtualOriginalZ2 + 2 * zo * virtualOriginalZ) / 2 / zo;
auto beta = xo / zo;
auto interceptX = (alpha * beta +
sqrtf(-1 * powf(alpha, 2) + (powf(beta, 2) + 1) * radius2)) /
(powf(beta, 2) + 1);
auto interceptZ = alpha - beta * interceptX;
auto interceptTheta = atan2f(interceptX, interceptZ);
if(interceptTheta > maxInterceptTheta || interceptTheta < -maxInterceptTheta)
{
interceptX = (alpha * beta -
sqrtf(-1 * powf(alpha, 2) + (powf(beta, 2) + 1) * radius2)) /
(powf(beta, 2) + 1);
interceptZ = alpha - beta * interceptX;
interceptTheta = atan2f(interceptX, interceptZ);
if(interceptTheta > maxInterceptTheta || interceptTheta < -maxInterceptTheta)
{
gridPixelR.push_back(0);
gridPixelTheta.push_back(0);
}
else
{
auto gridPixelAx = sqrtf(powf(x - probeRadius * sinf(interceptTheta), 2) +
powf(z - probeRadius * cosf(interceptTheta), 2));
if(gridPixelAx >= startDepth && gridPixelAx <= depth)
{
gridPixelR.push_back(probeRadius + gridPixelAx);
gridPixelTheta.push_back(interceptTheta);
}
else
{
gridPixelR.push_back(0);
gridPixelTheta.push_back(0);
}
}
}
else
{
auto gridPixelAx = sqrtf(powf(x - probeRadius * sinf(interceptTheta), 2) +
powf(z - probeRadius * cosf(interceptTheta), 2));
if(gridPixelAx >= startDepth && gridPixelAx <= depth)
{
gridPixelR.push_back(probeRadius + gridPixelAx);
gridPixelTheta.push_back(interceptTheta);
}
else
{
gridPixelR.push_back(0);
gridPixelTheta.push_back(0);
}
}
}
}
else
{
gridPixelR.push_back(0);
gridPixelTheta.push_back(0);
}
}
}
}

11
source/model/processor/strategies/Cri.cpp

@ -11,14 +11,11 @@ Cri::Cri(const Context context,const QString kernelPath,const QObject *parent =
// _criBuffer = new Image2D()[CRI_MAX_BUFFER_SIZE];
}
void Cri::cpuProcess(ScenGenOutput_t params)
void Cri::cpuProcess(Input_t params)
{
if(params.criFilterMode.isUpdated)
_kernelParameters.criFilterMode = params.criFilterMode.value;
if(params.scenarioFrameNo.isUpdated)
_kernelParameters.scenariFrameNo = params.scenarioFrameNo.value;
if(params.frameCntr.isUpdated)
_kernelParameters.frameCntr = params.frameCntr.value;
_kernelParameters.criFilterMode = params.criFilterMode;
_kernelParameters.scenariFrameNo = params.scenarioFrameNo;
_kernelParameters.frameCntr = params.frameCntr;
}
void Cri::finalize()

20
source/model/processor/strategies/DynCont.cpp

@ -13,23 +13,11 @@ DynCont::DynCont(const Context context,
memset(&_kernelParameters, 0, sizeof (DynCont_t));
}
void DynCont::cpuProcess(ScenGenOutput_t parameters)
void DynCont::cpuProcess(Input_t parameters)
{
if(parameters.dynContGain.isUpdated)
{
_kernelParameters.gain = parameters.dynContGain.value;
}
if(parameters.dynContSelector.isUpdated)
{
_kernelParameters.dynContSelector = parameters.dynContSelector.value;
}
if(parameters.compressionType.isUpdated)
{
_kernelParameters.compressionType = parameters.compressionType.value;
}
_kernelParameters.gain = parameters.dynContGain;
_kernelParameters.dynContSelector = parameters.dynContSelector;
_kernelParameters.compressionType = parameters.compressionType;
}
void DynCont::finalize()

153
source/model/processor/strategies/Enhance.cpp

@ -14,110 +14,107 @@ Enhance::Enhance(const Context context,
_filter = Q_NULLPTR;
}
void Enhance::cpuProcess(ScenGenOutput_t parameters)
void Enhance::cpuProcess(Input_t parameters)
{
if(parameters.enhance.isUpdated || parameters.enhanceAlgorithm.isUpdated)
_run = false;
if(parameters.enhance == 0)
{
_run = false;
if(parameters.enhance.value == 0)
{
return;
}
return;
}
float *hpf;
int *backgroundRecovery;
float *hpf;
int *backgroundRecovery;
//sharpen
if(parameters.enhanceAlgorithm.value == 0)
{
auto alpha = 0.25f * (parameters.enhance.value - 1);
//sharpen
if(parameters.enhanceAlgorithm == 0)
{
auto alpha = 0.25f * (parameters.enhance - 1);
_kernelParameters.filterWidth = 3;
_kernelParameters.filterHeight = 3;
_kernelParameters.filterWidth = 3;
_kernelParameters.filterHeight = 3;
hpf = new float[9];
backgroundRecovery = new int[9];
hpf = new float[9];
backgroundRecovery = new int[9];
auto factor = 4 / (alpha + 1);
int index = 0;
auto factor = 4 / (alpha + 1);
int index = 0;
hpf[index++] = factor * (alpha / 4);
hpf[index++] = factor * ((1 - alpha) / 4);
hpf[index++] = factor * (alpha / 4);
hpf[index++] = factor * (alpha / 4);
hpf[index++] = factor * ((1 - alpha) / 4);
hpf[index++] = factor * (alpha / 4);
hpf[index++] = factor * ((1 - alpha) / 4);
hpf[index++] = factor * -1;
hpf[index++] = factor * ((1 - alpha) / 4);
hpf[index++] = factor * ((1 - alpha) / 4);
hpf[index++] = factor * -1;
hpf[index++] = factor * ((1 - alpha) / 4);
hpf[index++] = factor * (alpha / 4);
hpf[index++] = factor * ((1 - alpha) / 4);
hpf[index++] = factor * (alpha / 4);
hpf[index++] = factor * (alpha / 4);
hpf[index++] = factor * ((1 - alpha) / 4);
hpf[index++] = factor * (alpha / 4);
index = 0;
index = 0;
memset(backgroundRecovery, 0, 9 * sizeof (int));
backgroundRecovery[4] = 1;
memset(backgroundRecovery, 0, 9 * sizeof (int));
backgroundRecovery[4] = 1;
_run = true;
}
//log
else if(parameters.enhanceAlgorithm.value == 1)
{
_kernelParameters.filterWidth = 5;
_kernelParameters.filterHeight = 5;
_run = true;
}
//log
else if(parameters.enhanceAlgorithm == 1)
{
_kernelParameters.filterWidth = 5;
_kernelParameters.filterHeight = 5;
hpf = new float[25];
backgroundRecovery = new int[25];
hpf = new float[25];
backgroundRecovery = new int[25];
auto sigma = 0.5f + 0.25f * (parameters.enhance.value - 1);
float sumHg = 0;
float h[25];
auto sigma = 0.5f + 0.25f * (parameters.enhance - 1);
float sumHg = 0;
float h[25];
for(int i = -2; i <= 2; i++)
for(int i = -2; i <= 2; i++)
{
for(int j = -2; j <= 2; j++)
{
for(int j = -2; j <= 2; j++)
{
float temp = expf(-(powf(i, 2) + powf(j, 2))
/ 2 / powf(sigma, 2));
h[(i + 2) * 5 + (j + 2)] = (powf(i, 2) + powf(j, 2) - 2 * powf(sigma, 2)) *
temp;
sumHg += temp;
}
}
float temp = expf(-(powf(i, 2) + powf(j, 2))
/ 2 / powf(sigma, 2));
h[(i + 2) * 5 + (j + 2)] = (powf(i, 2) + powf(j, 2) - 2 * powf(sigma, 2)) *
temp;
for(int i = 0; i < 25 ; i++)
{
hpf[i] = h[i] / powf(sigma, 4) / sumHg;
sumHg += temp;
}
memset(backgroundRecovery, 0, 25 * sizeof (int));
backgroundRecovery[12] = 1;
_run = true;
}
if(_run)
for(int i = 0; i < 25 ; i++)
{
auto filterSize = _kernelParameters.filterWidth * _kernelParameters.filterHeight;
auto filter = new float[filterSize];
for(int i = 0; i < filterSize ; i++)
{
filter[i] = backgroundRecovery[i] - hpf[i];
}
hpf[i] = h[i] / powf(sigma, 4) / sumHg;
}
delete [] hpf;
delete [] backgroundRecovery;
memset(backgroundRecovery, 0, 25 * sizeof (int));
backgroundRecovery[12] = 1;
if(_filter)
delete _filter;
_run = true;
}
_filter = _openCLHelper.array2CLBuffer(_CLContext, filterSize * sizeof (float));
BIP::getInstance()->CLQueue.enqueueWriteBuffer(*_filter, CL_TRUE,
0, filterSize * sizeof (float),
filter);
delete[] filter;
if(_run)
{
auto filterSize = _kernelParameters.filterWidth * _kernelParameters.filterHeight;
auto filter = new float[filterSize];
for(int i = 0; i < filterSize ; i++)
{
filter[i] = backgroundRecovery[i] - hpf[i];
}
delete [] hpf;
delete [] backgroundRecovery;
if(_filter)
delete _filter;
_filter = _openCLHelper.array2CLBuffer(_CLContext, filterSize * sizeof (float));
BIP::getInstance()->CLQueue.enqueueWriteBuffer(*_filter, CL_TRUE,
0, filterSize * sizeof (float),
filter);
delete[] filter;
}
}

7
source/model/processor/strategies/GrayMap.cpp

@ -13,12 +13,9 @@ GrayMap::GrayMap(const Context context,
memset(&_kernelParameters, 0, sizeof (GrayMap_t));
}
void GrayMap::cpuProcess(ScenGenOutput_t parameters)
void GrayMap::cpuProcess(Input_t parameters)
{
if(parameters.grayMapSelector.isUpdated)
{
_kernelParameters.grayMapSelector = parameters.grayMapSelector.value;
}
_kernelParameters.grayMapSelector = parameters.grayMapSelector;
}
void GrayMap::finalize()

9
source/model/processor/strategies/Persist.cpp

@ -15,13 +15,10 @@ Persist::Persist(const Context context,
_reCalc = true;
}
void Persist::cpuProcess(ScenGenOutput_t parameters)
void Persist::cpuProcess(Input_t parameters)
{
if(parameters.persist.isUpdated)
{
_kernelParameters.persist = parameters.persist.value;
_reCalc = true;
}
_kernelParameters.persist = parameters.persist;
_reCalc = true;
}
void Persist::finalize()

4
source/model/processor/strategies/Rejection.cpp

@ -12,9 +12,9 @@ Rejection::Rejection(const Context context,
}
void Rejection::cpuProcess(ScenGenOutput_t parameters)
void Rejection::cpuProcess(Input_t parameters)
{
//_rejectionThr = parameters.rejectThreshold.value;
//_rejectionThr = parameters.rejectThreshold;
}
void Rejection::finalize()

755
source/model/processor/strategies/ScanConversion.cpp

@ -2,6 +2,9 @@
#include <QPixmap>
#include <QImage>
#include "model/processor/BIP.h"
#include "model/algorithms/ScanConversionAlg.h"
#include <QtMath>
ScanConversion::ScanConversion(const Context context,
const QString kernelPath,
@ -10,744 +13,86 @@ ScanConversion::ScanConversion(const Context context,
_kernelFunctor(KernelFunctor<Image2D, Image2D,
Buffer, Buffer, Buffer, Buffer, ScanConversion_t>(_kernel))
{
_gridPixelXPos = Q_NULLPTR;
_gridPixelZPos = Q_NULLPTR;
_scanXPos = Q_NULLPTR;
_scanZPos = Q_NULLPTR;
_gridX = Q_NULLPTR;
_gridZ = Q_NULLPTR;
_queryX = Q_NULLPTR;
_queryZ = Q_NULLPTR;
_gridPixelR = Q_NULLPTR;
_gridPixelTheta = Q_NULLPTR;
}
void ScanConversion::cpuProcess(ScenGenOutput_t params)
void ScanConversion::cpuProcess(Input_t params)
{
auto context = _openCLHelper.getContext();
auto queue = BIP::getInstance()->CLQueue;
//convex
if (!params.linear.value)
{
if(params.outputWidth.isUpdated || params.outputHeight.isUpdated)
{
if(_gridPixelXPos)
delete[] _gridPixelXPos;
if(_gridPixelZPos)
delete[] _gridPixelZPos;
_gridPixelXPos = new myflt[params.outputWidth.value * params.outputHeight.value];
_gridPixelZPos = new myflt[params.outputWidth.value * params.outputHeight.value];
_width = params.outputWidth.value;
_height = params.outputHeight.value;
_kernelParameters.width = _width;
}
if(params.depth.isUpdated || params.probeRadius.isUpdated ||
params.fieldOfView.isUpdated || params.angle.isUpdated ||
params.startDepth.isUpdated || params.startDepth.isUpdated ||
params.outputWidth.isUpdated || params.outputHeight.isUpdated||
params.steering.isUpdated)
{
auto maxX = params.probeRadius.value*sinf(params.fieldOfView.value/2)+params.depth.value*sinf(params.angle.value/2);
auto minX = -1 * maxX;
auto maxZ = params.depth.value + params.probeRadius.value;
auto minZ = params.probeRadius.value*cosf(params.fieldOfView.value/2)+params.startDepth.value*cosf(params.angle.value/2);
// auto baseZ = (maxZ - minZ) / (params.outputHeight.value - 1);
// auto baseX = (maxX - minX) / (params.outputWidth.value - 1);
// for (auto i = 0; i < params.outputHeight.value; ++i)
// {
// auto temp = i * baseZ;
// auto baseIndex = i * params.outputHeight.value;
// for (auto j = 0; j < params.outputWidth.value; ++j)
// {
// auto b = minX + baseX * j;
// _gridPixelXPos[baseIndex+j] = b;
// auto a = minZ + temp;
// _gridPixelZPos[baseIndex+j] = a;
// }
// }
auto baseZ = (maxZ - minZ) / (params.outputHeight.value - 1);
auto baseX = (maxX - minX) / (params.outputWidth.value - 1);
for (auto i = 0; i < params.outputHeight.value; ++i)
{
auto temp = i * baseZ;
auto baseIndex = i * params.outputHeight.value;
for (auto j = 0; j < params.outputWidth.value; ++j)
{
auto a = minZ + i * (maxZ - minZ) / (params.outputHeight.value - 1);
_gridPixelZPos[baseIndex+j] = a;
auto b = minX + baseX * j;
_gridPixelXPos[baseIndex+j] = b;
}
}
if(_gridPixelR)
delete[] _gridPixelR;
_gridPixelR = new myflt[params.outputWidth.value * params.outputHeight.value];
if(_gridPixelTheta)
delete[] _gridPixelTheta;
_gridPixelTheta = new myflt[params.outputWidth.value * params.outputHeight.value];
auto virtualOriginalZ = params.probeRadius.value * (cosf(params.fieldOfView.value/2) -
sinf(params.fieldOfView.value/2) /
tanf(params.angle.value/2));
auto virtualOriginalZ2 = powf(virtualOriginalZ, 2);
auto minR = params.probeRadius.value - virtualOriginalZ + params.startDepth.value;
auto maxR = params.probeRadius.value + params.depth.value;
auto minTheta = (-1 * params.angle.value) / 2 - abs(params.steering.value);
auto maxTheta = params.angle.value / 2 + abs(params.steering.value);
auto strSin = 2 * sinf(params.steering.value);
auto maxInterceptTheta = params.fieldOfView.value / 2;
auto radius2 = powf(params.probeRadius.value, 2);
if(params.steering.value == 0.0f)
{
for (auto i = 0; i < params.outputWidth.value * params.outputHeight.value; ++i)
{
auto x = _gridPixelXPos[i];
auto z = _gridPixelZPos[i];
auto pixelTheta = atan2f(x, z - virtualOriginalZ);
auto pixelR = sqrtf(powf(x, 2) + powf((z - virtualOriginalZ), 2));
if(pixelR >= minR && pixelR <= maxR && pixelTheta >= minTheta && pixelTheta <= maxTheta)
{
auto interceptTheta = 0.0f;
auto interceptX = 0.0f;
auto interceptZ = 0.0f;
auto alpha = virtualOriginalZ;
auto beta = (virtualOriginalZ - z) / x;
if (x == 0.0f)
interceptTheta = 0;
else
{
interceptX = (alpha * beta + sqrtf(-1 * powf(alpha, 2) + (powf(beta, 2) + 1)* radius2)) / (powf(beta, 2) + 1);
interceptZ = alpha - beta * interceptX;
interceptTheta = atan2f(interceptX, interceptZ);
}
if(interceptTheta > maxInterceptTheta || interceptTheta < (-1 * maxInterceptTheta))
{
interceptX = (alpha * beta - sqrtf(-1 * powf(alpha, 2) + (powf(beta, 2) + 1)* radius2)) / (powf(beta, 2) + 1);
interceptZ = alpha - beta * interceptX;
interceptTheta = atan2f(interceptX, interceptZ);
if(interceptTheta > maxInterceptTheta || interceptTheta < (-1 * maxInterceptTheta))
{
_gridPixelR[i] = 0;
_gridPixelTheta[i] = 0;
}
else
{
auto gridPixelAx = sqrtf(powf((x - params.probeRadius.value * sinf(interceptTheta)), 2) +
powf((z - params.probeRadius.value * cosf(interceptTheta)), 2));
if(gridPixelAx >= params.startDepth.value && gridPixelAx <= params.depth.value)
{
_gridPixelR[i] = params.probeRadius.value + gridPixelAx;
_gridPixelTheta[i] = interceptTheta;
}
else
{
_gridPixelR[i] = 0;
_gridPixelTheta[i] = 0;
}
}
}
else
{
auto gridPixelAx = sqrtf(powf((x - params.probeRadius.value * sinf(interceptTheta)), 2) +
powf((z - params.probeRadius.value * cosf(interceptTheta)), 2));
if(gridPixelAx >= params.startDepth.value && gridPixelAx <= params.depth.value)
{
_gridPixelR[i] = params.probeRadius.value + gridPixelAx;
_gridPixelTheta[i] = interceptTheta;
}
else
{
_gridPixelR[i] = 0;
_gridPixelTheta[i] = 0;
}
}
}
else
{
_gridPixelR[i] = 0;
_gridPixelTheta[i] = 0;
}
}
}
else
{
for (auto i = 0; i < params.outputWidth.value * params.outputHeight.value; ++i)
{
auto x = _gridPixelXPos[i];
auto z = _gridPixelZPos[i];
auto pixelTheta = atan2f(x, z - virtualOriginalZ);
auto pixelR = sqrtf(powf(x, 2) + powf((z - virtualOriginalZ), 2));
if(pixelR >= minR && pixelR <= maxR && pixelTheta >= minTheta && pixelTheta <=maxTheta)
{
auto ro = pixelR / strSin;
auto xo = ro * cosf(params.steering.value - pixelTheta);
auto zo = ro * sinf(params.steering.value - pixelTheta) + virtualOriginalZ;
if(zo == 0.0f)
{
auto interceptX = (radius2 - virtualOriginalZ2) / 2 / xo;
auto interceptZ = sqrtf(radius2 - powf(interceptX , 2));
auto interceptTheta = atan2f(interceptX, interceptZ);
if (interceptTheta > maxInterceptTheta || interceptTheta < (-1 * maxInterceptTheta))
{
interceptZ = -1 * sqrtf(radius2 - powf(interceptX , 2));
interceptTheta = atan2(interceptX, interceptZ);
if(interceptTheta > maxInterceptTheta || interceptTheta < (-1 * maxInterceptTheta))
{
_gridPixelR[i] = 0;
_gridPixelTheta[i] = 0;
}
else
{
auto gridPixelAx = sqrtf(powf(x - params.probeRadius.value * sinf(interceptTheta), 2) +
powf(z - params.probeRadius.value * cosf(interceptTheta), 2));
if(gridPixelAx >= params.startDepth.value && gridPixelAx <= params.depth.value)
{
_gridPixelR[i] = params.probeRadius.value + gridPixelAx;
_gridPixelTheta[i] = interceptTheta;
}
else
{
_gridPixelR[i] = 0;
_gridPixelTheta[i] = 0;
}
}
}
else
{
auto gridPixelAx = sqrtf(powf(x - params.probeRadius.value * sinf(interceptTheta), 2) +
powf(z - params.probeRadius.value * cosf(interceptTheta), 2));
if(gridPixelAx >= params.startDepth.value && gridPixelAx <= params.depth.value)
{
_gridPixelR[i] = params.probeRadius.value + gridPixelAx;
_gridPixelTheta[i] = interceptTheta;
}
else
{
_gridPixelR[i] = 0;
_gridPixelTheta[i] = 0;
}
}
}
else
{
auto alpha = (radius2 - virtualOriginalZ2 + 2 * zo * virtualOriginalZ) / 2 / zo;
auto beta = xo / zo;
auto interceptX = (alpha * beta + sqrtf(-1 * powf(alpha, 2) + (powf(beta,2) + 1) * radius2)) / (powf(beta, 2) + 1);
auto interceptZ = alpha - beta * interceptX;
auto interceptTheta = atan2f(interceptX, interceptZ);
if(interceptTheta > maxInterceptTheta || interceptTheta < (-1 * maxInterceptTheta))
{
interceptX = (alpha * beta - sqrtf(-1 * powf(alpha, 2) + (powf(beta,2) + 1) * radius2)) / (powf(beta, 2) + 1);
interceptZ = alpha - beta * interceptX;
interceptTheta = atan2f(interceptX, interceptZ);
if(interceptTheta > maxInterceptTheta || interceptTheta < (-1 * maxInterceptTheta))
{
_gridPixelR[i] = 0;
_gridPixelTheta[i] = 0;
}
else
{
auto gridPixelAx = sqrtf(powf(x - params.probeRadius.value * sinf(interceptTheta), 2) +
powf(z - params.probeRadius.value * cosf(interceptTheta), 2));
if(gridPixelAx >= params.startDepth.value && gridPixelAx <= params.depth.value)
{
_gridPixelR[i] = params.probeRadius.value + gridPixelAx;
_gridPixelTheta[i] = interceptTheta;
}
else
{
_gridPixelR[i] = 0;
_gridPixelTheta[i] = 0;
}
}
}
else
{
auto gridPixelAx = sqrtf(powf(x - params.probeRadius.value * sinf(interceptTheta), 2) +
powf(z - params.probeRadius.value * cosf(interceptTheta), 2));
if(gridPixelAx >= params.startDepth.value && gridPixelAx <= params.depth.value)
{
_gridPixelR[i] = params.probeRadius.value + gridPixelAx;
_gridPixelTheta[i] = interceptTheta;
}
else
{
_gridPixelR[i] = 0;
_gridPixelTheta[i] = 0;
}
}
}
}
else
{
_gridPixelR[i] = 0;
_gridPixelTheta[i] = 0;
}
}
}
if(_queryX)
delete _queryX;
if(_queryZ)
delete _queryZ;
_queryX = _openCLHelper.array2CLBuffer(context,
params.outputWidth.value *
params.outputHeight.value *
sizeof (myflt));
_queryZ = _openCLHelper.array2CLBuffer(context,
params.outputWidth.value *
params.outputHeight.value *
sizeof (myflt));
BIP::getInstance()->CLQueue.enqueueWriteBuffer(*_queryZ, CL_TRUE, 0,
params.outputWidth.value *
params.outputHeight.value *
sizeof (myflt),
_gridPixelR);
queue.enqueueWriteBuffer(*_queryX, CL_TRUE, 0,
params.outputWidth.value *
params.outputHeight.value *
sizeof (myflt),
_gridPixelTheta);
}
//TODO:: write after convex
//scanTheta
if(params.rxLineNo.isUpdated || params.minScanAz.isUpdated ||
params.rxLineDaz.isUpdated)
{
if(_scanXPos)
delete [] _scanXPos;
if(_gridX)
delete _gridX;
_scanXPos = new myflt[params.rxLineNo.value];
for (auto i = 0; i < params.rxLineNo.value ; ++i)
{
_scanXPos[i] = params.minScanAz.value + i * params.rxLineDaz.value;
}
_gridX = _openCLHelper.array2CLBuffer(context, static_cast<qint64>(params.rxLineNo.value * sizeof (myflt)));
auto er = queue.enqueueWriteBuffer(*_gridX,CL_TRUE, 0, static_cast<unsigned long>(params.rxLineNo.value * sizeof (myflt)), _scanXPos);
_kernelParameters.gridXSize = params.rxLineNo.value;
}
//scanR
if(params.rxFocusPointNo.isUpdated || params.minScanAx.isUpdated ||
params.rxPointDax.isUpdated)
{
if(_scanZPos)
delete [] _scanZPos;
if(_gridZ)
delete _gridZ;
_scanZPos = new myflt[params.rxFocusPointNo.value];
for (auto i = 0; i < params.rxFocusPointNo.value; ++i)
{
_scanZPos[i] = (params.minScanAx.value + i * params.rxPointDax.value ) +params.probeRadius.value;
}
_gridZ = _openCLHelper.array2CLBuffer(context, static_cast<qint64>(params.rxFocusPointNo.value * sizeof (myflt)));
auto er = queue.enqueueWriteBuffer(*_gridZ, CL_TRUE, 0, static_cast<unsigned long>(params.rxFocusPointNo.value * sizeof (myflt)),_scanZPos);
_kernelParameters.gridZSize = params.rxFocusPointNo.value;
}
}
//virtual convex
else if(params.virtualConvex.value)
{
if(params.outputWidth.isUpdated|| params.outputHeight.isUpdated)
{
if(_gridPixelXPos)
delete[] _gridPixelXPos;
if(_queryX)
delete _queryX;
if(_gridPixelZPos)
delete[] _gridPixelZPos;
if(_queryZ)
delete _queryZ;
_gridPixelXPos = new myflt[params.outputWidth.value *
params.outputHeight.value];
_gridPixelZPos = new myflt[params.outputWidth.value *
params.outputHeight.value];
if(_gridX)
delete _gridX;
_width = params.outputWidth.value;
_height = params.outputHeight.value;
if(_gridZ)
delete _gridZ;
_kernelParameters.width = _width;
}
_gridPixelXPos.clear();
_gridPixelZPos.clear();
_scanXPos.clear();
_scanZPos.clear();
if(params.depth.isUpdated || params.startDepth.isUpdated ||
params.fieldOfView.isUpdated || params.vcMaxTheta.isUpdated ||
params.outputWidth.isUpdated || params.outputHeight.isUpdated)
{
auto maxZ = params.depth.value;
auto minZ = params.startDepth.value * cosf(params.vcMaxTheta.value);
auto maxX = params.fieldOfView.value / 2 + maxZ * sinf(params.vcMaxTheta.value);
auto minX = -1 * maxX;
_queryX = _openCLHelper.array2CLBuffer(context,
params.outputWidth *
params.outputHeight *
sizeof (myflt));
_queryZ = _openCLHelper.array2CLBuffer(context,
params.outputWidth *
params.outputHeight *
sizeof (myflt));
auto baseZ = (maxZ - minZ) / (params.outputHeight.value - 1);
auto baseX = (maxX - minX) / (params.outputWidth.value - 1);
_gridX = _openCLHelper.array2CLBuffer
(context, static_cast<quint64>(params.rxLineNo * sizeof (float)));
for(auto i = 0; i < params.outputHeight.value; i++)
{
auto temp = i * baseZ;
for(auto j = 0; j < params.outputWidth.value; j++)
{
_gridPixelZPos[i * params.outputHeight.value + j] = minZ + temp;
_gridPixelXPos[i * params.outputHeight.value + j] = minX + (baseX * j);
}
}
_gridZ = _openCLHelper.array2CLBuffer
(context, static_cast<quint64>(params.rxFocusPointNo * sizeof (float)));
auto virtualOriginZ = params.fieldOfView.value / 2 / tanf(params.vcMaxTheta.value);
ScanConversionAlg::scanConversion(params, _scanXPos, _scanZPos, _gridPixelXPos, _gridPixelZPos);
if(_gridPixelR)
delete[] _gridPixelR;
queue.enqueueWriteBuffer(*_queryZ, CL_TRUE, 0,
params.outputWidth *
params.outputHeight *
sizeof (myflt),
_gridPixelZPos.data());
if(_gridPixelTheta)
delete[] _gridPixelTheta;
queue.enqueueWriteBuffer(*_queryX, CL_TRUE, 0,
params.outputWidth *
params.outputHeight *
sizeof (myflt),
_gridPixelXPos.data());
_gridPixelR = new myflt[params.outputWidth.value *
params.outputHeight.value];
_gridPixelTheta = new myflt[params.outputWidth.value *
params.outputHeight.value];
queue.enqueueWriteBuffer(*_gridX, CL_TRUE, 0,
static_cast<quint64>(params.rxLineNo * sizeof (float)),
_scanXPos.data());
auto strTan = tanf(params.steering.value);
queue.enqueueWriteBuffer(*_gridZ, CL_TRUE, 0,
static_cast<quint64>(params.rxFocusPointNo * sizeof (float)),
_scanZPos.data());
for(auto i = 0; i < params.outputWidth.value *
params.outputHeight.value; i++)
{
auto x = _gridPixelXPos[i];
auto z = _gridPixelZPos[i];
_kernelParameters.gridXSize = params.rxLineNo;
_kernelParameters.gridZSize = params.rxFocusPointNo;
_kernelParameters.width = params.outputWidth;
auto pixelTheta = atanf(x / (z + virtualOriginZ));
if(pixelTheta >= -params.vcMaxTheta.value - abs(params.steering.value) &&
pixelTheta <= params.vcMaxTheta.value + abs(params.steering.value))
{
if(params.steering.value == 0)
{
auto gridPixelAx = sqrtf(powf(x - virtualOriginZ * tanf(pixelTheta), 2) + powf(z, 2));
if(gridPixelAx >= params.startDepth.value &&
gridPixelAx <= params.depth.value)
{
_gridPixelR[i] = gridPixelAx;
_gridPixelTheta[i] = pixelTheta;
}
else
{
_gridPixelR[i] = 0;
_gridPixelTheta[i] = 0;
}
}
else
{
auto a = virtualOriginZ * strTan;
auto b = x * strTan + virtualOriginZ + z;
auto c = x - z * strTan;
auto interceptTheta = atanf((b + sqrtf(powf(b, 2) - 4 * a * c)) / (2 * a));
if(interceptTheta > params.vcMaxTheta.value ||
interceptTheta < -params.vcMaxTheta.value)
{
interceptTheta = atanf((b - sqrtf(powf(b, 2) - 4 * a * c)) / (2 * a));
if(interceptTheta > params.vcMaxTheta.value ||
interceptTheta < -params.vcMaxTheta.value)
{
_gridPixelR[i] = 0;
_gridPixelTheta[i] = 0;
}
else
{
auto gridPixelAx = sqrtf(powf(x - virtualOriginZ * tanf(interceptTheta), 2) + powf(z, 2));
if(gridPixelAx >= params.startDepth.value &&
gridPixelAx <= params.depth.value)
{
_gridPixelR[i] = gridPixelAx;
_gridPixelTheta[i] = interceptTheta;
}
else
{
_gridPixelR[i] = 0;
_gridPixelTheta[i] = 0;
}
}
}
else
{
auto gridPixelAx = sqrtf(powf(x - virtualOriginZ * tanf(interceptTheta), 2) + powf(z, 2));
if(gridPixelAx >= params.startDepth.value &&
gridPixelAx <= params.depth.value)
{
_gridPixelR[i] = gridPixelAx;
_gridPixelTheta[i] = interceptTheta;
}
else
{
_gridPixelR[i] = 0;
_gridPixelTheta[i] = 0;
}
}
}
}
else
{
_gridPixelR[i] = 0;
_gridPixelTheta[i] = 0;
}
}
if(_queryX)
delete _queryX;
if(_queryZ)
delete _queryZ;
_queryX = _openCLHelper.array2CLBuffer(context,
params.outputWidth.value *
params.outputHeight.value *
sizeof (myflt));
_queryZ = _openCLHelper.array2CLBuffer(context,
params.outputWidth.value *
params.outputHeight.value *
sizeof (myflt));
BIP::getInstance()->CLQueue.enqueueWriteBuffer(*_queryZ, CL_TRUE, 0,
params.outputWidth.value *
params.outputHeight.value *
sizeof (myflt),
_gridPixelR);
queue.enqueueWriteBuffer(*_queryX, CL_TRUE, 0,
params.outputWidth.value *
params.outputHeight.value *
sizeof (myflt),
_gridPixelTheta);
}
if(params.minScanAz.isUpdated || params.rxLineNo.isUpdated ||
params.rxLineDaz.isUpdated)
{
if(_scanXPos)
delete [] _scanXPos;
if(_gridX)
delete _gridX;
_scanXPos = new myflt[params.rxLineNo.value];
for(auto i = 0; i < params.rxLineNo.value; i++)
{
_scanXPos[i] = params.minScanAz.value + i * params.rxLineDaz.value;
}
_gridX = _openCLHelper.array2CLBuffer(context,
static_cast<quint64>(params.rxLineNo.value)
* sizeof (myflt));
queue.enqueueWriteBuffer(*_gridX, CL_TRUE, 0,
static_cast<unsigned long>(params.rxLineNo.value) * sizeof (myflt),
_scanXPos);
_kernelParameters.gridXSize = params.rxLineNo.value;
}
if(params.rxFocusPointNo.isUpdated || params.minScanAx.isUpdated ||
params.rxPointDax.isUpdated)
{
if(_scanZPos)
delete[] _scanZPos;
if(_gridZ)
delete _gridZ;
_scanZPos = new myflt [params.rxFocusPointNo.value];
for(auto i = 0; i < params.rxFocusPointNo.value; i++)
{
_scanZPos[i] = params.minScanAx.value + i * params.rxPointDax.value;
}
_gridZ = _openCLHelper.array2CLBuffer(context,
static_cast<quint64>(params.rxFocusPointNo.value)
* sizeof (myflt));
queue.enqueueWriteBuffer(*_gridZ, CL_TRUE, 0,
static_cast<unsigned long>(params.rxFocusPointNo.value) * sizeof (myflt),
_scanZPos);
_kernelParameters.gridZSize = params.rxFocusPointNo.value;
}
}
//linear non convex
else
{
if(params.outputWidth.isUpdated || params.outputHeight.isUpdated)
{
if(_gridPixelXPos)
delete[] _gridPixelXPos;
if(_gridPixelZPos)
delete[] _gridPixelZPos;
_gridPixelXPos = new myflt[params.outputWidth.value *
params.outputHeight.value];
_gridPixelZPos = new myflt[params.outputWidth.value *
params.outputHeight.value];
if(_queryX)
delete _queryX;
if(_queryZ)
delete _queryZ;
_queryX = _openCLHelper.array2CLBuffer(context,
params.outputWidth.value *
params.outputHeight.value *
sizeof (myflt));
_queryZ = _openCLHelper.array2CLBuffer(context,
params.outputWidth.value *
params.outputHeight.value *
sizeof (myflt));
_width = params.outputWidth.value;
_height = params.outputHeight.value;
_kernelParameters.width = _width;
}
if(params.depth.isUpdated || params.startDepth.isUpdated ||
params.fieldOfView.isUpdated || params.steering.isUpdated ||
params.outputWidth.isUpdated || params.outputHeight.isUpdated)
{
auto maxZ = params.depth.value;
auto minZ = params.startDepth.value;
auto maxX = params.fieldOfView.value / 2;
auto minX = -1 * maxX;
auto baseZ = (maxZ - minZ) / (params.outputHeight.value - 1);
auto baseX = (maxX - minX) / (params.outputWidth.value - 1);
for(auto i = 0; i < params.outputHeight.value; i++)
{
auto temp = i * baseZ;
auto tan_result = temp * tanf(params.steering.value);
for(auto j = 0; j < params.outputWidth.value; j++)
{
_gridPixelZPos[i * params.outputHeight.value + j] = minZ + temp;
_gridPixelXPos[i * params.outputHeight.value + j] = minX + (baseX * j) - tan_result;
}
}
BIP::getInstance()->CLQueue.enqueueWriteBuffer(*_queryX, CL_TRUE, 0,
params.outputWidth.value *
params.outputHeight.value *
sizeof (myflt),
_gridPixelXPos);
queue.enqueueWriteBuffer(*_queryZ, CL_TRUE, 0,
params.outputWidth.value *
params.outputHeight.value *
sizeof (myflt),
_gridPixelZPos);
}
if(params.fieldOfView.isUpdated || params.rxLineNo.isUpdated ||
params.rxLineDaz.isUpdated)
{
if(_scanXPos)
delete [] _scanXPos;
if(_gridX)
delete _gridX;
_scanXPos = new myflt[params.rxLineNo.value];
for(auto i = 0; i < params.rxLineNo.value; i++)
{
_scanXPos[i] = -params.fieldOfView.value / 2 + i * params.rxLineDaz.value;
}
_gridX = _openCLHelper.array2CLBuffer(context,
static_cast<quint64>(params.rxLineNo.value)
* sizeof (myflt));
queue.enqueueWriteBuffer(*_gridX, CL_TRUE, 0,
static_cast<unsigned long>(params.rxLineNo.value) * sizeof (myflt),
_scanXPos);
_kernelParameters.gridXSize = params.rxLineNo.value;
}
if(params.rxFocusPointNo.isUpdated || params.rxPointDax.isUpdated)
{
if(_scanZPos)
delete[] _scanZPos;
if(_gridZ)
delete _gridZ;
_scanZPos = new myflt [params.rxFocusPointNo.value];
for(auto i = 0; i < params.rxFocusPointNo.value; i++)
{
_scanZPos[i] = params.startDepth.value + i * params.rxPointDax.value;
}
_gridZ = _openCLHelper.array2CLBuffer(context,
static_cast<quint64>(params.rxFocusPointNo.value)
* sizeof (myflt));
queue.enqueueWriteBuffer(*_gridZ, CL_TRUE, 0,
static_cast<unsigned long>(params.rxFocusPointNo.value) * sizeof (myflt),
_scanZPos);
_kernelParameters.gridZSize = params.rxFocusPointNo.value;
}
}
_width = params.outputWidth;
_height = params.outputHeight;
}
void ScanConversion::finalize()
{
delete _gridPixelXPos;
delete _gridPixelZPos;
delete _scanXPos;
delete _scanZPos;
delete _gridX;
delete _gridZ;
delete _queryX;
delete _queryZ;
_gridPixelXPos = Q_NULLPTR;
_gridPixelZPos = Q_NULLPTR;
_scanXPos = Q_NULLPTR;
_scanZPos = Q_NULLPTR;
_gridX = Q_NULLPTR;
_gridZ = Q_NULLPTR;
_queryX = Q_NULLPTR;

7
source/model/processor/strategies/Sri.cpp

@ -13,12 +13,9 @@ Sri::Sri(const Context context,
memset(&_kernelParameters, 0, sizeof (Sri_t));
}
void Sri::cpuProcess(ScenGenOutput_t parameters)
void Sri::cpuProcess(Input_t parameters)
{
if(parameters.sri.isUpdated)
{
_kernelParameters.sri = parameters.sri.value;
}
_kernelParameters.sri = parameters.sri;
}
void Sri::finalize()

7
source/model/processor/strategies/TintMap.cpp

@ -13,12 +13,9 @@ TintMap::TintMap(const Context context,
memset(&_kernelParameters, 0, sizeof (TintMap_t));
}
void TintMap::cpuProcess(ScenGenOutput_t parameters)
void TintMap::cpuProcess(Input_t parameters)
{
if(parameters.tintMapSelector.isUpdated)
{
_kernelParameters.tintMapSelector = parameters.tintMapSelector.value;
}
_kernelParameters.tintMapSelector = parameters.tintMapSelector;
}
void TintMap::finalize()

Loading…
Cancel
Save