libheif decodes and generates all conformant still-image HEIF/AVIF files, including HDR, and uses the color transformation matrices specified in the color profile. The HEIF decoder makes use of libde265. For encoding, x265 is used. AVIF uses either libaom or dav1d for decoding and libaom or rav1e for encoding.
The library is available as the libheif package in Debian and Ubuntu and has been integrated into:
More information on its github page.