summaryrefslogtreecommitdiff
path: root/src/lib/openjp2/opj_intmath.h
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2017-08-18 15:08:51 +0200
committerEven Rouault <even.rouault@spatialys.com>2017-08-18 15:08:51 +0200
commit5d403250561398f7ba3041d9eb8c893bd680dd72 (patch)
treef0da191cd421b212901c8e982d021649f9d60e2c /src/lib/openjp2/opj_intmath.h
parent028c504a43e962a725c4fd73d6642ee73c653e1b (diff)
Subtile decoding: only do 5x3 IDWT computations on relevant areas of tile-component buffer.
This lowers 'bin/opj_decompress -i ../MAPA.jp2 -o out.tif -d 0,0,256,256' down to 0.860s
Diffstat (limited to 'src/lib/openjp2/opj_intmath.h')
-rw-r--r--src/lib/openjp2/opj_intmath.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib/openjp2/opj_intmath.h b/src/lib/openjp2/opj_intmath.h
index cf97c15b..d7d85e52 100644
--- a/src/lib/openjp2/opj_intmath.h
+++ b/src/lib/openjp2/opj_intmath.h
@@ -96,6 +96,15 @@ static INLINE OPJ_UINT32 opj_uint_adds(OPJ_UINT32 a, OPJ_UINT32 b)
}
/**
+ Get the saturated difference of two unsigned integers
+ @return Returns saturated sum of a-b
+ */
+static INLINE OPJ_UINT32 opj_uint_subs(OPJ_UINT32 a, OPJ_UINT32 b)
+{
+ return (a >= b) ? a - b : 0;
+}
+
+/**
Clamp an integer inside an interval
@return
<ul>