增加调试代码
parent
dce9400f1c
commit
5cd3729fdf
|
@ -16,7 +16,7 @@
|
|||
|
||||
//#define __PRFDEBUG__
|
||||
|
||||
#define __TBPIMAGE__
|
||||
#define __TBPIMAGEDEBUG__
|
||||
|
||||
//#include <mkl.h>
|
||||
#include <complex>
|
||||
|
|
|
@ -2808,3 +2808,72 @@ ErrorCode DEM2XYZRasterAndSlopRaster(QString dempath, QString demxyzpath, QStri
|
|||
return ErrorCode::SUCCESS;
|
||||
}
|
||||
|
||||
void testOutAmpArr(QString filename, float* amp, long rowcount, long colcount)
|
||||
{
|
||||
|
||||
|
||||
Eigen::MatrixXd h_amp_img = Eigen::MatrixXd::Zero(rowcount, colcount);
|
||||
|
||||
for (long hii = 0; hii < rowcount; hii++) {
|
||||
for (long hjj = 0; hjj < colcount; hjj++) {
|
||||
h_amp_img(hii, hjj) = amp[hii * colcount + hjj];
|
||||
}
|
||||
}
|
||||
QString ampPath = getDebugDataPath(filename);
|
||||
saveEigenMatrixXd2Bin(h_amp_img, ampPath);
|
||||
std::cout << filename.toLocal8Bit().constData() << std::endl;
|
||||
std::cout << "max:\t" << h_amp_img.maxCoeff() << std::endl;
|
||||
std::cout << "min:\t" << h_amp_img.minCoeff() << std::endl;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void testOutClsArr(QString filename, long* amp, long rowcount, long colcount) {
|
||||
|
||||
Eigen::MatrixXd h_amp_img = Eigen::MatrixXd::Zero(rowcount, colcount);
|
||||
|
||||
for (long hii = 0; hii < rowcount; hii++) {
|
||||
for (long hjj = 0; hjj < colcount; hjj++) {
|
||||
h_amp_img(hii, hjj) = amp[hii * colcount + hjj];
|
||||
}
|
||||
}
|
||||
QString ampPath = getDebugDataPath(filename);
|
||||
saveEigenMatrixXd2Bin(h_amp_img, ampPath);
|
||||
std::cout << filename.toLocal8Bit().constData() << std::endl;
|
||||
std::cout << "max:\t" << h_amp_img.maxCoeff() << std::endl;
|
||||
std::cout << "min:\t" << h_amp_img.minCoeff() << std::endl;
|
||||
|
||||
}
|
||||
|
||||
void testOutAntPatternTrans(QString antpatternfilename, float* antPatternArr,
|
||||
double starttheta, double deltetheta,
|
||||
double startphi, double deltaphi,
|
||||
long thetanum, long phinum)
|
||||
{
|
||||
|
||||
|
||||
Eigen::MatrixXd antPatternMatrix(thetanum, phinum);
|
||||
for (long t = 0; t < thetanum; ++t) {
|
||||
for (long p = 0; p < phinum; ++p) {
|
||||
long index = t * phinum + p;
|
||||
if (index < thetanum * phinum) {
|
||||
antPatternMatrix(t, p) = static_cast<double>(antPatternArr[index]); // Copy to Eigen matrix
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Eigen::MatrixXd gt(2, 3);
|
||||
gt(0, 0) = startphi;//x
|
||||
gt(0, 1) = deltaphi;
|
||||
gt(0, 2) = 0;
|
||||
|
||||
gt(1, 0) = starttheta;
|
||||
gt(1, 1) = 0;
|
||||
gt(1, 2) = deltetheta;
|
||||
|
||||
QString antpatternfilepath = getDebugDataPath(antpatternfilename);
|
||||
gdalImage ds = CreategdalImage(antpatternfilepath, thetanum, phinum, 1, gt, "", true, true, true);
|
||||
ds.saveImage(antPatternMatrix, 0, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -272,6 +272,13 @@ ErrorCode MergeRasterInGeoCoding(QVector<gdalImage> inimgs, gdalImage resultimg,
|
|||
bool saveEigenMatrixXd2Bin(Eigen::MatrixXd data, QString dataStrPath);
|
||||
|
||||
|
||||
// 测试
|
||||
void testOutAntPatternTrans(QString antpatternfilename, float* antPatternArr, double starttheta, double deltetheta, double startphi, double deltaphi, long thetanum, long phinum);
|
||||
void testOutAmpArr(QString filename, float* amp, long rowcount, long colcount);
|
||||
void testOutClsArr(QString filename, long* amp, long rowcount, long colcount);
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename T>
|
||||
std::shared_ptr<T> readDataArr(gdalImage& imgds, int start_row, int start_col, int rows_count, int cols_count, int band_ids, GDALREADARRCOPYMETHOD method)
|
||||
|
|
|
@ -1122,72 +1122,3 @@ void RTPCProcessMain(long num_thread, QString TansformPatternFilePath, QString R
|
|||
qDebug() << "-------------- RTPC end---------------------------------------";
|
||||
}
|
||||
|
||||
void testOutAntPatternTrans(QString antpatternfilename,float* antPatternArr,
|
||||
double starttheta, double deltetheta,
|
||||
double startphi, double deltaphi,
|
||||
long thetanum, long phinum)
|
||||
{
|
||||
|
||||
|
||||
Eigen::MatrixXd antPatternMatrix(thetanum,phinum);
|
||||
for (long t = 0; t < thetanum; ++t) {
|
||||
for (long p = 0; p < phinum; ++p) {
|
||||
long index = t * phinum + p;
|
||||
if (index < thetanum * phinum) {
|
||||
antPatternMatrix(t, p) = static_cast<double>(antPatternArr[index]); // Copy to Eigen matrix
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Eigen::MatrixXd gt(2, 3);
|
||||
gt(0, 0)=startphi;//x
|
||||
gt(0, 1)=deltaphi;
|
||||
gt(0, 2)=0;
|
||||
|
||||
gt(1, 0)=starttheta;
|
||||
gt(1, 1)=0;
|
||||
gt(1, 2)=deltetheta;
|
||||
|
||||
QString antpatternfilepath = getDebugDataPath(antpatternfilename);
|
||||
gdalImage ds= CreategdalImage(antpatternfilepath, thetanum, phinum, 1, gt, "", true, true, true);
|
||||
ds.saveImage(antPatternMatrix, 0, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void testOutClsArr(QString filename, long* amp, long rowcount, long colcount) {
|
||||
|
||||
Eigen::MatrixXd h_amp_img = Eigen::MatrixXd::Zero(rowcount, colcount);
|
||||
|
||||
for (long hii = 0; hii < rowcount; hii++) {
|
||||
for (long hjj = 0; hjj < colcount; hjj++) {
|
||||
h_amp_img(hii, hjj) = amp[hii * colcount + hjj];
|
||||
}
|
||||
}
|
||||
QString ampPath = getDebugDataPath(filename);
|
||||
saveEigenMatrixXd2Bin(h_amp_img, ampPath);
|
||||
std::cout << filename.toLocal8Bit().constData() << std::endl;
|
||||
std::cout << "max:\t" << h_amp_img.maxCoeff() << std::endl;
|
||||
std::cout << "min:\t" << h_amp_img.minCoeff() << std::endl;
|
||||
|
||||
}
|
||||
|
||||
void testOutAmpArr(QString filename, float* amp, long rowcount, long colcount)
|
||||
{
|
||||
|
||||
|
||||
Eigen::MatrixXd h_amp_img = Eigen::MatrixXd::Zero(rowcount, colcount);
|
||||
|
||||
for (long hii = 0; hii < rowcount; hii++) {
|
||||
for (long hjj = 0; hjj < colcount; hjj++) {
|
||||
h_amp_img(hii, hjj) = amp[hii * colcount + hjj];
|
||||
}
|
||||
}
|
||||
QString ampPath = getDebugDataPath(filename);
|
||||
saveEigenMatrixXd2Bin(h_amp_img, ampPath);
|
||||
std::cout << filename.toLocal8Bit().constData() << std::endl;
|
||||
std::cout << "max:\t" << h_amp_img.maxCoeff() << std::endl;
|
||||
std::cout << "min:\t" << h_amp_img.minCoeff() << std::endl;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -84,7 +84,3 @@ private:
|
|||
|
||||
void RTPCProcessMain(long num_thread,QString TansformPatternFilePath,QString ReceivePatternFilePath,QString simulationtaskName, QString OutEchoPath, QString GPSXmlPath,QString TaskXmlPath,QString demTiffPath, QString LandCoverPath, QString HHSigmaPath, QString HVSigmaPath, QString VHSigmaPath, QString VVSigmaPath);
|
||||
|
||||
// ²âÊÔ
|
||||
void testOutAntPatternTrans(QString antpatternfilename,float* antPatternArr,double starttheta,double deltetheta,double startphi,double deltaphi,long thetanum,long phinum );
|
||||
void testOutAmpArr(QString filename, float* amp, long rowcount, long colcount);
|
||||
void testOutClsArr(QString filename, long* amp, long rowcount, long colcount);
|
||||
|
|
|
@ -233,10 +233,10 @@ ErrorCode TBPImageAlgCls::ProcessGPU()
|
|||
|
||||
|
||||
// 按照回波分块,图像分块
|
||||
long echoBlockline = Memory1GB / 8 / 2 / PlusePoints * 4;
|
||||
long echoBlockline = Memory1GB / 8 / 2 / PlusePoints * 3;
|
||||
echoBlockline = echoBlockline < 1 ? 1 : echoBlockline;
|
||||
|
||||
long imageBlockline = Memory1GB / 8 / 2 / colCount * 4;
|
||||
long imageBlockline = Memory1GB / 8 / 2 / colCount * 3;
|
||||
imageBlockline = imageBlockline < 1 ? 1 : imageBlockline;
|
||||
|
||||
gdalImage imageXYZ(this->outRasterXYZPath);
|
||||
|
@ -380,18 +380,62 @@ void TBPImageGPUAlg(std::shared_ptr<float> antPx, std::shared_ptr<float> antPy,
|
|||
for (long prfid = 0; prfid < prfcount; prfid++) {
|
||||
CUDATBPImage(
|
||||
d_antPx,d_antPy,d_antPz,
|
||||
d_imgx,d_imgy,d_imgz, d_R,
|
||||
d_imgx,d_imgy,d_imgz,
|
||||
d_R,
|
||||
d_echoArr,
|
||||
d_imgArr,
|
||||
freq, fs, Rnear, Rfar,
|
||||
rowcount, colcount,
|
||||
prfid, freqcount
|
||||
);
|
||||
|
||||
#ifdef __TBPIMAGEDEBUG__
|
||||
// 判断当前坐标情况下的 各块的计算情况
|
||||
qDebug() << "Ant=[" << h_antPx[prfid] << " " << h_antPy[prfid] << " " << h_antPz[prfid] << "];";
|
||||
DeviceToHost(h_R, d_R, sizeof(float) * rowcount * colcount);
|
||||
DeviceToHost(h_imgArr, d_imgArr, sizeof(cuComplex) * rowcount * colcount);
|
||||
testOutAmpArr(QString("imge_R_%1").arg(prfid), h_R, rowcount, colcount);
|
||||
testOutAmpArr(QString("imge_X_%1").arg(prfid), h_imgx, rowcount, colcount);
|
||||
testOutAmpArr(QString("imge_Y_%1").arg(prfid), h_imgy, rowcount, colcount);
|
||||
testOutAmpArr(QString("imge_Z_%1").arg(prfid), h_imgz, rowcount, colcount);
|
||||
long pixelcount = rowcount * colcount;
|
||||
float* h_echoAmp_real = (float*)mallocCUDAHost(sizeof(float) * prfcount* freqcount);
|
||||
float* h_echoAmp_imag = (float*)mallocCUDAHost(sizeof(float) * prfcount * freqcount);
|
||||
float* h_echoAmp_abs = (float*)mallocCUDAHost(sizeof(float) * prfcount * freqcount);
|
||||
|
||||
for (long freqi = 0; freqi < prfcount * freqcount; freqi++) {
|
||||
h_echoAmp_real[freqi] = d_echoArr[freqi].x;
|
||||
h_echoAmp_imag[freqi] = d_echoArr[freqi].y;
|
||||
h_echoAmp_abs[freqi] = 20 * std::log10(std::abs(std::complex<double>(h_echoAmp_real[freqi], h_echoAmp_imag[freqi])));
|
||||
}
|
||||
|
||||
testOutAmpArr(QString("h_echo_absdB_%1.bin").arg(prfid), h_echoAmp_abs, prfcount, freqcount);
|
||||
|
||||
float* h_imgAmp_real = (float*)mallocCUDAHost(sizeof(float) * rowcount * colcount);
|
||||
float* h_imgAmp_imag = (float*)mallocCUDAHost(sizeof(float) * rowcount * colcount);
|
||||
float* h_imgAmp_abs = (float*)mallocCUDAHost(sizeof(float) * rowcount * colcount);
|
||||
|
||||
for (long freqi = 0; freqi < rowcount * colcount; freqi++) {
|
||||
h_imgAmp_real[freqi] = h_imgArr[freqi].x;
|
||||
h_imgAmp_imag[freqi] = h_imgArr[freqi].y;
|
||||
h_imgAmp_abs[freqi] = 20 * std::log10(std::abs(std::complex<double>(h_imgAmp_real[freqi], h_imgAmp_imag[freqi])));
|
||||
}
|
||||
|
||||
testOutAmpArr(QString("h_image_absdB_%1.bin").arg(prfid), h_imgAmp_abs, rowcount, colcount);
|
||||
|
||||
|
||||
|
||||
|
||||
exit(-1);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Device -> Host
|
||||
DeviceToHost(h_imgArr, d_imgArr, sizeof(cuComplex) * rowcount * colcount);
|
||||
DeviceToHost(h_R,d_R,sizeof(float)*rowcount*colcount);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue