From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id C03B64BB85 for ; Wed, 23 Jul 2025 13:58:39 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id CC39868D965; Wed, 23 Jul 2025 16:56:55 +0300 (EEST) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 596C068D892 for ; Wed, 23 Jul 2025 16:56:33 +0300 (EEST) Received: from haasn.dev (unknown [10.30.1.1]) by haasn.dev (Postfix) with UTF8SMTP id 996C8483B8; Wed, 23 Jul 2025 15:56:28 +0200 (CEST) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Wed, 23 Jul 2025 15:47:12 +0200 Message-ID: <20250723135626.1390296-10-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250723135626.1390296-1-ffmpeg@haasn.xyz> References: <20250723135626.1390296-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 09/18] avcodec/libjxlenc: also attach extra channel info X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Niklas Haas Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Niklas Haas Works around a bug where older versions of libjxl don't correctly forward the alpha channel information to the extra channel info. --- libavcodec/libjxlenc.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libavcodec/libjxlenc.c b/libavcodec/libjxlenc.c index 924a835436..5a062b8d0d 100644 --- a/libavcodec/libjxlenc.c +++ b/libavcodec/libjxlenc.c @@ -394,6 +394,19 @@ static int libjxl_preprocess_stream(AVCodecContext *avctx, const AVFrame *frame, return AVERROR_EXTERNAL; } + if (info.alpha_bits) { + JxlExtraChannelInfo extra_info; + JxlEncoderInitExtraChannelInfo(JXL_CHANNEL_ALPHA, &extra_info); + extra_info.bits_per_sample = info.alpha_bits; + extra_info.exponent_bits_per_sample = info.alpha_exponent_bits; + extra_info.alpha_premultiplied = info.alpha_premultiplied; + + if (JxlEncoderSetExtraChannelInfo(ctx->encoder, 0, &extra_info) != JXL_ENC_SUCCESS) { + av_log(avctx, AV_LOG_ERROR, "Failed to set JxlExtraChannelInfo for channel %d\n", i); + return AVERROR_EXTERNAL; + } + } + sd = av_frame_get_side_data(frame, AV_FRAME_DATA_ICC_PROFILE); if (sd && sd->size && JxlEncoderSetICCProfile(ctx->encoder, sd->data, sd->size) != JXL_ENC_SUCCESS) { av_log(avctx, AV_LOG_WARNING, "Could not set ICC Profile\n"); -- 2.50.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".