diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2017-09-01 16:31:04 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2017-09-01 16:31:04 +0200 |
| commit | ae19001ba425a9b396a29fba3417dccc746bd2ef (patch) | |
| tree | 10fec9d87c3b666387bab8c61697412a47538d58 /src/lib/openjp2/opj_intmath.h | |
| parent | 470f3ed416a8cc3618b2c04000ea7b4694043f34 (diff) | |
opj_tcd_dc_level_shift_decode(): optimize lossy case
Diffstat (limited to 'src/lib/openjp2/opj_intmath.h')
| -rw-r--r-- | src/lib/openjp2/opj_intmath.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/lib/openjp2/opj_intmath.h b/src/lib/openjp2/opj_intmath.h index d7d85e52..ad135976 100644 --- a/src/lib/openjp2/opj_intmath.h +++ b/src/lib/openjp2/opj_intmath.h @@ -124,6 +124,28 @@ static INLINE OPJ_INT32 opj_int_clamp(OPJ_INT32 a, OPJ_INT32 min, } return a; } + +/** +Clamp an integer inside an interval +@return +<ul> +<li>Returns a if (min < a < max) +<li>Returns max if (a > max) +<li>Returns min if (a < min) +</ul> +*/ +static INLINE OPJ_INT64 opj_int64_clamp(OPJ_INT64 a, OPJ_INT64 min, + OPJ_INT64 max) +{ + if (a < min) { + return min; + } + if (a > max) { + return max; + } + return a; +} + /** @return Get absolute value of integer */ |
