Skip to content

feat: add COG writer with Perlin noise pixel generation#99

Draft
prantogg wants to merge 4 commits into
pranav/feature/raster-scaling-scaffoldfrom
pranav/feature/raster-cog-writer
Draft

feat: add COG writer with Perlin noise pixel generation#99
prantogg wants to merge 4 commits into
pranav/feature/raster-scaling-scaffoldfrom
pranav/feature/raster-cog-writer

Conversation

@prantogg
Copy link
Copy Markdown
Contributor

Summary

  • Adds Perlin noise module for deterministic, spatially correlated UInt8 pixel generation (realistic ~2-4x compression ratios)
  • Adds GDAL-based COG writer behind cog-writer feature flag using MEM→COG create_copy workflow
  • Single-band, ZSTD compressed, 256×256 internal tiling, per-footprint UTM CRS

Stacked on

Test plan

  • 24 tests passing: noise determinism/range/variation + COG roundtrip/determinism/uniqueness
  • cargo clippy -- -D warnings clean
  • cargo fmt --check clean

prantogg added 4 commits May 14, 2026 14:44
- Add noise module: 2D Perlin noise generator (deterministic, spatially
  correlated) for realistic satellite imagery compression ratios
- Add cog module: GDAL-based COG writer using MEM→COG create_copy
  workflow, gated behind 'cog-writer' feature flag
- Single-band UInt8, ZSTD compressed, 256x256 internal tiling
- Per-footprint UTM CRS, geotransform from footprint origin
- Seed from (footprint_id, cog_id) ensures deterministic output
- 24 tests passing (5 noise + 3 COG roundtrip/determinism tests)
- Hoist loop-invariant frequency/dimension divisions in generate_raster
- Add generate_raster_into(&mut Vec<u8>) for buffer reuse across COGs
- CogConfig now wraps FootprintConfig to eliminate duplicated dimensions
- Add pixel readback assertion to roundtrip test (verifies non-trivial data)
- Scope band borrow explicitly to clarify lifetime before create_copy
- All noise arithmetic now uses f32 (~2x throughput on ARM NEON)
- Row-level y-axis values (grid cell, fractional offset, fade curve) are
  computed once per row and reused across all 1830 columns
- Permutation lookups for p[xi] and p[xi+1] hoisted out of hash step
- f32 precision is more than sufficient for UInt8 pixel output
- Add NUM_THREADS=ALL_CPUS to COG creation options
- GDAL time per COG: 41.5ms → 15.8ms (2.6x faster)
- Total: 54.6ms → 29.2ms per COG (1.87x end-to-end)
- Add bench_cog example for profiling noise + COG write
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant