From 817681fb9865bea231293a7607521d6d7dacfb38 Mon Sep 17 00:00:00 2001 From: Antonin Descampe Date: Sun, 19 Mar 2006 18:51:32 +0000 Subject: [PATCH] fixed a bug in t1.c that prevented in some cases a true lossless compression (thanks to Don Mimlitch for reporting this bug) --- ChangeLog | 3 +++ libopenjpeg/t1.c | 6 +----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index fda1049a..c4a97169 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ What's New for OpenJPEG ! : changed + : added +March 19, 2006 +* [Antonin] fixed a bug in t1.c that prevented in some cases a true lossless compression (thanks to Don Mimlitch for reporting this bug) + February 12, 2006 - [Herve Drolon] removed unneeded working variables in opj_tcd_t diff --git a/libopenjpeg/t1.c b/libopenjpeg/t1.c index 6b153502..210a6969 100644 --- a/libopenjpeg/t1.c +++ b/libopenjpeg/t1.c @@ -1066,11 +1066,7 @@ void t1_decode_cblks(opj_t1_t *t1, opj_tcd_tile_t *tile, opj_tcp_t *tcp) { for (j = 0; j < cblk->y1 - cblk->y0; j++) { for (i = 0; i < cblk->x1 - cblk->x0; i++) { int tmp = t1->data[j][i]; - if(tmp >> 1 == 0) { - tilec->data[x + i + (y + j) * (tilec->x1 - tilec->x0)] = 0; - } else { - tilec->data[x + i + (y + j) * (tilec->x1 - tilec->x0)] = tmp<0?(tmp>>1)+1:(tmp>>1); - } + tilec->data[x + i + (y + j) * (tilec->x1 - tilec->x0)] = tmp/2; } } } else { /* if (tcp->tccps[compno].qmfbid == 0) */