PostGIS  2.2.7dev-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 148 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, 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().

148  {
149  switch (pixtype) {
150  case PT_1BB: {
151  return (double) rt_util_clamp_to_1BB((double) CHAR_MIN);
152  }
153  case PT_2BUI: {
154  return (double) rt_util_clamp_to_2BUI((double) CHAR_MIN);
155  }
156  case PT_4BUI: {
157  return (double) rt_util_clamp_to_4BUI((double) CHAR_MIN);
158  }
159  case PT_8BUI: {
160  return (double) rt_util_clamp_to_8BUI((double) CHAR_MIN);
161  }
162  case PT_8BSI: {
163  return (double) rt_util_clamp_to_8BSI((double) SCHAR_MIN);
164  }
165  case PT_16BSI: {
166  return (double) rt_util_clamp_to_16BSI((double) SHRT_MIN);
167  }
168  case PT_16BUI: {
169  return (double) rt_util_clamp_to_16BUI((double) SHRT_MIN);
170  }
171  case PT_32BSI: {
172  return (double) rt_util_clamp_to_32BSI((double) INT_MIN);
173  }
174  case PT_32BUI: {
175  return (double) rt_util_clamp_to_32BUI((double) INT_MIN);
176  }
177  case PT_32BF: {
178  return (double) -FLT_MAX;
179  }
180  case PT_64BF: {
181  return (double) -DBL_MAX;
182  }
183  default: {
184  rterror("rt_pixtype_get_min_value: Unknown pixeltype %d", pixtype);
185  return (double) rt_util_clamp_to_8BUI((double) CHAR_MIN);
186  }
187  }
188 }
int32_t rt_util_clamp_to_32BSI(double value)
Definition: rt_util.c:69
uint32_t rt_util_clamp_to_32BUI(double value)
Definition: rt_util.c:74
void rterror(const char *fmt,...)
Wrappers used for reporting errors and info.
Definition: rt_context.c:199
uint16_t rt_util_clamp_to_16BUI(double value)
Definition: rt_util.c:64
int8_t rt_util_clamp_to_8BSI(double value)
Definition: rt_util.c:49
uint8_t rt_util_clamp_to_4BUI(double value)
Definition: rt_util.c:44
uint8_t rt_util_clamp_to_8BUI(double value)
Definition: rt_util.c:54
uint8_t rt_util_clamp_to_1BB(double value)
Definition: rt_util.c:34
uint8_t rt_util_clamp_to_2BUI(double value)
Definition: rt_util.c:39
int16_t rt_util_clamp_to_16BSI(double value)
Definition: rt_util.c:59

Here is the call graph for this function:

Here is the caller graph for this function: