MQC: remove disabled MQC_PERF_OPT mode, which brings no performance improvements (see #923)

This commit is contained in:
Even Rouault 2017-05-15 14:11:47 +02:00
parent 4431fa7265
commit 83d7a6d4a4
3 changed files with 0 additions and 67 deletions

View File

@ -275,22 +275,12 @@ static void opj_mqc_setbits(opj_mqc_t *mqc)
opj_mqc_t* opj_mqc_create(void) opj_mqc_t* opj_mqc_create(void)
{ {
opj_mqc_t *mqc = (opj_mqc_t*)opj_malloc(sizeof(opj_mqc_t)); 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; return mqc;
} }
void opj_mqc_destroy(opj_mqc_t *mqc) void opj_mqc_destroy(opj_mqc_t *mqc)
{ {
if (mqc) { if (mqc) {
#ifdef MQC_PERF_OPT
if (mqc->buffer) {
opj_free(mqc->buffer);
}
#endif
opj_free(mqc); 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); 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); opj_mqc_bytein(mqc);
mqc->c <<= 7; mqc->c <<= 7;
mqc->ct -= 7; mqc->ct -= 7;

View File

@ -78,9 +78,6 @@ typedef struct opj_mqc {
opj_mqc_state_t *ctxs[MQC_NUMCTXS]; opj_mqc_state_t *ctxs[MQC_NUMCTXS];
opj_mqc_state_t **curctx; opj_mqc_state_t **curctx;
const OPJ_BYTE *lut_ctxno_zc_orient; /* lut_ctxno_zc shifted by 256 * bandno */ 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; } opj_mqc_t;
#include "mqc_inl.h" #include "mqc_inl.h"

View File

@ -82,15 +82,6 @@ static INLINE OPJ_INT32 opj_mqc_lpsexchange(opj_mqc_t *const mqc)
Input a byte Input a byte
@param mqc MQC handle @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) static INLINE void opj_mqc_bytein(opj_mqc_t *const mqc)
{ {
/* Implements ISO 15444-1 C.3.4 Compressed image data input (BYTEIN) */ /* 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; mqc->ct = 8;
} }
} }
#endif
/** /**
Renormalize mqc->a and mqc->c while decoding Renormalize mqc->a and mqc->c while decoding