openjpeg icon indicating copy to clipboard operation
openjpeg copied to clipboard

ojp_compress result has same compression ratio despite providing different -r parameters

Open Enerccio opened this issue 4 years ago • 2 comments

For parameters

-n 6 -b 64,64 -c [256,256],[256,256],[128,128],[128,128],[128,128],[128,128] -t 1024,1024 -p RPCL -M 1 -TP R -I -r 10,10,10,9,9,8,8,7,6,5,3,1

-n 6 -b 64,64 -c [256,256],[256,256],[128,128],[128,128],[128,128],[128,128] -t 1024,1024 -p RPCL -M 1 -TP R -I -r 20,19,18,17,16,15,14,13,11,9,6,1

and even

-n 6 -b 64,64 -c [256,256],[256,256],[128,128],[128,128],[128,128],[128,128] -t 4096,4096 -p RPCL -SOP -EPH -M 1 -TP R -r 1

I get the same compression ratio of <compressionRatio>1.43</compressionRatio>. Filesize differs a tiny bit but nowhere near that I would expect from lossy vs lossless and 20:1 vs 10:1. Am I doing something wrong?

Enerccio avatar Aug 04 '20 08:08 Enerccio

as you include 1 in your compression ratios, it means that the last layer will include all remaining bits to achieve "lossless" compression (as much as it can when irreversible DWT is used). So what you observe is expected. You'd probably want to use just -r 10 or -r 20 to achieve 20:1 and 10:1 compression.

rouault avatar Aug 04 '20 08:08 rouault

ah I see, but I also need 12 (logarithmic) quality layers, which is why I used scale like 20,19,18,17,16,15,14,13,11,9,6,1.

Enerccio avatar Aug 04 '20 09:08 Enerccio