AOMediaCodec / libavif

libavif - Library for encoding and decoding .avif files
Other
1.57k stars 202 forks source link

libavif support region decoding from the file ? #1253

Open seraphlee opened 1 year ago

seraphlee commented 1 year ago

First of all, thank you so much for this amazing lib

but i think it really need avif region decoder, because some Android device performance is poor,they can't decode large image in their low memory.

y-guyon commented 1 year ago

Thank you for the report. I believe it is a duplicate of https://github.com/AOMediaCodec/libavif/issues/1147.

Could you provide details on the typical large images (dimensions, alpha, source, web/on-device etc.) and the target Android devices (brand, model, available memory etc.)? Do you need this libavif feature for a native app, a website..?

Some chip constructors already ship hardware AV1 decoding support (see https://en.wikipedia.org/wiki/AV1#Hardware). It may help unless the whole buffer size is the issue. I doubt the Android devices with poor performance you mentioned have hardware support anyway.

If possible, I would suggest using lighter alternatives such as Jpeg or WebP, and smaller images. For low-end devices, we may assume the screen resolution is lower, and thus scaling images up after decoding is a reasonable option.

seraphlee commented 1 year ago

Thank you for your reply,i'm a Android Developer

Android provide BitmapRegionDecoder to decode a rectangle region from an image, it can be useful when an original image is large and only need parts of the image. it input byte array of compressed image data and the rectangle that specified the region to be decode, finally return the decoded bitmap

in some case, load the whole large image can lead to OOM, so can libavif provide a function to do the same thing?