Skip to content

Commit 78a45b7

Browse files
committedAug 8, 2018
[opencl] Small optimization in hillshade
... and more tolerant epsilon for float comparison in tests
1 parent 8f40129 commit 78a45b7

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed
 

‎src/analysis/raster/qgshillshadefilter.cpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,16 @@ QgsHillshadeFilter::QgsHillshadeFilter( const QString &inputFile, const QString
3030
=======
3131
, mLightAzimuth( lightAzimuth )
3232
, mLightAngle( lightAngle )
33+
<<<<<<< 8f40129d09776c7fe96b88604405a908595f9ede
3334
, mCosZenithRad( std::cos( mLightAngle * M_PI / 180.0 ) )
3435
, mSinZenithRad( std::sin( mLightAngle * M_PI / 180.0 ) )
3536
, mAzimuthRad( mLightAzimuth * M_PI / 180.0 )
3637
>>>>>>> [opencl] Fix small OpenCL alg issues
38+
=======
39+
, mCosZenithRad( std::cos( mLightAngle * M_PI / 180.0f ) )
40+
, mSinZenithRad( std::sin( mLightAngle * M_PI / 180.0f ) )
41+
, mAzimuthRad( mLightAzimuth * M_PI / 180.0f )
42+
>>>>>>> [opencl] Small optimization in hillshade
3743
{
3844
}
3945

@@ -109,17 +115,9 @@ void QgsHillshadeFilter::addExtraRasterParams( std::vector<float> &params )
109115
void QgsHillshadeFilter::addExtraRasterParams( std::vector<float> &params )
110116
{
111117

112-
// Original CPU formula
113-
float zenith_rad = mLightAngle * M_PI / 180.0;
114-
float azimuth_rad = mLightAzimuth * M_PI / 180.0;
115-
params.push_back( zenith_rad ); // 5
116-
params.push_back( azimuth_rad ); // 6
117-
118-
/*
119-
params.push_back( std::cos( mLightAngle * M_PI / 180.0 ) ); // cos_zenith_rad 5
120-
params.push_back( mLightAzimuth * M_PI / 180.0 ); // azimuth_rad 6
121-
params.push_back( std::sin( mLightAzimuth * M_PI / 180.0 ) ); // sin_zenith_rad 7
122-
*/
118+
params.push_back( mCosZenithRad ); // cos_zenith_rad 5
119+
params.push_back( mSinZenithRad ); // sin_zenith_rad 6
120+
params.push_back( mAzimuthRad ); // azimuth_rad 7
123121

124122
}
125123
<<<<<<< 573283f0dcf022e84bd615e84fd2656043a9722b

‎tests/src/analysis/testqgsninecellfilters.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,15 @@ void TestNineCellFilters::_rasterCompare( QgsAlignRaster::RasterInfo &out, QgsA
185185
QCOMPARE( out.cellSize(), refCellSize );
186186

187187
// If the values differ less than tolerance they are considered equal
188+
<<<<<<< 8f40129d09776c7fe96b88604405a908595f9ede
188189
<<<<<<< 8689c401a2a66b4b159a54d0c37e26a33aa183c3
189190
double tolerance = 0.0001;
190191
=======
191192
double tolerance = 0.0000001;
192193
>>>>>>> [opencl] Increase test coverage with no-opencl image comparison
194+
=======
195+
double tolerance = 0.0001;
196+
>>>>>>> [opencl] Small optimization in hillshade
193197

194198
// Check three points
195199
std::map<int, int> controlPoints;

0 commit comments

Comments
 (0)
Please sign in to comment.