From 9324bc4cd4fac1934a9b72ef0f16cf79ccc73d0a Mon Sep 17 00:00:00 2001 From: Antonin Descampe Date: Fri, 6 Nov 2009 12:52:54 +0000 Subject: [PATCH] fixed MCT check bug in t1_getwmsedec. See http://groups.google.com/group/openjpeg/browse_thread/thread/d9d96dd4ec3e7443 for info --- ChangeLog | 3 +++ libopenjpeg/t1.c | 15 ++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 51dd1187..e5151c83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ What's New for OpenJPEG ! : changed + : added +November 5, 2009 +* [antonin] fixed MCT check bug in t1_getwmsedec. See http://groups.google.com/group/openjpeg/browse_thread/thread/d9d96dd4ec3e7443 for info. + November 5, 2009 * [antonin] fixed "tiffio" header inclusion to use user version on Win32 system only (otherwise assume its existence in system headers). diff --git a/libopenjpeg/t1.c b/libopenjpeg/t1.c index ad1c6a83..a78b700f 100644 --- a/libopenjpeg/t1.c +++ b/libopenjpeg/t1.c @@ -178,7 +178,8 @@ static double t1_getwmsedec( int bpno, int qmfbid, double stepsize, - int numcomps); + int numcomps, + int mct); /** Encode 1 code-block @param t1 T1 handle @@ -202,6 +203,7 @@ static void t1_encode_cblk( double stepsize, int cblksty, int numcomps, + int mct, opj_tcd_tile_t * tile); /** Decode 1 code-block @@ -736,14 +738,15 @@ static double t1_getwmsedec( int bpno, int qmfbid, double stepsize, - int numcomps) + int numcomps, + int mct) { double w1, w2, wmsedec; if (qmfbid == 1) { - w1 = (numcomps > 1) ? mct_getnorm(compno) : 1.0; + w1 = (mct && numcomps==3) ? mct_getnorm(compno) : 1.0; w2 = dwt_getnorm(level, orient); } else { /* if (qmfbid == 0) */ - w1 = (numcomps > 1) ? mct_getnorm_real(compno) : 1.0; + w1 = (mct && numcomps==3) ? mct_getnorm_real(compno) : 1.0; w2 = dwt_getnorm_real(level, orient); } wmsedec = w1 * w2 * stepsize * (1 << bpno); @@ -800,6 +803,7 @@ static void t1_encode_cblk( double stepsize, int cblksty, int numcomps, + int mct, opj_tcd_tile_t * tile) { double cumwmsedec = 0.0; @@ -850,7 +854,7 @@ static void t1_encode_cblk( } /* fixed_quality */ - tempwmsedec = t1_getwmsedec(nmsedec, compno, level, orient, bpno, qmfbid, stepsize, numcomps); + tempwmsedec = t1_getwmsedec(nmsedec, compno, level, orient, bpno, qmfbid, stepsize, numcomps, mct); cumwmsedec += tempwmsedec; tile->distotile += tempwmsedec; @@ -1110,6 +1114,7 @@ void t1_encode_cblks( band->stepsize, tccp->cblksty, tile->numcomps, + tcp->mct, tile); } /* cblkno */