Merge branch 't1_flag_optimizations'
authorEven Rouault <even.rouault@spatialys.com>
Tue, 13 Jun 2017 10:09:52 +0000 (12:09 +0200)
committerEven Rouault <even.rouault@spatialys.com>
Tue, 13 Jun 2017 10:09:52 +0000 (12:09 +0200)
1  2 
src/lib/openjp2/mqc.c
src/lib/openjp2/mqc.h
src/lib/openjp2/t1.c
src/lib/openjp2/t2.c
src/lib/openjp2/tcd.c

Simple merge
Simple merge
index 94aa9b29f6ffc1fcd82a269b8df961c5053ccecb,e9d44e01d27680f7f054df4d6d7dc4304ea4402f..ce0fb7d13d8fa7facaf421a1d23475bf69aaffd8
@@@ -2153,12 -1993,7 +2030,12 @@@ static void opj_t1_encode_cblk(opj_t1_
      OPJ_BYTE type = T1_TYPE_MQ;
      OPJ_FLOAT64 tempwmsedec;
  
-     mqc->lut_ctxno_zc_orient = lut_ctxno_zc + orient * 256;
 +#ifdef EXTRA_DEBUG
 +    printf("encode_cblk(x=%d,y=%d,x1=%d,y1=%d,orient=%d,compno=%d,level=%d\n",
 +           cblk->x0, cblk->y0, cblk->x1, cblk->y1, orient, compno, level);
 +#endif
 +
+     mqc->lut_ctxno_zc_orient = lut_ctxno_zc + (orient << 9);
  
      max = 0;
      for (i = 0; i < t1->w; ++i) {
          }
          pass->len = pass->rate - (passno == 0 ? 0 : cblk->passes[passno - 1].rate);
      }
 +
 +#ifdef EXTRA_DEBUG
 +    printf(" len=%d\n", (cblk->totalpasses) ? opj_mqc_numbytes(mqc) : 0);
 +
 +    /* Check that there not 0xff >=0x90 sequences */
 +    if (cblk->totalpasses) {
 +        OPJ_UINT32 i;
 +        OPJ_UINT32 len = opj_mqc_numbytes(mqc);
 +        for (i = 1; i < len; ++i) {
 +            if (cblk->data[i - 1] == 0xff && cblk->data[i] >= 0x90) {
 +                printf("0xff %02x at offset %d\n", cblk->data[i], i - 1);
 +                abort();
 +            }
 +        }
 +    }
 +#endif
  }
- #if 0
- static void opj_t1_dec_refpass_step(opj_t1_t *t1,
-                                     opj_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;
-     opj_mqc_t *mqc = t1->mqc;   /* MQC component */
-     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) {
-         opj_mqc_setcurctx(mqc, opj_t1_getctxno_mag(flag));  /* ESSAI */
-         if (type == T1_TYPE_RAW) {
-             v = opj_raw_decode(raw);
-         } else {
-             v = opj_mqc_decode(mqc);
-         }
-         t = v ? poshalf : neghalf;
-         *datap += *datap < 0 ? -t : t;
-         *flagsp |= T1_REFINE;
-     }
- }               /* VSC and  BYPASS by Antonin  */
- #endif
- #if 0
- static void opj_t1_dec_sigpass_step(opj_t1_t *t1,
-                                     opj_flag_t *flagsp,
-                                     OPJ_INT32 *datap,
-                                     OPJ_UINT32 orient,
-                                     OPJ_INT32 oneplushalf,
-                                     OPJ_BYTE type,
-                                     OPJ_UINT32 vsc)
- {
-     OPJ_UINT32 v, flag;
-     opj_raw_t *raw = t1->raw;   /* RAW component */
-     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))) {
-         if (type == T1_TYPE_RAW) {
-             if (opj_raw_decode(raw)) {
-                 v = opj_raw_decode(raw);    /* ESSAI */
-                 *datap = v ? -oneplushalf : oneplushalf;
-                 opj_t1_updateflags(flagsp, v, t1->flags_stride);
-             }
-         } else {
-             opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(flag, orient));
-             if (opj_mqc_decode(mqc)) {
-                 opj_mqc_setcurctx(mqc, opj_t1_getctxno_sc(flag));
-                 v = opj_mqc_decode(mqc) ^ opj_t1_getspb(flag);
-                 *datap = v ? -oneplushalf : oneplushalf;
-                 opj_t1_updateflags(flagsp, v, t1->flags_stride);
-             }
-         }
-         *flagsp |= T1_VISIT;
-     }
- }               /* VSC and  BYPASS by Antonin */
- #endif
Simple merge
Simple merge