From: DRC Date: Thu, 15 Aug 2019 18:24:25 +0000 (-0500) Subject: tjDecodeYUV*: Fix err if TJ inst used for prog dec X-Git-Tag: 2.0.3~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ded5a504b4c9aa998c852a5a7f4c0f9e9b78eb47;p=libjpeg-turbo tjDecodeYUV*: Fix err if TJ inst used for prog dec If the TurboJPEG instance passed to tjDecodeYUV[Planes]() was previously used to decompress a progressive JPEG image, then we need to disable the progressive decompression parameters in the underlying libjpeg instance before calling jinit_master_decompress(). This commit also modifies the build system so that the "tjtest" target will test for this issue, and it corrects a previous oversight in the build system whereby tjbenchtest did not test progressive compression/decompression unless WITH_JAVA was true. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index ccd3f08..28fd443 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1290,6 +1290,8 @@ if(WITH_TURBOJPEG) COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest -yuv -alloc COMMAND echo tjbenchtest -progressive COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest -progressive + COMMAND echo tjbenchtest -progressive -yuv + COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest -progressive -yuv COMMAND echo tjexampletest COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjexampletest COMMAND echo tjbenchtest.java @@ -1298,6 +1300,9 @@ if(WITH_TURBOJPEG) COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest.java -yuv COMMAND echo tjbenchtest.java -progressive COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest.java -progressive + COMMAND echo tjexampletest.java -progressive -yuv + COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest.java + -progressive -yuv COMMAND echo tjexampletest.java COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjexampletest.java DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest @@ -1313,6 +1318,10 @@ if(WITH_TURBOJPEG) COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest -yuv COMMAND echo tjbenchtest -yuv -alloc COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest -yuv -alloc + COMMAND echo tjbenchtest -progressive + COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest -progressive + COMMAND echo tjbenchtest -progressive -yuv + COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest -progressive -yuv COMMAND echo tjexampletest COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjexampletest DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest) diff --git a/ChangeLog.md b/ChangeLog.md index 0033f27..3667d12 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -30,6 +30,11 @@ generate a progressive JPEG image on an SSE2-capable CPU using a scan script containing one or more scans with lengths divisible by 16 would result in an error ("Missing Huffman code table entry") and an invalid JPEG image. +6. Fixed an issue whereby `tjDecodeYUV()` and `tjDecodeYUVPlanes()` would throw +an error ("Invalid progressive parameters") or a warning ("Inconsistent +progression sequence") if passed a TurboJPEG instance that was previously used +to decompress a progressive JPEG image. + 2.0.2 ===== diff --git a/turbojpeg.c b/turbojpeg.c index b6a1f20..3a1e3a9 100644 --- a/turbojpeg.c +++ b/turbojpeg.c @@ -1432,6 +1432,9 @@ DLLEXPORT int tjDecodeYUVPlanes(tjhandle handle, else if (flags & TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1"); #endif + dinfo->progressive_mode = dinfo->inputctl->has_multiple_scans = FALSE; + dinfo->Ss = dinfo->Ah = dinfo->Al = 0; + dinfo->Se = DCTSIZE2 - 1; if (setDecodeDefaults(dinfo, pixelFormat, subsamp, flags) == -1) { retval = -1; goto bailout; }