/**
Encode significant pass
*/
-static void t1_enc_sigpass_step(opj_t1_t *t1, flag_t *flagsp, int *dp, int orient, int bpno, int one, int *nmsedec, char type, int vsc);
+static void t1_enc_sigpass_step(
+ opj_t1_t *t1,
+ flag_t *flagsp,
+ int *dp,
+ int orient,
+ int bpno,
+ int one,
+ int *nmsedec,
+ char type,
+ int vsc);
/**
Decode significant pass
*/
-static void t1_dec_sigpass_step(opj_t1_t *t1, flag_t *flagsp, int *dp, int orient, int oneplushalf, char type, int vsc);
+static void t1_dec_sigpass_step(
+ opj_t1_t *t1,
+ flag_t *flagsp,
+ int *dp,
+ int orient,
+ int oneplushalf,
+ char type,
+ int vsc);
/**
Encode significant pass
*/
-static void t1_enc_sigpass(opj_t1_t *t1, int w, int h, int bpno, int orient, int *nmsedec, char type, int cblksty);
+static void t1_enc_sigpass(
+ opj_t1_t *t1,
+ int w,
+ int h,
+ int bpno,
+ int orient,
+ int *nmsedec,
+ char type,
+ int cblksty);
/**
Decode significant pass
*/
-static void t1_dec_sigpass(opj_t1_t *t1, int w, int h, int bpno, int orient, char type, int cblksty);
+static void t1_dec_sigpass(
+ opj_t1_t *t1,
+ int w,
+ int h,
+ int bpno,
+ int orient,
+ char type,
+ int cblksty);
/**
Encode refinement pass
*/
-static void t1_enc_refpass_step(opj_t1_t *t1, flag_t *flagsp, int *dp, int bpno, int one, int *nmsedec, char type, int vsc);
+static void t1_enc_refpass_step(
+ opj_t1_t *t1,
+ flag_t *flagsp,
+ int *dp,
+ int bpno,
+ int one,
+ int *nmsedec,
+ char type,
+ int vsc);
/**
Decode refinement pass
*/
-static void t1_dec_refpass_step(opj_t1_t *t1, flag_t *flagsp, int *dp, int poshalf, int neghalf, char type, int vsc);
+static void t1_dec_refpass_step(
+ opj_t1_t *t1,
+ flag_t *flagsp,
+ int *dp,
+ int poshalf,
+ int neghalf,
+ char type,
+ int vsc);
/**
Encode refinement pass
*/
-static void t1_enc_refpass(opj_t1_t *t1, int w, int h, int bpno, int *nmsedec, char type, int cblksty);
+static void t1_enc_refpass(
+ opj_t1_t *t1,
+ int w,
+ int h,
+ int bpno,
+ int *nmsedec,
+ char type,
+ int cblksty);
/**
Decode refinement pass
*/
-static void t1_dec_refpass(opj_t1_t *t1, int w, int h, int bpno, char type, int cblksty);
+static void t1_dec_refpass(
+ opj_t1_t *t1,
+ int w,
+ int h,
+ int bpno,
+ char type,
+ int cblksty);
/**
Encode clean-up pass
*/
-static void t1_enc_clnpass_step(opj_t1_t *t1, flag_t *flagsp, int *dp, int orient, int bpno, int one, int *nmsedec, int partial, int vsc);
+static void t1_enc_clnpass_step(
+ opj_t1_t *t1,
+ flag_t *flagsp,
+ int *dp,
+ int orient,
+ int bpno,
+ int one,
+ int *nmsedec,
+ int partial,
+ int vsc);
/**
Decode clean-up pass
*/
-static void t1_dec_clnpass_step(opj_t1_t *t1, flag_t *flagsp, int *dp, int orient, int oneplushalf, int partial, int vsc);
+static void t1_dec_clnpass_step(
+ opj_t1_t *t1,
+ flag_t *flagsp,
+ int *dp,
+ int orient,
+ int oneplushalf,
+ int partial,
+ int vsc);
/**
Encode clean-up pass
*/
-static void t1_enc_clnpass(opj_t1_t *t1, int w, int h, int bpno, int orient, int *nmsedec, int cblksty);
+static void t1_enc_clnpass(
+ opj_t1_t *t1,
+ int w,
+ int h,
+ int bpno,
+ int orient,
+ int *nmsedec,
+ int cblksty);
/**
Decode clean-up pass
*/
-static void t1_dec_clnpass(opj_t1_t *t1, int w, int h, int bpno, int orient, int cblksty);
-static double t1_getwmsedec(int nmsedec, int compno, int level, int orient, int bpno, int qmfbid, double stepsize, int numcomps);
+static void t1_dec_clnpass(
+ opj_t1_t *t1,
+ int w,
+ int h,
+ int bpno,
+ int orient,
+ int cblksty);
+static double t1_getwmsedec(
+ int nmsedec,
+ int compno,
+ int level,
+ int orient,
+ int bpno,
+ int qmfbid,
+ double stepsize,
+ int numcomps);
/**
Encode 1 code-block
@param t1 T1 handle
@param numcomps
@param tile
*/
-static void t1_encode_cblk(opj_t1_t *t1, opj_tcd_cblk_t * cblk, int orient, int compno, int level, int qmfbid, double stepsize, int cblksty, int numcomps, opj_tcd_tile_t * tile);
+static void t1_encode_cblk(
+ opj_t1_t *t1,
+ opj_tcd_cblk_t * cblk,
+ int orient,
+ int compno,
+ int level,
+ int qmfbid,
+ double stepsize,
+ int cblksty,
+ int numcomps,
+ opj_tcd_tile_t * tile);
/**
Decode 1 code-block
@param t1 T1 handle
@param roishift Region of interest shifting value
@param cblksty Code-block style
*/
-static void t1_decode_cblk(opj_t1_t *t1, opj_tcd_cblk_t * cblk, int orient, int roishift, int cblksty);
+static void t1_decode_cblk(
+ opj_t1_t *t1,
+ opj_tcd_cblk_t * cblk,
+ int orient,
+ int roishift,
+ int cblksty);
/*@}*/
}
}
-static void t1_enc_sigpass_step(opj_t1_t *t1, flag_t *flagsp, int *dp, int orient, int bpno, int one, int *nmsedec, char type, int vsc) {
+static void t1_enc_sigpass_step(
+ opj_t1_t *t1,
+ flag_t *flagsp,
+ int *dp,
+ int orient,
+ int bpno,
+ int one,
+ int *nmsedec,
+ char type,
+ int vsc)
+{
int v, flag;
opj_mqc_t *mqc = t1->mqc; /* MQC component */
}
}
-static void t1_dec_sigpass_step(opj_t1_t *t1, flag_t *flagsp, int *dp, int orient, int oneplushalf, char type, int vsc) {
+static void t1_dec_sigpass_step(
+ opj_t1_t *t1,
+ flag_t *flagsp,
+ int *dp,
+ int orient,
+ int oneplushalf,
+ char type,
+ int vsc)
+{
int v, flag;
opj_raw_t *raw = t1->raw; /* RAW component */
}
} /* VSC and BYPASS by Antonin */
-static void t1_enc_sigpass(opj_t1_t *t1, int w, int h, int bpno, int orient, int *nmsedec, char type, int cblksty) {
+static void t1_enc_sigpass(
+ opj_t1_t *t1,
+ int w,
+ int h,
+ int bpno,
+ int orient,
+ int *nmsedec,
+ char type,
+ int cblksty)
+{
int i, j, k, one, vsc;
*nmsedec = 0;
one = 1 << (bpno + T1_NMSEDEC_FRACBITS);
for (k = 0; k < h; k += 4) {
- for (i = 0; i < w; i++) {
- for (j = k; j < k + 4 && j < h; j++) {
+ for (i = 0; i < w; ++i) {
+ for (j = k; j < k + 4 && j < h; ++j) {
vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == h - 1)) ? 1 : 0;
- t1_enc_sigpass_step(t1, &t1->flags[1 + j][1 + i], &t1->data[j][i], orient, bpno, one, nmsedec, type, vsc);
+ t1_enc_sigpass_step(
+ t1,
+ &t1->flags[1 + j][1 + i],
+ &t1->data[j][i],
+ orient,
+ bpno,
+ one,
+ nmsedec,
+ type,
+ vsc);
}
}
}
}
-static void t1_dec_sigpass(opj_t1_t *t1, int w, int h, int bpno, int orient, char type, int cblksty) {
+static void t1_dec_sigpass(
+ opj_t1_t *t1,
+ int w,
+ int h,
+ int bpno,
+ int orient,
+ char type,
+ int cblksty)
+{
int i, j, k, one, half, oneplushalf, vsc;
one = 1 << bpno;
half = one >> 1;
oneplushalf = one | half;
for (k = 0; k < h; k += 4) {
- for (i = 0; i < w; i++) {
- for (j = k; j < k + 4 && j < h; j++) {
+ for (i = 0; i < w; ++i) {
+ for (j = k; j < k + 4 && j < h; ++j) {
vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == h - 1)) ? 1 : 0;
- t1_dec_sigpass_step(t1, &t1->flags[1 + j][1 + i], &t1->data[j][i], orient, oneplushalf, type, vsc);
+ t1_dec_sigpass_step(
+ t1,
+ &t1->flags[1 + j][1 + i],
+ &t1->data[j][i],
+ orient,
+ oneplushalf,
+ type,
+ vsc);
}
}
}
} /* VSC and BYPASS by Antonin */
-static void t1_enc_refpass_step(opj_t1_t *t1, flag_t *flagsp, int *dp, int bpno, int one, int *nmsedec, char type, int vsc) {
+static void t1_enc_refpass_step(
+ opj_t1_t *t1,
+ flag_t *flagsp,
+ int *dp,
+ int bpno,
+ int one,
+ int *nmsedec,
+ char type,
+ int vsc)
+{
int v, flag;
opj_mqc_t *mqc = t1->mqc; /* MQC component */
}
}
-static void t1_dec_refpass_step(opj_t1_t *t1, flag_t *flagsp, int *dp, int poshalf, int neghalf, char type, int vsc) {
+static void t1_dec_refpass_step(
+ opj_t1_t *t1,
+ flag_t *flagsp,
+ int *dp,
+ int poshalf,
+ int neghalf,
+ char type,
+ int vsc)
+{
int v, t, flag;
opj_mqc_t *mqc = t1->mqc; /* MQC component */
}
} /* VSC and BYPASS by Antonin */
-static void t1_enc_refpass(opj_t1_t *t1, int w, int h, int bpno, int *nmsedec, char type, int cblksty) {
+static void t1_enc_refpass(
+ opj_t1_t *t1,
+ int w,
+ int h,
+ int bpno,
+ int *nmsedec,
+ char type,
+ int cblksty)
+{
int i, j, k, one, vsc;
*nmsedec = 0;
one = 1 << (bpno + T1_NMSEDEC_FRACBITS);
for (k = 0; k < h; k += 4) {
- for (i = 0; i < w; i++) {
- for (j = k; j < k + 4 && j < h; j++) {
+ for (i = 0; i < w; ++i) {
+ for (j = k; j < k + 4 && j < h; ++j) {
vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == h - 1)) ? 1 : 0;
- t1_enc_refpass_step(t1, &t1->flags[1 + j][1 + i], &t1->data[j][i], bpno, one, nmsedec, type, vsc);
+ t1_enc_refpass_step(
+ t1,
+ &t1->flags[1 + j][1 + i],
+ &t1->data[j][i],
+ bpno,
+ one,
+ nmsedec,
+ type,
+ vsc);
}
}
}
}
-static void t1_dec_refpass(opj_t1_t *t1, int w, int h, int bpno, char type, int cblksty) {
+static void t1_dec_refpass(
+ opj_t1_t *t1,
+ int w,
+ int h,
+ int bpno,
+ char type,
+ 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 < h; k += 4) {
- for (i = 0; i < w; i++) {
- for (j = k; j < k + 4 && j < h; j++) {
+ for (i = 0; i < w; ++i) {
+ for (j = k; j < k + 4 && j < h; ++j) {
vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == h - 1)) ? 1 : 0;
- t1_dec_refpass_step(t1, &t1->flags[1 + j][1 + i], &t1->data[j][i], poshalf, neghalf, type, vsc);
+ t1_dec_refpass_step(
+ t1,
+ &t1->flags[1 + j][1 + i],
+ &t1->data[j][i],
+ poshalf,
+ neghalf,
+ type,
+ vsc);
}
}
}
} /* VSC and BYPASS by Antonin */
-static void t1_enc_clnpass_step(opj_t1_t *t1, flag_t *flagsp, int *dp, int orient, int bpno, int one, int *nmsedec, int partial, int vsc) {
+static void t1_enc_clnpass_step(
+ opj_t1_t *t1,
+ flag_t *flagsp,
+ int *dp,
+ int orient,
+ int bpno,
+ int one,
+ int *nmsedec,
+ int partial,
+ int vsc)
+{
int v, flag;
opj_mqc_t *mqc = t1->mqc; /* MQC component */
*flagsp &= ~T1_VISIT;
}
-static void t1_dec_clnpass_step(opj_t1_t *t1, flag_t *flagsp, int *dp, int orient, int oneplushalf, int partial, int vsc) {
+static void t1_dec_clnpass_step(
+ opj_t1_t *t1,
+ flag_t *flagsp,
+ int *dp,
+ int orient,
+ int oneplushalf,
+ int partial,
+ int vsc)
+{
int v, flag;
opj_mqc_t *mqc = t1->mqc; /* MQC component */
*flagsp &= ~T1_VISIT;
} /* VSC and BYPASS by Antonin */
-static void t1_enc_clnpass(opj_t1_t *t1, int w, int h, int bpno, int orient, int *nmsedec, int cblksty) {
+static void t1_enc_clnpass(
+ opj_t1_t *t1,
+ int w,
+ int h,
+ int bpno,
+ int orient,
+ int *nmsedec,
+ int cblksty)
+{
int i, j, k, one, agg, runlen, vsc;
opj_mqc_t *mqc = t1->mqc; /* MQC component */
*nmsedec = 0;
one = 1 << (bpno + T1_NMSEDEC_FRACBITS);
for (k = 0; k < h; k += 4) {
- for (i = 0; i < w; i++) {
+ for (i = 0; i < w; ++i) {
if (k + 3 < h) {
if (cblksty & J2K_CCP_CBLKSTY_VSC) {
agg = !(t1->flags[1 + k][1 + i] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
agg = 0;
}
if (agg) {
- for (runlen = 0; runlen < 4; runlen++) {
+ for (runlen = 0; runlen < 4; ++runlen) {
if (int_abs(t1->data[k + runlen][i]) & one)
break;
}
} else {
runlen = 0;
}
- for (j = k + runlen; j < k + 4 && j < h; j++) {
+ for (j = k + runlen; j < k + 4 && j < h; ++j) {
vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == h - 1)) ? 1 : 0;
t1_enc_clnpass_step(t1, &t1->flags[1 + j][1 + i], &t1->data[j][i], orient, bpno, one, nmsedec, agg && (j == k + runlen), vsc);
}
}
}
-static void t1_dec_clnpass(opj_t1_t *t1, int w, int h, int bpno, int orient, int cblksty) {
+static void t1_dec_clnpass(
+ opj_t1_t *t1,
+ int w,
+ int h,
+ int bpno,
+ int orient,
+ int cblksty)
+{
int i, j, k, one, half, oneplushalf, agg, runlen, vsc;
int segsym = cblksty & J2K_CCP_CBLKSTY_SEGSYM;
half = one >> 1;
oneplushalf = one | half;
for (k = 0; k < h; k += 4) {
- for (i = 0; i < w; i++) {
+ for (i = 0; i < w; ++i) {
if (k + 3 < h) {
if (cblksty & J2K_CCP_CBLKSTY_VSC) {
agg = !(t1->flags[1 + k][1 + i] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
} else {
runlen = 0;
}
- for (j = k + runlen; j < k + 4 && j < h; j++) {
+ for (j = k + runlen; j < k + 4 && j < h; ++j) {
vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == h - 1)) ? 1 : 0;
- t1_dec_clnpass_step(t1, &t1->flags[1 + j][1 + i], &t1->data[j][i], orient, oneplushalf, agg && (j == k + runlen), vsc);
+ t1_dec_clnpass_step(
+ t1,
+ &t1->flags[1 + j][1 + i],
+ &t1->data[j][i],
+ orient,
+ oneplushalf,
+ agg && (j == k + runlen),
+ vsc);
}
}
}
/** mod fixed_quality */
-static double t1_getwmsedec(int nmsedec, int compno, int level, int orient, int bpno, int qmfbid, double stepsize, int numcomps) {
+static double t1_getwmsedec(
+ int nmsedec,
+ int compno,
+ int level,
+ int orient,
+ int bpno,
+ int qmfbid,
+ double stepsize,
+ int numcomps)
+{
double w1, w2, wmsedec;
if (qmfbid == 1) {
w1 = (numcomps > 1) ? mct_getnorm(compno) : 1;
}
/** mod fixed_quality */
-static void t1_encode_cblk(opj_t1_t *t1, opj_tcd_cblk_t * cblk, int orient, int compno, int level, int qmfbid, double stepsize, int cblksty, int numcomps, opj_tcd_tile_t * tile) {
+static void t1_encode_cblk(
+ opj_t1_t *t1,
+ opj_tcd_cblk_t * cblk,
+ int orient,
+ int compno,
+ int level,
+ int qmfbid,
+ double stepsize,
+ int cblksty,
+ int numcomps,
+ opj_tcd_tile_t * tile)
+{
int i, j;
int w, h;
int passno;
h = cblk->y1 - cblk->y0;
max = 0;
- for (j = 0; j < h; j++) {
- for (i = 0; i < w; i++) {
+ for (j = 0; j < h; ++j) {
+ for (i = 0; i < w; ++i) {
max = int_max(max, int_abs(t1->data[j][i]));
}
}
mqc_setstate(mqc, T1_CTXNO_ZC, 0, 4);
mqc_init_enc(mqc, cblk->data);
- for (passno = 0; bpno >= 0; passno++) {
+ for (passno = 0; bpno >= 0; ++passno) {
opj_tcd_pass_t *pass = &cblk->passes[passno];
int correction = 3;
type = ((bpno < (cblk->numbps - 4)) && (passtype < 2) && (cblksty & J2K_CCP_CBLKSTY_LAZY)) ? T1_TYPE_RAW : T1_TYPE_MQ;
}
}
-static void t1_decode_cblk(opj_t1_t *t1, opj_tcd_cblk_t * cblk, int orient, int roishift, int cblksty) {
+static void t1_decode_cblk(
+ opj_t1_t *t1,
+ opj_tcd_cblk_t * cblk,
+ int orient,
+ int roishift,
+ int cblksty)
+{
int i, w, h;
int bpno, passtype;
int segno, passno;
mqc_setstate(mqc, T1_CTXNO_AGG, 0, 3);
mqc_setstate(mqc, T1_CTXNO_ZC, 0, 4);
- for (segno = 0; segno < cblk->numsegs; segno++) {
+ for (segno = 0; segno < cblk->numsegs; ++segno) {
opj_tcd_seg_t *seg = &cblk->segs[segno];
/* BYPASS mode */
mqc_init_dec(mqc, seg->data, seg->len);
}
- for (passno = 0; passno < seg->numpasses; passno++) {
+ for (passno = 0; passno < seg->numpasses; ++passno) {
switch (passtype) {
case 0:
t1_dec_sigpass(t1, w, h, bpno+1, orient, type, cblksty);
}
}
-void t1_encode_cblks(opj_t1_t *t1, opj_tcd_tile_t *tile, opj_tcp_t *tcp) {
+void t1_encode_cblks(
+ opj_t1_t *t1,
+ opj_tcd_tile_t *tile,
+ opj_tcp_t *tcp)
+{
int compno, resno, bandno, precno, cblkno;
tile->distotile = 0; /* fixed_quality */
- for (compno = 0; compno < tile->numcomps; compno++) {
+ for (compno = 0; compno < tile->numcomps; ++compno) {
opj_tcd_tilecomp_t *tilec = &tile->comps[compno];
- for (resno = 0; resno < tilec->numresolutions; resno++) {
+ for (resno = 0; resno < tilec->numresolutions; ++resno) {
opj_tcd_resolution_t *res = &tilec->resolutions[resno];
- for (bandno = 0; bandno < res->numbands; bandno++) {
+ for (bandno = 0; bandno < res->numbands; ++bandno) {
opj_tcd_band_t *band = &res->bands[bandno];
- for (precno = 0; precno < res->pw * res->ph; precno++) {
+ for (precno = 0; precno < res->pw * res->ph; ++precno) {
opj_tcd_precinct_t *prc = &band->precincts[precno];
- for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
- int x, y, w, i, j, orient;
+ for (cblkno = 0; cblkno < prc->cw * prc->ch; ++cblkno) {
+ int x, y, w, i, j, orient, cblk_w, cblk_h;
opj_tcd_cblk_t *cblk = &prc->cblks[cblkno];
x = cblk->x0 - band->x0;
opj_tcd_resolution_t *pres = &tilec->resolutions[resno - 1];
y += pres->y1 - pres->y0;
}
-
+
+ cblk_w = cblk->x1 - cblk->x0;
+ cblk_h = cblk->y1 - cblk->y0;
+
w = tilec->x1 - tilec->x0;
if (tcp->tccps[compno].qmfbid == 1) {
- for (j = 0; j < cblk->y1 - cblk->y0; j++) {
- for (i = 0; i < cblk->x1 - cblk->x0; i++) {
+ for (j = 0; j < cblk_h; ++j) {
+ for (i = 0; i < cblk_w; ++i) {
t1->data[j][i] =
tilec->data[(x + i) + (y + j) * w] << T1_NMSEDEC_FRACBITS;
}
}
} else { /* if (tcp->tccps[compno].qmfbid == 0) */
- for (j = 0; j < cblk->y1 - cblk->y0; j++) {
- for (i = 0; i < cblk->x1 - cblk->x0; i++) {
+ for (j = 0; j < cblk_h; ++j) {
+ for (i = 0; i < cblk_w; ++i) {
t1->data[j][i] =
fix_mul(
tilec->data[x + i + (y + j) * w],
orient = 2;
}
- t1_encode_cblk(t1, cblk, orient, compno, tilec->numresolutions - 1 - resno, tcp->tccps[compno].qmfbid, band->stepsize, tcp->tccps[compno].cblksty, tile->numcomps, tile);
+ t1_encode_cblk(
+ t1,
+ cblk,
+ orient,
+ compno,
+ tilec->numresolutions - 1 - resno,
+ tcp->tccps[compno].qmfbid,
+ band->stepsize,
+ tcp->tccps[compno].cblksty,
+ tile->numcomps,
+ tile);
} /* cblkno */
} /* precno */
} /* compno */
}
-void t1_decode_cblks(opj_t1_t *t1, opj_tcd_tile_t *tile, opj_tcp_t *tcp) {
+void t1_decode_cblks(
+ opj_t1_t *t1,
+ opj_tcd_tile_t *tile,
+ opj_tcp_t *tcp)
+{
int compno, resno, bandno, precno, cblkno;
- for (compno = 0; compno < tile->numcomps; compno++) {
+ for (compno = 0; compno < tile->numcomps; ++compno) {
opj_tcd_tilecomp_t *tilec = &tile->comps[compno];
- for (resno = 0; resno < tilec->numresolutions; resno++) {
+ for (resno = 0; resno < tilec->numresolutions; ++resno) {
opj_tcd_resolution_t *res = &tilec->resolutions[resno];
- for (bandno = 0; bandno < res->numbands; bandno++) {
+ for (bandno = 0; bandno < res->numbands; ++bandno) {
opj_tcd_band_t *band = &res->bands[bandno];
- for (precno = 0; precno < res->pw * res->ph; precno++) {
+ for (precno = 0; precno < res->pw * res->ph; ++precno) {
opj_tcd_precinct_t *prc = &band->precincts[precno];
- for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
- int x, y, w, i, j, orient;
+ for (cblkno = 0; cblkno < prc->cw * prc->ch; ++cblkno) {
+ int x, y, w, i, j, orient, cblk_w, cblk_h;
opj_tcd_cblk_t *cblk = &prc->cblks[cblkno];
orient = band->bandno; /* FIXME */
orient = 2;
}
- t1_decode_cblk(t1, cblk, orient, tcp->tccps[compno].roishift, tcp->tccps[compno].cblksty);
+ t1_decode_cblk(
+ t1,
+ cblk,
+ orient,
+ tcp->tccps[compno].roishift,
+ tcp->tccps[compno].cblksty);
x = cblk->x0 - band->x0;
y = cblk->y0 - band->y0;
opj_tcd_resolution_t *pres = &tilec->resolutions[resno - 1];
y += pres->y1 - pres->y0;
}
-
+
+ cblk_w = cblk->x1 - cblk->x0;
+ cblk_h = cblk->y1 - cblk->y0;
+
if (tcp->tccps[compno].roishift) {
int thresh = 1 << tcp->tccps[compno].roishift;
- for (j = 0; j < cblk->y1 - cblk->y0; j++) {
- for (i = 0; i < cblk->x1 - cblk->x0; i++) {
+ for (j = 0; j < cblk_h; ++j) {
+ for (i = 0; i < cblk_w; ++i) {
int val = t1->data[j][i];
int mag = int_abs(val);
if (mag >= thresh) {
w = tilec->x1 - tilec->x0;
if (tcp->tccps[compno].qmfbid == 1) {
- for (j = 0; j < cblk->y1 - cblk->y0; j++) {
- for (i = 0; i < cblk->x1 - cblk->x0; i++) {
+ for (j = 0; j < cblk_h; ++j) {
+ for (i = 0; i < cblk_w; ++i) {
tilec->data[x + i + (y + j) * w] = t1->data[j][i]/2;
}
}
} else { /* if (tcp->tccps[compno].qmfbid == 0) */
- for (j = 0; j < cblk->y1 - cblk->y0; j++) {
- for (i = 0; i < cblk->x1 - cblk->x0; i++) {
+ for (j = 0; j < cblk_h; ++j) {
+ for (i = 0; i < cblk_w; ++i) {
if (t1->data[j][i] >> 1 == 0) {
tilec->data[x + i + (y + j) * w] = 0;
} else {