testmmap
Overview
testmmap is a diagnostic test program that creates an 8-bit JHC_header raster of specified dimensions (-xlen by -ylen) and tests POSIX memory-mapped I/O (mmap) by writing a vertical 0â255 grayscale ramp across the image buffer.
Syntax & CLI Options
testmmap [-colorbar] [-spacing <N>] -xlen <cols> -ylen <rows> -out <outfile>
| Flag | Description |
|---|---|
-xlen <cols> | Grid width in columns (header.dx). |
-ylen <rows> | Grid height in rows (header.dy). |
-spacing <N> | Grid spacing parameter (default: 10). |
-colorbar | Enable colorbar flag. |
-out <outfile> | Output raster filename. |
How It Works
- Opens
<outfile>for writing, mapsxlen * ylenbytes at offset1024usingmmap(..., PROT_WRITE | PROT_READ, MAP_SHARED, ...), and writes the 1024-byteOMG1JHC_headerwithdx = xlenanddy = ylen. - Loops over each row
i = 0..ylen-1, filling each scanline with(unsigned char)((255.0 * i) / ylen)and copying it into the memory-mapped region.
Examples
Test memory-mapped raster creation for a 500x500 image
testmmap -xlen 500 -ylen 500 -out ramp_test.8bit
Workflow Context
- Related Tools:
make_blank,edhead.