Commit aee1838d for libheif
commit aee1838d5c757704f5bb4eb2d40bac516db95f11
Author: ojvasquez830 <oj.vasquez830@gmail.com>
Date: Fri Aug 28 08:34:49 2026 -0700
support 12, 14 and 16 bit monochrome in the FFmpeg decoder plugin
ffmpeg_get_chroma_format() only mapped GRAY8 and GRAY10LE to
heif_chroma_monochrome. Any monochrome frame above 10 bit fell through to the
default branch and returned heif_chroma_undefined, so the decode failed with
heif_error_Unsupported_feature / heif_suberror_Unsupported_color_conversion.
get_ffmpeg_format_bpp(), directly below it in the same file, already handles
GRAY12LE, GRAY14LE and GRAY16LE. The two switches simply disagreed.
This also affects colour images: an alpha channel is stored as a separate
monochrome item, so a 12 bit image with an alpha plane failed as well even
though the image itself is not monochrome.
diff --git a/libheif/plugins/decoder_ffmpeg.cc b/libheif/plugins/decoder_ffmpeg.cc
index 0f7f05cb..3f5313be 100644
--- a/libheif/plugins/decoder_ffmpeg.cc
+++ b/libheif/plugins/decoder_ffmpeg.cc
@@ -339,6 +339,9 @@ static heif_chroma ffmpeg_get_chroma_format(AVPixelFormat pix_fmt) {
switch (pix_fmt) {
case AV_PIX_FMT_GRAY8:
case AV_PIX_FMT_GRAY10LE:
+ case AV_PIX_FMT_GRAY12LE:
+ case AV_PIX_FMT_GRAY14LE:
+ case AV_PIX_FMT_GRAY16LE:
return heif_chroma_monochrome;
case AV_PIX_FMT_YUV420P: