Grok 20.3.2
grk_swath_buffer Struct Reference

User-managed output buffer for asynchronous swath tile copy-and-convert. More...

#include <grok.h>

Public Attributes

void * data
 Output buffer pointer.
uint8_t prec
 Output bit depth: 8, 16, or 32.
bool sgnd
 true = signed output (int16/int32); false = unsigned
uint16_t numcomps
 Number of output bands.
int64_t pixel_space
 Bytes between adjacent pixels in same row and band (GDAL nPixelSpace).
int64_t line_space
 Bytes between adjacent rows in same band (GDAL nLineSpace).
int64_t band_space
 Bytes between adjacent bands (GDAL nBandSpace).
int * band_map
 numcomps-element array of 1-based component indices, or NULL
int promote_alpha
 0-based component index for 1-bit alpha promotion, or -1
uint32_t x0
 Swath image x origin (image pixel coordinates).
uint32_t y0
 Swath image y origin (image pixel coordinates).
uint32_t x1
 Swath image x end, exclusive (image pixel coordinates).
uint32_t y1
 Swath image y end, exclusive (image pixel coordinates).

Detailed Description

User-managed output buffer for asynchronous swath tile copy-and-convert.

After grk_decompress_wait() returns for a given swath, pass this struct to grk_decompress_schedule_swath_copy() to schedule per-tile copies from the internal int32_t tile buffers into the caller's output buffer via Taskflow and Highway SIMD.

The output buffer layout mirrors GDAL's pixel/line/band spacing convention, supporting BIP, BSQ, or any other interleaving. Output type is described by prec (bit depth: 8, 16, or 32) and sgnd (signed vs unsigned): prec=8, sgnd=false → uint8_t (GDT_Byte) prec=16, sgnd=false → uint16_t (GDT_UInt16) prec=16, sgnd=true → int16_t (GDT_Int16) prec=32, sgnd=false → uint32_t (GDT_UInt32) prec=32, sgnd=true → int32_t (GDT_Int32)

Conversion from the internal int32_t source follows GDALCopyWords semantics: values are clamped to the output type's representable range.

band_map[i] is a 1-based component index (GDAL panBandMap convention): output band i is sourced from image component band_map[i]-1. If band_map is NULL, band i is sourced from component i.

promote_alpha: if >= 0, the component at this 0-based index is a 1-bit alpha channel and its values are scaled by 255 before output.

Assumes component subsampling dx == dy == 1. The user must keep the buffer alive until grk_decompress_wait_swath_copy().

Member Data Documentation

◆ band_map

int* grk_swath_buffer::band_map

numcomps-element array of 1-based component indices, or NULL

◆ band_space

int64_t grk_swath_buffer::band_space

Bytes between adjacent bands (GDAL nBandSpace).

◆ data

void* grk_swath_buffer::data

Output buffer pointer.

Referenced by grk::CodeStreamDecompress::scheduleSwathCopy().

◆ line_space

int64_t grk_swath_buffer::line_space

Bytes between adjacent rows in same band (GDAL nLineSpace).

◆ numcomps

uint16_t grk_swath_buffer::numcomps

Number of output bands.

◆ pixel_space

int64_t grk_swath_buffer::pixel_space

Bytes between adjacent pixels in same row and band (GDAL nPixelSpace).

◆ prec

uint8_t grk_swath_buffer::prec

Output bit depth: 8, 16, or 32.

Referenced by grk::CodeStreamDecompress::scheduleSwathCopy().

◆ promote_alpha

int grk_swath_buffer::promote_alpha

0-based component index for 1-bit alpha promotion, or -1

◆ sgnd

bool grk_swath_buffer::sgnd

true = signed output (int16/int32); false = unsigned

◆ x0

uint32_t grk_swath_buffer::x0

Swath image x origin (image pixel coordinates).

◆ x1

uint32_t grk_swath_buffer::x1

Swath image x end, exclusive (image pixel coordinates).

◆ y0

uint32_t grk_swath_buffer::y0

Swath image y origin (image pixel coordinates).

◆ y1

uint32_t grk_swath_buffer::y1

Swath image y end, exclusive (image pixel coordinates).


The documentation for this struct was generated from the following file: