Fix an issue that resulted in an error ("Invalid SOS parameters for sequential JPEG. Didn't expect more than one scan.") when decoding progressive+arithmetic JPEGs generated by libjpeg-turbo.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1048 632fc199-4ca6-4c93-a231-07263d6284db
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 690dc2b..e0a1b76 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -38,10 +38,8 @@
access the c:\WINDOWS\system32 directory, which made it impossible for the
TurboVNC build scripts to bundle the 64-bit TurboJPEG DLL.
-[3] Fixed a bug whereby attempting to encode a progressive JPEG with arithmetic
-entropy coding (by passing arguments of -progressive -arithmetic to cjpeg or
-jpegtran, for instance) would result in an error, "Requested feature was
-omitted at compile time".
+[3] Fixed a couple of bugs that prevented libjpeg-turbo from encoding or
+decoding progressive JPEGs with arithmetic entropy coding.
1.3.0
diff --git a/jcmarker.c b/jcmarker.c
index 039dea1..311e4b2 100644
--- a/jcmarker.c
+++ b/jcmarker.c
@@ -3,6 +3,7 @@
*
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1991-1998, Thomas G. Lane.
+ * Modified 2003-2010 by Guido Vollbeding.
* Modifications:
* Copyright (C) 2010, D. R. Commander.
* For conditions of distribution and use, see the accompanying README file.
@@ -532,7 +533,10 @@
/* Emit the proper SOF marker */
if (cinfo->arith_code) {
- emit_sof(cinfo, M_SOF9); /* SOF code for arithmetic coding */
+ if (cinfo->progressive_mode)
+ emit_sof(cinfo, M_SOF10); /* SOF code for progressive arithmetic */
+ else
+ emit_sof(cinfo, M_SOF9); /* SOF code for sequential arithmetic */
} else {
if (cinfo->progressive_mode)
emit_sof(cinfo, M_SOF2); /* SOF code for progressive Huffman */