libultrahdr icon indicating copy to clipboard operation
libultrahdr copied to clipboard

Request: Decode support for images with Apple gain map format

Open gregbenz opened this issue 1 year ago • 8 comments

It would be helpful to have support to decode images captured with an iPhone, which includes JPG and HEIC images with the Apple gain map format. This would help to transcode images captured with an iPhone (such as for uploading to web services).

If you attempt to decode such an image now, libultrahdr_app will throw "xml parse error, could not find attribute hdrgm:Version".

Support for decoding is all that is needed. Output in the Android format (and ultimately with the ISO gain map spec when finalized) is sufficient.

gregbenz avatar Jul 11 '24 00:07 gregbenz

https://developer.apple.com/documentation/appkit/images_and_pdf/applying_apple_hdr_effect_to_your_photos

gregbenz avatar Jul 11 '24 00:07 gregbenz

👍🏻 , not only Apple but HEIC in general

for example S24U, FX7U, OP12 - all of them support Ultra HDR but as soon as you enable HEIC mode it's gone

I saw that the whole UHDR library is based around JPEG files and to be honest isn't that a bit stupid? I'd understand if it was Android 8-9 but Android 14 when most of the phones are shipping with HEIC files that actually save 2-3 times of the storage..?

Is this possible to be done?

xs1vr avatar Jul 17 '24 17:07 xs1vr

@xs1vr we are in the process of integrating hevc and av1 codecs and extending uhdr_codec_t of ultrahdr_api.h to include heic and avif. Inspite of lesser coding efficiency, jpeg is also useful as it has less cpu burden on embedded devices.

ram-mohan avatar Jul 24 '24 01:07 ram-mohan

+1 on adding support for the ISO 21496-1 binary format of gain map metadata, at least for decode (encode would be nice too).

It would also be useful to have a way to input a decoded base image, a decoded gain map, and gain map metadata in either format (xml or binary), and produce a reconstructed alternate (HDR) image.

jonsneyers avatar Feb 27 '25 08:02 jonsneyers

Can confirm that heic hdr also doesn't work on Google photos with photos from poco x7 pro. So it's not just incompatibility with apple heic hdr.

Googling around, people says Google photos Somtimes is compatible with heic hdr https://www.reddit.com/r/googlephotos/comments/1bp9fhq/ultra_hdr_view_not_working_with_s24_ultra_heic/

orangpelupa avatar Mar 13 '25 01:03 orangpelupa

@xs1vr we are in the process of integrating hevc and av1 codecs and extending uhdr_codec_t of ultrahdr_api.h to include heic and avif. Inspite of lesser coding efficiency, jpeg is also useful as it has less cpu burden on embedded devices.

I've seen this has been added to A16B2. Thank you for your time and contribution!

I don't want to sound rude, especially after not replying for so long..but when you said jpeg is also useful as it has less cpu burden on embedded devices...those embedded devices that can't support something as simple as decoding HEIC wouldn't be having HDR-enabled display to begin with 😁 as for androids, thanks to ARM we're basically more powerful and efficient than top of the line desktop processors so no much trouble here :p

xs1vr avatar Mar 26 '25 22:03 xs1vr

@jonsneyers libultra supports ISO encoding of JPG gain maps (AVIF and HEIF coming too).

You need to enabling the feature when compiling: cmake -DUHDR_WRITE_ISO=1

gregbenz avatar Mar 31 '25 13:03 gregbenz

changes here should allow support for heif and avif encoding formats as well.

ram-mohan avatar Apr 01 '25 12:04 ram-mohan