GraphicsMagick: JXL: Call JxlEncoderCloseInput() to close input ...

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.41975.1647028405.1607.graphicsmagick-commit@lists.sourceforge.net>
changeset 0fe658be8f34 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=0fe658be8f34
summary: JXL: Call JxlEncoderCloseInput() to close input to the encoder.

diffstat:

 ChangeLog          |  4 ++++
 coders/jxl.c       |  7 ++++++-
 www/Changelog.html |  8 ++++++--
 3 files changed, 16 insertions(+), 3 deletions(-)

diffs (56 lines):

diff -r a0a3bc91a1fa -r 0fe658be8f34 ChangeLog
--- a/ChangeLog	Fri Mar 11 13:26:39 2022 -0600
+++ b/ChangeLog	Fri Mar 11 13:53:13 2022 -0600
@@ -1,5 +1,9 @@
 2022-03-11  Bob Friesenhahn  <[email protected]>
 
+        * coders/jxl.c (WriteJXLImage): Call JxlEncoderCloseInput() so
+        that encoder output is not corrupt.  JXL passes testsuite tests
+        now!
+
         * magick/command.c (CompareImageCommand): Add -auto-orient support
         to 'compare'.  This tries to assure that the two images are right
         side up before comparing.
diff -r a0a3bc91a1fa -r 0fe658be8f34 coders/jxl.c
--- a/coders/jxl.c	Fri Mar 11 13:26:39 2022 -0600
+++ b/coders/jxl.c	Fri Mar 11 13:53:13 2022 -0600
@@ -12,7 +12,7 @@
 %                                   J   X   L                                 %
 %                                 JJJ  X X  LLL                               %
 %                                                                             %
-%                     Read/Write Google JPEG-XL Image Format.                 %
+%                        Read/Write JPEG-XL Image Format.                     %
 %                                                                             %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
@@ -955,6 +955,11 @@
     /* TODO Better Error-code? */
     ThrowJXLWriterException(CoderError,NoDataReturned,image);
 
+  /* Close any input to the encoder. No further input of any kind may
+     be given to the encoder, but further JxlEncoderProcessOutput
+     calls should be done to create the final output. */
+  JxlEncoderCloseInput(jxl_encoder);
+
   out_buf=MagickAllocateResourceLimitedArray(unsigned char *,MaxBufferExtent,sizeof(*out_buf));
   if (out_buf == (unsigned char *) NULL)
     ThrowJXLWriterException(ResourceLimitError,MemoryAllocationFailed,image);
diff -r a0a3bc91a1fa -r 0fe658be8f34 www/Changelog.html
--- a/www/Changelog.html	Fri Mar 11 13:26:39 2022 -0600
+++ b/www/Changelog.html	Fri Mar 11 13:53:13 2022 -0600
@@ -37,9 +37,13 @@
 
 <p>2022-03-11  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>
-* magick/command.c (CompareImageCommand): Add -auto-orient support
+<p>* coders/jxl.c (WriteJXLImage): Call JxlEncoderCloseInput() so
+that encoder output is not corrupt.  JXL passes testsuite tests
+now!</p>
+<p>* magick/command.c (CompareImageCommand): Add -auto-orient support
 to 'compare'.  This tries to assure that the two images are right
-side up before comparing.</blockquote>
+side up before comparing.</p>
+</blockquote>
 <p>2022-03-05  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>
 * coders/jxl.c (WriteJXLImage): Work to update JXL writer code to
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.