diff --git a/docs/roadmap/implementation-status.md b/docs/roadmap/implementation-status.md index b41d519..c8cb8d7 100644 --- a/docs/roadmap/implementation-status.md +++ b/docs/roadmap/implementation-status.md @@ -10,10 +10,11 @@ lane, the core libraries, the initial GeoTIFF window reader, the metadata authoring library, and the first format-specific plugin are built and tested. The optional libtiff backend now decodes Deflate, LZW, and PackBits windows through the RandomAccessSource client-I/O boundary. Uncompressed floating-point -predictor windows are decoded in the reader, while broad read planning and converter -sources are not implemented yet. The initial GeoTIFF-to-regular-grid mesh slice is now -connected and tested, including its interactive vertex ceiling, and no release -has been tagged. +predictor windows are decoded in the reader, and read planning, memory budgets, +and tile-boundary cancellation are covered by tests. Converter sources are not +implemented yet. The initial GeoTIFF-to-regular-grid mesh slice is now connected +and tested, including its interactive vertex ceiling, and no release has been +tagged. Status words, from [MODULE_README_CONTRACT.md](../contributing/MODULE_README_CONTRACT.md): @@ -128,8 +129,8 @@ Detail in [phase-1-raster-core.md](phase-1-raster-core.md). | `ReadScanlines` | implemented | | Read planning and range coalescing | implemented | | I/O counters and amplification reporting | implemented | -| Memory budget enforcement | planned | -| Cancellation at tile boundaries | planned | +| Memory budget enforcement | implemented | +| Cancellation at tile boundaries | implemented | ## Milestone 4 — mesh authoring (in progress, `v0.3.0`) diff --git a/libs/usd-geotiff/tests/test_geotiff_pixel.cpp b/libs/usd-geotiff/tests/test_geotiff_pixel.cpp index 4d27063..d99fb75 100644 --- a/libs/usd-geotiff/tests/test_geotiff_pixel.cpp +++ b/libs/usd-geotiff/tests/test_geotiff_pixel.cpp @@ -399,6 +399,33 @@ int main() { usdgeo::DiagnosticCode::Cancelled, diagnostics); options.isCancelled = {}; + diagnostics.Clear(); + auto midReadBytes = ReadFile(std::string(FIXTURE_DIR) + + "/geotiff-8x8-uint16-striped.tif"); + usdraster::MemorySource midReadSource(midReadBytes.data(), + midReadBytes.size(), "mid-read"); + usdraster::RecordingSource midReadRecording(midReadSource); + usdgeotiff::GeoTiffReader midReadReader(midReadRecording); + std::size_t cancellationChecks = 0; + options.isCancelled = [&cancellationChecks] { + return ++cancellationChecks >= 3; + }; + grid = usdraster::RasterGrid{}; + Check(!midReadReader.ReadWindow({0, 0, 8, 8}, options, &grid, + &diagnostics), + "mid-read cancellation fails the window"); + Check(HasCode(diagnostics, usdgeo::DiagnosticCode::Cancelled), + "mid-read cancellation has typed diagnostic"); + Check(grid.IsEmpty(), "mid-read cancellation releases the partial grid"); + const std::uint64_t midReadPixelOffset = midReadBytes.size() - 128; + std::size_t midReadPixelRanges = 0; + for (const auto& range : midReadRecording.GetRanges()) { + if (range.offset >= midReadPixelOffset) ++midReadPixelRanges; + } + Check(midReadPixelRanges == 1, + "mid-read cancellation stops at a segment boundary"); + options.isCancelled = {}; + diagnostics.Clear(); CheckIntegerFixture("geotiff-2x2-uint8-striped.tif", usdraster::RasterDataType::UInt8, 4,