GraphicsMagick: WriteJXLImage(): Port forward to latest developm...

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.11470.1688836331.17685.graphicsmagick-commit@lists.sourceforge.net>
changeset 43bc74dd0c13 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=43bc74dd0c13
summary: WriteJXLImage(): Port forward to latest development 0.9.0 API

diffstat:

 ChangeLog                              |   8 ++++++++
 VisualMagick/installer/inc/version.isx |   4 ++--
 coders/jxl.c                           |  27 +++++++++++++++++++++------
 magick/version.h                       |   4 ++--
 www/Changelog.html                     |  10 ++++++++++
 5 files changed, 43 insertions(+), 10 deletions(-)

diffs (122 lines):

diff -r 258acc091770 -r 43bc74dd0c13 ChangeLog
--- a/ChangeLog	Thu Jul 06 08:16:25 2023 -0500
+++ b/ChangeLog	Sat Jul 08 12:11:53 2023 -0500
@@ -1,3 +1,11 @@
+2023-07-08  Bob Friesenhahn  <[email protected]>
+
+	* coders/jxl.c (WriteJXLImage): Port forward to latest development
+	0.9.0 API, which removes unused pixel_format from
+	JxlDecoderGetColorAsEncodedProfile(),
+	JxlDecoderGetICCProfileSize(), JxlDecoderGetColorAsICCProfile()
+	and silently drops JXL_ENC_NOT_SUPPORTED.
+
 2023-07-06  Bob Friesenhahn  <[email protected]>
 
 	* fuzzing/oss-fuzz-build.sh: Add --disable-ifunc to xz build
diff -r 258acc091770 -r 43bc74dd0c13 VisualMagick/installer/inc/version.isx
--- a/VisualMagick/installer/inc/version.isx	Thu Jul 06 08:16:25 2023 -0500
+++ b/VisualMagick/installer/inc/version.isx	Sat Jul 08 12:11:53 2023 -0500
@@ -10,5 +10,5 @@
 
 #define public MagickPackageName "GraphicsMagick"
 #define public MagickPackageVersion "1.4"
-#define public MagickPackageVersionAddendum ".020230706"
-#define public MagickPackageReleaseDate "snapshot-20230706"
+#define public MagickPackageVersionAddendum ".020230708"
+#define public MagickPackageReleaseDate "snapshot-20230708"
diff -r 258acc091770 -r 43bc74dd0c13 coders/jxl.c
--- a/coders/jxl.c	Thu Jul 06 08:16:25 2023 -0500
+++ b/coders/jxl.c	Sat Jul 08 12:11:53 2023 -0500
@@ -631,8 +631,12 @@
             JxlColorEncoding
               color_encoding;
 
-            status=JxlDecoderGetColorAsEncodedProfile(jxl_decoder,&pixel_format,
-                                                      JXL_COLOR_PROFILE_TARGET_DATA,&color_encoding);
+            status=JxlDecoderGetColorAsEncodedProfile(jxl_decoder,
+#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0,9,0)
+                                                      &pixel_format,
+#endif /* if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0,9,0) */
+                                                      JXL_COLOR_PROFILE_TARGET_DATA,
+                                                      &color_encoding);
             if (status == JXL_DEC_ERROR)
               {
                 status=JXL_DEC_SUCCESS;
@@ -733,8 +737,12 @@
               size_t
                 profile_size;
 
-              if (JxlDecoderGetICCProfileSize(jxl_decoder,&pixel_format,
-                                              JXL_COLOR_PROFILE_TARGET_ORIGINAL,&profile_size)
+              if (JxlDecoderGetICCProfileSize(jxl_decoder,
+#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0,9,0)
+                                              &pixel_format,
+#endif /* if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0,9,0) */
+                                              JXL_COLOR_PROFILE_TARGET_ORIGINAL,
+                                              &profile_size)
                   == JXL_DEC_SUCCESS)
                 {
                   unsigned char
@@ -743,10 +751,14 @@
                   if ((profile=MagickAllocateResourceLimitedMemory(unsigned char *,profile_size))
                       != NULL)
                     {
-                      if (JxlDecoderGetColorAsICCProfile(jxl_decoder,&pixel_format,
+                      if (JxlDecoderGetColorAsICCProfile(jxl_decoder,
+#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0,9,0)
+                                                         &pixel_format,
+#endif /* if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0,9,0) */
                                                          JXL_COLOR_PROFILE_TARGET_ORIGINAL,
                                                          profile,
-                                                         profile_size) == JXL_DEC_SUCCESS)
+                                                         profile_size)
+                          == JXL_DEC_SUCCESS)
                         {
                           (void) SetImageProfile(image,"ICM",profile,profile_size);
                         }
@@ -1290,8 +1302,11 @@
       /* TODO better error codes */
       if (jxl_status == JXL_ENC_ERROR)
         ThrowJXLWriterException(CoderError,NoDataReturned,image);
+#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0,9,0)
+      /* JXL_ENC_NOT_SUPPORTED was removed for 0.9.0, although API docs still mention it. */
       else if (jxl_status == JXL_ENC_NOT_SUPPORTED)
         ThrowJXLWriterException(CoderError,UnsupportedBitsPerSample,image);
+#endif /* if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0,9,0) */
       else
         ThrowJXLWriterException(CoderFatalError,Default,image);
     }
diff -r 258acc091770 -r 43bc74dd0c13 magick/version.h
--- a/magick/version.h	Thu Jul 06 08:16:25 2023 -0500
+++ b/magick/version.h	Sat Jul 08 12:11:53 2023 -0500
@@ -38,8 +38,8 @@
 #define MagickLibVersion  0x272402
 #define MagickLibVersionText  "1.4"
 #define MagickLibVersionNumber 27,24,2
-#define MagickChangeDate   "20230706"
-#define MagickReleaseDate  "snapshot-20230706"
+#define MagickChangeDate   "20230708"
+#define MagickReleaseDate  "snapshot-20230708"
 
 /*
   The MagickLibInterfaceNewest and MagickLibInterfaceOldest defines
diff -r 258acc091770 -r 43bc74dd0c13 www/Changelog.html
--- a/www/Changelog.html	Thu Jul 06 08:16:25 2023 -0500
+++ b/www/Changelog.html	Sat Jul 08 12:11:53 2023 -0500
@@ -37,6 +37,16 @@
 </div>
 
 <div class="document">
+<p>2023-07-08  Bob Friesenhahn  &lt;<a class="reference external" href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#64;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
+<blockquote>
+<ul class="simple">
+<li><p>coders/jxl.c (WriteJXLImage): Port forward to latest development
+0.9.0 API, which removes unused pixel_format from
+JxlDecoderGetColorAsEncodedProfile(),
+JxlDecoderGetICCProfileSize(), JxlDecoderGetColorAsICCProfile()
+and silently drops JXL_ENC_NOT_SUPPORTED.</p></li>
+</ul>
+</blockquote>
 <p>2023-07-06  Bob Friesenhahn  &lt;<a class="reference external" href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#64;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
 <blockquote>
 <ul class="simple">
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.