PostGIS  2.1.10dev-r@@SVN_REVISION@@
rt_errorstate rt_pixtype_compare_clamped_values ( rt_pixtype  pixtype,
double  val,
double  refval,
int *  isequal 
)

Returns 1 if clamped values are equal, 0 if not equal, -1 if error.

Test to see if two values are equal when clamped.

Parameters
pixtype: the pixel type to clamp the provided values
val: value to compare to reference value
refval: reference value to be compared with
isequal: non-zero if clamped values are equal, 0 otherwise
Returns
ES_NONE on success, ES_ERROR on error

Definition at line 1258 of file rt_api.c.

References ES_ERROR, ES_NONE, FLT_EQ, 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_32F(), rt_util_clamp_to_4BUI(), rt_util_clamp_to_8BSI(), rt_util_clamp_to_8BUI(), and rterror().

Referenced by rt_band_clamped_value_is_nodata(), rt_band_get_pixel_of_value(), and test_pixtype_compare_clamped_values().

1262  {
1263  assert(isequal != NULL);
1264  *isequal = 0;
1265 
1266  switch (pixtype) {
1267  case PT_1BB:
1268  if (rt_util_clamp_to_1BB(val) == rt_util_clamp_to_1BB(refval))
1269  *isequal = 1;
1270  break;
1271  case PT_2BUI:
1272  if (rt_util_clamp_to_2BUI(val) == rt_util_clamp_to_2BUI(refval))
1273  *isequal = 1;
1274  break;
1275  case PT_4BUI:
1276  if (rt_util_clamp_to_4BUI(val) == rt_util_clamp_to_4BUI(refval))
1277  *isequal = 1;
1278  break;
1279  case PT_8BSI:
1280  if (rt_util_clamp_to_8BSI(val) == rt_util_clamp_to_8BSI(refval))
1281  *isequal = 1;
1282  break;
1283  case PT_8BUI:
1284  if (rt_util_clamp_to_8BUI(val) == rt_util_clamp_to_8BUI(refval))
1285  *isequal = 1;
1286  break;
1287  case PT_16BSI:
1288  if (rt_util_clamp_to_16BSI(val) == rt_util_clamp_to_16BSI(refval))
1289  *isequal = 1;
1290  break;
1291  case PT_16BUI:
1292  if (rt_util_clamp_to_16BUI(val) == rt_util_clamp_to_16BUI(refval))
1293  *isequal = 1;
1294  break;
1295  case PT_32BSI:
1296  if (rt_util_clamp_to_32BSI(val) == rt_util_clamp_to_32BSI(refval))
1297  *isequal = 1;
1298  break;
1299  case PT_32BUI:
1300  if (rt_util_clamp_to_32BUI(val) == rt_util_clamp_to_32BUI(refval))
1301  *isequal = 1;
1302  break;
1303  case PT_32BF:
1305  *isequal = 1;
1306  break;
1307  case PT_64BF:
1308  if (FLT_EQ(val, refval))
1309  *isequal = 1;
1310  break;
1311  default:
1312  rterror("rt_pixtype_compare_clamped_values: Unknown pixeltype %d", pixtype);
1313  return ES_ERROR;
1314  }
1315 
1316  return ES_NONE;
1317 }
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
float rt_util_clamp_to_32F(double value)
Definition: rt_api.c:134
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
#define FLT_EQ(x, y)
Definition: rt_api.h:2159
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: