+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;
+ OPJ_UINT32 i, j, k;
+ 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;
+ opj_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 opj_t1_dec_sigpass_mqc(
+ opj_t1_t *t1,
+ OPJ_INT32 bpno,
+ OPJ_INT32 orient)
+{
+ OPJ_INT32 one, half, oneplushalf;
+ OPJ_UINT32 i, j, k;
+ OPJ_INT32 *data1 = t1->data;
+ opj_flag_t *flags1 = &t1->flags[1];
+ one = 1 << bpno;
+ half = one >> 1;
+ oneplushalf = one | half;
+ for (k = 0; k < (t1->h & ~3u); k += 4) {
+ for (i = 0; i < t1->w; ++i) {
+ OPJ_INT32 *data2 = data1 + i;
+ opj_flag_t *flags2 = flags1 + i;
+ flags2 += t1->flags_stride;
+ opj_t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf);
+ data2 += t1->w;
+ flags2 += t1->flags_stride;
+ opj_t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf);
+ data2 += t1->w;
+ flags2 += t1->flags_stride;
+ opj_t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf);
+ data2 += t1->w;
+ flags2 += t1->flags_stride;
+ opj_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) {
+ OPJ_INT32 *data2 = data1 + i;
+ opj_flag_t *flags2 = flags1 + i;
+ for (j = k; j < t1->h; ++j) {
+ flags2 += t1->flags_stride;
+ opj_t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf);
+ data2 += t1->w;
+ }
+ }
+} /* 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 one, half, oneplushalf, vsc;
+ OPJ_UINT32 i, j, k;
+ 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;
+ opj_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 opj_t1_enc_refpass_step( opj_t1_t *t1,
+ opj_flag_t *flagsp,