Skip to content

Commit

Permalink
Bug in Himawari image processing : QMutex lock/unlock not necessary.
Browse files Browse the repository at this point in the history
All QMutex g_mutex disabled.
  • Loading branch information
hvanruys committed Feb 5, 2018
1 parent ec1fb58 commit 7bf08f2
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 129 deletions.
2 changes: 0 additions & 2 deletions core/globe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ extern gshhsData *gshhsdata;

#include <QMutex>

extern QMutex g_mutex;

void Render3DColorTexture(Globe *gl, int geoindex)
{
gl->Render3DGeoSegment( geoindex );
Expand Down
2 changes: 1 addition & 1 deletion core/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include <QMutex>

#define APPVERSION "1.3.1"
#define APPVERSION "1.3.2"
using namespace std;

QMutex g_mutex;
Expand Down
1 change: 0 additions & 1 deletion core/segment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ extern Options opts;
extern SegmentImage *imageptrs;

#include <QMutex>
extern QMutex g_mutex;

Segment::Segment(QObject *parent) :
QObject(parent)
Expand Down
1 change: 0 additions & 1 deletion core/segmentgac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#include <QMutex>

extern QMutex g_mutex;
extern Options opts;
extern SegmentImage *imageptrs;

Expand Down
102 changes: 7 additions & 95 deletions core/segmentlistgeostationary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ quint32 _ntohl(quint32 x) {
}
}

