static char t1_getspb(int f);
static short t1_getnmsedec_sig(int x, int bitpos);
static short t1_getnmsedec_ref(int x, int bitpos);
-static void t1_updateflags(flag_t *flagsp, int s, int stride);
+static void opj_t1_updateflags(flag_t *flagsp, OPJ_UINT32 s, OPJ_UINT32 stride);
/**
Encode significant pass
*/
/**
Decode significant pass
*/
-static void t1_dec_sigpass_step(
- opj_t1_t *t1,
- flag_t *flagsp,
- OPJ_INT32 *datap,
- OPJ_UINT32 orient,
- OPJ_INT32 oneplushalf,
- OPJ_BYTE type,
- OPJ_UINT32 vsc);
-/**
-Decode significant pass
-*/
-static INLINE void t1_dec_sigpass_step_raw(
- opj_t1_t *t1,
- flag_t *flagsp,
- int *datap,
- int orient,
- int oneplushalf,
- int vsc);
-static INLINE void t1_dec_sigpass_step_mqc(
- opj_t1_t *t1,
- flag_t *flagsp,
- int *datap,
- int orient,
- int oneplushalf);
-static INLINE void t1_dec_sigpass_step_mqc_vsc(
- opj_t1_t *t1,
- flag_t *flagsp,
- int *datap,
- int orient,
- int oneplushalf,
- int vsc);
+static void opj_t1_dec_sigpass_step(opj_t1_t *t1,
+ flag_t *flagsp,
+ OPJ_INT32 *datap,
+ OPJ_UINT32 orient,
+ OPJ_INT32 oneplushalf,
+ OPJ_BYTE type,
+ OPJ_UINT32 vsc);
+
/**
Encode significant pass
*/
/**
Decode significant pass
*/
-static void t1_dec_sigpass(
- opj_t1_t *t1,
- OPJ_INT32 bpno,
- OPJ_UINT32 orient,
- OPJ_BYTE type,
- OPJ_UINT32 cblksty);
+static void opj_t1_dec_sigpass( opj_t1_t *t1,
+ OPJ_INT32 bpno,
+ OPJ_UINT32 orient,
+ OPJ_BYTE type,
+ OPJ_UINT32 cblksty);
+
-/**
-Decode significant pass
-*/
-static void t1_dec_sigpass_raw(
- opj_t1_t *t1,
- int bpno,
- int orient,
- int cblksty);
-static void t1_dec_sigpass_mqc(
- opj_t1_t *t1,
- int bpno,
- int orient);
-static void t1_dec_sigpass_mqc_vsc(
- opj_t1_t *t1,
- int bpno,
- int orient);
/**
Encode refinement pass
*/
int *nmsedec,
char type,
int vsc);
-/**
-Decode refinement pass
-*/
-static INLINE void t1_dec_refpass_step_raw(
- opj_t1_t *t1,
- flag_t *flagsp,
- int *datap,
- int poshalf,
- int neghalf,
- int vsc);
-static INLINE void t1_dec_refpass_step_mqc(
- opj_t1_t *t1,
- flag_t *flagsp,
- int *datap,
- int poshalf,
- int neghalf);
-static INLINE void t1_dec_refpass_step_mqc_vsc(
- opj_t1_t *t1,
- flag_t *flagsp,
- int *datap,
- int poshalf,
- int neghalf,
- int vsc);
+
/**
Encode refinement pass
/**
Decode refinement pass
*/
-static void t1_dec_refpass(
- opj_t1_t *t1,
- OPJ_INT32 bpno,
- OPJ_BYTE type,
- OPJ_UINT32 cblksty);
+static void opj_t1_dec_refpass( opj_t1_t *t1,
+ OPJ_INT32 bpno,
+ OPJ_BYTE type,
+ OPJ_UINT32 cblksty);
/**
Decode refinement pass
*/
-static void t1_dec_refpass_step(
- opj_t1_t *t1,
- flag_t *flagsp,
- OPJ_INT32 *datap,
- OPJ_INT32 poshalf,
- OPJ_INT32 neghalf,
- OPJ_BYTE type,
- OPJ_UINT32 vsc);
+static void opj_t1_dec_refpass_step(opj_t1_t *t1,
+ flag_t *flagsp,
+ OPJ_INT32 *datap,
+ OPJ_INT32 poshalf,
+ OPJ_INT32 neghalf,
+ OPJ_BYTE type,
+ OPJ_UINT32 vsc);
/**
-Decode refinement pass
-*/
-static void t1_dec_refpass_raw(
- opj_t1_t *t1,
- int bpno,
- int cblksty);
-static void t1_dec_refpass_mqc(
- opj_t1_t *t1,
- int bpno);
-static void t1_dec_refpass_mqc_vsc(
- opj_t1_t *t1,
- int bpno);
-/**
Encode clean-up pass
*/
static void t1_enc_clnpass_step(
@param orient
@param roishift Region of interest shifting value
@param cblksty Code-block style
-@deprecated ?
*/
-static opj_bool t1_decode_cblk(
- opj_t1_t *t1,
- opj_tcd_cblk_dec_t* cblk,
- int orient,
- int roishift,
- int cblksty);
+static opj_bool opj_t1_decode_cblk( opj_t1_t *t1,
+ opj_tcd_cblk_dec_v2_t* cblk,
+ OPJ_UINT32 orient,
+ OPJ_UINT32 roishift,
+ OPJ_UINT32 cblksty);
-/**
-Decode 1 code-block
-@param t1 T1 handle
-@param cblk Code-block coding parameters
-@param orient
-@param roishift Region of interest shifting value
-@param cblksty Code-block style
-*/
-static opj_bool t1_decode_cblk_v2(
- opj_t1_t *t1,
- opj_tcd_cblk_dec_v2_t* cblk,
- OPJ_UINT32 orient,
- OPJ_UINT32 roishift,
- OPJ_UINT32 cblksty);
+opj_bool opj_t1_allocate_buffers( opj_t1_t *t1,
+ OPJ_UINT32 w,
+ OPJ_UINT32 h);
/*@}*/
return lut_nmsedec_ref0[x & ((1 << T1_NMSEDEC_BITS) - 1)];
}
-static void t1_updateflags(flag_t *flagsp, int s, int stride) {
+void opj_t1_updateflags(flag_t *flagsp, OPJ_UINT32 s, OPJ_UINT32 stride) {
flag_t *np = flagsp - stride;
flag_t *sp = flagsp + stride;
} else {
mqc_encode(mqc, v ^ t1_getspb(flag));
}
- t1_updateflags(flagsp, v, t1->flags_stride);
+ opj_t1_updateflags(flagsp, v, t1->flags_stride);
}
*flagsp |= T1_VISIT;
}
}
-
-static INLINE void t1_dec_sigpass_step_raw(
- opj_t1_t *t1,
- flag_t *flagsp,
- int *datap,
- int orient,
- int oneplushalf,
- int vsc)
-{
- int 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 (raw_decode(raw)) {
- v = raw_decode(raw); /* ESSAI */
- *datap = v ? -oneplushalf : oneplushalf;
- t1_updateflags(flagsp, v, t1->flags_stride);
- }
- *flagsp |= T1_VISIT;
- }
-} /* VSC and BYPASS by Antonin */
-
-static INLINE void t1_dec_sigpass_step_mqc(
- opj_t1_t *t1,
- flag_t *flagsp,
- int *datap,
- int orient,
- int oneplushalf)
-{
- int v, flag;
-
- opj_mqc_t *mqc = t1->mqc; /* MQC component */
-
- flag = *flagsp;
- if ((flag & T1_SIG_OTH) && !(flag & (T1_SIG | T1_VISIT))) {
- mqc_setcurctx(mqc, t1_getctxno_zc(flag, orient));
- if (mqc_decode(mqc)) {
- mqc_setcurctx(mqc, t1_getctxno_sc(flag));
- v = mqc_decode(mqc) ^ t1_getspb(flag);
- *datap = v ? -oneplushalf : oneplushalf;
- t1_updateflags(flagsp, v, t1->flags_stride);
- }
- *flagsp |= T1_VISIT;
- }
-} /* VSC and BYPASS by Antonin */
-
-static INLINE void t1_dec_sigpass_step_mqc_vsc(
- opj_t1_t *t1,
- flag_t *flagsp,
- int *datap,
- int orient,
- int oneplushalf,
- int vsc)
-{
- int v, flag;
-
- opj_mqc_t *mqc = t1->mqc; /* MQC component */
-
- 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))) {
- mqc_setcurctx(mqc, t1_getctxno_zc(flag, orient));
- if (mqc_decode(mqc)) {
- mqc_setcurctx(mqc, t1_getctxno_sc(flag));
- v = mqc_decode(mqc) ^ t1_getspb(flag);
- *datap = v ? -oneplushalf : oneplushalf;
- t1_updateflags(flagsp, v, t1->flags_stride);
- }
- *flagsp |= T1_VISIT;
- }
-} /* VSC and BYPASS by Antonin */
-
void opj_t1_enc_sigpass(opj_t1_t *t1,
OPJ_INT32 bpno,
OPJ_UINT32 orient,
}
}
-static void t1_dec_sigpass_raw(
- opj_t1_t *t1,
- int bpno,
- int orient,
- int cblksty)
-{
- int i, j, k, one, half, oneplushalf, vsc;
- one = 1 << bpno;
- half = one >> 1;
- oneplushalf = one | half;
- for (k = 0; k < t1->h; k += 4) {
- for (i = 0; i < t1->w; ++i) {
- for (j = k; j < k + 4 && j < t1->h; ++j) {
- vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0;
- t1_dec_sigpass_step_raw(
- t1,
- &t1->flags[((j+1) * t1->flags_stride) + i + 1],
- &t1->data[(j * t1->w) + i],
- orient,
- oneplushalf,
- vsc);
- }
- }
- }
-} /* VSC and BYPASS by Antonin */
-
-static void t1_dec_sigpass_mqc(
- opj_t1_t *t1,
- int bpno,
- int orient)
-{
- int i, j, k, one, half, oneplushalf;
- int *data1 = t1->data;
- flag_t *flags1 = &t1->flags[1];
- one = 1 << bpno;
- half = one >> 1;
- oneplushalf = one | half;
- for (k = 0; k < (t1->h & ~3); k += 4) {
- for (i = 0; i < t1->w; ++i) {
- int *data2 = data1 + i;
- flag_t *flags2 = flags1 + i;
- flags2 += t1->flags_stride;
- t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf);
- data2 += t1->w;
- flags2 += t1->flags_stride;
- t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf);
- data2 += t1->w;
- flags2 += t1->flags_stride;
- t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf);
- data2 += t1->w;
- flags2 += t1->flags_stride;
- t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf);
- data2 += t1->w;
- }
- data1 += t1->w << 2;
- flags1 += t1->flags_stride << 2;
- }
- for (i = 0; i < t1->w; ++i) {
- int *data2 = data1 + i;
- flag_t *flags2 = flags1 + i;
- for (j = k; j < t1->h; ++j) {
- flags2 += t1->flags_stride;
- t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf);
- data2 += t1->w;
- }
- }
-} /* VSC and BYPASS by Antonin */
-
-static void t1_dec_sigpass_mqc_vsc(
- opj_t1_t *t1,
- int bpno,
- int orient)
-{
- int i, j, k, one, half, oneplushalf, vsc;
- one = 1 << bpno;
- half = one >> 1;
- oneplushalf = one | half;
- for (k = 0; k < t1->h; k += 4) {
- for (i = 0; i < t1->w; ++i) {
- for (j = k; j < k + 4 && j < t1->h; ++j) {
- vsc = (j == k + 3 || j == t1->h - 1) ? 1 : 0;
- t1_dec_sigpass_step_mqc_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 */
static void t1_enc_refpass_step(
opj_t1_t *t1,
}
}
-static INLINE void t1_dec_refpass_step_raw(
- opj_t1_t *t1,
- flag_t *flagsp,
- int *datap,
- int poshalf,
- int neghalf,
- int vsc)
-{
- int v, t, flag;
-
- opj_raw_t *raw = t1->raw; /* RAW component */
-
- flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp);
- if ((flag & (T1_SIG | T1_VISIT)) == T1_SIG) {
- v = raw_decode(raw);
- t = v ? poshalf : neghalf;
- *datap += *datap < 0 ? -t : t;
- *flagsp |= T1_REFINE;
- }
-} /* VSC and BYPASS by Antonin */
-
-static INLINE void t1_dec_refpass_step_mqc(
- opj_t1_t *t1,
- flag_t *flagsp,
- int *datap,
- int poshalf,
- int neghalf)
-{
- int v, t, flag;
-
- opj_mqc_t *mqc = t1->mqc; /* MQC component */
-
- flag = *flagsp;
- if ((flag & (T1_SIG | T1_VISIT)) == T1_SIG) {
- mqc_setcurctx(mqc, t1_getctxno_mag(flag)); /* ESSAI */
- v = mqc_decode(mqc);
- t = v ? poshalf : neghalf;
- *datap += *datap < 0 ? -t : t;
- *flagsp |= T1_REFINE;
- }
-} /* VSC and BYPASS by Antonin */
-
-static INLINE void t1_dec_refpass_step_mqc_vsc(
- opj_t1_t *t1,
- flag_t *flagsp,
- int *datap,
- int poshalf,
- int neghalf,
- int vsc)
-{
- int v, t, flag;
-
- opj_mqc_t *mqc = t1->mqc; /* MQC component */
-
- flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp);
- if ((flag & (T1_SIG | T1_VISIT)) == T1_SIG) {
- mqc_setcurctx(mqc, t1_getctxno_mag(flag)); /* ESSAI */
- v = mqc_decode(mqc);
- t = v ? poshalf : neghalf;
- *datap += *datap < 0 ? -t : t;
- *flagsp |= T1_REFINE;
- }
-} /* VSC and BYPASS by Antonin */
static void t1_enc_refpass(
opj_t1_t *t1,
}
}
-static void t1_dec_refpass_raw(
- opj_t1_t *t1,
- int bpno,
- int cblksty)
-{
- int i, j, k, one, poshalf, neghalf;
- int vsc;
- one = 1 << bpno;
- poshalf = one >> 1;
- neghalf = bpno > 0 ? -poshalf : -1;
- for (k = 0; k < t1->h; k += 4) {
- for (i = 0; i < t1->w; ++i) {
- for (j = k; j < k + 4 && j < t1->h; ++j) {
- vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0;
- t1_dec_refpass_step_raw(
- t1,
- &t1->flags[((j+1) * t1->flags_stride) + i + 1],
- &t1->data[(j * t1->w) + i],
- poshalf,
- neghalf,
- vsc);
- }
- }
- }
-} /* VSC and BYPASS by Antonin */
-
-static void t1_dec_refpass_mqc(
- opj_t1_t *t1,
- int bpno)
-{
- int i, j, k, one, poshalf, neghalf;
- int *data1 = t1->data;
- flag_t *flags1 = &t1->flags[1];
- one = 1 << bpno;
- poshalf = one >> 1;
- neghalf = bpno > 0 ? -poshalf : -1;
- for (k = 0; k < (t1->h & ~3); k += 4) {
- for (i = 0; i < t1->w; ++i) {
- int *data2 = data1 + i;
- flag_t *flags2 = flags1 + i;
- flags2 += t1->flags_stride;
- t1_dec_refpass_step_mqc(t1, flags2, data2, poshalf, neghalf);
- data2 += t1->w;
- flags2 += t1->flags_stride;
- t1_dec_refpass_step_mqc(t1, flags2, data2, poshalf, neghalf);
- data2 += t1->w;
- flags2 += t1->flags_stride;
- t1_dec_refpass_step_mqc(t1, flags2, data2, poshalf, neghalf);
- data2 += t1->w;
- flags2 += t1->flags_stride;
- t1_dec_refpass_step_mqc(t1, flags2, data2, poshalf, neghalf);
- data2 += t1->w;
- }
- data1 += t1->w << 2;
- flags1 += t1->flags_stride << 2;
- }
- for (i = 0; i < t1->w; ++i) {
- int *data2 = data1 + i;
- flag_t *flags2 = flags1 + i;
- for (j = k; j < t1->h; ++j) {
- flags2 += t1->flags_stride;
- t1_dec_refpass_step_mqc(t1, flags2, data2, poshalf, neghalf);
- data2 += t1->w;
- }
- }
-} /* VSC and BYPASS by Antonin */
-
-static void t1_dec_refpass_mqc_vsc(
- opj_t1_t *t1,
- int bpno)
-{
- int i, j, k, one, poshalf, neghalf;
- int vsc;
- one = 1 << bpno;
- poshalf = one >> 1;
- neghalf = bpno > 0 ? -poshalf : -1;
- for (k = 0; k < t1->h; k += 4) {
- for (i = 0; i < t1->w; ++i) {
- for (j = k; j < k + 4 && j < t1->h; ++j) {
- vsc = ((j == k + 3 || j == t1->h - 1)) ? 1 : 0;
- t1_dec_refpass_step_mqc_vsc(
- t1,
- &t1->flags[((j+1) * t1->flags_stride) + i + 1],
- &t1->data[(j * t1->w) + i],
- poshalf,
- neghalf,
- vsc);
- }
- }
- }
-} /* VSC and BYPASS by Antonin */
static void t1_enc_clnpass_step(
opj_t1_t *t1,
mqc_setcurctx(mqc, t1_getctxno_sc(flag));
v = *datap < 0 ? 1 : 0;
mqc_encode(mqc, v ^ t1_getspb(flag));
- t1_updateflags(flagsp, v, t1->flags_stride);
+ opj_t1_updateflags(flagsp, v, t1->flags_stride);
}
}
*flagsp &= ~T1_VISIT;
mqc_setcurctx(mqc, t1_getctxno_sc(flag));
v = mqc_decode(mqc) ^ t1_getspb(flag);
*datap = v ? -oneplushalf : oneplushalf;
- t1_updateflags(flagsp, v, t1->flags_stride);
+ opj_t1_updateflags(flagsp, v, t1->flags_stride);
*flagsp &= ~T1_VISIT;
} /* VSC and BYPASS by Antonin */
mqc_setcurctx(mqc, t1_getctxno_sc(flag));
v = mqc_decode(mqc) ^ t1_getspb(flag);
*datap = v ? -oneplushalf : oneplushalf;
- t1_updateflags(flagsp, v, t1->flags_stride);
+ opj_t1_updateflags(flagsp, v, t1->flags_stride);
}
}
*flagsp &= ~T1_VISIT;
mqc_setcurctx(mqc, t1_getctxno_sc(flag));
v = mqc_decode(mqc) ^ t1_getspb(flag);
*datap = v ? -oneplushalf : oneplushalf;
- t1_updateflags(flagsp, v, t1->flags_stride);
+ opj_t1_updateflags(flagsp, v, t1->flags_stride);
}
}
*flagsp &= ~T1_VISIT;
return wmsedec;
}
-static opj_bool allocate_buffers(
+opj_bool opj_t1_allocate_buffers(
opj_t1_t *t1,
- int w,
- int h)
+ OPJ_UINT32 w,
+ OPJ_UINT32 h)
{
- int datasize=w * h;
- int flagssize;
+ OPJ_UINT32 datasize=w * h;
+ OPJ_UINT32 flagssize;
if(datasize > t1->datasize){
opj_aligned_free(t1->data);
- t1->data = (int*) opj_aligned_malloc(datasize * sizeof(int));
+ t1->data = (OPJ_INT32*) opj_aligned_malloc(datasize * sizeof(OPJ_INT32));
if(!t1->data){
return OPJ_FALSE;
}
t1->datasize=datasize;
}
- memset(t1->data,0,datasize * sizeof(int));
+ memset(t1->data,0,datasize * sizeof(OPJ_INT32));
t1->flags_stride=w+2;
flagssize=t1->flags_stride * (h+2);
}
}
-static opj_bool t1_decode_cblk(
- opj_t1_t *t1,
- opj_tcd_cblk_dec_t* cblk,
- int orient,
- int roishift,
- int cblksty)
-{
- opj_raw_t *raw = t1->raw; /* RAW component */
- opj_mqc_t *mqc = t1->mqc; /* MQC component */
-
- int bpno, passtype;
- int segno, passno;
- char type = T1_TYPE_MQ; /* BYPASS mode */
-
- if(!allocate_buffers(
- t1,
- cblk->x1 - cblk->x0,
- cblk->y1 - cblk->y0))
- {
- return OPJ_FALSE;
- }
-
- bpno = roishift + cblk->numbps - 1;
- passtype = 2;
-
- mqc_resetstates(mqc);
- mqc_setstate(mqc, T1_CTXNO_UNI, 0, 46);
- mqc_setstate(mqc, T1_CTXNO_AGG, 0, 3);
- mqc_setstate(mqc, T1_CTXNO_ZC, 0, 4);
-
- for (segno = 0; segno < cblk->numsegs; ++segno) {
- opj_tcd_seg_t *seg = &cblk->segs[segno];
-
- /* BYPASS mode */
- type = ((bpno <= (cblk->numbps - 1) - 4) && (passtype < 2) && (cblksty & J2K_CCP_CBLKSTY_LAZY)) ? T1_TYPE_RAW : T1_TYPE_MQ;
- /* FIXME: slviewer gets here with a null pointer. Why? Partially downloaded and/or corrupt textures? */
- if(seg->data == NULL){
- continue;
- }
- if (type == T1_TYPE_RAW) {
- raw_init_dec(raw, (*seg->data) + seg->dataindex, seg->len);
- } else {
- if (OPJ_FALSE == mqc_init_dec(mqc, (*seg->data) + seg->dataindex, seg->len)) {
- return OPJ_FALSE;
- }
- }
-
- for (passno = 0; passno < seg->numpasses; ++passno) {
- switch (passtype) {
- case 0:
- if (type == T1_TYPE_RAW) {
- t1_dec_sigpass_raw(t1, bpno+1, orient, cblksty);
- } else {
- if (cblksty & J2K_CCP_CBLKSTY_VSC) {
- t1_dec_sigpass_mqc_vsc(t1, bpno+1, orient);
- } else {
- t1_dec_sigpass_mqc(t1, bpno+1, orient);
- }
- }
- break;
- case 1:
- if (type == T1_TYPE_RAW) {
- t1_dec_refpass_raw(t1, bpno+1, cblksty);
- } else {
- if (cblksty & J2K_CCP_CBLKSTY_VSC) {
- t1_dec_refpass_mqc_vsc(t1, bpno+1);
- } else {
- t1_dec_refpass_mqc(t1, bpno+1);
- }
- }
- break;
- case 2:
- t1_dec_clnpass(t1, bpno+1, orient, cblksty);
- break;
- }
-
- if ((cblksty & J2K_CCP_CBLKSTY_RESET) && type == T1_TYPE_MQ) {
- mqc_resetstates(mqc);
- mqc_setstate(mqc, T1_CTXNO_UNI, 0, 46);
- mqc_setstate(mqc, T1_CTXNO_AGG, 0, 3);
- mqc_setstate(mqc, T1_CTXNO_ZC, 0, 4);
- }
- if (++passtype == 3) {
- passtype = 0;
- bpno--;
- }
- }
- }
- return OPJ_TRUE;
-}
/* ----------------------------------------------------------------------- */
y += pres->y1 - pres->y0;
}
- if(!allocate_buffers(
+ if(!opj_t1_allocate_buffers(
t1,
cblk->x1 - cblk->x0,
cblk->y1 - cblk->y0))
OPJ_INT32 x, y;
OPJ_UINT32 i, j;
- if (OPJ_FALSE == t1_decode_cblk_v2(
- t1,
- cblk,
- band->bandno,
- tccp->roishift,
- tccp->cblksty)) {
- return OPJ_FALSE;
- }
+ if (OPJ_FALSE == opj_t1_decode_cblk(
+ t1,
+ cblk,
+ band->bandno,
+ tccp->roishift,
+ tccp->cblksty)) {
+ return OPJ_FALSE;
+ }
x = cblk->x0 - band->x0;
y = cblk->y0 - band->y0;
}
-static opj_bool t1_decode_cblk_v2(
- opj_t1_t *t1,
- opj_tcd_cblk_dec_v2_t* cblk,
- OPJ_UINT32 orient,
- OPJ_UINT32 roishift,
- OPJ_UINT32 cblksty)
+opj_bool opj_t1_decode_cblk(opj_t1_t *t1,
+ opj_tcd_cblk_dec_v2_t* cblk,
+ OPJ_UINT32 orient,
+ OPJ_UINT32 roishift,
+ OPJ_UINT32 cblksty)
{
opj_raw_t *raw = t1->raw; /* RAW component */
opj_mqc_t *mqc = t1->mqc; /* MQC component */
OPJ_UINT32 segno, passno;
OPJ_BYTE type = T1_TYPE_MQ; /* BYPASS mode */
- if(!allocate_buffers(
+ if(!opj_t1_allocate_buffers(
t1,
cblk->x1 - cblk->x0,
cblk->y1 - cblk->y0))
if (type == T1_TYPE_RAW) {
raw_init_dec(raw, (*seg->data) + seg->dataindex, seg->len);
} else {
- if (OPJ_FALSE == mqc_init_dec(mqc, (*seg->data) + seg->dataindex, seg->len)) {
- return OPJ_FALSE;
- }
+ if (OPJ_FALSE == mqc_init_dec(mqc, (*seg->data) + seg->dataindex, seg->len)) {
+ return OPJ_FALSE;
+ }
}
for (passno = 0; passno < seg->real_num_passes; ++passno) {
switch (passtype) {
case 0:
- t1_dec_sigpass(t1, bpno+1, orient, type, cblksty);
+ opj_t1_dec_sigpass(t1, bpno+1, orient, type, cblksty);
break;
case 1:
- t1_dec_refpass(t1, bpno+1, type, cblksty);
+ opj_t1_dec_refpass(t1, bpno+1, type, cblksty);
break;
case 2:
t1_dec_clnpass(t1, bpno+1, orient, cblksty);
y += pres->y1 - pres->y0;
}
- if(!allocate_buffers(
+ if(!opj_t1_allocate_buffers(
t1,
cblk->x1 - cblk->x0,
cblk->y1 - cblk->y0))
}
}
-
-static void t1_dec_refpass(
- opj_t1_t *t1,
- OPJ_INT32 bpno,
- OPJ_BYTE type,
- OPJ_UINT32 cblksty)
+void opj_t1_dec_refpass(opj_t1_t *t1,
+ OPJ_INT32 bpno,
+ OPJ_BYTE type,
+ OPJ_UINT32 cblksty)
{
OPJ_UINT32 i, j, k;
OPJ_INT32 one, poshalf, neghalf;
for (i = 0; i < t1->w; ++i) {
for (j = k; j < k + 4 && j < t1->h; ++j) {
vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0;
- t1_dec_refpass_step(
+ opj_t1_dec_refpass_step(
t1,
&t1->flags[((j+1) * t1->flags_stride) + i + 1],
&t1->data[(j * t1->w) + i],
} /* VSC and BYPASS by Antonin */
-static void t1_dec_refpass_step(
- opj_t1_t *t1,
- flag_t *flagsp,
- OPJ_INT32 *datap,
- OPJ_INT32 poshalf,
- OPJ_INT32 neghalf,
- OPJ_BYTE type,
- OPJ_UINT32 vsc)
+void opj_t1_dec_refpass_step( opj_t1_t *t1,
+ flag_t *flagsp,
+ OPJ_INT32 *datap,
+ OPJ_INT32 poshalf,
+ OPJ_INT32 neghalf,
+ OPJ_BYTE type,
+ OPJ_UINT32 vsc)
{
OPJ_INT32 t;
OPJ_UINT32 v,flag;
}
} /* VSC and BYPASS by Antonin */
-static void t1_dec_sigpass(
- opj_t1_t *t1,
- OPJ_INT32 bpno,
- OPJ_UINT32 orient,
- OPJ_BYTE type,
- OPJ_UINT32 cblksty)
+void opj_t1_dec_sigpass(opj_t1_t *t1,
+ OPJ_INT32 bpno,
+ OPJ_UINT32 orient,
+ OPJ_BYTE type,
+ OPJ_UINT32 cblksty)
{
OPJ_UINT32 i, j, k, vsc;
OPJ_INT32 one, half, oneplushalf;
for (i = 0; i < t1->w; ++i) {
for (j = k; j < k + 4 && j < t1->h; ++j) {
vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0;
- t1_dec_sigpass_step(
+ opj_t1_dec_sigpass_step(
t1,
&t1->flags[((j+1) * t1->flags_stride) + i + 1],
&t1->data[(j * t1->w) + i],
}
} /* VSC and BYPASS by Antonin */
-static void t1_dec_sigpass_step(
- opj_t1_t *t1,
- flag_t *flagsp,
- OPJ_INT32 *datap,
- OPJ_UINT32 orient,
- OPJ_INT32 oneplushalf,
- OPJ_BYTE type,
- OPJ_UINT32 vsc)
+void opj_t1_dec_sigpass_step( opj_t1_t *t1,
+ flag_t *flagsp,
+ OPJ_INT32 *datap,
+ OPJ_UINT32 orient,
+ OPJ_INT32 oneplushalf,
+ OPJ_BYTE type,
+ OPJ_UINT32 vsc)
{
OPJ_UINT32 v, flag;
if (raw_decode(raw)) {
v = raw_decode(raw); /* ESSAI */
*datap = v ? -oneplushalf : oneplushalf;
- t1_updateflags(flagsp, v, t1->flags_stride);
+ opj_t1_updateflags(flagsp, v, t1->flags_stride);
}
} else {
mqc_setcurctx(mqc, t1_getctxno_zc(flag, orient));
mqc_setcurctx(mqc, t1_getctxno_sc(flag));
v = mqc_decode(mqc) ^ t1_getspb(flag);
*datap = v ? -oneplushalf : oneplushalf;
- t1_updateflags(flagsp, v, t1->flags_stride);
+ opj_t1_updateflags(flagsp, v, t1->flags_stride);
}
}
*flagsp |= T1_VISIT;