summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2017-06-01 19:42:03 +0200
committerEven Rouault <even.rouault@spatialys.com>2017-06-02 18:22:42 +0200
commit2ba861c37cb5032d1fa90a7c9298f6e08a0f5413 (patch)
treef5854c9fd54a8dd8ebc39f719e661c655da33555 /src/lib
parenta0861855c11bcb8c93f399ca51e766b5c8ef9e33 (diff)
Optimize opj_t1_update_flags()
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/openjp2/t1.c48
-rw-r--r--src/lib/openjp2/t1.h1
2 files changed, 11 insertions, 38 deletions
diff --git a/src/lib/openjp2/t1.c b/src/lib/openjp2/t1.c
index d5fba6f9..eb69939c 100644
--- a/src/lib/openjp2/t1.c
+++ b/src/lib/openjp2/t1.c
@@ -306,58 +306,30 @@ static OPJ_INT16 opj_t1_getnmsedec_ref(OPJ_UINT32 x, OPJ_UINT32 bitpos)
static INLINE void opj_t1_update_flags(opj_flag_t *flagsp, OPJ_UINT32 ci,
OPJ_UINT32 s, OPJ_UINT32 stride)
{
- /* set up to point to the north and south data points' flags words, if required */
- opj_flag_t* north;
- opj_flag_t* south;
+ /* east */
+ flagsp[-1] |= T1_SIGMA_5 << (3U * ci);
/* mark target as significant */
- *flagsp |= T1_SIGMA_4 << (3U * ci);
+ *flagsp |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci);
+
+ /* west */
+ flagsp[1] |= T1_SIGMA_3 << (3U * ci);
/* north-west, north, north-east */
if (ci == 0U) {
- north = flagsp - stride;
- *north |= T1_SIGMA_16;
+ opj_flag_t* north = flagsp - stride;
+ *north |= (s << T1_CHI_5_I) | T1_SIGMA_16;
north[-1] |= T1_SIGMA_17;
north[1] |= T1_SIGMA_15;
}
/* south-west, south, south-east */
if (ci == 3U) {
- south = flagsp + stride;
- *south |= T1_SIGMA_1;
+ opj_flag_t* south = flagsp + stride;
+ *south |= (s << T1_CHI_0_I) | T1_SIGMA_1;
south[-1] |= T1_SIGMA_2;
south[1] |= T1_SIGMA_0;
}
-
- /* east */
- flagsp[-1] |= T1_SIGMA_5 << (3U * ci);
-
- /* west */
- flagsp[1] |= T1_SIGMA_3 << (3U * ci);
-
- if (s) {
- switch (ci) {
- case 0U: {
- *flagsp |= T1_CHI_1;
- north = flagsp - stride;
- *north |= T1_CHI_5;
- break;
- }
- case 1:
- *flagsp |= T1_CHI_2;
- break;
- case 2:
- *flagsp |= T1_CHI_3;
- break;
- case 3: {
- *flagsp |= T1_CHI_4;
- south = flagsp + stride;
- *south |= T1_CHI_0;
- break;
- }
-
- }
- }
}
/**
diff --git a/src/lib/openjp2/t1.h b/src/lib/openjp2/t1.h
index a6982ce2..17123265 100644
--- a/src/lib/openjp2/t1.h
+++ b/src/lib/openjp2/t1.h
@@ -124,6 +124,7 @@ in T1.C are used by some function in TCD.C.
#define T1_MU_3 (1U << 29)
#define T1_PI_3 (1U << 30)
#define T1_CHI_5 (1U << 31)
+#define T1_CHI_5_I 31
/** As an example, the bits T1_SIGMA_3, T1_SIGMA_4 and T1_SIGMA_5
* indicate the significance state of the west neighbour of data point zero