/** @name Local static functions */
/*@{*/
-static INLINE OPJ_BYTE opj_t1_getctxno_zc(OPJ_UINT32 f, OPJ_UINT32 orient);
+static INLINE OPJ_BYTE opj_t1_getctxno_zc(opj_mqc_t *mqc, OPJ_UINT32 f);
static OPJ_BYTE opj_t1_getctxno_sc(OPJ_UINT32 f);
static INLINE OPJ_UINT32 opj_t1_getctxno_mag(OPJ_UINT32 f);
static OPJ_BYTE opj_t1_getspb(OPJ_UINT32 f);
static void opj_t1_enc_sigpass_step(opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
- OPJ_UINT32 orient,
OPJ_INT32 bpno,
OPJ_INT32 one,
OPJ_INT32 *nmsedec,
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
- OPJ_INT32 orient,
OPJ_INT32 oneplushalf,
OPJ_INT32 vsc);
static INLINE void opj_t1_dec_sigpass_step_mqc(
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
- OPJ_INT32 orient,
OPJ_INT32 oneplushalf);
static INLINE void opj_t1_dec_sigpass_step_mqc_vsc(
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
- OPJ_INT32 orient,
OPJ_INT32 oneplushalf,
OPJ_INT32 vsc);
*/
static void opj_t1_enc_sigpass( opj_t1_t *t1,
OPJ_INT32 bpno,
- OPJ_UINT32 orient,
OPJ_INT32 *nmsedec,
OPJ_BYTE type,
OPJ_UINT32 cblksty);
static void opj_t1_dec_sigpass_raw(
opj_t1_t *t1,
OPJ_INT32 bpno,
- OPJ_INT32 orient,
OPJ_INT32 cblksty);
static void opj_t1_dec_sigpass_mqc_vsc(
opj_t1_t *t1,
- OPJ_INT32 bpno,
- OPJ_INT32 orient);
+ OPJ_INT32 bpno);
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
- OPJ_UINT32 orient,
OPJ_INT32 bpno,
OPJ_INT32 one,
OPJ_INT32 *nmsedec,
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
- OPJ_INT32 orient,
OPJ_INT32 oneplushalf);
static void opj_t1_dec_clnpass_step(
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
- OPJ_INT32 orient,
OPJ_INT32 oneplushalf);
static void opj_t1_dec_clnpass_step_vsc(
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
- OPJ_INT32 orient,
OPJ_INT32 oneplushalf,
OPJ_INT32 partial,
OPJ_INT32 vsc);
static void opj_t1_enc_clnpass(
opj_t1_t *t1,
OPJ_INT32 bpno,
- OPJ_UINT32 orient,
OPJ_INT32 *nmsedec,
OPJ_UINT32 cblksty);
/**
static void opj_t1_dec_clnpass(
opj_t1_t *t1,
OPJ_INT32 bpno,
- OPJ_INT32 orient,
OPJ_INT32 cblksty);
static OPJ_FLOAT64 opj_t1_getwmsedec(
/* ----------------------------------------------------------------------- */
-static OPJ_BYTE opj_t1_getctxno_zc(OPJ_UINT32 f, OPJ_UINT32 orient) {
- return lut_ctxno_zc[(orient << 8) | (f & T1_SIG_OTH)];
+static OPJ_BYTE opj_t1_getctxno_zc(opj_mqc_t *mqc, OPJ_UINT32 f) {
+ return mqc->lut_ctxno_zc_orient[(f & T1_SIG_OTH)];
}
static OPJ_BYTE opj_t1_getctxno_sc(OPJ_UINT32 f) {
static void opj_t1_enc_sigpass_step( opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
- OPJ_UINT32 orient,
OPJ_INT32 bpno,
OPJ_INT32 one,
OPJ_INT32 *nmsedec,
flag = vsc ? (OPJ_UINT32)((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (OPJ_UINT32)(*flagsp);
if ((flag & T1_SIG_OTH) && !(flag & (T1_SIG | T1_VISIT))) {
v = (opj_int_abs(*datap) & one) ? 1 : 0;
- opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(flag, orient)); /* ESSAI */
+ opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(mqc, flag)); /* ESSAI */
if (type == T1_TYPE_RAW) { /* BYPASS/LAZY MODE */
opj_mqc_bypass_enc(mqc, (OPJ_UINT32)v);
} else {
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
- OPJ_INT32 orient,
OPJ_INT32 oneplushalf,
OPJ_INT32 vsc)
{
OPJ_INT32 v, flag;
opj_raw_t *raw = t1->raw; /* RAW component */
- OPJ_ARG_NOT_USED(orient);
-
+
flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp);
if ((flag & T1_SIG_OTH) && !(flag & (T1_SIG | T1_VISIT))) {
if (opj_raw_decode(raw)) {
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
- OPJ_INT32 orient,
OPJ_INT32 oneplushalf)
{
OPJ_INT32 v, flag;
flag = *flagsp;
if ((flag & T1_SIG_OTH) && !(flag & (T1_SIG | T1_VISIT))) {
- opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc((OPJ_UINT32)flag, (OPJ_UINT32)orient));
+ opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(mqc, (OPJ_UINT32)flag));
if (opj_mqc_decode(mqc)) {
opj_mqc_setcurctx(mqc, opj_t1_getctxno_sc((OPJ_UINT32)flag));
v = opj_mqc_decode(mqc) ^ opj_t1_getspb((OPJ_UINT32)flag);
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
- OPJ_INT32 orient,
OPJ_INT32 oneplushalf,
OPJ_INT32 vsc)
{
flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp);
if ((flag & T1_SIG_OTH) && !(flag & (T1_SIG | T1_VISIT))) {
- opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc((OPJ_UINT32)flag, (OPJ_UINT32)orient));
+ opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(mqc, (OPJ_UINT32)flag));
if (opj_mqc_decode(mqc)) {
opj_mqc_setcurctx(mqc, opj_t1_getctxno_sc((OPJ_UINT32)flag));
v = opj_mqc_decode(mqc) ^ opj_t1_getspb((OPJ_UINT32)flag);
static void opj_t1_enc_sigpass(opj_t1_t *t1,
OPJ_INT32 bpno,
- OPJ_UINT32 orient,
OPJ_INT32 *nmsedec,
OPJ_BYTE type,
OPJ_UINT32 cblksty
t1,
&t1->flags[((j+1) * t1->flags_stride) + i + 1],
&t1->data[(j * t1->data_stride) + i],
- orient,
bpno,
one,
nmsedec,
static void opj_t1_dec_sigpass_raw(
opj_t1_t *t1,
OPJ_INT32 bpno,
- OPJ_INT32 orient,
OPJ_INT32 cblksty)
{
OPJ_INT32 one, half, oneplushalf, vsc;
t1,
&t1->flags[((j+1) * t1->flags_stride) + i + 1],
&t1->data[(j * t1->w) + i],
- orient,
oneplushalf,
vsc);
}
}
} /* VSC and BYPASS by Antonin */
-#define opj_t1_dec_sigpass_mqc_internal(t1, bpno, orient, w, h, flags_stride) \
+#define opj_t1_dec_sigpass_mqc_internal(t1, bpno, w, h, flags_stride) \
{ \
OPJ_INT32 one, half, oneplushalf; \
OPJ_UINT32 i, j, k; \
OPJ_INT32 *data2 = data1 + i; \
opj_flag_t *flags2 = flags1 + i; \
flags2 += flags_stride; \
- opj_t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf); \
+ opj_t1_dec_sigpass_step_mqc(t1, flags2, data2, oneplushalf); \
data2 += w; \
flags2 += flags_stride; \
- opj_t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf); \
+ opj_t1_dec_sigpass_step_mqc(t1, flags2, data2, oneplushalf); \
data2 += w; \
flags2 += flags_stride; \
- opj_t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf); \
+ opj_t1_dec_sigpass_step_mqc(t1, flags2, data2, oneplushalf); \
data2 += w; \
flags2 += flags_stride; \
- opj_t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf); \
+ opj_t1_dec_sigpass_step_mqc(t1, flags2, data2, oneplushalf); \
data2 += w; \
} \
data1 += w << 2; \
opj_flag_t *flags2 = flags1 + i; \
for (j = k; j < h; ++j) { \
flags2 += flags_stride; \
- opj_t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf); \
+ opj_t1_dec_sigpass_step_mqc(t1, flags2, data2, oneplushalf); \
data2 += w; \
} \
} \
static void opj_t1_dec_sigpass_mqc_64x64(
opj_t1_t *t1,
- OPJ_INT32 bpno,
- OPJ_INT32 orient)
+ OPJ_INT32 bpno)
{
- opj_t1_dec_sigpass_mqc_internal(t1, bpno, orient, 64, 64, 66);
+ opj_t1_dec_sigpass_mqc_internal(t1, bpno, 64, 64, 66);
}
static void opj_t1_dec_sigpass_mqc_generic(
opj_t1_t *t1,
- OPJ_INT32 bpno,
- OPJ_INT32 orient)
+ OPJ_INT32 bpno)
{
- opj_t1_dec_sigpass_mqc_internal(t1, bpno, orient, t1->w, t1->h, t1->flags_stride);
+ opj_t1_dec_sigpass_mqc_internal(t1, bpno, t1->w, t1->h, t1->flags_stride);
}
/* VSC and BYPASS by Antonin */
static void opj_t1_dec_sigpass_mqc_vsc(
opj_t1_t *t1,
- OPJ_INT32 bpno,
- OPJ_INT32 orient)
+ OPJ_INT32 bpno)
{
OPJ_INT32 one, half, oneplushalf, vsc;
OPJ_UINT32 i, j, k;
t1,
&t1->flags[((j+1) * t1->flags_stride) + i + 1],
&t1->data[(j * t1->w) + i],
- orient,
oneplushalf,
vsc);
}
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
- OPJ_UINT32 orient,
OPJ_INT32 bpno,
OPJ_INT32 one,
OPJ_INT32 *nmsedec,
goto LABEL_PARTIAL;
}
if (!(*flagsp & (T1_SIG | T1_VISIT))) {
- opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(flag, orient));
+ opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(mqc, flag));
v = (opj_int_abs(*datap) & one) ? 1 : 0;
opj_mqc_encode(mqc, (OPJ_UINT32)v);
if (v) {
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
- OPJ_INT32 orient,
OPJ_INT32 oneplushalf)
{
OPJ_INT32 v, flag;
opj_mqc_t *mqc = t1->mqc; /* MQC component */
- OPJ_ARG_NOT_USED(orient);
-
flag = *flagsp;
opj_mqc_setcurctx(mqc, opj_t1_getctxno_sc((OPJ_UINT32)flag));
v = opj_mqc_decode(mqc) ^ opj_t1_getspb((OPJ_UINT32)flag);
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
- OPJ_INT32 orient,
OPJ_INT32 oneplushalf)
{
OPJ_INT32 v, flag;
flag = *flagsp;
if (!(flag & (T1_SIG | T1_VISIT))) {
- opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc((OPJ_UINT32)flag, (OPJ_UINT32)orient));
+ opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(mqc, (OPJ_UINT32)flag));
if (opj_mqc_decode(mqc)) {
opj_mqc_setcurctx(mqc, opj_t1_getctxno_sc((OPJ_UINT32)flag));
v = opj_mqc_decode(mqc) ^ opj_t1_getspb((OPJ_UINT32)flag);
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
- OPJ_INT32 orient,
OPJ_INT32 oneplushalf)
{
OPJ_INT32 v;
flag = *flagsp;
/*if (!(flag & (T1_SIG | T1_VISIT)))*/
{
- opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc((OPJ_UINT32)flag, (OPJ_UINT32)orient));
+ opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(mqc, (OPJ_UINT32)flag));
if (opj_mqc_decode(mqc)) {
opj_mqc_setcurctx(mqc, opj_t1_getctxno_sc((OPJ_UINT32)flag));
v = opj_mqc_decode(mqc) ^ opj_t1_getspb((OPJ_UINT32)flag);
opj_t1_t *t1,
opj_flag_t *flagsp,
OPJ_INT32 *datap,
- OPJ_INT32 orient,
OPJ_INT32 oneplushalf,
OPJ_INT32 partial,
OPJ_INT32 vsc)
goto LABEL_PARTIAL;
}
if (!(flag & (T1_SIG | T1_VISIT))) {
- opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc((OPJ_UINT32)flag, (OPJ_UINT32)orient));
+ opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(mqc, (OPJ_UINT32)flag));
if (opj_mqc_decode(mqc)) {
LABEL_PARTIAL:
opj_mqc_setcurctx(mqc, opj_t1_getctxno_sc((OPJ_UINT32)flag));
static void opj_t1_enc_clnpass(
opj_t1_t *t1,
OPJ_INT32 bpno,
- OPJ_UINT32 orient,
OPJ_INT32 *nmsedec,
OPJ_UINT32 cblksty)
{
t1,
&t1->flags[((j+1) * t1->flags_stride) + i + 1],
&t1->data[(j * t1->data_stride) + i],
- orient,
bpno,
one,
nmsedec,
#define MACRO_t1_flags_internal(x,y,flags_stride) t1->flags[((x)*(flags_stride))+(y)]
-#define opj_t1_dec_clnpass_internal(t1, bpno, orient, cblksty, w, h, flags_stride) \
+#define opj_t1_dec_clnpass_internal(t1, bpno, cblksty, w, h, flags_stride) \
{ \
OPJ_INT32 one, half, oneplushalf, agg, runlen, vsc; \
OPJ_UINT32 i, j, k; \
t1, \
&t1->flags[((j+1) * flags_stride) + i + 1], \
&t1->data[(j * w) + i], \
- orient, \
oneplushalf, \
agg && (j == k + (OPJ_UINT32)runlen), \
vsc); \
for (j = (OPJ_UINT32)runlen; j < 4 && j < h; ++j) { \
flags2 += flags_stride; \
if (agg && (j == (OPJ_UINT32)runlen)) { \
- opj_t1_dec_clnpass_step_partial(t1, flags2, data2, orient, oneplushalf); \
+ opj_t1_dec_clnpass_step_partial(t1, flags2, data2, oneplushalf); \
} else { \
- opj_t1_dec_clnpass_step(t1, flags2, data2, orient, oneplushalf); \
+ opj_t1_dec_clnpass_step(t1, flags2, data2, oneplushalf); \
} \
data2 += w; \
} \
flags2 += flags_stride; \
flag = *flags2; \
if (!(flag & (T1_SIG | T1_VISIT))) \
- opj_t1_dec_clnpass_step_only_if_flag_not_sig_visit(t1, flags2, data2, orient, oneplushalf); \
+ opj_t1_dec_clnpass_step_only_if_flag_not_sig_visit(t1, flags2, data2, oneplushalf); \
*flags2 &= ~T1_VISIT; \
data2 += w; \
flags2 += flags_stride; \
flag = *flags2; \
if (!(flag & (T1_SIG | T1_VISIT))) \
- opj_t1_dec_clnpass_step_only_if_flag_not_sig_visit(t1, flags2, data2, orient, oneplushalf); \
+ opj_t1_dec_clnpass_step_only_if_flag_not_sig_visit(t1, flags2, data2, oneplushalf); \
*flags2 &= ~T1_VISIT; \
data2 += w; \
flags2 += flags_stride; \
flag = *flags2; \
if (!(flag & (T1_SIG | T1_VISIT))) \
- opj_t1_dec_clnpass_step_only_if_flag_not_sig_visit(t1, flags2, data2, orient, oneplushalf); \
+ opj_t1_dec_clnpass_step_only_if_flag_not_sig_visit(t1, flags2, data2, oneplushalf); \
*flags2 &= ~T1_VISIT; \
data2 += w; \
flags2 += flags_stride; \
flag = *flags2; \
if (!(flag & (T1_SIG | T1_VISIT))) \
- opj_t1_dec_clnpass_step_only_if_flag_not_sig_visit(t1, flags2, data2, orient, oneplushalf); \
+ opj_t1_dec_clnpass_step_only_if_flag_not_sig_visit(t1, flags2, data2, oneplushalf); \
*flags2 &= ~T1_VISIT; \
data2 += w; \
} \
opj_flag_t *flags2 = flags1 + i; \
for (j = k; j < h; ++j) { \
flags2 += flags_stride; \
- opj_t1_dec_clnpass_step(t1, flags2, data2, orient, oneplushalf); \
+ opj_t1_dec_clnpass_step(t1, flags2, data2, oneplushalf); \
data2 += w; \
} \
} \
static void opj_t1_dec_clnpass_64x64(
opj_t1_t *t1,
OPJ_INT32 bpno,
- OPJ_INT32 orient,
OPJ_INT32 cblksty)
{
- opj_t1_dec_clnpass_internal(t1, bpno, orient, cblksty, 64, 64, 66);
+ opj_t1_dec_clnpass_internal(t1, bpno, cblksty, 64, 64, 66);
}
static void opj_t1_dec_clnpass_generic(
opj_t1_t *t1,
OPJ_INT32 bpno,
- OPJ_INT32 orient,
OPJ_INT32 cblksty)
{
- opj_t1_dec_clnpass_internal(t1, bpno, orient, cblksty, t1->w, t1->h, t1->flags_stride);
+ opj_t1_dec_clnpass_internal(t1, bpno, cblksty, t1->w, t1->h, t1->flags_stride);
}
{
opj_raw_t *raw = t1->raw; /* RAW component */
opj_mqc_t *mqc = t1->mqc; /* MQC component */
+
+ mqc->lut_ctxno_zc_orient = lut_ctxno_zc + orient * 256;
OPJ_INT32 bpno_plus_one;
OPJ_UINT32 passtype;
switch (passtype) {
case 0:
if (type == T1_TYPE_RAW) {
- opj_t1_dec_sigpass_raw(t1, bpno_plus_one, (OPJ_INT32)orient, (OPJ_INT32)cblksty);
+ opj_t1_dec_sigpass_raw(t1, bpno_plus_one, (OPJ_INT32)cblksty);
} else {
if (cblksty & J2K_CCP_CBLKSTY_VSC) {
- opj_t1_dec_sigpass_mqc_vsc(t1, bpno_plus_one, (OPJ_INT32)orient);
+ opj_t1_dec_sigpass_mqc_vsc(t1, bpno_plus_one);
} else {
- opj_t1_dec_sigpass_mqc_64x64(t1, bpno_plus_one, (OPJ_INT32)orient);
+ opj_t1_dec_sigpass_mqc_64x64(t1, bpno_plus_one);
}
}
break;
}
break;
case 2:
- opj_t1_dec_clnpass_64x64(t1, bpno_plus_one, (OPJ_INT32)orient, (OPJ_INT32)cblksty);
+ opj_t1_dec_clnpass_64x64(t1, bpno_plus_one, (OPJ_INT32)cblksty);
break;
}
switch (passtype) {
case 0:
if (type == T1_TYPE_RAW) {
- opj_t1_dec_sigpass_raw(t1, bpno_plus_one, (OPJ_INT32)orient, (OPJ_INT32)cblksty);
+ opj_t1_dec_sigpass_raw(t1, bpno_plus_one, (OPJ_INT32)cblksty);
} else {
if (cblksty & J2K_CCP_CBLKSTY_VSC) {
- opj_t1_dec_sigpass_mqc_vsc(t1, bpno_plus_one, (OPJ_INT32)orient);
+ opj_t1_dec_sigpass_mqc_vsc(t1, bpno_plus_one);
} else {
- opj_t1_dec_sigpass_mqc_generic(t1, bpno_plus_one, (OPJ_INT32)orient);
+ opj_t1_dec_sigpass_mqc_generic(t1, bpno_plus_one);
}
}
break;
}
break;
case 2:
- opj_t1_dec_clnpass_generic(t1, bpno_plus_one, (OPJ_INT32)orient, (OPJ_INT32)cblksty);
+ opj_t1_dec_clnpass_generic(t1, bpno_plus_one, (OPJ_INT32)cblksty);
break;
}
OPJ_FLOAT64 cumwmsedec = 0.0;
opj_mqc_t *mqc = t1->mqc; /* MQC component */
+ mqc->lut_ctxno_zc_orient = lut_ctxno_zc + orient * 256;
OPJ_UINT32 passno;
OPJ_INT32 bpno;
switch (passtype) {
case 0:
- opj_t1_enc_sigpass(t1, bpno, orient, &nmsedec, type, cblksty);
+ opj_t1_enc_sigpass(t1, bpno, &nmsedec, type, cblksty);
break;
case 1:
opj_t1_enc_refpass(t1, bpno, &nmsedec, type, cblksty);
break;
case 2:
- opj_t1_enc_clnpass(t1, bpno, orient, &nmsedec, cblksty);
+ opj_t1_enc_clnpass(t1, bpno, &nmsedec, cblksty);
/* code switch SEGMARK (i.e. SEGSYM) */
if (cblksty & J2K_CCP_CBLKSTY_SEGSYM)
opj_mqc_segmark_enc(mqc);