Open leo-barnes opened 2 years ago
Thanks for raising the issue. These are good questions.
item_type
or another item feature.One issue with using the content_encoding
field is that the uncompressed size is not stored anywhere. So a parser has no idea how large it will be when unpacked. Maybe not a critical issue, but it makes it harder to have strict checks.
I think I added a conformance file containing compressed XMP metadata. But we still have no way to have compressed Exif. Maybe we should morph this issue into tracking some way of adding that.
@leo-barnes do you plan to submit an example of compressed Exif for the next meeting?
Probably won't have time to do it unfortunately.
On second thought, let me see if I can't put something together...
@leo-barnes libheif
generates compressed XMP metadata (deflate
) when you encode with --enable-metadata-compression
and enabled that during compilation with (-DWITH_DEFLATE_HEADER_COMPRESSION=ON
).
One issue with using the content_encoding field is that the uncompressed size is not stored anywhere. So a parser has no idea how large it will be when unpacked. Maybe not a critical issue, but it makes it harder to have strict checks.
At least for deflate
, one does usually decode the data in chunks. Thus, the application can always throw an error when it exceeds a security limit. Having an uncompressed size field in the file also would not increase security since it is not guaranteed that the compressed data will match the size indicated there.
It would most likely be beneficial to compress Exif and XMP metadata to save space.
XMP
is specified with anitem_type
ofmime
, which allows you to specify acontent_encoding
. This could be used to specify any of the usual compression schemes.Exif is specified with an
item_type
ofExif
, which does not allow specifying an encoding.Two questions that need clarification:
item_type
ofmime
and some already specified MIME type? If not, we should introduce some kind of compressed Exifitem_type
.