PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ rt_pixtype_compare_clamped_values()

rt_errorstate rt_pixtype_compare_clamped_values ( rt_pixtype  pixtype,
double  val,
double  refval,
int *  isequal 
)

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

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 200 of file rt_pixel.c.

204 {
205 assert(isequal != NULL);
206 *isequal = 0;
207
208 switch (pixtype) {
209 case PT_1BB:
210 if (rt_util_clamp_to_1BB(val) == rt_util_clamp_to_1BB(refval))
211 *isequal = 1;
212 break;
213 case PT_2BUI:
215 *isequal = 1;
216 break;
217 case PT_4BUI:
219 *isequal = 1;
220 break;
221 case PT_8BSI:
223 *isequal = 1;
224 break;
225 case PT_8BUI:
227 *isequal = 1;
228 break;
229 case PT_16BSI:
231 *isequal = 1;
232 break;
233 case PT_16BUI:
235 *isequal = 1;
236 break;
237 case PT_32BSI:
239 *isequal = 1;
240 break;
241 case PT_32BUI:
243 *isequal = 1;
244 break;
245 case PT_32BF:
247 *isequal = 1;
248 break;
249 case PT_64BF:
250 if (FLT_EQ(val, refval))
251 *isequal = 1;
252 break;
253 default:
254 rterror("rt_pixtype_compare_clamped_values: Unknown pixeltype %d", pixtype);
255 return ES_ERROR;
256 }
257
258 return ES_NONE;
259}
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
#define FLT_EQ(x, y)
Definition librtcore.h:2235
uint8_t rt_util_clamp_to_2BUI(double value)
Definition rt_util.c:39
uint8_t rt_util_clamp_to_8BUI(double value)
Definition rt_util.c:54
@ ES_NONE
Definition librtcore.h:180
@ ES_ERROR
Definition librtcore.h:181
int16_t rt_util_clamp_to_16BSI(double value)
Definition rt_util.c:59
uint8_t rt_util_clamp_to_4BUI(double value)
Definition rt_util.c:44
uint16_t rt_util_clamp_to_16BUI(double value)
Definition rt_util.c:64
uint32_t rt_util_clamp_to_32BUI(double value)
Definition rt_util.c:74
float rt_util_clamp_to_32F(double value)
Definition rt_util.c:79

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().

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