From 83d7a6d4a44833e78321bfd367dc0f822a8d0945 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Mon, 15 May 2017 14:11:47 +0200 Subject: [PATCH] MQC: remove disabled MQC_PERF_OPT mode, which brings no performance improvements (see #923) --- src/lib/openjp2/mqc.c | 54 --------------------------------------- src/lib/openjp2/mqc.h | 3 --- src/lib/openjp2/mqc_inl.h | 10 -------- 3 files changed, 67 deletions(-) diff --git a/src/lib/openjp2/mqc.c b/src/lib/openjp2/mqc.c index d5ba1ab6..8a792b60 100644 --- a/src/lib/openjp2/mqc.c +++ b/src/lib/openjp2/mqc.c @@ -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; diff --git a/src/lib/openjp2/mqc.h b/src/lib/openjp2/mqc.h index 8417bb0a..f21d46ef 100644 --- a/src/lib/openjp2/mqc.h +++ b/src/lib/openjp2/mqc.h @@ -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" diff --git a/src/lib/openjp2/mqc_inl.h b/src/lib/openjp2/mqc_inl.h index e6558c59..ca3991d7 100644 --- a/src/lib/openjp2/mqc_inl.h +++ b/src/lib/openjp2/mqc_inl.h @@ -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