PostGIS  2.1.10dev-r@@SVN_REVISION@@
double rt_pixtype_get_min_value ( rt_pixtype  pixtype)

Return minimum value possible for pixel type.

Parameters
pixtype: the pixel type to get minimum possible value for
Returns
the minimum possible value for the pixel type.

Definition at line 1206 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, rt_util_clamp_to_16BSI(), rt_util_clamp_to_16BUI(), rt_util_clamp_to_1BB(), rt_util_clamp_to_2BUI(), rt_util_clamp_to_32BSI(), rt_util_clamp_to_32BUI(), rt_util_clamp_to_4BUI(), rt_util_clamp_to_8BSI(), rt_util_clamp_to_8BUI(), and rterror().

Referenced by RASTER_mapAlgebra2(), RASTER_minPossibleValue(), RASTER_union_transfn(), rt_band_corrected_clamped_value(), rt_band_get_min_value(), rt_band_get_nearest_pixel(), and test_pixtype_get_min_value().

1206  {
1207  switch (pixtype) {
1208  case PT_1BB: {
1209  return (double) rt_util_clamp_to_1BB((double) CHAR_MIN);
1210  }
1211  case PT_2BUI: {
1212  return (double) rt_util_clamp_to_2BUI((double) CHAR_MIN);
1213  }
1214  case PT_4BUI: {
1215  return (double) rt_util_clamp_to_4BUI((double) CHAR_MIN);
1216  }
1217  case PT_8BUI: {
1218  return (double) rt_util_clamp_to_8BUI((double) CHAR_MIN);
1219  }
1220  case PT_8BSI: {
1221  return (double) rt_util_clamp_to_8BSI((double) SCHAR_MIN);
1222  }
1223  case PT_16BSI: {
1224  return (double) rt_util_clamp_to_16BSI((double) SHRT_MIN);
1225  }
1226  case PT_16BUI: {
1227  return (double) rt_util_clamp_to_16BUI((double) SHRT_MIN);
1228  }
1229  case PT_32BSI: {
1230  return (double) rt_util_clamp_to_32BSI((double) INT_MIN);
1231  }
1232  case PT_32BUI: {
1233  return (double) rt_util_clamp_to_32BUI((double) INT_MIN);
1234  }
1235  case PT_32BF: {
1236  return (double) -FLT_MAX;
1237  }
1238  case PT_64BF: {
1239  return (double) -DBL_MAX;
1240  }
1241  default: {
1242  rterror("rt_pixtype_get_min_value: Unknown pixeltype %d", pixtype);
1243  return (double) rt_util_clamp_to_8BUI((double) CHAR_MIN);
1244  }
1245  }
1246 }
uint8_t rt_util_clamp_to_8BUI(double value)
Definition: rt_api.c:109
uint8_t rt_util_clamp_to_4BUI(double value)
Definition: rt_api.c:99
int32_t rt_util_clamp_to_32BSI(double value)
Definition: rt_api.c:124
uint8_t rt_util_clamp_to_1BB(double value)
Definition: rt_api.c:89
uint8_t rt_util_clamp_to_2BUI(double value)
Definition: rt_api.c:94
Definition: rt_api.h:173
uint16_t rt_util_clamp_to_16BUI(double value)
Definition: rt_api.c:119
uint32_t rt_util_clamp_to_32BUI(double value)
Definition: rt_api.c:129
void rterror(const char *fmt,...)
Raster core error and info handlers.
Definition: rt_api.c:895
int8_t rt_util_clamp_to_8BSI(double value)
Definition: rt_api.c:104
int16_t rt_util_clamp_to_16BSI(double value)
Definition: rt_api.c:114

Here is the call graph for this function:

Here is the caller graph for this function: