Skip to content

Commit

Permalink
GDAL 3.6.1 (yocontra#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmomtchev authored Dec 21, 2022
1 parent dad45ef commit b3f5cca
Show file tree
Hide file tree
Showing 74 changed files with 2,069 additions and 673 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.6.1] 2022-12-21

### Added
- GDAL 3.6.1
- Fix [#53](https://github.com/mmomtchev/node-gdal-async/issues/53), rebuilding from source fails

## [3.6.0] 201-12-21
### Added
- GDAL 3.6.0
Expand Down
4 changes: 2 additions & 2 deletions deps/libgdal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -eu
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR/libgdal"

GDAL_VERSION=3.6.0
GDAL_VERSION=3.6.1
GDAL_VERSION_SUFFIX=
dir_gdal=./gdal
dir_formats_gyp=./gyp-formats
Expand Down Expand Up @@ -110,7 +110,7 @@ function generate_formats() {
fi
done
# check for additional include directories
add_includes=`cat ${dir_format}/GNUmakefile | grep -oE -- '-I\S+' | sed 's#-I#../gdal/frmts/#g'`
add_includes=`cat ${dir_format}/CMakeLists.txt | grep -oE -- '-I\S+' | sed 's#-I#../gdal/frmts/#g'`
relative_dir_format="${relative_dir_format}"$'\n'"${add_includes}"

gyp_template="${format_gyp_template}"
Expand Down
2 changes: 1 addition & 1 deletion deps/libgdal/gdal/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repos:
swig/python/osgeo/|
autotest/ogr/data/
)
- repo: https://gitlab.com/pycqa/flake8
- repo: https://github.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
Expand Down
4 changes: 2 additions & 2 deletions deps/libgdal/gdal/CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cff-version: 1.2.0
message: Please cite this software using these metadata or in the CITATION file.
type: software
title: GDAL
version: 3.6.0
date-released: 2022-11-03
version: 3.6.1
date-released: 2022-12-14
doi: 10.5281/zenodo.5884351
abstract: GDAL is a translator library for raster and vector geospatial data
formats that is released under an MIT style Open Source License by the Open
Expand Down
2 changes: 1 addition & 1 deletion deps/libgdal/gdal/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.6.0
3.6.1
32 changes: 32 additions & 0 deletions deps/libgdal/gdal/alg/gdalcutline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,38 @@ GDALWarpCutlineMasker( void *pMaskFuncArg,
return CE_None;
}

// And now check if the chunk to warp is fully contained within the cutline
// to save rasterization.
if( OGRGeometryFactory::haveGEOS()
#ifdef DEBUG
// Env var just for debugging purposes
&& !CPLTestBool(CPLGetConfigOption("GDALCUTLINE_SKIP_CONTAINMENT_TEST", "NO"))
#endif
)
{
OGRLinearRing* poRing = new OGRLinearRing();
poRing->addPoint(-psWO->dfCutlineBlendDist + nXOff,
-psWO->dfCutlineBlendDist + nYOff);
poRing->addPoint(-psWO->dfCutlineBlendDist + nXOff,
psWO->dfCutlineBlendDist + nYOff + nYSize);
poRing->addPoint(psWO->dfCutlineBlendDist + nXOff + nXSize,
psWO->dfCutlineBlendDist + nYOff + nYSize);
poRing->addPoint(psWO->dfCutlineBlendDist + nXOff + nXSize,
-psWO->dfCutlineBlendDist + nYOff);
poRing->addPoint(-psWO->dfCutlineBlendDist + nXOff,
-psWO->dfCutlineBlendDist + nYOff);
OGRPolygon oChunkFootprint;
oChunkFootprint.addRingDirectly(poRing);
OGREnvelope sChunkEnvelope;
oChunkFootprint.getEnvelope(&sChunkEnvelope );
if( sEnvelope.Contains(sChunkEnvelope) &&
OGRGeometry::FromHandle(hPolygon)->Contains(&oChunkFootprint) )
{
CPLDebug("WARP", "Source chunk fully contained within cutline.");
return CE_None;
}
}

/* -------------------------------------------------------------------- */
/* Create a byte buffer into which we can burn the */
/* mask polygon and wrap it up as a memory dataset. */
Expand Down
136 changes: 94 additions & 42 deletions deps/libgdal/gdal/alg/gdalwarpkernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4787,53 +4787,102 @@ static CPLErr GWKOpenCLCase( GDALWarpKernel *poWK )
/* GWKCheckAndComputeSrcOffsets() */
/************************************************************************/
static CPL_INLINE bool GWKCheckAndComputeSrcOffsets(
const int* _pabSuccess,
GWKJobStruct* psJob,
int* _pabSuccess,
int _iDstX,
const double* _padfX,
const double* _padfY,
const GDALWarpKernel* _poWK,
int _iDstY,
double* _padfX,
double* _padfY,
int _nSrcXSize,
int _nSrcYSize,
GPtrDiff_t& iSrcOffset)
{
if( !_pabSuccess[_iDstX] )
return false;

// If this happens this is likely the symptom of a bug somewhere.
if( CPLIsNan(_padfX[_iDstX]) || CPLIsNan(_padfY[_iDstX]) )
const GDALWarpKernel* _poWK = psJob->poWK;
for( int iTry = 0; iTry < 2; ++iTry )
{
static bool bNanCoordFound = false;
if( !bNanCoordFound )
if( iTry == 1 )
{
CPLDebug("WARP",
"GWKCheckAndComputeSrcOffsets(): "
"NaN coordinate found on point %d.",
_iDstX);
bNanCoordFound = true;
// If the source coordinate is slightly outside of the source raster
// retry to transform it alone, so that the exact coordinate
// transformer is used.

_padfX[_iDstX] = _iDstX + 0.5 + _poWK->nDstXOff;
_padfY[_iDstX] = _iDstY + 0.5 + _poWK->nDstYOff;
double dfZ = 0;
_poWK->pfnTransformer( psJob->pTransformerArg, TRUE, 1,
_padfX + _iDstX, _padfY + _iDstX, &dfZ,
_pabSuccess + _iDstX );
}
if( !_pabSuccess[_iDstX] )
return false;

// If this happens this is likely the symptom of a bug somewhere.
if( CPLIsNan(_padfX[_iDstX]) || CPLIsNan(_padfY[_iDstX]) )
{
static bool bNanCoordFound = false;
if( !bNanCoordFound )
{
CPLDebug("WARP",
"GWKCheckAndComputeSrcOffsets(): "
"NaN coordinate found on point %d.",
_iDstX);
bNanCoordFound = true;
}
return false;
}
return false;
}

/* -------------------------------------------------------------------- */
/* Figure out what pixel we want in our source raster, and skip */
/* further processing if it is well off the source image. */
/* -------------------------------------------------------------------- */
/* We test against the value before casting to avoid the */
/* problem of asymmetric truncation effects around zero. That is */
/* -0.5 will be 0 when cast to an int. */
if( _padfX[_iDstX] < _poWK->nSrcXOff
|| _padfY[_iDstX] < _poWK->nSrcYOff )
return false;
/* We test against the value before casting to avoid the */
/* problem of asymmetric truncation effects around zero. That is */
/* -0.5 will be 0 when cast to an int. */
if( _padfX[_iDstX] < _poWK->nSrcXOff )
{
// If the source coordinate is slightly outside of the source raster
// retry to transform it alone, so that the exact coordinate
// transformer is used.
if( iTry == 0 && _padfX[_iDstX] > _poWK->nSrcXOff - 1 )
continue;
return false;
}

// Check for potential overflow when casting from float to int, (if
// operating outside natural projection area, padfX/Y can be a very huge
// positive number before doing the actual conversion), as such cast is
// undefined behavior that can trigger exception with some compilers
// (see #6753)
if( _padfX[_iDstX] + 1e-10 > _nSrcXSize + _poWK->nSrcXOff ||
_padfY[_iDstX] + 1e-10 > _nSrcYSize + _poWK->nSrcYOff )
{
return false;
if( _padfY[_iDstX] < _poWK->nSrcYOff )
{
// If the source coordinate is slightly outside of the source raster
// retry to transform it alone, so that the exact coordinate
// transformer is used.
if( iTry == 0 && _padfY[_iDstX] > _poWK->nSrcYOff - 1 )
continue;
return false;
}

// Check for potential overflow when casting from float to int, (if
// operating outside natural projection area, padfX/Y can be a very huge
// positive number before doing the actual conversion), as such cast is
// undefined behavior that can trigger exception with some compilers
// (see #6753)
if( _padfX[_iDstX] + 1e-10 > _nSrcXSize + _poWK->nSrcXOff )
{
// If the source coordinate is slightly outside of the source raster
// retry to transform it alone, so that the exact coordinate
// transformer is used.
if( iTry == 0 && _padfX[_iDstX] < _nSrcXSize + _poWK->nSrcXOff + 1 )
continue;
return false;
}
if( _padfY[_iDstX] + 1e-10 > _nSrcYSize + _poWK->nSrcYOff )
{
// If the source coordinate is slightly outside of the source raster
// retry to transform it alone, so that the exact coordinate
// transformer is used.
if( iTry == 0 && _padfY[_iDstX] < _nSrcYSize + _poWK->nSrcYOff + 1 )
continue;
return false;
}

break;
}

int iSrcX =
Expand Down Expand Up @@ -4944,8 +4993,9 @@ static void GWKGeneralCaseThread( void* pData)
for( int iDstX = 0; iDstX < nDstXSize; iDstX++ )
{
GPtrDiff_t iSrcOffset = 0;
if( !GWKCheckAndComputeSrcOffsets(pabSuccess, iDstX, padfX, padfY,
poWK, nSrcXSize, nSrcYSize, iSrcOffset) )
if( !GWKCheckAndComputeSrcOffsets(psJob, pabSuccess, iDstX, iDstY,
padfX, padfY,
nSrcXSize, nSrcYSize, iSrcOffset) )
continue;

/* -------------------------------------------------------------------- */
Expand Down Expand Up @@ -5175,8 +5225,9 @@ static void GWKRealCaseThread( void* pData)
for( int iDstX = 0; iDstX < nDstXSize; iDstX++ )
{
GPtrDiff_t iSrcOffset = 0;
if( !GWKCheckAndComputeSrcOffsets(pabSuccess, iDstX, padfX, padfY,
poWK, nSrcXSize, nSrcYSize, iSrcOffset) )
if(!GWKCheckAndComputeSrcOffsets(psJob, pabSuccess, iDstX, iDstY,
padfX, padfY,
nSrcXSize, nSrcYSize, iSrcOffset) )
continue;

/* -------------------------------------------------------------------- */
Expand Down Expand Up @@ -5429,9 +5480,9 @@ static void GWKResampleNoMasksOrDstDensityOnlyThreadInternal( void* pData )
for( int iDstX = 0; iDstX < nDstXSize; iDstX++ )
{
GPtrDiff_t iSrcOffset = 0;
if( !GWKCheckAndComputeSrcOffsets(pabSuccess, iDstX, padfX, padfY,
poWK, nSrcXSize, nSrcYSize,
iSrcOffset) )
if( !GWKCheckAndComputeSrcOffsets(psJob, pabSuccess, iDstX, iDstY,
padfX, padfY,
nSrcXSize, nSrcYSize, iSrcOffset) )
continue;

/* ==================================================================== */
Expand Down Expand Up @@ -5655,8 +5706,9 @@ static void GWKNearestThread( void* pData )
for( int iDstX = 0; iDstX < nDstXSize; iDstX++ )
{
GPtrDiff_t iSrcOffset = 0;
if( !GWKCheckAndComputeSrcOffsets(pabSuccess, iDstX, padfX, padfY,
poWK, nSrcXSize, nSrcYSize, iSrcOffset) )
if( !GWKCheckAndComputeSrcOffsets(psJob, pabSuccess, iDstX, iDstY,
padfX, padfY,
nSrcXSize, nSrcYSize, iSrcOffset) )
continue;

/* -------------------------------------------------------------------- */
Expand Down
4 changes: 2 additions & 2 deletions deps/libgdal/gdal/alg/gdalwarpoperation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,7 @@ CPLErr GDALWarpOperation::ChunkAndWarpMulti(
}
asThreadData[iThread].bIOMutexTaken = FALSE;

CPLDebug( "GDAL", "Start chunk %d.", iChunk );
CPLDebug( "GDAL", "Start chunk %d / %d.", iChunk, nChunkListCount );
asThreadData[iThread].hThreadHandle = CPLCreateJoinableThread(
ChunkThreadMain,
const_cast<ChunkThreadData *>(&asThreadData[iThread]));
Expand Down Expand Up @@ -1211,7 +1211,7 @@ CPLErr GDALWarpOperation::ChunkAndWarpMulti(
CPLJoinThread(asThreadData[iThread].hThreadHandle);
asThreadData[iThread].hThreadHandle = nullptr;

CPLDebug( "GDAL", "Finished chunk %d.", iChunk-1 );
CPLDebug( "GDAL", "Finished chunk %d / %d.", iChunk-1, nChunkListCount );

eErr = asThreadData[iThread].eErr;

Expand Down
14 changes: 14 additions & 0 deletions deps/libgdal/gdal/apps/bench_ogr_batch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ int main(int argc, char* argv[])
schema.release(&schema);
}
#endif

#if 0
int64_t lastId = 0;
#endif
while( true )
{
struct ArrowArray array;
Expand All @@ -144,6 +148,16 @@ int main(int argc, char* argv[])
{
break;
}
#if 0
const int64_t* fid_col = static_cast<const int64_t*>(array.children[0]->buffers[1]);
for(int64_t i = 0; i < array.length; ++i )
{
int64_t id = fid_col[i];
if( id != lastId + 1 )
printf(CPL_FRMT_GIB "\n", static_cast<GIntBig>(id));
lastId = id;
}
#endif
array.release(&array);
}
stream.release(&stream);
Expand Down
Loading

0 comments on commit b3f5cca

Please sign in to comment.