wiki:FDORfc65

Version 5 (modified by trevorwekel, 12 years ago) ( diff )

--

FDO RFC 65 - Implement Resampling for GDAL Provider

This page contains a request for comments document (RFC) for the FDO Open Source project. More FDO RFCs can be found on the RFCs page.

Status

RFC Template Version(1.1)
Submission Date(Oct 12, 2012)
Last Modified(Trevor Wekel - Oct 12, 2012)
Author(Trevor Wekel)
RFC Status(Ready for Review)
Implementation Status(In progress)
Proposed Milestone(3.8)
Assigned PSC guide(s)
Voting History(vote date)
+1
+0
-0
-1

Overview

This proposal adds GDAL resampling support using a layered approach over the existing GDAL Provider. This maintains nearly identical behaviour with the current provider implementation if resampling is not turned on while still providing access to GDAL library resampling capabilities for cases where it is useful.

Motivation

The GDAL Provider defaults to nearest neighbour resampling. This resampling method is problematic for imagery with embedded symbology or text.

Proposed Solution

A new class FdoRfpStreamReaderByTileResample is introduced to implement resampling behaviour. It maintains a member instance of the existing FdoRfpStreamReaderByTile to perform the reading and resampling from the GDAL library. The member reader samples at 2x the required pixel density. This data is then downsampled to the required pixel density using one of resampling methods supported by GDAL warp:

  • Bilinear - Bilinear resampling
  • Cubic - Cubic resampling
  • CubicSpline - Cubic spline resampling
  • Lanczos - Lanczos windowed sinc resampling

The resampling method is specified by a new "ResamplingMethod" parameter in the connection string for the provider. The parameter values are case insensitive.

m_connection->SetConnectionString(L"DefaultRasterFileLocation=../../TestData/pci_eg/acea.tif;ResamplingMethod=bilinear");

The internal reader uses a memory buffer to supply the GDAL warp operation with data. This eliminates any performance issues caused by writing temporary data to disk.

The FdoRfpStreamReaderByTileResample reader automatically upgrades all bit depths and color to 32 bit RGBA. A 32 bit color space is generally required to accurately display the blended pixels resulting from the resampling.

See attachment:RasterResample20121012.patch for an initial implementation of the RFC. This patch can be applied directly to trunk.

Updated attachment:RasterResample20121021.patch contains CPLPrintPointer modification suggested by Frank Warmerdam and updates for Linux build.

Implications

Current performance of the provider is unaffected when using the default nearest neighbour behaviour. Performance will be slower when any of the resampling methods is employed. Requesting 30+ megapixel views (5600x5600 pix) could lead to out of memory conditions on a 32 bit platform.

Test Plan

A single unit test will be created to validate that the resampling is functioning and generating 32bit RGBA imagery.

Funding/Resources

OTX Systems is developing this feature with support from Linknode.

Attachments (3)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.