Commit cce01a58 for libheif
commit cce01a5807f2fb3a292374b6b48287e2d703033b
Author: Dirk Farin <dirk.farin@gmail.com>
Date: Tue Sep 29 18:17:27 2026 +0200
FFmpeg decoder: support full-range 8-bit 4:2:2 and 4:4:4 output
FFmpeg has separate pixel formats for full-range 8-bit YCbCr. Its AVC
decoder returns YUVJ422P and YUVJ444P for full-range streams, and its
JPEG decoder for every JPEG with 4:2:2 or 4:4:4 chroma. Only YUVJ420P
was accepted, the other two were rejected as unsupported pixel formats.
The range is not taken from the pixel format. As for YUVJ420P, it comes
from the colour signalling of the stream or from the 'colr' box.
diff --git a/libheif/plugins/decoder_ffmpeg.cc b/libheif/plugins/decoder_ffmpeg.cc
index 9c58e5e4..bd1c2fe2 100644
--- a/libheif/plugins/decoder_ffmpeg.cc
+++ b/libheif/plugins/decoder_ffmpeg.cc
@@ -371,6 +371,7 @@ static heif_chroma ffmpeg_get_chroma_format(AVPixelFormat pix_fmt) {
return heif_chroma_420;
case AV_PIX_FMT_YUV422P:
+ case AV_PIX_FMT_YUVJ422P:
case AV_PIX_FMT_YUV422P9:
case AV_PIX_FMT_YUV422P10:
case AV_PIX_FMT_YUV422P12:
@@ -379,6 +380,7 @@ static heif_chroma ffmpeg_get_chroma_format(AVPixelFormat pix_fmt) {
return heif_chroma_422;
case AV_PIX_FMT_YUV444P:
+ case AV_PIX_FMT_YUVJ444P:
case AV_PIX_FMT_YUV444P9:
case AV_PIX_FMT_YUV444P10:
case AV_PIX_FMT_YUV444P12:
@@ -444,7 +446,9 @@ static int get_ffmpeg_format_bpp(AVPixelFormat pix_fmt)
case AV_PIX_FMT_YUV420P:
case AV_PIX_FMT_YUVJ420P:
case AV_PIX_FMT_YUV422P:
+ case AV_PIX_FMT_YUVJ422P:
case AV_PIX_FMT_YUV444P:
+ case AV_PIX_FMT_YUVJ444P:
case AV_PIX_FMT_GBRP:
return 8;
case AV_PIX_FMT_GRAY9: