PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ rt_pixtype_size()

int rt_pixtype_size ( rt_pixtype  pixtype)

Return size in bytes of a value in the given pixtype.

Parameters
pixtype: the pixel type to get byte size for
Returns
the pixel type's byte size

Definition at line 40 of file rt_pixel.c.

40 {
41 int pixbytes = -1;
42
43 switch (pixtype) {
44 case PT_1BB:
45 case PT_2BUI:
46 case PT_4BUI:
47 case PT_8BSI:
48 case PT_8BUI:
49 pixbytes = 1;
50 break;
51 case PT_16BSI:
52 case PT_16BUI:
53 case PT_16BF:
54 pixbytes = 2;
55 break;
56 case PT_32BSI:
57 case PT_32BUI:
58 case PT_32BF:
59 pixbytes = 4;
60 break;
61 case PT_64BF:
62 pixbytes = 8;
63 break;
64 default:
65 rterror("rt_pixtype_size: Unknown pixeltype %d", pixtype);
66 pixbytes = -1;
67 break;
68 }
69
70 RASTER_DEBUGF(3, "Pixel type = %s and size = %d bytes",
71 rt_pixtype_name(pixtype), pixbytes);
72
73 return pixbytes;
74}
void rterror(const char *fmt,...) __attribute__((format(printf
Wrappers used for reporting errors and info.
#define RASTER_DEBUGF(level, msg,...)
Definition librtcore.h:308
@ PT_32BUI
Definition librtcore.h:197
@ PT_16BF
Definition librtcore.h:198
@ PT_2BUI
Definition librtcore.h:190
@ PT_32BSI
Definition librtcore.h:196
@ PT_4BUI
Definition librtcore.h:191
@ PT_32BF
Definition librtcore.h:199
@ PT_1BB
Definition librtcore.h:189
@ PT_16BUI
Definition librtcore.h:195
@ PT_8BSI
Definition librtcore.h:192
@ PT_16BSI
Definition librtcore.h:194
@ PT_64BF
Definition librtcore.h:200
@ PT_8BUI
Definition librtcore.h:193
const char * rt_pixtype_name(rt_pixtype pixtype)
Definition rt_pixel.c:114

References PT_16BF, PT_16BSI, PT_16BUI, PT_1BB, PT_2BUI, PT_32BF, PT_32BSI, PT_32BUI, PT_4BUI, PT_64BF, PT_8BSI, PT_8BUI, RASTER_DEBUGF, rt_pixtype_name(), and rterror().

Referenced by convert_raster(), cu_add_band(), rt_band_duplicate(), rt_band_from_wkb(), rt_band_get_pixel_line(), rt_band_init_value(), rt_band_reclass(), rt_band_reclass_exact(), rt_band_set_pixel_line(), rt_pixtype_alignment(), rt_raster_deserialize(), rt_raster_from_gdal_dataset(), rt_raster_gdal_rasterize(), rt_raster_generate_new_band(), rt_raster_serialize(), rt_raster_serialized_size(), rt_raster_to_gdal_mem(), rt_raster_to_wkb(), rt_raster_wkb_size(), test_band_pixtype_16BSI(), test_band_pixtype_16BUI(), test_band_pixtype_1BB(), test_band_pixtype_2BUI(), test_band_pixtype_32BF(), test_band_pixtype_32BSI(), test_band_pixtype_32BUI(), test_band_pixtype_4BUI(), test_band_pixtype_64BF(), test_band_pixtype_8BSI(), test_band_pixtype_8BUI(), test_pixtype_size(), and test_raster_replace_band().

Here is the call graph for this function:
Here is the caller graph for this function: