openjpeg icon indicating copy to clipboard operation
openjpeg copied to clipboard

Openjpeg 2.3.1 changes color matrix.

Open Jamaika1 opened this issue 5 years ago • 7 comments

Openjpeg 2.3.1 changes color matrix. In my opinion codec should not do this. copenjpeg_j2k.exe -i Stationery.yuv -o Stationery_openjpeg.j2k -F 4000,3000,3,8,u@1x1:2x2:2x2 -mct 1 -b 64,64 -c [128,128],[256,256] -p CPRL -r 150 https://imgsli.com/MTIzOTc Unable to convert colorspace unknown to rgb.

Jamaika1 avatar Feb 22 '20 08:02 Jamaika1

Can you bisect it to one commit that causes the issue? What matrix you are talking about?

ValZapod avatar Apr 09 '20 07:04 ValZapod

Matrix unknown. For HTJPEG2000 the same settings are correct. cjpegHTJ2K_j2c.exe -i Stationery.yuv -o Stationery_openjph.j2c -dims {4000,3000} -num_comps 3 -signed false -bit_depth 8 -downsamp {1,1},{2,2},{2,2} -block_size {64,64} -precincts {128,128},{256,256} -prog_order CPRL -qstep 0.048 https://imgsli.com/MTIzOTg

Jamaika1 avatar Apr 09 '20 09:04 Jamaika1

Please give Stationery.yuv, Stationery_openjpeg.j2k, Stationery_openjph.j2c in zip archive (you can drag and drop it here). That imgsli converted everything to png.

ValZapod avatar Apr 09 '20 09:04 ValZapod

https://www.sendspace.com/file/tna3t1

Jamaika1 avatar Apr 09 '20 20:04 Jamaika1

The difference in https://imgsli.com/MTIzOTg is that left picture does not have any Gamma metadata while picture on the right does have Gamma 2.2 (in PNG gAMA).

ValZapod avatar Nov 12 '20 21:11 ValZapod

You are using command cjpegHTJ2K_j2c.exe -i Stationery.yuv -o Stationery_openjph.j2c -dims {4000,3000} -num_comps 3 -signed false -bit_depth 8 -downsamp {1,1},{2,2},{2,2} -block_size {64,64} -precincts {128,128},{256,256} -prog_order CPRL -qstep 0.048 that looks like is adding gAMA chunk of 2.2. sRGB is not 2.2! It is also not 2.4, but uses much more complex formula. See https://en.wikipedia.org/wiki/Gamma_correction#Mathematics

I would also say that we are not supporting https://www.itu.int/rec/T-REC-T.814/en -- High-throughput JPEG 2000, nor we support cjpegHTJ2K... Your issue #1112 should be reopened though. D:)

ValZapod avatar Dec 21 '20 13:12 ValZapod

It turned out my mistake. I wanted to use RGB-YCoCg {mct} color conversion, which is forbidden for yuv '-F'. Is it possible to import yuv rgb24 or rgba photos. Reportedly an alpha channel is possible for jpeg2000 part16 and is fully compatible with heif/avif. I have not tested if the matrix colors are correct for mct zero

Jamaika1 avatar Jan 12 '21 07:01 Jamaika1