Definition at line 36 of file rt_wkb.c.
References ovdump::band, BANDTYPE_HAS_NODATA, BANDTYPE_IS_NODATA, BANDTYPE_IS_OFFDB, BANDTYPE_PIXTYPE_MASK, rt_band_t::data, flip_endian_16(), flip_endian_32(), flip_endian_64(), rt_band_t::hasnodata, rt_band_t::height, isMachineLittleEndian(), rt_band_t::isnodata, rt_band_t::mem, rt_band_t::nodataval, rt_band_t::offline, rt_band_t::ownsdata, rt_band_t::pixtype, PT_16BSI, PT_16BUI, PT_1BB, PT_2BUI, PT_32BF, PT_32BSI, PT_32BUI, PT_4BUI, PT_64BF, PT_8BSI, PT_8BUI, PT_END, RASTER_DEBUGF, read_float32(), read_float64(), read_int16(), read_int32(), read_int8(), read_uint16(), read_uint32(), read_uint8(), rt_band_destroy(), rt_pixtype_name(), rt_pixtype_size(), rtalloc(), rterror(), ovdump::type, and rt_band_t::width.
Referenced by rt_raster_from_wkb().
52 rterror(
"rt_band_from_wkb: Out of memory allocating rt_band during WKB parsing");
58 rterror(
"rt_band_from_wkb: Premature end of WKB on band reading (%s:%d)",
66 rterror(
"rt_band_from_wkb: Invalid pixtype %d", type & BANDTYPE_PIXTYPE_MASK);
78 RASTER_DEBUGF(3,
" Band pixtype:%s, offline:%d, hasnodata:%d",
86 if (((*ptr) + pixbytes) >= end) {
87 rterror(
"rt_band_from_wkb: Premature end of WKB on band novalue reading");
145 RASTER_DEBUGF(3,
" Nodata value: %g, pixbytes: %d, ptr @ %p, end @ %p",
149 if (((*ptr) + 1) >= end) {
150 rterror(
"rt_band_from_wkb: Premature end of WKB on offline " 151 "band data bandNum reading (%s:%d)",
164 while ((*ptr)[sz] && &((*ptr)[sz]) < end) ++sz;
165 if (&((*ptr)[sz]) >= end) {
166 rterror(
"rt_band_from_wkb: Premature end of WKB on band offline path reading");
176 rterror(
"rt_band_from_wkb: Out of memory allocating for offline path of band");
199 if (((*ptr) + sz) > end) {
200 rterror(
"rt_band_from_wkb: Premature end of WKB on band data reading (%s:%d)",
208 rterror(
"rt_band_from_wkb: Out of memory during band creation in WKB parser");
214 memcpy(band->
data.
mem, *ptr, sz);
226 else if (pixbytes == 4)
228 else if (pixbytes == 8)
231 rterror(
"rt_band_from_wkb: Unexpected pix bytes %d", pixbytes);
238 for (v = 0; v < sz; ++v) {
254 for (v = 0; v < sz; ++v) {
257 rterror(
"rt_band_from_wkb: Invalid value %d for pixel of type %s",
void rterror(const char *fmt,...)
Wrappers used for reporting errors and info.
void * rtalloc(size_t size)
Wrappers used for managing memory.
void rt_band_destroy(rt_band band)
Destroy a raster band.
void flip_endian_16(uint8_t *d)
int16_t read_int16(const uint8_t **from, uint8_t littleEndian)
uint32_t read_uint32(const uint8_t **from, uint8_t littleEndian)
uint16_t read_uint16(const uint8_t **from, uint8_t littleEndian)
#define BANDTYPE_IS_OFFDB(x)
void flip_endian_32(uint8_t *d)
#define BANDTYPE_PIXTYPE_MASK
#define RASTER_DEBUGF(level, msg,...)
uint8_t isMachineLittleEndian(void)
int rt_pixtype_size(rt_pixtype pixtype)
Return size in bytes of a value in the given pixtype.
uint8_t read_uint8(const uint8_t **from)
int8_t read_int8(const uint8_t **from)
const char * rt_pixtype_name(rt_pixtype pixtype)
int32_t read_int32(const uint8_t **from, uint8_t littleEndian)
double read_float64(const uint8_t **from, uint8_t littleEndian)
#define BANDTYPE_HAS_NODATA(x)
float read_float32(const uint8_t **from, uint8_t littleEndian)
#define BANDTYPE_IS_NODATA(x)
void flip_endian_64(uint8_t *d)