[fdo-internals] RFC 65 Implement Resampling for GDAL Provider
trevor_wekel at otxsystems.com
Fri Oct 12 15:20:25 PDT 2012
I was not aware of VRTWarpedDataset so did not consider it initially.
So I took a quick look at vrtwarped.cpp. I have a question. In vrtwarped.cpp, the ProcessBlock() seems to cache the results of the warp operation (GDALCopyWords around line 1174) into each raster band. Does this mean that all blocks will end up being cached?
For FDO, we basically call a ReadNext() to suck the contents of the tile into a buffer supplied by the caller. The ReadNext() drives the calls to _getTile(). As far as I can tell, our access pattern is linear and we only access each tile once. If we switch to using VRTWarpedDataset, will we have to call ProcessBlock() for each tile? Will this end up caching all the blocks as we do the linear read?
As an alternative to using VRTWarpedDataset, would it be ok to instantiate a GDALWarpOperation as a member of the FdoRfpStreamReaderByTileResample? Pseudo code would be something like this:
m_warpOp = new GDALWarpOperation();
warpOptions = GDALCreateWarpOptions();
// populate warp options
This may improve the speed of the _getTile() call if a) Initialize() can be called more than once and b) the new GDALWarpOperation() does a lot of setup work
I will also modify the snprintf statement to use the CPLPrintPointer() for the DATAPOINTER argument. Thanks for the heads up.
From: fdo-internals-bounces at lists.osgeo.org [mailto:fdo-internals-bounces at lists.osgeo.org] On Behalf Of Frank Warmerdam
Sent: October 12, 2012 2:56 PM
To: FDO Internals Mail List
Subject: Re: [fdo-internals] RFC 65 Implement Resampling for GDAL Provider
I skimmed the patch. I'm slightly uptight about the concept of instantiating a warper for each tile. In the "gdal/frmts/vrtwarped.cc" code I believe I created the warper once for the whole virtual result and then just invoked poWarper->WarpRegionToBuffer() on a per tile basis but this does mean a fair amount of extra work. Did you examine the approach of just using VRTWarpedDataset? I think that was the approach I used in QGIS at one time in history for warped rasters.
One other nit, the following line is unlikely to work well on some systems:
snprintf(buf, 255, "MEM:::DATAPOINTER=0x%p,PIXELS=%d,LINES=%d,BANDS=4,DATATYPE=Byte,PIXELOFFSET=4,LINEOFFSET=%d,BANDOFFSET=1", resampledBytes, resampledXSize, resampledYSize, resampledXSize*4);
I found for maximum portability I had to do special stuff which is now captured in the CPLPrintPointer() function. You might want to consider using it.
On Fri, Oct 12, 2012 at 1:14 PM, Trevor Wekel <trevor_wekel at otxsystems.com<mailto:trevor_wekel at otxsystems.com>> wrote:
I would like to present "RFC 65 - Implement Resampling for GDAL Provider" for review and comment. I would like to add this functionality to the future FDO 3.8 release. The submitted code patch also works with FDO 3.7... (unofficially...)
fdo-internals mailing list
fdo-internals at lists.osgeo.org<mailto:fdo-internals at lists.osgeo.org>
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com<mailto:warmerdam at pobox.com>
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Software Developer
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fdo-internals