[FFmpeg-devel] [PATCH] avcodec/libjxlenc: use reciprocol gamma for GAMMA22 and GAMMA28

Leo Izen leo.izen at gmail.com
Tue Apr 4 17:18:31 EEST 2023


libjxl rejects JxlColorEncoding->gamma 2.2f or 2.8f and expects
0.45455f or 0.35714f, respectively.

Signed-off-by: Leo Izen <leo.izen at gmail.com>
---
 libavcodec/libjxlenc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/libjxlenc.c b/libavcodec/libjxlenc.c
index 897452f575..82dfe189d6 100644
--- a/libavcodec/libjxlenc.c
+++ b/libavcodec/libjxlenc.c
@@ -335,11 +335,11 @@ static int libjxl_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFra
         break;
     case AVCOL_TRC_GAMMA22:
         jxl_color.transfer_function = JXL_TRANSFER_FUNCTION_GAMMA;
-        jxl_color.gamma = 2.2;
+        jxl_color.gamma = 0.45455;
         break;
     case AVCOL_TRC_GAMMA28:
         jxl_color.transfer_function = JXL_TRANSFER_FUNCTION_GAMMA;
-        jxl_color.gamma = 2.8;
+        jxl_color.gamma = 0.35714;
         break;
     default:
         if (pix_desc->flags & AV_PIX_FMT_FLAG_FLOAT) {
-- 
2.40.0



More information about the ffmpeg-devel mailing list