Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-value of jp2:quality does not work #1873

Closed
3 tasks done
yoya opened this issue Mar 24, 2020 · 2 comments
Closed
3 tasks done

Multi-value of jp2:quality does not work #1873

yoya opened this issue Mar 24, 2020 · 2 comments

Comments

@yoya
Copy link
Contributor

yoya commented Mar 24, 2020

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am using the latest version of ImageMagick
  • I have searched open and closed issues to ensure it has not already been reported

Description

jp2:quality=x,x,... set the quality layer PSNR, given in dB. The order is from left to right in ascending order. The default is a single lossless quality layer.

Even if the values of jp2:quality are arranged in ascending order as described above, it's still an error because it should be in descending order.

Steps to Reproduce

  • I want it to work
% convert rose: -define jp2:quality=10,20,30 rose.jp2
convert: tcp_rates[1]=0.000000 (corrected as 1.000000) should be strictly lesser than tcp_rates[0]=0.000000 (corrected as 1.000000)
 `OpenJP2' @ warning/jp2.c/JP2WarningHandler/237.
convert: tcp_rates[2]=0.000000 (corrected as 1.000000) should be strictly lesser than tcp_rates[1]=0.000000 (corrected as 1.000000)
 `OpenJP2' @ warning/jp2.c/JP2WarningHandler/237.
  • superfluous
% convert rose: -define jp2:quality=30,20,10 rose.jp2
convert: tcp_rates[1]=0.000000 (corrected as 1.000000) should be strictly lesser than tcp_rates[0]=0.000000 (corrected as 1.000000)
 `OpenJP2' @ warning/jp2.c/JP2WarningHandler/237.
convert: tcp_rates[2]=0.000000 (corrected as 1.000000) should be strictly lesser than tcp_rates[1]=0.000000 (corrected as 1.000000)
 `OpenJP2' @ warning/jp2.c/JP2WarningHandler/237.

System Configuration

  • ImageMagick version: 7.0.10-3
  • Environment (Operating system, version and so on):macOS Catalina (10.15.3), OpenJPEG 2.3.1
  • Additional information:

OpenJPEG checks the tcp_rates array, even though ImageMagick sets the tcp_distoratio array to a value in jp2:quality.
Probably because ImageMagick set cp_disto_alloc=1 at the beginning to make the default lossless, but did not set cp_disto_alloc back to 0 just by setting cp_fixed_quality=1 when jp2:quality is specified.

yoya added a commit to yoya/ImageMagick that referenced this issue Mar 24, 2020
BUG: cp_disto_alloc is not set back to 0 by only setting cp_fixed_quality=1 when specifying -define jp2:quality (and -quality)

ref) ImageMagick#1873
@yoya yoya changed the title Multi-value of jp:quality does not work Multi-value of jp2:quality does not work Mar 26, 2020
urban-warrior pushed a commit to ImageMagick/ImageMagick6 that referenced this issue Apr 1, 2020
@urban-warrior
Copy link
Member

Thanks for the patch. It appears to resolve the problem you reported.

@yoya
Copy link
Contributor Author

yoya commented Apr 2, 2020

Here's what I tested with the ImageMagick/master HEAD (3c92cc1) branch.
It is as expected.

% ~/ImageMagick/master/bin/convert rose: -quality 10 rose.jp2
% ~/ImageMagick/master/bin/convert rose: -define jp2:quality=10,20,30 rose.jp2
% identify  rose.jp2
rose.jp2 JP2 70x46 70x46+0+0 8-bit sRGB 0.000u 0:00.000
%
% ~/ImageMagick/master/bin/convert rose: -define jp2:quality=30,20,10 rose.jp2
convert: tcp_distoratio[1]=20.000000 should be strictly greater than tcp_distoratio[0]=30.000000
 `OpenJP2' @ warning/jp2.c/JP2WarningHandler/237.
convert: tcp_distoratio[2]=10.000000 should be strictly greater than tcp_distoratio[1]=20.000000
 `OpenJP2' @ warning/jp2.c/JP2WarningHandler/237.

Thank you.

@yoya yoya closed this as completed Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants