[fdo-internals] RFC 65 Implement Resampling for GDAL Provider

Trevor Wekel trevor_wekel at otxsystems.com
Fri Oct 12 15:20:25 PDT 2012


Hi Frank,

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:

FdoRfpStreamReaderGdalByTileResample::FdoRfpStreamReaderGdalByTileResample()
{
m_warpOp = new GDALWarpOperation();
}

FdoRfpStreamReaderGdalByTileResample::_getTile()
{
warpOptions = GDALCreateWarpOptions();
// populate warp options
m_warpOp->Initialize(warpOptions);
m_warpOp->WarpRegion(0,0,origXSize,origYSize);
}

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.

Regards,
Trevor

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

Trevor,

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.

Best regards,
Frank

On Fri, Oct 12, 2012 at 1:14 PM, Trevor Wekel <trevor_wekel at otxsystems.com<mailto:trevor_wekel at otxsystems.com>> wrote:
Hello list,

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...)

http://trac.osgeo.org/fdo/wiki/FDORfc65

Regards,
Trevor

_______________________________________________
fdo-internals mailing list
fdo-internals at lists.osgeo.org<mailto:fdo-internals at lists.osgeo.org>
http://lists.osgeo.org/mailman/listinfo/fdo-internals



--
---------------------------------------+--------------------------------------
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...
URL: <http://lists.osgeo.org/pipermail/fdo-internals/attachments/20121012/d6c58f7a/attachment-0001.html>


More information about the fdo-internals mailing list