]> granicus.if.org Git - openjpeg/commitdiff
MQC: remove disabled MQC_PERF_OPT mode, which brings no performance improvements...
authorEven Rouault <even.rouault@spatialys.com>
Mon, 15 May 2017 12:11:47 +0000 (14:11 +0200)
committerEven Rouault <even.rouault@spatialys.com>
Mon, 15 May 2017 12:11:47 +0000 (14:11 +0200)
src/lib/openjp2/mqc.c
src/lib/openjp2/mqc.h
src/lib/openjp2/mqc_inl.h

index d5ba1ab6c22d66f616700be8f6c7b4c61b86db90..8a792b601760844dbaec1adc5a21b07741a87e2c 100644 (file)
@@ -275,22 +275,12 @@ static void opj_mqc_setbits(opj_mqc_t *mqc)
 opj_mqc_t* opj_mqc_create(void)
 {
     opj_mqc_t *mqc = (opj_mqc_t*)opj_malloc(sizeof(opj_mqc_t));
-#ifdef MQC_PERF_OPT
-    if (mqc) {
-        mqc->buffer = NULL;
-    }
-#endif
     return mqc;
 }
 
 void opj_mqc_destroy(opj_mqc_t *mqc)
 {
     if (mqc) {
-#ifdef MQC_PERF_OPT
-        if (mqc->buffer) {
-            opj_free(mqc->buffer);
-        }
-#endif
         opj_free(mqc);
     }
 }
@@ -463,50 +453,6 @@ OPJ_BOOL opj_mqc_init_dec(opj_mqc_t *mqc, OPJ_BYTE *bp, OPJ_UINT32 len)
         mqc->c = (OPJ_UINT32)(*mqc->bp << 16);
     }
 
-#ifdef MQC_PERF_OPT /* TODO_MSD: check this option and put in experimental */
-    {
-        OPJ_UINT32 c;
-        OPJ_UINT32 *ip;
-        OPJ_BYTE *end = mqc->end - 1;
-        void* new_buffer = opj_realloc(mqc->buffer, (len + 1) * sizeof(OPJ_UINT32));
-        if (! new_buffer) {
-            opj_free(mqc->buffer);
-            mqc->buffer = NULL;
-            return OPJ_FALSE;
-        }
-        mqc->buffer = new_buffer;
-
-        ip = (OPJ_UINT32 *) mqc->buffer;
-
-        while (bp < end) {
-            c = *(bp + 1);
-            if (*bp == 0xff) {
-                if (c > 0x8f) {
-                    break;
-                } else {
-                    *ip = 0x00000017 | (c << 9);
-                }
-            } else {
-                *ip = 0x00000018 | (c << 8);
-            }
-            bp++;
-            ip++;
-        }
-
-        /* Handle last byte of data */
-        c = 0xff;
-        if (*bp == 0xff) {
-            *ip = 0x0000ff18;
-        } else {
-            bp++;
-            *ip = 0x00000018 | (c << 8);
-        }
-        ip++;
-
-        *ip = 0x0000ff08;
-        mqc->bp = mqc->buffer;
-    }
-#endif
     opj_mqc_bytein(mqc);
     mqc->c <<= 7;
     mqc->ct -= 7;
index 8417bb0a262a2c64a70b6d86462659947859882c..f21d46ef2b52c9bd29dd19a51950bd931fa12bd5 100644 (file)
@@ -78,9 +78,6 @@ typedef struct opj_mqc {
     opj_mqc_state_t *ctxs[MQC_NUMCTXS];
     opj_mqc_state_t **curctx;
     const OPJ_BYTE *lut_ctxno_zc_orient; /* lut_ctxno_zc shifted by 256 * bandno */
-#ifdef MQC_PERF_OPT
-    unsigned char *buffer;
-#endif
 } opj_mqc_t;
 
 #include "mqc_inl.h"
index e6558c597799ef4076ba048060587629a2932854..ca3991d7ee60c5305c066f8572fd9d5f171e1104 100644 (file)
@@ -82,15 +82,6 @@ static INLINE OPJ_INT32 opj_mqc_lpsexchange(opj_mqc_t *const mqc)
 Input a byte
 @param mqc MQC handle
 */
-#ifdef MQC_PERF_OPT
-static INLINE void opj_mqc_bytein(opj_mqc_t *const mqc)
-{
-    unsigned int i = *((unsigned int *) mqc->bp);
-    mqc->c += i & 0xffff00;
-    mqc->ct = i & 0x0f;
-    mqc->bp += (i >> 2) & 0x04;
-}
-#else
 static INLINE void opj_mqc_bytein(opj_mqc_t *const mqc)
 {
     /* Implements ISO 15444-1 C.3.4 Compressed image data input (BYTEIN) */
@@ -123,7 +114,6 @@ static INLINE void opj_mqc_bytein(opj_mqc_t *const mqc)
         mqc->ct = 8;
     }
 }
-#endif
 
 /**
 Renormalize mqc->a and mqc->c while decoding