PostGIS  2.1.10dev-r@@SVN_REVISION@@
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 1097 of file rt_api.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().

1097  {
1098  int pixbytes = -1;
1099 
1100  switch (pixtype) {
1101  case PT_1BB:
1102  case PT_2BUI:
1103  case PT_4BUI:
1104  case PT_8BSI:
1105  case PT_8BUI:
1106  pixbytes = 1;
1107  break;
1108  case PT_16BSI:
1109  case PT_16BUI:
1110  pixbytes = 2;
1111  break;
1112  case PT_32BSI:
1113  case PT_32BUI:
1114  case PT_32BF:
1115  pixbytes = 4;
1116  break;
1117  case PT_64BF:
1118  pixbytes = 8;
1119  break;
1120  default:
1121  rterror("rt_pixtype_size: Unknown pixeltype %d", pixtype);
1122  pixbytes = -1;
1123  break;
1124  }
1125 
1126  RASTER_DEBUGF(3, "Pixel type = %s and size = %d bytes",
1127  rt_pixtype_name(pixtype), pixbytes);
1128 
1129  return pixbytes;
1130 }
const char * rt_pixtype_name(rt_pixtype pixtype)
Definition: rt_api.c:1168
Definition: rt_api.h:173
#define RASTER_DEBUGF(level, msg,...)
Definition: rt_api.h:285
void rterror(const char *fmt,...)
Raster core error and info handlers.
Definition: rt_api.c:895

Here is the call graph for this function:

Here is the caller graph for this function: