Skip to content
Permalink
Browse files

[opencl] Small optimization in hillshade

... and more tolerant epsilon for float comparison in tests
  • Loading branch information
elpaso committed Aug 8, 2018
1 parent 8f40129 commit 78a45b7db48bbf028fbb9ff9fa9690d2a596d7ef
Showing with 13 additions and 11 deletions.
  1. +9 −11 src/analysis/raster/qgshillshadefilter.cpp
  2. +4 −0 tests/src/analysis/testqgsninecellfilters.cpp
@@ -30,10 +30,16 @@ QgsHillshadeFilter::QgsHillshadeFilter( const QString &inputFile, const QString
=======
, mLightAzimuth( lightAzimuth )
, mLightAngle( lightAngle )
<<<<<<< 8f40129d09776c7fe96b88604405a908595f9ede
, mCosZenithRad( std::cos( mLightAngle * M_PI / 180.0 ) )
, mSinZenithRad( std::sin( mLightAngle * M_PI / 180.0 ) )
, mAzimuthRad( mLightAzimuth * M_PI / 180.0 )
>>>>>>> [opencl] Fix small OpenCL alg issues
=======
, mCosZenithRad( std::cos( mLightAngle * M_PI / 180.0f ) )
, mSinZenithRad( std::sin( mLightAngle * M_PI / 180.0f ) )
, mAzimuthRad( mLightAzimuth * M_PI / 180.0f )
>>>>>>> [opencl] Small optimization in hillshade
{
}

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

// Original CPU formula
float zenith_rad = mLightAngle * M_PI / 180.0;
float azimuth_rad = mLightAzimuth * M_PI / 180.0;
params.push_back( zenith_rad ); // 5
params.push_back( azimuth_rad ); // 6

/*
params.push_back( std::cos( mLightAngle * M_PI / 180.0 ) ); // cos_zenith_rad 5
params.push_back( mLightAzimuth * M_PI / 180.0 ); // azimuth_rad 6
params.push_back( std::sin( mLightAzimuth * M_PI / 180.0 ) ); // sin_zenith_rad 7
*/
params.push_back( mCosZenithRad ); // cos_zenith_rad 5
params.push_back( mSinZenithRad ); // sin_zenith_rad 6
params.push_back( mAzimuthRad ); // azimuth_rad 7

}
<<<<<<< 573283f0dcf022e84bd615e84fd2656043a9722b
@@ -185,11 +185,15 @@ void TestNineCellFilters::_rasterCompare( QgsAlignRaster::RasterInfo &out, QgsA
QCOMPARE( out.cellSize(), refCellSize );

// If the values differ less than tolerance they are considered equal
<<<<<<< 8f40129d09776c7fe96b88604405a908595f9ede
<<<<<<< 8689c401a2a66b4b159a54d0c37e26a33aa183c3
double tolerance = 0.0001;
=======
double tolerance = 0.0000001;
>>>>>>> [opencl] Increase test coverage with no-opencl image comparison
=======
double tolerance = 0.0001;
>>>>>>> [opencl] Small optimization in hillshade

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

0 comments on commit 78a45b7

Please sign in to comment.
You can’t perform that action at this time.