uclouvain / openjpeg

Official repository of the OpenJPEG project
Other
977 stars 457 forks source link

Encoder converts bad color subsampling YCoCg #1031

Open Jamaika1 opened 7 years ago

Jamaika1 commented 7 years ago

I don't know, does command add 'force-rgb' by decoding?

-F <width>,<height>,<number_channels_subsampling>,<bitdepth>,{s,u}@<dx1>x<dy1>:...:<dxn>x<dyn>
    Characteristics of the raw input parameters image
    If delete channels colors, first channel 1x1 is luminance gray
      Example: ffmpeg.exe -i sample.tiff -f rawvideo -pix_fmt yuv444p sample.raw
               copenjpeg2000.exe -i sample.raw -o YCoCg24(444)_lossless.j2k
                                 -F 8736,5856,3,8,u@1x1:1x1:1x1 -mct 1 -r 1 -C ''
      Example: ffmpeg.exe -i sample.tiff -f rawvideo -pix_fmt yuv420p sample.raw
               copenjpeg2000.exe -i sample.raw -o YCoCg24(420)_lossy_50%size.j2k
                                 -F 8736,5856,3,8,u@1x1:2x2:2x2 -mct 1 -r 6 -C ''

    Required only if RAW or RAWL input file is provided. [Don't uses file RGB(A) and info subsampling {s}]
Jamaika1 commented 3 years ago

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 commented 3 years ago

I am surprised that viewers for jpeg2000 expect rgb24 and not yuv444p. https://i.ibb.co/mJvq4g9/ucsnath.png ffmpeg -i import -f rawvideo -pix_fmt yuv444p yuv444p.yuv ffmpeg -i import -f rawvideo -pix_fmt rgb24 rgb24.yuv ffmpeg -i import -f rawvideo -pix_fmt rgba rgba.yuv Lossless rgb conversion to ycocg was supposed to reduce file size. What about HDR with heif/avif photos? https://github.com/aous72/OpenJPH/pull/53