uclouvain/openjpeg

Encoding failure for 1-bit images with opj_compress

Opened this issue · 0 comments

Expected behavior and actual behavior.

1-bit images should encode correctly, however instead I'm getting the following, with variations on the remaining/needed:

[INFO] tile number 1 / 1
[ERROR] opj_t2_encode_packet(): only 203 bytes remaining in output buffer. 755 needed.
[ERROR] Cannot encode tile
failed to encode image: opj_encode
failed to encode image: opj_end_compress
failed to encode image

Steps to reproduce the problem.

Run opj_compress -i 1bit_failure.raw -o 1bit.j2k -F 123,234,1,1,u

Other things I've noticed:

  • A smaller image works OK with opj_compress -i 1bit_success.raw -o 1bit.j2k -F 70,100,1,1,u
  • opj_compress -i 1bit_failure.raw -o 1bit.j2k -F 123,234,1,2,u (i.e. 2-bit precision) also works OK

Test files (rename extensions to raw) - these are just purely random 1-bit images:

Operating system

Ubuntu 22.04

openjpeg version

Current master, also 2.5.0.