While using SCIFIO JPEG2000 codec, based on jai-imageio-jpeg2000, we have an exception while an attempt to encode 32-bit integer pixel samples:
Exception in thread "main" java.lang.IllegalArgumentException: 0 <= 0
at jj2000.j2k.util.MathUtil.log2(MathUtil.java:67)
at jj2000.j2k.image.forwcomptransf.ForwCompTransf.calcMixedBitDepths(ForwCompTransf.java:235)
at jj2000.j2k.image.forwcomptransf.ForwCompTransf.initForwICT(ForwCompTransf.java:307)
at jj2000.j2k.image.forwcomptransf.ForwCompTransf.setTile(ForwCompTransf.java:762)
at jj2000.j2k.image.ImgDataAdapter.setTile(ImgDataAdapter.java:288)
at jj2000.j2k.image.ImgDataAdapter.setTile(ImgDataAdapter.java:288)
at jj2000.j2k.wavelet.analysis.ForwWTFull.setTile(ForwWTFull.java:903)
at jj2000.j2k.image.ImgDataAdapter.setTile(ImgDataAdapter.java:288)
at jj2000.j2k.image.ImgDataAdapter.setTile(ImgDataAdapter.java:288)
at jj2000.j2k.roi.encoder.ROIScaler.setTile(ROIScaler.java:696)
at jj2000.j2k.image.ImgDataAdapter.setTile(ImgDataAdapter.java:288)
at jj2000.j2k.entropy.encoder.StdEntropyCoder.setTile(StdEntropyCoder.java:1267)
at jj2000.j2k.entropy.encoder.EBCOTRateAllocator.(EBCOTRateAllocator.java:281)
at jj2000.j2k.entropy.encoder.PostCompRateAllocator.createInstance(PostCompRateAllocator.java:260)
at com.github.jaiimageio.jpeg2000.impl.J2KImageWriter.write(J2KImageWriter.java:347)
While using SCIFIO JPEG2000 codec, based on jai-imageio-jpeg2000, we have an exception while an attempt to encode 32-bit integer pixel samples:
Exception in thread "main" java.lang.IllegalArgumentException: 0 <= 0 at jj2000.j2k.util.MathUtil.log2(MathUtil.java:67) at jj2000.j2k.image.forwcomptransf.ForwCompTransf.calcMixedBitDepths(ForwCompTransf.java:235) at jj2000.j2k.image.forwcomptransf.ForwCompTransf.initForwICT(ForwCompTransf.java:307) at jj2000.j2k.image.forwcomptransf.ForwCompTransf.setTile(ForwCompTransf.java:762) at jj2000.j2k.image.ImgDataAdapter.setTile(ImgDataAdapter.java:288) at jj2000.j2k.image.ImgDataAdapter.setTile(ImgDataAdapter.java:288) at jj2000.j2k.wavelet.analysis.ForwWTFull.setTile(ForwWTFull.java:903) at jj2000.j2k.image.ImgDataAdapter.setTile(ImgDataAdapter.java:288) at jj2000.j2k.image.ImgDataAdapter.setTile(ImgDataAdapter.java:288) at jj2000.j2k.roi.encoder.ROIScaler.setTile(ROIScaler.java:696) at jj2000.j2k.image.ImgDataAdapter.setTile(ImgDataAdapter.java:288) at jj2000.j2k.entropy.encoder.StdEntropyCoder.setTile(StdEntropyCoder.java:1267) at jj2000.j2k.entropy.encoder.EBCOTRateAllocator.(EBCOTRateAllocator.java:281)
at jj2000.j2k.entropy.encoder.PostCompRateAllocator.createInstance(PostCompRateAllocator.java:260)
at com.github.jaiimageio.jpeg2000.impl.J2KImageWriter.write(J2KImageWriter.java:347)
The reason is the following code:
When ntdepth[0]==32 (32 bits/sample), the << operator leads to 32-bit overflow and actually returns 1 instead of 1^32.