Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "Peter Kovář" <peter.kovar@reflexion.tv>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH] Adapted to the latest JPEG XL library version 0.9.0
Date: Sat, 1 Jul 2023 15:24:10 +0200
Message-ID: <fd749008-1aff-bb2a-3d7f-97928f96c148@reflexion.tv> (raw)


[-- Attachment #1.1.1.1: Type: text/plain, Size: 2973 bytes --]

Signed-off-by: Peter Kovář <peter.kovar@reflexion.tv>
---
  libavcodec/libjxldec.c | 17 +++++++++++++++++
  1 file changed, 17 insertions(+)

diff --git a/libavcodec/libjxldec.c b/libavcodec/libjxldec.c
index 50417bcb02..bfff60769c 100644
--- a/libavcodec/libjxldec.c
+++ b/libavcodec/libjxldec.c
@@ -210,14 +210,23 @@ static int libjxl_get_icc(AVCodecContext *avctx)
      JxlDecoderStatus jret;
      /* an ICC profile is present, and we can meaningfully get it,
       * because the pixel data is not XYB-encoded */
+#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0, 9, 0)
      jret = JxlDecoderGetICCProfileSize(ctx->decoder, &ctx->jxl_pixfmt, 
JXL_COLOR_PROFILE_TARGET_DATA, &icc_len);
+#else
+    jret = JxlDecoderGetICCProfileSize(ctx->decoder, 
JXL_COLOR_PROFILE_TARGET_DATA, &icc_len);
+#endif
      if (jret == JXL_DEC_SUCCESS && icc_len > 0) {
          av_buffer_unref(&ctx->iccp);
          ctx->iccp = av_buffer_alloc(icc_len);
          if (!ctx->iccp)
              return AVERROR(ENOMEM);
+#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0, 9, 0)
          jret = JxlDecoderGetColorAsICCProfile(ctx->decoder, 
&ctx->jxl_pixfmt, JXL_COLOR_PROFILE_TARGET_DATA,
                                                  ctx->iccp->data, icc_len);
+#else
+        jret = JxlDecoderGetColorAsICCProfile(ctx->decoder, 
JXL_COLOR_PROFILE_TARGET_DATA,
+                                                ctx->iccp->data, icc_len);
+#endif
          if (jret != JXL_DEC_SUCCESS) {
              av_log(avctx, AV_LOG_WARNING, "Unable to obtain ICC 
Profile\n");
              av_buffer_unref(&ctx->iccp);
@@ -253,12 +262,20 @@ static int 
libjxl_color_encoding_event(AVCodecContext *avctx, AVFrame *frame)
      /* set this flag if we need to fall back on wide gamut */
      int fallback = 0;
  +#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0, 9, 0)
      jret = JxlDecoderGetColorAsEncodedProfile(ctx->decoder, NULL, 
JXL_COLOR_PROFILE_TARGET_ORIGINAL, &jxl_color);
+#else
+    jret = JxlDecoderGetColorAsEncodedProfile(ctx->decoder, 
JXL_COLOR_PROFILE_TARGET_ORIGINAL, &jxl_color);
+#endif
      if (jret == JXL_DEC_SUCCESS) {
          /* enum values describe the colors of this image */
          jret = JxlDecoderSetPreferredColorProfile(ctx->decoder, 
&jxl_color);
          if (jret == JXL_DEC_SUCCESS)
+#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0, 9, 0)
              jret = JxlDecoderGetColorAsEncodedProfile(ctx->decoder, 
&ctx->jxl_pixfmt, JXL_COLOR_PROFILE_TARGET_DATA, &jxl_color);
+#else
+            jret = JxlDecoderGetColorAsEncodedProfile(ctx->decoder, 
JXL_COLOR_PROFILE_TARGET_DATA, &jxl_color);
+#endif
          /* if we couldn't successfully request the pixel data space, 
we fall back on wide gamut */
          /* this code path is very unlikely to happen in practice */
          if (jret != JXL_DEC_SUCCESS)
-- 
2.41.0


[-- Attachment #1.1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 657 bytes --]

[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

             reply	other threads:[~2023-07-01 13:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-01 13:24 Peter Kovář [this message]
2023-07-01 13:55 ` Gyan Doshi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fd749008-1aff-bb2a-3d7f-97928f96c148@reflexion.tv \
    --to=peter.kovar@reflexion.tv \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git