extern QMutex g_mutex;
extern Options opts;
extern SegmentImage *imageptrs;
extern gshhsData *gshhsdata;
Expand Down Expand Up @@ -128,6 +127,7 @@ SegmentListGeostationary::SegmentListGeostationary(QObject *parent, int geoindex
this->bActiveSegmentList = false;
this->bisRSS = false;
this->SetupContrastStretch( 0, 0, 1023, 255);

this->time = NULL; /* image of Julian Day Number */
this->lat = NULL; /* image of latitude */
this->lon = NULL; /* image of longitude */
Expand Down Expand Up @@ -704,9 +704,6 @@ void SegmentListGeostationary::ComposeSegmentImageXRITHimawari( QString filepath
im = imageptrs->ptrimageGeostationary;

quint16 c;
QRgb pix;
int r,g, b;
quint16 valcontrast;

if(channelindex == 0)
{
Expand All @@ -724,8 +721,6 @@ void SegmentListGeostationary::ComposeSegmentImageXRITHimawari( QString filepath
memset(imageptrs->ptrBlue[filesequence], 0, number_of_lines * number_of_columns *sizeof(quint16));
}



quint16 maxpic = 0;
quint16 minpic = 65535;

Expand All @@ -749,84 +744,13 @@ void SegmentListGeostationary::ComposeSegmentImageXRITHimawari( QString filepath
}


if(channelindex == 0)
this->issegmentcomposedRed[filesequence] = true;
else if(channelindex == 1)
this->issegmentcomposedGreen[filesequence] = true;
else if(channelindex == 2)
this->issegmentcomposedBlue[filesequence] = true;


// g_mutex.lock();


//// if(kindofimage == "VIS_IR")
//// CalculateMinMaxHimawari(5500, 550, imageptrs->ptrRed[filesequence], minvalueRed[filesequence], maxvalueRed[filesequence]);
//// else if(kindofimage == "VIS_IR Color")
//// {
//// if(channelindex == 0)
//// CalculateMinMaxHimawari(5500, 550, imageptrs->ptrRed[filesequence], minvalueRed[filesequence], maxvalueRed[filesequence]);
//// else if(channelindex == 1)
//// CalculateMinMaxHimawari(5500, 550, imageptrs->ptrGreen[filesequence], minvalueGreen[filesequence], maxvalueGreen[filesequence]);
//// else if(channelindex == 2)
//// CalculateMinMaxHimawari(5500, 550, imageptrs->ptrBlue[filesequence], minvalueBlue[filesequence], maxvalueBlue[filesequence]);

//// }



// for(int line = 0; line < nlin; line++)
// {
// row_col = (QRgb*)im->scanLine(nlin * filesequence + line);

// for (int pixelx = 0 ; pixelx < npix; pixelx++)
// {
// c = *(pixels + line * npix + pixelx);
// valcontrast = ContrastStretch(c);
// valcontrast = (valcontrast > 255 ? 255 : valcontrast);

// if(kindofimage == "VIS_IR Color")
// {
// pix = row_col[pixelx];

// if(channelindex == 2)
// {
// if(inversevector[2])
// valcontrast = 255 - valcontrast;
// r = qRed(pix);
// g = qGreen(pix);
// b = quint8(valcontrast);
// }
// else if(channelindex == 1)
// {
// if(inversevector[1])
// valcontrast = 255 - valcontrast;
// r = qRed(pix);
// g = quint8(valcontrast);
// b = qBlue(pix);
// }
// else if(channelindex == 0)
// {
// if(inversevector[0])
// valcontrast = 255 - valcontrast;
// r = quint8(valcontrast);
// g = qGreen(pix);
// b = qBlue(pix);
// }
// row_col[pixelx] = qRgb(r,g,b);
// }
// else if( kindofimage == "VIS_IR")
// {
// if(inversevector[0])
// valcontrast = 255 - valcontrast;
if(channelindex == 0)
this->issegmentcomposedRed[filesequence] = true;
else if(channelindex == 1)
this->issegmentcomposedGreen[filesequence] = true;
else if(channelindex == 2)
this->issegmentcomposedBlue[filesequence] = true;

// r = quint8(valcontrast);
// g = quint8(valcontrast);
// b = quint8(valcontrast);
// row_col[pixelx] = qRgb(r,g,b);
// }
// }
// }


if(allSegmentsReceived())
Expand All @@ -835,12 +759,6 @@ void SegmentListGeostationary::ComposeSegmentImageXRITHimawari( QString filepath
emit signalcomposefinished(kindofimage);
}




g_mutex.unlock();


delete header;
delete msgdat;
delete [ ] pixels;
Expand Down Expand Up @@ -1334,9 +1252,6 @@ void SegmentListGeostationary::ComposeSegmentImageHDFInThread(QStringList fileli
qDebug() << QString("0 stat min = %1 stat max = %2").arg(stat_min[0]).arg(stat_max[0]);
}


//g_mutex.lock();

int nlin = 0, npix = 0;
int deltaprogress, deltaprogresscounter = 30;

Expand Down Expand Up @@ -1448,9 +1363,6 @@ void SegmentListGeostationary::ComposeSegmentImageHDFInThread(QStringList fileli

emit this->progressCounter(100);


//g_mutex.unlock();

for(int j = 0; j < filelist.size(); j++)
{

Expand Down
12 changes: 0 additions & 12 deletions core/segmentmetop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ extern Options opts;
extern SegmentImage *imageptrs;
#include <QMutex>

extern QMutex g_mutex;

SegmentMetop::SegmentMetop(QFile *filesegment, SatelliteList *satl, QObject *parent) :
Segment(parent)
{
Expand Down Expand Up @@ -971,7 +969,6 @@ void SegmentMetop::RenderSegmentlineInGVP(int channel, int nbrLine, int heightin
else if (channel == 5)
row_col = (QRgb*)imageptrs->ptrimagecomp_ch[4]->scanLine(heightintotalimage);

//g_mutex.lock();

/* from pt 5 --> pt 2045
= 5 + 20 * 102 total of 103 pts
Expand Down Expand Up @@ -1026,9 +1023,6 @@ void SegmentMetop::RenderSegmentlineInGVP(int channel, int nbrLine, int heightin
}
}


//g_mutex.unlock();

}

float SegmentMetop::getSolarZenith(int navpoint, int intpoint, int nbrLine, int startnavindex, int deltaint, int lengthintindex, int lengthnavindex ) //navpoint = [0, 102] intpoint = [0, 19] nbrLine = [0, 1079]
Expand Down Expand Up @@ -1195,8 +1189,6 @@ void SegmentMetop::RenderSegmentlineInSG(int channel, int nbrLine, int heightint
else if (channel == 5)
row_col = (QRgb*)imageptrs->ptrimagecomp_ch[4]->scanLine(heightintotalimage);

//g_mutex.lock();


if(num_navigation_points == 103)
{
Expand Down Expand Up @@ -1231,8 +1223,6 @@ void SegmentMetop::RenderSegmentlineInSG(int channel, int nbrLine, int heightint
}
}

//g_mutex.unlock();

}

void SegmentMetop::ComposeSegmentLCCProjection(int inputchannel, int histogrammethod, bool normalized)
Expand Down Expand Up @@ -1274,7 +1264,6 @@ void SegmentMetop::RenderSegmentlineInLCC( int channel, int nbrLine, int heighti
else if (channel == 5)
row_col = (QRgb*)imageptrs->ptrimagecomp_ch[4]->scanLine(heightintotalimage);

//g_mutex.lock();

double dtot;
int pointx;
Expand Down Expand Up @@ -1335,7 +1324,6 @@ void SegmentMetop::RenderSegmentlineInLCC( int channel, int nbrLine, int heighti
}
}

//g_mutex.unlock();

}

Expand Down
3 changes: 0 additions & 3 deletions core/segmentolci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

extern Options opts;
extern SegmentImage *imageptrs;
extern QMutex g_mutex;

//void doCalcOverlayLatLon(SegmentOLCI *t, int collength, int rowlength)
//{
Expand Down Expand Up @@ -993,8 +992,6 @@ void SegmentOLCI::RenderSegmentlineInTextureOLCI( int nbrLine, QRgb *row )
QColor rgb;
int posx, posy;

//QMutexLocker locker(&g_mutex);

QPainter fb_painter(imageptrs->pmOut);

int devwidth = (fb_painter.device())->width();
Expand Down
3 changes: 0 additions & 3 deletions core/segmentslstr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

extern Options opts;
extern SegmentImage *imageptrs;
extern QMutex g_mutex;


SegmentSLSTR::SegmentSLSTR(QFileInfo fileinfo, SatelliteList *satl, QObject *parent) :
Expand Down Expand Up @@ -777,8 +776,6 @@ void SegmentSLSTR::RenderSegmentlineInTextureSLSTR( int nbrLine, QRgb *row )
QColor rgb;
int posx, posy;

//QMutexLocker locker(&g_mutex);

QPainter fb_painter(imageptrs->pmOut);

int devwidth = (fb_painter.device())->width();
Expand Down
3 changes: 0 additions & 3 deletions core/segmentviirsdnb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ extern Options opts;
extern SegmentImage *imageptrs;
#include <QMutex>

extern QMutex g_mutex;

SegmentVIIRSDNB::SegmentVIIRSDNB(QFile *filesegment, SatelliteList *satl, QObject *parent) :
Segment(parent)
Expand Down Expand Up @@ -1253,8 +1252,6 @@ void SegmentVIIRSDNB::RenderSegmentlineInTextureVIIRS( int nbrLine, QRgb *row )
QColor rgb;
int posx, posy;

//QMutexLocker locker(&g_mutex);

QPainter fb_painter(imageptrs->pmOut);

int devwidth = (fb_painter.device())->width();
Expand Down
8 changes: 0 additions & 8 deletions core/segmentviirsm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ extern Options opts;
extern SegmentImage *imageptrs;
#include <QMutex>

extern QMutex g_mutex;

SegmentVIIRSM::SegmentVIIRSM(QFile *filesegment, SatelliteList *satl, QObject *parent) :
Segment(parent)
{
Expand Down Expand Up @@ -1262,9 +1260,6 @@ void SegmentVIIRSM::RecalculateProjection()
*/


// g_mutex.unlock();



//void SegmentVIIRS::ComposeProjectionConcurrent()
//{
Expand All @@ -1288,7 +1283,6 @@ void SegmentVIIRSM::RecalculateProjection()
// //testlookupLonLat(55.888, 73.900, col, row);
// //return;

// g_mutex.lock();

// for (int j = 0; j < imageptrs->ptrimageProjection->height(); j++)
// {
Expand Down Expand Up @@ -1360,8 +1354,6 @@ void SegmentVIIRSM::RenderSegmentlineInTextureVIIRS( int nbrLine, QRgb *row )
QColor rgb;
int posx, posy;

//QMutexLocker locker(&g_mutex);

QPainter fb_painter(imageptrs->pmOut);

int devwidth = (fb_painter.device())->width();
Expand Down

0 comments on commit 7bf08f2

Please sign in to comment.