Bug 274546 - graphics/libheif: Update to 1.17.1
Summary: graphics/libheif: Update to 1.17.1
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Max Brazhnikov
URL: https://github.com/strukturag/libheif...
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-17 19:36 UTC by Daniel Engberg
Modified: 2024-01-24 14:46 UTC (History)
2 users (show)

See Also:
makc: maintainer-feedback+


Attachments
Patch for libheif (5.94 KB, patch)
2023-10-17 19:36 UTC, Daniel Engberg
no flags Details | Diff
Patch for libheif v2 (3.61 KB, patch)
2023-10-20 04:48 UTC, Daniel Engberg
no flags Details | Diff
Patch for libheif v3 (4.72 KB, patch)
2023-10-20 21:43 UTC, Daniel Engberg
no flags Details | Diff
Patch for libheif v4 (3.53 KB, patch)
2023-10-20 21:45 UTC, Daniel Engberg
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Engberg freebsd_committer freebsd_triage 2023-10-17 19:36:09 UTC
Created attachment 245702 [details]
Patch for libheif

Replace libde265 with ffmpeg as HEVC decoder
Enable JPEG and OpenJPEG 2000 support
Disable Doxygen detection
Backport multiple upstream commits 

Compile and runtime tested on FreeBSD 13.2-RELEASE (amd64) (make, make check-plist, make test)

Poudriere testport OK 13.2-RELEASE (amd64)
Poudriere testport OK 12.4-RELEASE (amd64)
Comment 1 Daniel Engberg freebsd_committer freebsd_triage 2023-10-17 19:36:45 UTC
Given the amount of patches we should probably wait a few days for a new release
Comment 2 Daniel Engberg freebsd_committer freebsd_triage 2023-10-20 04:48:50 UTC
Created attachment 245753 [details]
Patch for libheif v2
Comment 3 Daniel Engberg freebsd_committer freebsd_triage 2023-10-20 04:49:54 UTC
Tested with following consumers in Poudriere, 13.2-RELEASE:
astro/siril
graphics/ImageMagick6
graphics/ImageMagick7
graphics/cimg
graphics/darktable
graphics/digikam
graphics/geeqie
graphics/gimp-app
graphics/imv
graphics/kf5-kimageformats
graphics/krita
graphics/openimageio
graphics/py-openimageio
graphics/py-pillow-heif
graphics/vips
x11/swayimg
x11/wallutils
Comment 4 Max Brazhnikov freebsd_committer freebsd_triage 2023-10-20 21:10:25 UTC
(In reply to Daniel Engberg from comment #0)
Daniel, thanks for update. What's your reason for switching from libde265 to FFmpeg? FFmpeg support is still new, so I'd follow upstream here. Besides libde265 is much lighter as package comparing to FFmpeg.
Comment 5 Daniel Engberg freebsd_committer freebsd_triage 2023-10-20 21:40:37 UTC
Mainly because libde265 has a very poor track record, https://www.opencve.io/cve?vendor=struktur&product=libde265 but also that I don't see the need for using that library.

I'm aware that FFmpeg's default config is heavier but I would also argue that the majority of users wanting to utilize libheif (HEIF/AVIF) are already using other multimedia applications and/or also a desktop environment so they're likely to have FFmpeg installed anyway.
Comment 6 Daniel Engberg freebsd_committer freebsd_triage 2023-10-20 21:43:18 UTC
Created attachment 245764 [details]
Patch for libheif v3

Remove stray _DESC entry
Comment 7 Daniel Engberg freebsd_committer freebsd_triage 2023-10-20 21:45:08 UTC
Created attachment 245765 [details]
Patch for libheif v4

Attach correct patch
Comment 8 Max Brazhnikov freebsd_committer freebsd_triage 2023-10-20 22:43:27 UTC
(In reply to Daniel Engberg from comment #5)
Ok, Please add the explanation to the commit message and feel free to commit (and take maintainership if you've changed your mind :).
Comment 9 commit-hook freebsd_committer freebsd_triage 2023-10-21 07:29:57 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5b0594f2a47728e296665858d46809ca79d9b060

commit 5b0594f2a47728e296665858d46809ca79d9b060
Author:     Daniel Engberg <diizzy@FreeBSD.org>
AuthorDate: 2023-10-21 07:17:41 +0000
Commit:     Daniel Engberg <diizzy@FreeBSD.org>
CommitDate: 2023-10-21 07:17:45 +0000

    graphics/libheif: Update to 1.17.1

    - Replace libde265 with FFmpeg as HEVC decoder
    - Enable JPEG and OpenJPEG 2000 support
    - Disable Doxygen detection

    While FFmpeg's default configuration can be a bit on the heavy side
    it's also relatively easy to tailor it to fit your needs and if libheif
    is needed you're likely to have other related ports depending on FFmpeg
    installed. Support is relatively new so there may be bugs lurking.
    Looking back libde265 has also been hit by several CVEs which is another
    reason for the switch.

    References:
    https://www.opencve.io/cve?vendor=struktur&product=libde265

    PR:             274546
    Reviewed by:    makc (maintainer)

 graphics/libheif/Makefile  | 28 +++++++++++++++++++++-------
 graphics/libheif/distinfo  |  6 +++---
 graphics/libheif/pkg-plist |  7 ++++++-
 3 files changed, 30 insertions(+), 11 deletions(-)
Comment 10 Daniel Engberg freebsd_committer freebsd_triage 2023-10-21 07:33:37 UTC
Updated, thanks
Comment 11 Alexander Piskun 2024-01-16 07:57:29 UTC
The FFM decoder is not ready for practical use; there are many image modes for which it returns decoding errors.
That is why in libheif it is not the default decoder.
Unfortunately, I noticed this topic too late, and now nothing can be done about it.
Comment 12 Max Brazhnikov freebsd_committer freebsd_triage 2024-01-16 10:13:43 UTC
(In reply to Alexander Piskun from comment #11)
Not a problem at all, nothing prevents us from FFMPEG back to LIBDE265.

Daniel, what do you think?
Comment 13 Daniel Engberg freebsd_committer freebsd_triage 2024-01-20 09:43:53 UTC
While I don't mind the dependency I'm more concerned about security than a few variants not working to be honest looking at the history.

https://nvd.nist.gov/products/cpe/search/results?namingFormat=2.3&orderBy=2.3&keyword=cpe%3A2.3%3Aa%3Astruktur%3Alibde265&status=FINAL%2CDEPRECATED
Comment 14 Max Brazhnikov freebsd_committer freebsd_triage 2024-01-24 14:46:29 UTC
(In reply to Daniel Engberg from comment #13)
Bugs and security issues happen everywhere. libde265 project is alive, they fix problems and make new releases promptly. On the other hand our libde265 port needs more care and maintenance. It has to be updated to the latest version before we switch back.