PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ rt_pixtype_get_min_value()

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.

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 0;
155  }
156  case PT_4BUI: {
157  return 0;
158  }
159  case PT_8BUI: {
160  return 0;
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 0;
170  }
171  case PT_32BSI: {
172  return (double) rt_util_clamp_to_32BSI((double) INT_MIN);
173  }
174  case PT_32BUI: {
175  return 0;
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 }
void rterror(const char *fmt,...)
Wrappers used for reporting errors and info.
Definition: rt_context.c:199
int8_t rt_util_clamp_to_8BSI(double value)
Definition: rt_util.c:49
uint8_t rt_util_clamp_to_1BB(double value)
Definition: rt_util.c:34
int32_t rt_util_clamp_to_32BSI(double value)
Definition: rt_util.c:69
@ PT_32BUI
Definition: librtcore.h:194
@ PT_2BUI
Definition: librtcore.h:187
@ PT_32BSI
Definition: librtcore.h:193
@ PT_4BUI
Definition: librtcore.h:188
@ PT_32BF
Definition: librtcore.h:195
@ PT_1BB
Definition: librtcore.h:186
@ PT_16BUI
Definition: librtcore.h:192
@ PT_8BSI
Definition: librtcore.h:189
@ PT_16BSI
Definition: librtcore.h:191
@ PT_64BF
Definition: librtcore.h:196
@ PT_8BUI
Definition: librtcore.h:190
uint8_t rt_util_clamp_to_8BUI(double value)
Definition: rt_util.c:54
int16_t rt_util_clamp_to_16BSI(double value)
Definition: rt_util.c:59

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_1BB(), rt_util_clamp_to_32BSI(), 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().

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