PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ 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 39 of file rt_pixel.c.

References 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_reclass(), 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().

39  {
40  int pixbytes = -1;
41 
42  switch (pixtype) {
43  case PT_1BB:
44  case PT_2BUI:
45  case PT_4BUI:
46  case PT_8BSI:
47  case PT_8BUI:
48  pixbytes = 1;
49  break;
50  case PT_16BSI:
51  case PT_16BUI:
52  pixbytes = 2;
53  break;
54  case PT_32BSI:
55  case PT_32BUI:
56  case PT_32BF:
57  pixbytes = 4;
58  break;
59  case PT_64BF:
60  pixbytes = 8;
61  break;
62  default:
63  rterror("rt_pixtype_size: Unknown pixeltype %d", pixtype);
64  pixbytes = -1;
65  break;
66  }
67 
68  RASTER_DEBUGF(3, "Pixel type = %s and size = %d bytes",
69  rt_pixtype_name(pixtype), pixbytes);
70 
71  return pixbytes;
72 }
void rterror(const char *fmt,...)
Wrappers used for reporting errors and info.
Definition: rt_context.c:199
const char * rt_pixtype_name(rt_pixtype pixtype)
Definition: rt_pixel.c:110
#define RASTER_DEBUGF(level, msg,...)
Definition: librtcore.h:299
Here is the call graph for this function:
Here is the caller graph for this function: