Irreversible decoding: partially revert previous commit, to fix failures in test...
[openjpeg.git] / src / lib / openjp2 / tcd.c
index 02fb11db23d764e08bfecd8aa69d283ca1b468ff..810f83ec3d8a9f9b1bda5434f7ac568a1ee3c99a 100644 (file)
@@ -1000,7 +1000,11 @@ static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no,
 
                 {
                     /* Table E-1 - Sub-band gains */
-                    const OPJ_INT32 log2_gain = (l_band->bandno == 0) ? 0 :
+                    /* BUG_WEIRD_TWO_INVK (look for this identifier in dwt.c): */
+                    /* the test (!isEncoder && l_tccp->qmfbid == 0) is strongly */
+                    /* linked to the use of two_invK instead of invK */
+                    const OPJ_INT32 log2_gain = (!isEncoder &&
+                                                 l_tccp->qmfbid == 0) ? 0 : (l_band->bandno == 0) ? 0 :
                                                 (l_band->bandno == 3) ? 2 : 1;
 
                     /* Nominal dynamic range. Equation E-4 */