tables = new JPEGInputStream(new ByteArrayInputStream(ifd.getJPEGTables()));
}catch(IllegalArgumentException iae){
tables=null;
}
IntFilterInputStream intis;
int offset=0,mbps=width*rps,max=width*height;
for(int i=0;i<offsets.length;i++){
in.seek(offsets[i]);
byte[] data=new byte[(int)counts[i]];
in.read(data); // read codes
InputStream is=new ByteArrayInputStream(data);
if(ifd.getFillOrder()!=LowColHighBit){is=new BitSwapInputStream(is);}
mbps=((max-offset)<mbps)?max-offset:mbps;
switch(cmp){
case NOCOMPRESSION: // 1
intis=new RGBInputStream(is,spp,alpha!=0);
break;
case LZW: // 5, non base line
is=new LZWInputStream(is,8,false);
intis=new RGBInputStream(is,spp,alpha!=0);
break;
case JPEG:
if(tables!=null){ intis=new JPEGInputStream(is,tables.getQTs(),tables.getDCIns(),tables.getACIns());
}else{ intis=new JPEGInputStream(is);}
break;
case PACKBITS: // 32773
is=new PackBitsInputStream(is);
intis=new RGBInputStream(is,spp,alpha!=0);
break;
default:
System.out.println("9\b"+cn+".readRGBImage:\n\tDo not support compression scheme "+cmp+".");
return image;
}
offset+=intis.read(imgdata,offset,mbps); // read/decode max. rps image lines
}
}catch(Exception e){
System.out.println("9\b"+cn+".readRGBImage:\n\t"+e.getMessage());
e.printStackTrace();
}