[FFmpeg-cvslog] avcodec/libjxldec: fix gamma22 and gamma28 recognition

Leo Izen git at videolan.org
Sun Jan 22 17:18:44 EET 2023


ffmpeg | branch: release/5.1 | Leo Izen <leo.izen at gmail.com> | Wed Jan 18 09:16:37 2023 -0500| [30d432f205538f6ef6c86ed0a90e27cdd735cd2b] | committer: Jan Ekström

avcodec/libjxldec: fix gamma22 and gamma28 recognition

Gamma 2.2 and Gamma 2.8 are tagged in the file as 0.45455 and 0.35714,
respectively (i.e. 1/2.2 and 1/2.8). Trying to identify them as 2.2 and
2.8 instead of these values will cause the transfer function to not
properly be recognized. This patch fixes this.

(cherry picked from commit 9d5e66942c5bae578926e29efebec348199798df)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=30d432f205538f6ef6c86ed0a90e27cdd735cd2b
---

 libavcodec/libjxldec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/libjxldec.c b/libavcodec/libjxldec.c
index 829478bbde..396ed1dcb2 100644
--- a/libavcodec/libjxldec.c
+++ b/libavcodec/libjxldec.c
@@ -167,9 +167,9 @@ static enum AVColorTransferCharacteristic libjxl_get_trc(void *avctx, const JxlC
     case JXL_TRANSFER_FUNCTION_DCI: return AVCOL_TRC_SMPTE428;
     case JXL_TRANSFER_FUNCTION_HLG: return AVCOL_TRC_ARIB_STD_B67;
     case JXL_TRANSFER_FUNCTION_GAMMA:
-        if (jxl_color->gamma > 2.199 && jxl_color->gamma < 2.201)
+        if (jxl_color->gamma > 0.45355 && jxl_color->gamma < 0.45555)
             return AVCOL_TRC_GAMMA22;
-        else if (jxl_color->gamma > 2.799 && jxl_color->gamma < 2.801)
+        else if (jxl_color->gamma > 0.35614 && jxl_color->gamma < 0.35814)
             return AVCOL_TRC_GAMMA28;
         else
             av_log(avctx, AV_LOG_WARNING, "Unsupported gamma transfer: %f\n", jxl_color->gamma);



More information about the ffmpeg-cvslog mailing list