Reworks of t1_updateflags to get rid of the shift operation. mqc_setcurctx moved to the header to allow it to be inlined into the t1.
This commit is contained in:
parent
adca52578d
commit
d4d23c7eb5
|
@ -12,6 +12,8 @@ August 21, 2007
|
||||||
* [Callum Lerwick] Minor cleanup patch, that gets rid of a bunch of "old style declaration" warnings from Intel's compiler
|
* [Callum Lerwick] Minor cleanup patch, that gets rid of a bunch of "old style declaration" warnings from Intel's compiler
|
||||||
* [Callum Lerwick] Aligned malloc using Intel's _mm_malloc(). Cleanup on the t1 memory allocation, getting rid of some leftover debug code
|
* [Callum Lerwick] Aligned malloc using Intel's _mm_malloc(). Cleanup on the t1 memory allocation, getting rid of some leftover debug code
|
||||||
* [Callum Lerwick] Memory leaks fixed
|
* [Callum Lerwick] Memory leaks fixed
|
||||||
|
* [Callum Lerwick] Reworks of t1_updateflags to get rid of the shift operation
|
||||||
|
* [Callum Lerwick] mqc_setcurctx moved to the header to allow it to be inlined into the t1.
|
||||||
|
|
||||||
August 20, 2007
|
August 20, 2007
|
||||||
+ [FOD] Added support for the TGA file format in the codec
|
+ [FOD] Added support for the TGA file format in the codec
|
||||||
|
|
|
@ -371,10 +371,6 @@ void mqc_init_enc(opj_mqc_t *mqc, unsigned char *bp) {
|
||||||
mqc->start = bp;
|
mqc->start = bp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mqc_setcurctx(opj_mqc_t *mqc, int ctxno) {
|
|
||||||
mqc->curctx = &mqc->ctxs[ctxno];
|
|
||||||
}
|
|
||||||
|
|
||||||
void mqc_encode(opj_mqc_t *mqc, int d) {
|
void mqc_encode(opj_mqc_t *mqc, int d) {
|
||||||
if ((*mqc->curctx)->mps == d) {
|
if ((*mqc->curctx)->mps == d) {
|
||||||
mqc_codemps(mqc);
|
mqc_codemps(mqc);
|
||||||
|
|
|
@ -116,7 +116,7 @@ Set the current context used for coding/decoding
|
||||||
@param mqc MQC handle
|
@param mqc MQC handle
|
||||||
@param ctxno Number that identifies the context
|
@param ctxno Number that identifies the context
|
||||||
*/
|
*/
|
||||||
void mqc_setcurctx(opj_mqc_t *mqc, int ctxno);
|
#define mqc_setcurctx(mqc, ctxno) (mqc)->curctx = &(mqc)->ctxs[(int)(ctxno)]
|
||||||
/**
|
/**
|
||||||
Encode a symbol using the MQ-coder
|
Encode a symbol using the MQ-coder
|
||||||
@param mqc MQC handle
|
@param mqc MQC handle
|
||||||
|
|
|
@ -261,21 +261,22 @@ static void t1_updateflags(flag_t *flagsp, int s, int stride) {
|
||||||
flag_t *sp = flagsp + stride;
|
flag_t *sp = flagsp + stride;
|
||||||
|
|
||||||
static const flag_t mod[] = {
|
static const flag_t mod[] = {
|
||||||
T1_SIG_S, T1_SIG_N, T1_SIG_E, T1_SIG_W,
|
T1_SIG_S, T1_SIG_S|T1_SGN_S,
|
||||||
T1_SIG_S | T1_SGN_S, T1_SIG_N | T1_SGN_N, T1_SIG_E | T1_SGN_E, T1_SIG_W | T1_SGN_W
|
T1_SIG_E, T1_SIG_E|T1_SGN_E,
|
||||||
|
T1_SIG_W, T1_SIG_W|T1_SGN_W,
|
||||||
|
T1_SIG_N, T1_SIG_N|T1_SGN_N
|
||||||
};
|
};
|
||||||
|
|
||||||
s <<= 2;
|
|
||||||
|
|
||||||
np[-1] |= T1_SIG_SE;
|
np[-1] |= T1_SIG_SE;
|
||||||
np[0] |= mod[s];
|
np[0] |= mod[s];
|
||||||
np[1] |= T1_SIG_SW;
|
np[1] |= T1_SIG_SW;
|
||||||
|
|
||||||
flagsp[-1] |= mod[s+2];
|
flagsp[-1] |= mod[s+2];
|
||||||
flagsp[1] |= mod[s+3];
|
flagsp[0] |= T1_SIG;
|
||||||
|
flagsp[1] |= mod[s+4];
|
||||||
|
|
||||||
sp[-1] |= T1_SIG_NE;
|
sp[-1] |= T1_SIG_NE;
|
||||||
sp[0] |= mod[s+1];
|
sp[0] |= mod[s+6];
|
||||||
sp[1] |= T1_SIG_NW;
|
sp[1] |= T1_SIG_NW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,7 +316,6 @@ static void t1_enc_sigpass_step(
|
||||||
mqc_encode(mqc, v ^ t1_getspb(flag));
|
mqc_encode(mqc, v ^ t1_getspb(flag));
|
||||||
}
|
}
|
||||||
t1_updateflags(flagsp, v, t1->flags_stride);
|
t1_updateflags(flagsp, v, t1->flags_stride);
|
||||||
*flagsp |= T1_SIG;
|
|
||||||
}
|
}
|
||||||
*flagsp |= T1_VISIT;
|
*flagsp |= T1_VISIT;
|
||||||
}
|
}
|
||||||
|
@ -342,7 +342,6 @@ static void t1_dec_sigpass_step(
|
||||||
v = raw_decode(raw); /* ESSAI */
|
v = raw_decode(raw); /* ESSAI */
|
||||||
*datap = v ? -oneplushalf : oneplushalf;
|
*datap = v ? -oneplushalf : oneplushalf;
|
||||||
t1_updateflags(flagsp, v, t1->flags_stride);
|
t1_updateflags(flagsp, v, t1->flags_stride);
|
||||||
*flagsp |= T1_SIG;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mqc_setcurctx(mqc, t1_getctxno_zc(flag, orient));
|
mqc_setcurctx(mqc, t1_getctxno_zc(flag, orient));
|
||||||
|
@ -351,7 +350,6 @@ static void t1_dec_sigpass_step(
|
||||||
v = mqc_decode(mqc) ^ t1_getspb(flag);
|
v = mqc_decode(mqc) ^ t1_getspb(flag);
|
||||||
*datap = v ? -oneplushalf : oneplushalf;
|
*datap = v ? -oneplushalf : oneplushalf;
|
||||||
t1_updateflags(flagsp, v, t1->flags_stride);
|
t1_updateflags(flagsp, v, t1->flags_stride);
|
||||||
*flagsp |= T1_SIG;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*flagsp |= T1_VISIT;
|
*flagsp |= T1_VISIT;
|
||||||
|
@ -560,7 +558,6 @@ LABEL_PARTIAL:
|
||||||
v = *datap < 0 ? 1 : 0;
|
v = *datap < 0 ? 1 : 0;
|
||||||
mqc_encode(mqc, v ^ t1_getspb(flag));
|
mqc_encode(mqc, v ^ t1_getspb(flag));
|
||||||
t1_updateflags(flagsp, v, t1->flags_stride);
|
t1_updateflags(flagsp, v, t1->flags_stride);
|
||||||
*flagsp |= T1_SIG;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*flagsp &= ~T1_VISIT;
|
*flagsp &= ~T1_VISIT;
|
||||||
|
@ -591,7 +588,6 @@ LABEL_PARTIAL:
|
||||||
v = mqc_decode(mqc) ^ t1_getspb(flag);
|
v = mqc_decode(mqc) ^ t1_getspb(flag);
|
||||||
*datap = v ? -oneplushalf : oneplushalf;
|
*datap = v ? -oneplushalf : oneplushalf;
|
||||||
t1_updateflags(flagsp, v, t1->flags_stride);
|
t1_updateflags(flagsp, v, t1->flags_stride);
|
||||||
*flagsp |= T1_SIG;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*flagsp &= ~T1_VISIT;
|
*flagsp &= ~T1_VISIT;
|
||||||
|
|
Loading…
Reference in New Issue