Fixed Error in tiftoimage(). Modification in convert.c.

This commit is contained in:
Parvatha Elangovan 2007-04-12 10:01:48 +00:00
parent dbd132dca8
commit 110b54c7c6
2 changed files with 6 additions and 3 deletions

View File

@ -5,6 +5,9 @@ What's New for OpenJPEG
! : changed
+ : added
April 12,2007
* [Parvatha] Fixed Error in tiftoimage(). Modification in convert.c.
April 10,2007
+ [Parvatha] Accepting "j2c" as format for Encoding and Decoding. Modification in image_to_j2k.c.
* [Parvatha] Modified imagetotif() to read images with signed data. Modification in convert.c.

View File

@ -1355,7 +1355,7 @@ opj_image_t* tiftoimage(char *filename, opj_cparameters_t *parameters)
if (Info.tiBps==12){
for (i=0; i<ssize; i+=9) { /*12 bits per pixel*/
if(index < datasize){
if(index < imgsize){
image->comps[0].data[index] = ( dat8[i+0]<<4 ) |(dat8[i+1]>>4);
image->comps[1].data[index] = ((dat8[i+1]& 0x0f)<< 8) | dat8[i+2];
image->comps[2].data[index] = ( dat8[i+3]<<4) |(dat8[i+4]>>4);
@ -1369,7 +1369,7 @@ opj_image_t* tiftoimage(char *filename, opj_cparameters_t *parameters)
}
else if( Info.tiBps==16){
for (i=0; i<ssize; i+=6) { /* 16 bits per pixel */
if(index < datasize){
if(index < imgsize){
image->comps[0].data[index] = ( dat8[i+1] << 8 ) | dat8[i+0]; // R
image->comps[1].data[index] = ( dat8[i+3] << 8 ) | dat8[i+2]; // G
image->comps[2].data[index] = ( dat8[i+5] << 8 ) | dat8[i+4]; // B
@ -1380,7 +1380,7 @@ opj_image_t* tiftoimage(char *filename, opj_cparameters_t *parameters)
}
else if ( Info.tiBps==8){
for (i=0; i<ssize; i+=3) { /* 8 bits per pixel */
if(index < datasize){
if(index < imgsize){
image->comps[0].data[index] = dat8[i+0]; // R
image->comps[1].data[index] = dat8[i+1]; // G
image->comps[2].data[index] = dat8[i+2]; // B