google / libultrahdr

Ultra HDR is a true HDR image format, and is backcompatible. libultrahdr is the reference codec for the Ultra HDR format. The codecs that support the format can render the HDR intent of the image on HDR displays; other codecs can still decode and display the SDR intent of the image.
https://developer.android.com/guide/topics/media/platform/hdr-image-format
Apache License 2.0
146 stars 23 forks source link

output.jpeg doesn't contain MPF info in exiftool #38

Closed jeremysong1106 closed 10 months ago

jeremysong1106 commented 10 months ago

Hi,

I used the API-0 that you provided and got the output result output.jpeg, then I checked the output with camera-raw demo from adobe and the gainmap option can't be activated, and I found that is because the MPF info is not saved in the jpeg file.

Can you help me to solve the issue so that I can check the HDR image?

Bests

ram-mohan commented 10 months ago

Can you please share the command and attach the file that is generated

jeremysong1106 commented 10 months ago

out Hello here is the output jpeg file. the command i used is: ultrahdr_app -m 0 -p input.yuv -i input.jpg -w 3968 -h 2976 -t 1 -o 3 -e 1

jeremysong1106 commented 10 months ago

With the demo you provided raw_p010_image.p010 , it generated also SDR image

gregbenz commented 10 months ago

@jeremysong1106 How are you generating the input.yuv p010 HDR source? Are you aware of a way to convert other more common HDR formats (AVIF, 32-bit TIF, PQ-encoded PNG, etc) to this p010 format?

DichenZhang1 commented 10 months ago

Hi @jeremysong1106, I've made some code change, could you give it another try? Thank you!

jeremysong1106 commented 10 months ago

@DichenZhang1 thanks it works now

jeremysong1106 commented 10 months ago

@gregbenz The p010 file format can be any raw image data from camera without compression, the other formats you mentioned is compressed already

gregbenz commented 10 months ago

@jeremysong1106 Thank you. Do you know of a way to convert from other files? My hope here is that I might use this to build a gain map from an HDR and SDR version of an image I have processed in Photoshop (ie, edited TIF or something similar, not RAW or straight from the capture device, which would be a mirrorless camera most likely). I realize that's probably not an intended use of the library, but it would be quite valuable to encode gain maps with full artistic control over the SDR.

jeremysong1106 commented 10 months ago

@gregbenz Hi, I don't think there's a way to do so, but with the adobe PS you should be able to save hdr raw as a jpg file with gainmap in it, the gainmap can be extracted in some ways

jeremysong1106 commented 10 months ago

@DichenZhang1 Hi, now the output file contains gainmap info, but can you check why the gainmap result here is totally reversed? likethe bright part is not strengthen but the shadow part is? out

gregbenz commented 10 months ago

with the adobe PS you should be able to save hdr raw as a jpg file with gainmap in it,

Yes, you can (via ACR or LR, not PS). However, there is limited control over the SDR base image. I'm seeking a way to provide the actual SDR as you can improve things quite a bit with an advanced (manual) approach to create a paired SDR/HDR rendering. More details on the use case: https://community.adobe.com/t5/photoshop-ecosystem-ideas/allow-full-user-control-of-the-sdr-rendition-in-an-hdr-gain-map-export/idi-p/14205440#M19464

DichenZhang1 commented 10 months ago

@DichenZhang1 Hi, now the output file contains gainmap info, but can you check why the gainmap result here is totally reversed? likethe bright part is not strengthen but the shadow part is?

Hi @jeremysong1106, I looked into the attached image, and found the gainmap has multi-channel, could you confirm? The library now doesn't support multi-channel gainmap, but it's on our roadmap. Thanks!

jeremysong1106 commented 10 months ago

@DichenZhang1 Hi, I checked the gainmap, it's an jpg image with 3 channel, but all 3 channels have the same value, the same situation as the example p010 file that you provided.

martinimal commented 10 months ago

Hi @jeremysong1106 I downloaded the picture and could extract an RGB thumbnail, but I think this is not supposed to be the gain map but a preview image. Could you share the original as .zip? Hi @DichenZhang1, so far the library writes only single channel gain maps, isn't it? If so, it would not make sense that the uploaded image contains an RGB gain map and there is probably some confusion.

jeremysong1106 commented 10 months ago

@DichenZhang1 Here I upload the material that I usd with encode process, could you check if the output is correct? Thanks! example.zip

martinimal commented 9 months ago

@gregbenz concerning writing p010 files, did you try to use FFMPEG?

gregbenz commented 9 months ago

@martinimal I have not. Do you know if it will accept 32-bit TIF, HDR AVIF, or some other HDR source to produce an HDR p010 output?

martinimal commented 9 months ago

I use it with 16 bit TIFF input and convert to AVIF. So AVIF and TIFF are generally supported. According to the documentation, uncompressed YUV outpus is possible. You can try following input parameter besides the mandatory ones for input and output: '-still-picture', '1', '-pix_fmt', 'yuv420p',

martinimal commented 9 months ago

@gregbenz Correction: 'yuv420p10be' is the right format (pix-fmt), not 'yuv420p'. It allows to write valid P010 files. I created a yuv file with exactly the same file size as the P010 example by using the jpeg example. However, you might need to take care of the color mangement i.e. conversion from RGB to Yuv, depending on the input.