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

Size limited to 8192x8192 #221

Closed cmahnke closed 1 month ago

cmahnke commented 1 month ago

On larger images I get an error:

image dimensions cannot be larger than 8192x8192, received image dimensions 12560x17552

Would it be possible to increase the maximum size to let's say 32768x32768 or ist this a limitation of the JPEG container?

cmahnke commented 1 month ago

I've found it: https://github.com/google/libultrahdr/blob/9b3853a93023f7c92c994ed434264e941de8e0d1/lib/include/ultrahdr/jpegdecoderhelper.h#L42

Maybe this can be changed to the JPEG maximum (65,535) and the value of 8192 is only used to issue a warning? Or there could be some sort of #ifdef that enforce this maximum depending on the platform to build for - setting 8192 only when building for mobile devices.

ram-mohan commented 1 month ago

The value 8192 was chosen as per the needs of embedded devices. There is no limitation towards modifying the limits to 65535.

cmahnke commented 1 month ago

@ram-mohan : Yes, thanks, I already figured that one out. Maybe this can be lifted, by default and be limited when compiled for a mobile platform? Or made configurable via cmake

ram-mohan commented 1 month ago

@cmahnke can you try the above change and see if it works for you. thank you.

cmahnke commented 1 month ago

@ram-mohan It works, thanks. But I would like to avoid such al line in my build pipeline:

sed -i -E 's/8192/32768/g' lib/include/ultrahdr/jpegdecoderhelper.h
ram-mohan commented 1 month ago

@cmahnke I feel replacing a fixed constant with another fixed constant is not best as it will be prone to more revisions basing on the runtime criteria. Perhaps the best way to resolve this is to have a build time config option