This project is read-only.


charlstest fails to provide lossless compression


Using your image desktop.ppm in test folder, I try:
  • charlstest -encodepnm desktop.ppm des.jls
and then
  • charlstest -decodetopnm des.jls desktop_rec.ppm
but the reconstructed image is not the same of the original one. I am attaching the error between the images.

I also try to modify main.cpp present in the test folder adding
  • params.allowedlossyerror = 0;
in EncodePnm function before to call
  • JpegLsEncodeStream(jlsStreamInfo, &bytesWritten, rawStreamInfo, &params);
but the result is the same. How can I obtain the lossless compression with your charlstest?

file attachments

Closed Jan 2, 2015 at 11:29 AM by vbaderks
Closing as not reproducible.


vbaderks wrote Nov 5, 2014 at 9:07 PM


I tried to reproduce your problem but my generated desktop_rec.ppm looks identical to the input ppm. I can see however that your attached error.ppm is wrong.

Some questions:
  • Which version of the source code are you using?
  • Which compiler ?, which output target (32 bit vs 64 bit, debug or release)

gobihoko wrote Nov 7, 2014 at 7:41 AM


I tried the experiment with the current master (I think version) using Ubuntu 14.04 LTS 64 bit.
In the main folder, I done:
  • cmake CMakeLists.txt
and then
  • make
In the same folder, I took the generated charlstest and I tried the above experiment.

vbaderks wrote Nov 9, 2014 at 10:32 PM


I could not reproduce your problem on the 64 bit version on Windows or on the 64 bit version running in Ubuntu.

Could you run: cmake --trace and attach the output to this issue? Maybe it is a configuration of your system.

gobihoko wrote Nov 10, 2014 at 7:59 AM


I attach the output of:
  • cmake --trace CMakeLists.txt
Thanks for your help.

vbaderks wrote Nov 12, 2014 at 10:27 PM


I checked the differences between your output and my system. I have as C++ compiler GNU 4.9.1 and your system has GNU 4.8.2

I have attached my build of charlstest.

Did you created the debug or the release build?

gobihoko wrote Nov 13, 2014 at 2:43 PM


I created a release build.

vbaderks wrote Nov 15, 2014 at 8:04 PM

I updated the WIKI documentation (How to build CharLS) and the CMakeLists.txt file on the master branch

Could you try to build a debug version and upload it?

gobihoko wrote Nov 17, 2014 at 8:04 AM

I attach the debug version, made using the WIKI.

gobihoko wrote Nov 17, 2014 at 8:06 AM

But if I try to encode and decode desktop.ppm image and the result is the same of before.

I attach the decoded image.

vbaderks wrote Nov 26, 2014 at 10:50 PM

I downloaded your version of charlstest and also the rec.ppm, but I cannot reproduce the problem and rec.ppm seems to be fine.

I am wondering if there is a problem that the output file is not correctly flushed or if there is a big endian problem. I assume that you just run on a Intel x86 CPU ?

vbaderks wrote Nov 28, 2014 at 10:02 PM

I created a new VM with Ubuntu 14.04 LTS 64 bit and GNU 4.8.2 but I cannot reproduce the problem. The encoded\decoded image is equal with the source ppm:

using diff I just get:
< P6
< # Created by IrfanView
< 1280 1024

< 255

P6 1280 1024 255
which is to be expected as charlstest creates a different ppm header.