summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-09-29 01:00:09 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-09-29 01:00:10 +0200
commit0e1866017fd389629629b150ce252820592506cd (patch)
tree681142ae0e610ef7af2a43ca2d62c3ea5ed5f91a /src
parent9567a34bc0d9be87d3b0d6cbcb841837ca1d5659 (diff)
parent9a8175a13124e156948914854d2fda7436065b08 (diff)
Merge remote-tracking branch 'origin/5.12' into dev
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/double-conversion/bignum-dtoa.cc8
-rw-r--r--src/3rdparty/double-conversion/bignum-dtoa.h2
-rw-r--r--src/3rdparty/double-conversion/bignum.cc13
-rw-r--r--src/3rdparty/double-conversion/bignum.h4
-rw-r--r--src/3rdparty/double-conversion/cached-powers.cc10
-rw-r--r--src/3rdparty/double-conversion/cached-powers.h2
-rw-r--r--src/3rdparty/double-conversion/diy-fp.cc4
-rw-r--r--src/3rdparty/double-conversion/diy-fp.h2
-rw-r--r--src/3rdparty/double-conversion/double-conversion.cc262
-rw-r--r--src/3rdparty/double-conversion/double-conversion.pri2
-rw-r--r--src/3rdparty/double-conversion/fast-dtoa.cc8
-rw-r--r--src/3rdparty/double-conversion/fast-dtoa.h2
-rw-r--r--src/3rdparty/double-conversion/fixed-dtoa.cc6
-rw-r--r--src/3rdparty/double-conversion/fixed-dtoa.h2
-rw-r--r--src/3rdparty/double-conversion/ieee.h6
-rw-r--r--src/3rdparty/double-conversion/include/double-conversion/double-conversion.h53
-rw-r--r--src/3rdparty/double-conversion/include/double-conversion/utils.h58
-rw-r--r--src/3rdparty/double-conversion/qt_attribution.json4
-rw-r--r--src/3rdparty/double-conversion/strtod.cc49
-rw-r--r--src/3rdparty/double-conversion/strtod.h2
-rw-r--r--src/3rdparty/harfbuzz-ng/qt_attribution.json2
-rw-r--r--src/3rdparty/harfbuzz/qt_attribution.json2
-rw-r--r--src/3rdparty/iaccessible2/qt_attribution.json1
-rw-r--r--src/3rdparty/libjpeg.pri12
-rw-r--r--src/3rdparty/libjpeg/LICENSE16
-rwxr-xr-xsrc/3rdparty/libjpeg/import_from_libjpeg_tarball.sh8
-rw-r--r--src/3rdparty/libjpeg/jconfig.h23
-rw-r--r--src/3rdparty/libjpeg/jconfigint.h17
-rw-r--r--src/3rdparty/libjpeg/qt_attribution.json7
-rw-r--r--src/3rdparty/libjpeg/src/ChangeLog.md196
-rw-r--r--src/3rdparty/libjpeg/src/README.ijg64
-rw-r--r--[-rwxr-xr-x]src/3rdparty/libjpeg/src/README.md13
-rw-r--r--src/3rdparty/libjpeg/src/jaricom.c13
-rw-r--r--src/3rdparty/libjpeg/src/jcapimin.c44
-rw-r--r--src/3rdparty/libjpeg/src/jcapistd.c26
-rw-r--r--src/3rdparty/libjpeg/src/jcarith.c104
-rw-r--r--src/3rdparty/libjpeg/src/jccoefct.c102
-rw-r--r--src/3rdparty/libjpeg/src/jccolext.c46
-rw-r--r--src/3rdparty/libjpeg/src/jccolor.c377
-rw-r--r--src/3rdparty/libjpeg/src/jcdctmgr.c118
-rw-r--r--src/3rdparty/libjpeg/src/jchuff.c255
-rw-r--r--src/3rdparty/libjpeg/src/jchuff.h13
-rw-r--r--src/3rdparty/libjpeg/src/jcinit.c10
-rw-r--r--src/3rdparty/libjpeg/src/jcmainct.c40
-rw-r--r--src/3rdparty/libjpeg/src/jcmarker.c93
-rw-r--r--src/3rdparty/libjpeg/src/jcmaster.c135
-rw-r--r--src/3rdparty/libjpeg/src/jcomapi.c12
-rw-r--r--src/3rdparty/libjpeg/src/jconfig.h143
-rw-r--r--src/3rdparty/libjpeg/src/jconfig.h.in73
-rw-r--r--src/3rdparty/libjpeg/src/jconfigint.h13
-rw-r--r--src/3rdparty/libjpeg/src/jconfigint.h.in31
-rw-r--r--src/3rdparty/libjpeg/src/jcparam.c87
-rw-r--r--src/3rdparty/libjpeg/src/jcphuff.c675
-rw-r--r--src/3rdparty/libjpeg/src/jcprepct.c92
-rw-r--r--src/3rdparty/libjpeg/src/jcsample.c120
-rw-r--r--src/3rdparty/libjpeg/src/jctrans.c70
-rw-r--r--src/3rdparty/libjpeg/src/jdapimin.c42
-rw-r--r--src/3rdparty/libjpeg/src/jdapistd.c114
-rw-r--r--src/3rdparty/libjpeg/src/jdarith.c122
-rw-r--r--src/3rdparty/libjpeg/src/jdatadst.c50
-rw-r--r--src/3rdparty/libjpeg/src/jdatasrc.c52
-rw-r--r--src/3rdparty/libjpeg/src/jdcoefct.c247
-rw-r--r--src/3rdparty/libjpeg/src/jdcoefct.h6
-rw-r--r--src/3rdparty/libjpeg/src/jdcol565.c88
-rw-r--r--src/3rdparty/libjpeg/src/jdcolext.c34
-rw-r--r--src/3rdparty/libjpeg/src/jdcolor.c476
-rw-r--r--src/3rdparty/libjpeg/src/jdct.h148
-rw-r--r--src/3rdparty/libjpeg/src/jddctmgr.c32
-rw-r--r--src/3rdparty/libjpeg/src/jdhuff.c167
-rw-r--r--src/3rdparty/libjpeg/src/jdhuff.h98
-rw-r--r--src/3rdparty/libjpeg/src/jdinput.c99
-rw-r--r--src/3rdparty/libjpeg/src/jdmainct.c118
-rw-r--r--src/3rdparty/libjpeg/src/jdmainct.h12
-rw-r--r--src/3rdparty/libjpeg/src/jdmarker.c302
-rw-r--r--src/3rdparty/libjpeg/src/jdmaster.c173
-rw-r--r--src/3rdparty/libjpeg/src/jdmerge.c366
-rw-r--r--src/3rdparty/libjpeg/src/jdmrg565.c134
-rw-r--r--src/3rdparty/libjpeg/src/jdmrgext.c50
-rw-r--r--src/3rdparty/libjpeg/src/jdphuff.c141
-rw-r--r--src/3rdparty/libjpeg/src/jdpostct.c122
-rw-r--r--src/3rdparty/libjpeg/src/jdsample.c129
-rw-r--r--src/3rdparty/libjpeg/src/jdtrans.c14
-rw-r--r--src/3rdparty/libjpeg/src/jerror.c16
-rw-r--r--src/3rdparty/libjpeg/src/jerror.h99
-rw-r--r--src/3rdparty/libjpeg/src/jfdctflt.c58
-rw-r--r--src/3rdparty/libjpeg/src/jfdctfst.c50
-rw-r--r--src/3rdparty/libjpeg/src/jfdctint.c116
-rw-r--r--src/3rdparty/libjpeg/src/jidctflt.c112
-rw-r--r--src/3rdparty/libjpeg/src/jidctfst.c156
-rw-r--r--src/3rdparty/libjpeg/src/jidctint.c1722
-rw-r--r--src/3rdparty/libjpeg/src/jidctred.c254
-rw-r--r--src/3rdparty/libjpeg/src/jinclude.h20
-rw-r--r--src/3rdparty/libjpeg/src/jmemmgr.c304
-rw-r--r--src/3rdparty/libjpeg/src/jmemnobs.c32
-rw-r--r--src/3rdparty/libjpeg/src/jmemsys.h28
-rw-r--r--src/3rdparty/libjpeg/src/jmorecfg.h84
-rw-r--r--src/3rdparty/libjpeg/src/jpegcomp.h32
-rw-r--r--src/3rdparty/libjpeg/src/jpegint.h132
-rw-r--r--src/3rdparty/libjpeg/src/jpeglib.h210
-rw-r--r--src/3rdparty/libjpeg/src/jquant1.c190
-rw-r--r--src/3rdparty/libjpeg/src/jquant2.c357
-rw-r--r--src/3rdparty/libjpeg/src/jsimd.h182
-rw-r--r--src/3rdparty/libjpeg/src/jsimd_none.c244
-rw-r--r--src/3rdparty/libjpeg/src/jsimddct.h104
-rw-r--r--src/3rdparty/libjpeg/src/jstdhuff.c126
-rw-r--r--src/3rdparty/libjpeg/src/jutils.c20
-rw-r--r--src/3rdparty/libjpeg/src/jversion.h29
-rw-r--r--src/corelib/codecs/qtextcodec.cpp16
-rw-r--r--src/corelib/codecs/qtextcodec.h3
-rw-r--r--src/corelib/codecs/qutfcodec_p.h4
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_tools_qeasingcurve.cpp8
-rw-r--r--src/corelib/doc/src/resource-system.qdoc1
-rw-r--r--src/corelib/global/qconfig-bootstrapped.h4
-rw-r--r--src/corelib/global/qlibraryinfo.cpp4
-rw-r--r--src/corelib/global/qlibraryinfo.h4
-rw-r--r--src/corelib/kernel/qcore_unix_p.h2
-rw-r--r--src/corelib/kernel/qobject.cpp16
-rw-r--r--src/corelib/kernel/qvariant.cpp8
-rw-r--r--src/corelib/plugin/qelfparser_p.h2
-rw-r--r--src/corelib/qtcore.tracepoints9
-rw-r--r--src/corelib/serialization/qdatastream.cpp2
-rw-r--r--src/corelib/serialization/qxmlstream.cpp2
-rw-r--r--src/corelib/thread/qfuturewatcher.cpp8
-rw-r--r--src/corelib/thread/qthread.cpp1
-rw-r--r--src/corelib/thread/qthread_win.cpp2
-rw-r--r--src/corelib/tools/qdatetime.cpp112
-rw-r--r--src/corelib/tools/qdatetime.h20
-rw-r--r--src/corelib/tools/qdatetimeparser.cpp20
-rw-r--r--src/corelib/tools/qdatetimeparser_p.h6
-rw-r--r--src/corelib/tools/qeasingcurve.cpp2
-rw-r--r--src/corelib/tools/qlocale.cpp12
-rw-r--r--src/corelib/tools/qlocale.h2
-rw-r--r--src/gui/image/qimagewriter.cpp2
-rw-r--r--src/gui/kernel/qplatformdialoghelper.cpp37
-rw-r--r--src/gui/kernel/qplatformdialoghelper.h22
-rw-r--r--src/gui/kernel/qplatformscreen.cpp2
-rw-r--r--src/gui/kernel/qplatformwindow.cpp2
-rw-r--r--src/gui/opengl/qopenglbuffer.cpp13
-rw-r--r--src/gui/opengl/qopengldebug.cpp4
-rw-r--r--src/gui/opengl/qopenglprogrambinarycache.cpp16
-rw-r--r--src/gui/opengl/qopenglshaderprogram.cpp77
-rw-r--r--src/gui/painting/qcosmeticstroker_p.h3
-rw-r--r--src/gui/painting/qdrawhelper.cpp2
-rw-r--r--src/gui/text/qtextcursor.cpp3
-rw-r--r--src/network/access/access.pri14
-rw-r--r--src/network/access/qftp.cpp4
-rw-r--r--src/network/access/qhsts.cpp19
-rw-r--r--src/network/access/qhsts_p.h8
-rw-r--r--src/network/access/qhstsstore_p.h2
-rw-r--r--src/network/access/qnetworkaccessftpbackend.cpp2
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp15
-rw-r--r--src/network/access/qnetworkaccessmanager_p.h7
-rw-r--r--src/network/access/qnetworkrequest.cpp6
-rw-r--r--src/network/kernel/qdnslookup.cpp7
-rw-r--r--src/network/kernel/qdnslookup_p.h4
-rw-r--r--src/network/kernel/qhostinfo.cpp19
-rw-r--r--src/network/kernel/qhostinfo_p.h9
-rw-r--r--src/network/ssl/qsslcertificate.cpp2
-rw-r--r--src/network/ssl/qsslcertificate_openssl.cpp19
-rw-r--r--src/network/ssl/qsslcontext_openssl11.cpp8
-rw-r--r--src/network/ssl/qsslpresharedkeyauthenticator.h2
-rw-r--r--src/network/ssl/qsslsocket_mac.cpp4
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols.cpp4
-rw-r--r--src/platformheaders/cocoafunctions/qcocoawindowfunctions.qdoc2
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm6
-rw-r--r--src/plugins/platforms/android/qandroidplatformdialoghelpers.cpp16
-rw-r--r--src/plugins/platforms/cocoa/qcocoasystemsettings.mm3
-rw-r--r--src/plugins/platforms/wasm/qwasmcompositor.cpp2
-rw-r--r--src/plugins/platforms/wasm/qwasmeventtranslator.cpp32
-rw-r--r--src/plugins/platforms/wasm/qwasmwindow.cpp15
-rw-r--r--src/plugins/platforms/wasm/qwasmwindow.h3
-rw-r--r--src/plugins/platforms/windows/qwindowsclipboard.cpp11
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp32
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.h2
-rw-r--r--src/plugins/platforms/windows/qwindowscursor.cpp10
-rw-r--r--src/plugins/platforms/windows/qwindowscursor.h10
-rw-r--r--src/plugins/platforms/windows/qwindowsdrag.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp10
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.cpp20
-rw-r--r--src/plugins/platforms/windows/qwindowsopengltester.cpp28
-rw-r--r--src/plugins/platforms/windows/qwindowsopengltester.h5
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.h2
-rw-r--r--src/plugins/platforms/windows/windows.pri2
-rw-r--r--src/plugins/platforms/winrt/main.cpp2
-rw-r--r--src/plugins/platforms/winrt/qwinrtbackingstore.h2
-rw-r--r--src/plugins/platforms/winrt/qwinrtcanvas.cpp4
-rw-r--r--src/plugins/platforms/winrt/qwinrtcanvas.h2
-rw-r--r--src/plugins/platforms/winrt/qwinrtclipboard.cpp5
-rw-r--r--src/plugins/platforms/winrt/qwinrtcursor.cpp20
-rw-r--r--src/plugins/platforms/winrt/qwinrtcursor.h2
-rw-r--r--src/plugins/platforms/winrt/qwinrtdrag.cpp27
-rw-r--r--src/plugins/platforms/winrt/qwinrtdrag.h4
-rw-r--r--src/plugins/platforms/winrt/qwinrteglcontext.h2
-rw-r--r--src/plugins/platforms/winrt/qwinrteventdispatcher.h2
-rw-r--r--src/plugins/platforms/winrt/qwinrtfiledialoghelper.cpp30
-rw-r--r--src/plugins/platforms/winrt/qwinrtfiledialoghelper.h2
-rw-r--r--src/plugins/platforms/winrt/qwinrtfileengine.cpp25
-rw-r--r--src/plugins/platforms/winrt/qwinrtfileengine.h4
-rw-r--r--src/plugins/platforms/winrt/qwinrtinputcontext.cpp6
-rw-r--r--src/plugins/platforms/winrt/qwinrtintegration.h2
-rw-r--r--src/plugins/platforms/winrt/qwinrtmessagedialoghelper.cpp11
-rw-r--r--src/plugins/platforms/winrt/qwinrtmessagedialoghelper.h2
-rw-r--r--src/plugins/platforms/winrt/qwinrtscreen.h2
-rw-r--r--src/plugins/platforms/winrt/qwinrtservices.cpp10
-rw-r--r--src/plugins/platforms/winrt/qwinrtservices.h2
-rw-r--r--src/plugins/platforms/winrt/qwinrtwindow.cpp2
-rw-r--r--src/plugins/platforms/winrt/qwinrtwindow.h2
-rw-r--r--src/plugins/sqldrivers/mysql/qsql_mysql.cpp6
-rw-r--r--src/plugins/sqldrivers/psql/qsql_psql.cpp12
-rw-r--r--src/sql/kernel/qsqldriver.cpp2
-rw-r--r--src/testlib/qtest.h4
-rw-r--r--src/widgets/configure.json2
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp2
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp23
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp3
-rw-r--r--src/widgets/itemviews/qdirmodel.cpp2
-rw-r--r--src/widgets/itemviews/qheaderview.cpp3
-rw-r--r--src/widgets/kernel/qwidget.cpp6
-rw-r--r--src/widgets/util/qcompleter.cpp9
-rw-r--r--src/widgets/widgets/qdockarealayout.cpp2
-rw-r--r--src/widgets/widgets/qmdiarea.cpp2
-rw-r--r--src/widgets/widgets/qplaintextedit.cpp2
222 files changed, 6855 insertions, 5785 deletions
diff --git a/src/3rdparty/double-conversion/bignum-dtoa.cc b/src/3rdparty/double-conversion/bignum-dtoa.cc
index f1ad7a5ae8..526f96edf5 100644
--- a/src/3rdparty/double-conversion/bignum-dtoa.cc
+++ b/src/3rdparty/double-conversion/bignum-dtoa.cc
@@ -25,12 +25,12 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include <math.h>
+#include <cmath>
-#include "bignum-dtoa.h"
+#include <double-conversion/bignum-dtoa.h>
-#include "bignum.h"
-#include "ieee.h"
+#include <double-conversion/bignum.h>
+#include <double-conversion/ieee.h>
namespace double_conversion {
diff --git a/src/3rdparty/double-conversion/bignum-dtoa.h b/src/3rdparty/double-conversion/bignum-dtoa.h
index 34b961992d..9d15ce3dce 100644
--- a/src/3rdparty/double-conversion/bignum-dtoa.h
+++ b/src/3rdparty/double-conversion/bignum-dtoa.h
@@ -28,7 +28,7 @@
#ifndef DOUBLE_CONVERSION_BIGNUM_DTOA_H_
#define DOUBLE_CONVERSION_BIGNUM_DTOA_H_
-#include "utils.h"
+#include <double-conversion/utils.h>
namespace double_conversion {
diff --git a/src/3rdparty/double-conversion/bignum.cc b/src/3rdparty/double-conversion/bignum.cc
index 8892de8f2a..a7bc86d0c0 100644
--- a/src/3rdparty/double-conversion/bignum.cc
+++ b/src/3rdparty/double-conversion/bignum.cc
@@ -25,13 +25,13 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include "bignum.h"
-#include "utils.h"
+#include <double-conversion/bignum.h>
+#include <double-conversion/utils.h>
namespace double_conversion {
Bignum::Bignum()
- : bigits_(bigits_buffer_, kBigitCapacity), used_digits_(0), exponent_(0) {
+ : bigits_buffer_(), bigits_(bigits_buffer_, kBigitCapacity), used_digits_(0), exponent_(0) {
for (int i = 0; i < kBigitCapacity; ++i) {
bigits_[i] = 0;
}
@@ -445,26 +445,27 @@ void Bignum::AssignPowerUInt16(uint16_t base, int power_exponent) {
mask >>= 2;
uint64_t this_value = base;
- bool delayed_multipliciation = false;
+ bool delayed_multiplication = false;
const uint64_t max_32bits = 0xFFFFFFFF;
while (mask != 0 && this_value <= max_32bits) {
this_value = this_value * this_value;
// Verify that there is enough space in this_value to perform the
// multiplication. The first bit_size bits must be 0.
if ((power_exponent & mask) != 0) {
+ ASSERT(bit_size > 0);
uint64_t base_bits_mask =
~((static_cast<uint64_t>(1) << (64 - bit_size)) - 1);
bool high_bits_zero = (this_value & base_bits_mask) == 0;
if (high_bits_zero) {
this_value *= base;
} else {
- delayed_multipliciation = true;
+ delayed_multiplication = true;
}
}
mask >>= 1;
}
AssignUInt64(this_value);
- if (delayed_multipliciation) {
+ if (delayed_multiplication) {
MultiplyByUInt32(base);
}
diff --git a/src/3rdparty/double-conversion/bignum.h b/src/3rdparty/double-conversion/bignum.h
index c385f2237b..238a351196 100644
--- a/src/3rdparty/double-conversion/bignum.h
+++ b/src/3rdparty/double-conversion/bignum.h
@@ -28,7 +28,7 @@
#ifndef DOUBLE_CONVERSION_BIGNUM_H_
#define DOUBLE_CONVERSION_BIGNUM_H_
-#include "utils.h"
+#include <double-conversion/utils.h>
namespace double_conversion {
@@ -136,7 +136,7 @@ class Bignum {
// The Bignum's value equals value(bigits_) * 2^(exponent_ * kBigitSize).
int exponent_;
- DISALLOW_COPY_AND_ASSIGN(Bignum);
+ DC_DISALLOW_COPY_AND_ASSIGN(Bignum);
};
} // namespace double_conversion
diff --git a/src/3rdparty/double-conversion/cached-powers.cc b/src/3rdparty/double-conversion/cached-powers.cc
index 2b43f06412..6f771e9c73 100644
--- a/src/3rdparty/double-conversion/cached-powers.cc
+++ b/src/3rdparty/double-conversion/cached-powers.cc
@@ -25,13 +25,13 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include <stdarg.h>
-#include <limits.h>
-#include <math.h>
+#include <climits>
+#include <cmath>
+#include <cstdarg>
-#include "utils.h"
+#include <double-conversion/utils.h>
-#include "cached-powers.h"
+#include <double-conversion/cached-powers.h>
namespace double_conversion {
diff --git a/src/3rdparty/double-conversion/cached-powers.h b/src/3rdparty/double-conversion/cached-powers.h
index 61a50614cf..eabff4a15a 100644
--- a/src/3rdparty/double-conversion/cached-powers.h
+++ b/src/3rdparty/double-conversion/cached-powers.h
@@ -28,7 +28,7 @@
#ifndef DOUBLE_CONVERSION_CACHED_POWERS_H_
#define DOUBLE_CONVERSION_CACHED_POWERS_H_
-#include "diy-fp.h"
+#include <double-conversion/diy-fp.h>
namespace double_conversion {
diff --git a/src/3rdparty/double-conversion/diy-fp.cc b/src/3rdparty/double-conversion/diy-fp.cc
index ddd1891b16..82b0d08af4 100644
--- a/src/3rdparty/double-conversion/diy-fp.cc
+++ b/src/3rdparty/double-conversion/diy-fp.cc
@@ -26,8 +26,8 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include "diy-fp.h"
-#include "utils.h"
+#include <double-conversion/diy-fp.h>
+#include <double-conversion/utils.h>
namespace double_conversion {
diff --git a/src/3rdparty/double-conversion/diy-fp.h b/src/3rdparty/double-conversion/diy-fp.h
index 2edf34674e..e2011d43e5 100644
--- a/src/3rdparty/double-conversion/diy-fp.h
+++ b/src/3rdparty/double-conversion/diy-fp.h
@@ -28,7 +28,7 @@
#ifndef DOUBLE_CONVERSION_DIY_FP_H_
#define DOUBLE_CONVERSION_DIY_FP_H_
-#include "utils.h"
+#include <double-conversion/utils.h>
namespace double_conversion {
diff --git a/src/3rdparty/double-conversion/double-conversion.cc b/src/3rdparty/double-conversion/double-conversion.cc
index 6f21a0124c..ecd1a5ef3f 100644
--- a/src/3rdparty/double-conversion/double-conversion.cc
+++ b/src/3rdparty/double-conversion/double-conversion.cc
@@ -25,17 +25,18 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include <limits.h>
-#include <math.h>
+#include <climits>
+#include <locale>
+#include <cmath>
-#include "double-conversion.h"
+#include <double-conversion/double-conversion.h>
-#include "bignum-dtoa.h"
-#include "fast-dtoa.h"
-#include "fixed-dtoa.h"
-#include "ieee.h"
-#include "strtod.h"
-#include "utils.h"
+#include <double-conversion/bignum-dtoa.h>
+#include <double-conversion/fast-dtoa.h>
+#include <double-conversion/fixed-dtoa.h>
+#include <double-conversion/ieee.h>
+#include <double-conversion/strtod.h>
+#include <double-conversion/utils.h>
namespace double_conversion {
@@ -414,21 +415,55 @@ void DoubleToStringConverter::DoubleToAscii(double v,
}
+namespace {
+
+inline char ToLower(char ch) {
+ static const std::ctype<char>& cType =
+ std::use_facet<std::ctype<char> >(std::locale::classic());
+ return cType.tolower(ch);
+}
+
+inline char Pass(char ch) {
+ return ch;
+}
+
+template <class Iterator, class Converter>
+static inline bool ConsumeSubStringImpl(Iterator* current,
+ Iterator end,
+ const char* substring,
+ Converter converter) {
+ ASSERT(converter(**current) == *substring);
+ for (substring++; *substring != '\0'; substring++) {
+ ++*current;
+ if (*current == end || converter(**current) != *substring) {
+ return false;
+ }
+ }
+ ++*current;
+ return true;
+}
+
// Consumes the given substring from the iterator.
// Returns false, if the substring does not match.
template <class Iterator>
static bool ConsumeSubString(Iterator* current,
Iterator end,
- const char* substring) {
- ASSERT(**current == *substring);
- for (substring++; *substring != '\0'; substring++) {
- ++*current;
- if (*current == end || **current != *substring) return false;
+ const char* substring,
+ bool allow_case_insensibility) {
+ if (allow_case_insensibility) {
+ return ConsumeSubStringImpl(current, end, substring, ToLower);
+ } else {
+ return ConsumeSubStringImpl(current, end, substring, Pass);
}
- ++*current;
- return true;
}
+// Consumes first character of the str is equal to ch
+inline bool ConsumeFirstCharacter(char ch,
+ const char* str,
+ bool case_insensibility) {
+ return case_insensibility ? ToLower(ch) == str[0] : ch == str[0];
+}
+} // namespace
// Maximum number of significant digits in decimal representation.
// The longest possible double in decimal representation is
@@ -502,7 +537,7 @@ static bool IsDecimalDigitForRadix(int c, int radix) {
#pragma optimize("",on)
#else
static bool inline IsDecimalDigitForRadix(int c, int radix) {
- return '0' <= c && c <= '9' && (c - '0') < radix;
+ return '0' <= c && c <= '9' && (c - '0') < radix;
}
#endif
// Returns true if 'c' is a character digit that is valid for the given radix.
@@ -516,17 +551,86 @@ static bool IsCharacterDigitForRadix(int c, int radix, char a_character) {
return radix > 10 && c >= a_character && c < a_character + radix - 10;
}
+// Returns true, when the iterator is equal to end.
+template<class Iterator>
+static bool Advance (Iterator* it, char separator, int base, Iterator& end) {
+ if (separator == StringToDoubleConverter::kNoSeparator) {
+ ++(*it);
+ return *it == end;
+ }
+ if (!isDigit(**it, base)) {
+ ++(*it);
+ return *it == end;
+ }
+ ++(*it);
+ if (*it == end) return true;
+ if (*it + 1 == end) return false;
+ if (**it == separator && isDigit(*(*it + 1), base)) {
+ ++(*it);
+ }
+ return *it == end;
+}
+
+// Checks whether the string in the range start-end is a hex-float string.
+// This function assumes that the leading '0x'/'0X' is already consumed.
+//
+// Hex float strings are of one of the following forms:
+// - hex_digits+ 'p' ('+'|'-')? exponent_digits+
+// - hex_digits* '.' hex_digits+ 'p' ('+'|'-')? exponent_digits+
+// - hex_digits+ '.' 'p' ('+'|'-')? exponent_digits+
+template<class Iterator>
+static bool IsHexFloatString(Iterator start,
+ Iterator end,
+ char separator,
+ bool allow_trailing_junk) {
+ ASSERT(start != end);
+
+ Iterator current = start;
+
+ bool saw_digit = false;
+ while (isDigit(*current, 16)) {
+ saw_digit = true;
+ if (Advance(&current, separator, 16, end)) return false;
+ }
+ if (*current == '.') {
+ if (Advance(&current, separator, 16, end)) return false;
+ while (isDigit(*current, 16)) {
+ saw_digit = true;
+ if (Advance(&current, separator, 16, end)) return false;
+ }
+ if (!saw_digit) return false; // Only the '.', but no digits.
+ }
+ if (*current != 'p' && *current != 'P') return false;
+ if (Advance(&current, separator, 16, end)) return false;
+ if (*current == '+' || *current == '-') {
+ if (Advance(&current, separator, 16, end)) return false;
+ }
+ if (!isDigit(*current, 10)) return false;
+ if (Advance(&current, separator, 16, end)) return true;
+ while (isDigit(*current, 10)) {
+ if (Advance(&current, separator, 16, end)) return true;
+ }
+ return allow_trailing_junk || !AdvanceToNonspace(&current, end);
+}
+
// Parsing integers with radix 2, 4, 8, 16, 32. Assumes current != end.
+//
+// If parse_as_hex_float is true, then the string must be a valid
+// hex-float.
template <int radix_log_2, class Iterator>
static double RadixStringToIeee(Iterator* current,
Iterator end,
bool sign,
+ char separator,
+ bool parse_as_hex_float,
bool allow_trailing_junk,
double junk_string_value,
bool read_as_double,
bool* result_is_junk) {
ASSERT(*current != end);
+ ASSERT(!parse_as_hex_float ||
+ IsHexFloatString(*current, end, separator, allow_trailing_junk));
const int kDoubleSize = Double::kSignificandSize;
const int kSingleSize = Single::kSignificandSize;
@@ -534,27 +638,39 @@ static double RadixStringToIeee(Iterator* current,
*result_is_junk = true;
+ int64_t number = 0;
+ int exponent = 0;
+ const int radix = (1 << radix_log_2);
+ // Whether we have encountered a '.' and are parsing the decimal digits.
+ // Only relevant if parse_as_hex_float is true.
+ bool post_decimal = false;
+
// Skip leading 0s.
while (**current == '0') {
- ++(*current);
- if (*current == end) {
+ if (Advance(current, separator, radix, end)) {
*result_is_junk = false;
return SignedZero(sign);
}
}
- int64_t number = 0;
- int exponent = 0;
- const int radix = (1 << radix_log_2);
-
- do {
+ while (true) {
int digit;
if (IsDecimalDigitForRadix(**current, radix)) {
digit = static_cast<char>(**current) - '0';
+ if (post_decimal) exponent -= radix_log_2;
} else if (IsCharacterDigitForRadix(**current, radix, 'a')) {
digit = static_cast<char>(**current) - 'a' + 10;
+ if (post_decimal) exponent -= radix_log_2;
} else if (IsCharacterDigitForRadix(**current, radix, 'A')) {
digit = static_cast<char>(**current) - 'A' + 10;
+ if (post_decimal) exponent -= radix_log_2;
+ } else if (parse_as_hex_float && **current == '.') {
+ post_decimal = true;
+ Advance(current, separator, radix, end);
+ ASSERT(*current != end);
+ continue;
+ } else if (parse_as_hex_float && (**current == 'p' || **current == 'P')) {
+ break;
} else {
if (allow_trailing_junk || !AdvanceToNonspace(current, end)) {
break;
@@ -577,17 +693,26 @@ static double RadixStringToIeee(Iterator* current,
int dropped_bits_mask = ((1 << overflow_bits_count) - 1);
int dropped_bits = static_cast<int>(number) & dropped_bits_mask;
number >>= overflow_bits_count;
- exponent = overflow_bits_count;
+ exponent += overflow_bits_count;
bool zero_tail = true;
for (;;) {
- ++(*current);
- if (*current == end || !isDigit(**current, radix)) break;
+ if (Advance(current, separator, radix, end)) break;
+ if (parse_as_hex_float && **current == '.') {
+ // Just run over the '.'. We are just trying to see whether there is
+ // a non-zero digit somewhere.
+ Advance(current, separator, radix, end);
+ ASSERT(*current != end);
+ post_decimal = true;
+ }
+ if (!isDigit(**current, radix)) break;
zero_tail = zero_tail && **current == '0';
- exponent += radix_log_2;
+ if (!post_decimal) exponent += radix_log_2;
}
- if (!allow_trailing_junk && AdvanceToNonspace(current, end)) {
+ if (!parse_as_hex_float &&
+ !allow_trailing_junk &&
+ AdvanceToNonspace(current, end)) {
return junk_string_value;
}
@@ -609,15 +734,37 @@ static double RadixStringToIeee(Iterator* current,
}
break;
}
- ++(*current);
- } while (*current != end);
+ if (Advance(current, separator, radix, end)) break;
+ }
ASSERT(number < ((int64_t)1 << kSignificandSize));
ASSERT(static_cast<int64_t>(static_cast<double>(number)) == number);
*result_is_junk = false;
- if (exponent == 0) {
+ if (parse_as_hex_float) {
+ ASSERT(**current == 'p' || **current == 'P');
+ Advance(current, separator, radix, end);
+ ASSERT(*current != end);
+ bool is_negative = false;
+ if (**current == '+') {
+ Advance(current, separator, radix, end);
+ ASSERT(*current != end);
+ } else if (**current == '-') {
+ is_negative = true;
+ Advance(current, separator, radix, end);
+ ASSERT(*current != end);
+ }
+ int written_exponent = 0;
+ while (IsDecimalDigitForRadix(**current, 10)) {
+ written_exponent = 10 * written_exponent + **current - '0';
+ if (Advance(current, separator, radix, end)) break;
+ }
+ if (is_negative) written_exponent = -written_exponent;
+ exponent += written_exponent;
+ }
+
+ if (exponent == 0 || number == 0) {
if (sign) {
if (number == 0) return -0.0;
number = -number;
@@ -626,10 +773,10 @@ static double RadixStringToIeee(Iterator* current,
}
ASSERT(number != 0);
- return Double(DiyFp(number, exponent)).value();
+ double result = Double(DiyFp(number, exponent)).value();
+ return sign ? -result : result;
}
-
template <class Iterator>
double StringToDoubleConverter::StringToIeee(
Iterator input,
@@ -645,6 +792,7 @@ double StringToDoubleConverter::StringToIeee(
const bool allow_leading_spaces = (flags_ & ALLOW_LEADING_SPACES) != 0;
const bool allow_trailing_spaces = (flags_ & ALLOW_TRAILING_SPACES) != 0;
const bool allow_spaces_after_sign = (flags_ & ALLOW_SPACES_AFTER_SIGN) != 0;
+ const bool allow_case_insensibility = (flags_ & ALLOW_CASE_INSENSIBILITY) != 0;
// To make sure that iterator dereferencing is valid the following
// convention is used:
@@ -694,8 +842,8 @@ double StringToDoubleConverter::StringToIeee(
}
if (infinity_symbol_ != NULL) {
- if (*current == infinity_symbol_[0]) {
- if (!ConsumeSubString(&current, end, infinity_symbol_)) {
+ if (ConsumeFirstCharacter(*current, infinity_symbol_, allow_case_insensibility)) {
+ if (!ConsumeSubString(&current, end, infinity_symbol_, allow_case_insensibility)) {
return junk_string_value_;
}
@@ -713,8 +861,8 @@ double StringToDoubleConverter::StringToIeee(
}
if (nan_symbol_ != NULL) {
- if (*current == nan_symbol_[0]) {
- if (!ConsumeSubString(&current, end, nan_symbol_)) {
+ if (ConsumeFirstCharacter(*current, nan_symbol_, allow_case_insensibility)) {
+ if (!ConsumeSubString(&current, end, nan_symbol_, allow_case_insensibility)) {
return junk_string_value_;
}
@@ -733,8 +881,7 @@ double StringToDoubleConverter::StringToIeee(
bool leading_zero = false;
if (*current == '0') {
- ++current;
- if (current == end) {
+ if (Advance(&current, separator_, 10, end)) {
*processed_characters_count = static_cast<int>(current - input);
return SignedZero(sign);
}
@@ -742,16 +889,24 @@ double StringToDoubleConverter::StringToIeee(
leading_zero = true;
// It could be hexadecimal value.
- if ((flags_ & ALLOW_HEX) && (*current == 'x' || *current == 'X')) {
+ if (((flags_ & ALLOW_HEX) || (flags_ & ALLOW_HEX_FLOATS)) &&
+ (*current == 'x' || *current == 'X')) {
++current;
- if (current == end || !isDigit(*current, 16)) {
- return junk_string_value_; // "0x".
+
+ bool parse_as_hex_float = (flags_ & ALLOW_HEX_FLOATS) &&
+ IsHexFloatString(current, end, separator_, allow_trailing_junk);
+
+ if (current == end) return junk_string_value_; // "0x"
+ if (!parse_as_hex_float && !isDigit(*current, 16)) {
+ return junk_string_value_;
}
bool result_is_junk;
double result = RadixStringToIeee<4>(&current,
end,
sign,
+ separator_,
+ parse_as_hex_float,
allow_trailing_junk,
junk_string_value_,
read_as_double,
@@ -765,8 +920,7 @@ double StringToDoubleConverter::StringToIeee(
// Ignore leading zeros in the integer part.
while (*current == '0') {
- ++current;
- if (current == end) {
+ if (Advance(&current, separator_, 10, end)) {
*processed_characters_count = static_cast<int>(current - input);
return SignedZero(sign);
}
@@ -787,8 +941,7 @@ double StringToDoubleConverter::StringToIeee(
nonzero_digit_dropped = nonzero_digit_dropped || *current != '0';
}
octal = octal && *current < '8';
- ++current;
- if (current == end) goto parsing_done;
+ if (Advance(&current, separator_, 10, end)) goto parsing_done;
}
if (significant_digits == 0) {
@@ -799,8 +952,7 @@ double StringToDoubleConverter::StringToIeee(
if (octal && !allow_trailing_junk) return junk_string_value_;
if (octal) goto parsing_done;
- ++current;
- if (current == end) {
+ if (Advance(&current, separator_, 10, end)) {
if (significant_digits == 0 && !leading_zero) {
return junk_string_value_;
} else {
@@ -813,8 +965,7 @@ double StringToDoubleConverter::StringToIeee(
// Integer part consists of 0 or is absent. Significant digits start after
// leading zeros (if any).
while (*current == '0') {
- ++current;
- if (current == end) {
+ if (Advance(&current, separator_, 10, end)) {
*processed_characters_count = static_cast<int>(current - input);
return SignedZero(sign);
}
@@ -834,8 +985,7 @@ double StringToDoubleConverter::StringToIeee(
// Ignore insignificant digits in the fractional part.
nonzero_digit_dropped = nonzero_digit_dropped || *current != '0';
}
- ++current;
- if (current == end) goto parsing_done;
+ if (Advance(&current, separator_, 10, end)) goto parsing_done;
}
}
@@ -851,9 +1001,11 @@ double StringToDoubleConverter::StringToIeee(
if (*current == 'e' || *current == 'E') {
if (octal && !allow_trailing_junk) return junk_string_value_;
if (octal) goto parsing_done;
+ Iterator junk_begin = current;
++current;
if (current == end) {
if (allow_trailing_junk) {
+ current = junk_begin;
goto parsing_done;
} else {
return junk_string_value_;
@@ -865,6 +1017,7 @@ double StringToDoubleConverter::StringToIeee(
++current;
if (current == end) {
if (allow_trailing_junk) {
+ current = junk_begin;
goto parsing_done;
} else {
return junk_string_value_;
@@ -874,6 +1027,7 @@ double StringToDoubleConverter::StringToIeee(
if (current == end || *current < '0' || *current > '9') {
if (allow_trailing_junk) {
+ current = junk_begin;
goto parsing_done;
} else {
return junk_string_value_;
@@ -918,6 +1072,8 @@ double StringToDoubleConverter::StringToIeee(
result = RadixStringToIeee<3>(&start,
buffer + buffer_pos,
sign,
+ separator_,
+ false, // Don't parse as hex_float.
allow_trailing_junk,
junk_string_value_,
read_as_double,
diff --git a/src/3rdparty/double-conversion/double-conversion.pri b/src/3rdparty/double-conversion/double-conversion.pri
index 3207169689..6564f960d4 100644
--- a/src/3rdparty/double-conversion/double-conversion.pri
+++ b/src/3rdparty/double-conversion/double-conversion.pri
@@ -1,4 +1,4 @@
-INCLUDEPATH += $$PWD/include $$PWD/include/double-conversion
+INCLUDEPATH += $$PWD/.. $$PWD/include $$PWD/include/double-conversion
SOURCES += \
$$PWD/bignum.cc \
$$PWD/bignum-dtoa.cc \
diff --git a/src/3rdparty/double-conversion/fast-dtoa.cc b/src/3rdparty/double-conversion/fast-dtoa.cc
index 61350383a9..e5c222291f 100644
--- a/src/3rdparty/double-conversion/fast-dtoa.cc
+++ b/src/3rdparty/double-conversion/fast-dtoa.cc
@@ -25,11 +25,11 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include "fast-dtoa.h"
+#include <double-conversion/fast-dtoa.h>
-#include "cached-powers.h"
-#include "diy-fp.h"
-#include "ieee.h"
+#include <double-conversion/cached-powers.h>
+#include <double-conversion/diy-fp.h>
+#include <double-conversion/ieee.h>
namespace double_conversion {
diff --git a/src/3rdparty/double-conversion/fast-dtoa.h b/src/3rdparty/double-conversion/fast-dtoa.h
index 5f1e8eee5e..ac4317c04d 100644
--- a/src/3rdparty/double-conversion/fast-dtoa.h
+++ b/src/3rdparty/double-conversion/fast-dtoa.h
@@ -28,7 +28,7 @@
#ifndef DOUBLE_CONVERSION_FAST_DTOA_H_
#define DOUBLE_CONVERSION_FAST_DTOA_H_
-#include "utils.h"
+#include <double-conversion/utils.h>
namespace double_conversion {
diff --git a/src/3rdparty/double-conversion/fixed-dtoa.cc b/src/3rdparty/double-conversion/fixed-dtoa.cc
index 0f55a0b6eb..8c111aca64 100644
--- a/src/3rdparty/double-conversion/fixed-dtoa.cc
+++ b/src/3rdparty/double-conversion/fixed-dtoa.cc
@@ -25,10 +25,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include <math.h>
+#include <cmath>
-#include "fixed-dtoa.h"
-#include "ieee.h"
+#include <double-conversion/fixed-dtoa.h>
+#include <double-conversion/ieee.h>
namespace double_conversion {
diff --git a/src/3rdparty/double-conversion/fixed-dtoa.h b/src/3rdparty/double-conversion/fixed-dtoa.h
index 3bdd08e21f..a9436fc9f6 100644
--- a/src/3rdparty/double-conversion/fixed-dtoa.h
+++ b/src/3rdparty/double-conversion/fixed-dtoa.h
@@ -28,7 +28,7 @@
#ifndef DOUBLE_CONVERSION_FIXED_DTOA_H_
#define DOUBLE_CONVERSION_FIXED_DTOA_H_
-#include "utils.h"
+#include <double-conversion/utils.h>
namespace double_conversion {
diff --git a/src/3rdparty/double-conversion/ieee.h b/src/3rdparty/double-conversion/ieee.h
index b14cf4f717..baaeced31c 100644
--- a/src/3rdparty/double-conversion/ieee.h
+++ b/src/3rdparty/double-conversion/ieee.h
@@ -28,7 +28,7 @@
#ifndef DOUBLE_CONVERSION_DOUBLE_H_
#define DOUBLE_CONVERSION_DOUBLE_H_
-#include "diy-fp.h"
+#include <double-conversion/diy-fp.h>
namespace double_conversion {
@@ -257,7 +257,7 @@ class Double {
(biased_exponent << kPhysicalSignificandSize);
}
- DISALLOW_COPY_AND_ASSIGN(Double);
+ DC_DISALLOW_COPY_AND_ASSIGN(Double);
};
class Single {
@@ -394,7 +394,7 @@ class Single {
const uint32_t d32_;
- DISALLOW_COPY_AND_ASSIGN(Single);
+ DC_DISALLOW_COPY_AND_ASSIGN(Single);
};
} // namespace double_conversion
diff --git a/src/3rdparty/double-conversion/include/double-conversion/double-conversion.h b/src/3rdparty/double-conversion/include/double-conversion/double-conversion.h
index 6bdfa8d25d..7495d17a1d 100644
--- a/src/3rdparty/double-conversion/include/double-conversion/double-conversion.h
+++ b/src/3rdparty/double-conversion/include/double-conversion/double-conversion.h
@@ -28,7 +28,7 @@
#ifndef DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_
#define DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_
-#include "utils.h"
+#include <double-conversion/utils.h>
namespace double_conversion {
@@ -294,13 +294,18 @@ class DoubleToStringConverter {
// should be at least kBase10MaximalLength + 1 characters long.
static const int kBase10MaximalLength = 17;
- // Converts the given double 'v' to ascii. 'v' must not be NaN, +Infinity, or
- // -Infinity. In SHORTEST_SINGLE-mode this restriction also applies to 'v'
- // after it has been casted to a single-precision float. That is, in this
- // mode static_cast<float>(v) must not be NaN, +Infinity or -Infinity.
+ // Converts the given double 'v' to digit characters. 'v' must not be NaN,
+ // +Infinity, or -Infinity. In SHORTEST_SINGLE-mode this restriction also
+ // applies to 'v' after it has been casted to a single-precision float. That
+ // is, in this mode static_cast<float>(v) must not be NaN, +Infinity or
+ // -Infinity.
//
// The result should be interpreted as buffer * 10^(point-length).
//
+ // The digits are written to the buffer in the platform's charset, which is
+ // often UTF-8 (with ASCII-range digits) but may be another charset, such
+ // as EBCDIC.
+ //
// The output depends on the given mode:
// - SHORTEST: produce the least amount of digits for which the internal
// identity requirement is still satisfied. If the digits are printed
@@ -374,7 +379,7 @@ class DoubleToStringConverter {
const int max_leading_padding_zeroes_in_precision_mode_;
const int max_trailing_padding_zeroes_in_precision_mode_;
- DISALLOW_IMPLICIT_CONSTRUCTORS(DoubleToStringConverter);
+ DC_DISALLOW_IMPLICIT_CONSTRUCTORS(DoubleToStringConverter);
};
@@ -389,9 +394,13 @@ class StringToDoubleConverter {
ALLOW_TRAILING_JUNK = 4,
ALLOW_LEADING_SPACES = 8,
ALLOW_TRAILING_SPACES = 16,
- ALLOW_SPACES_AFTER_SIGN = 32
+ ALLOW_SPACES_AFTER_SIGN = 32,
+ ALLOW_CASE_INSENSIBILITY = 64,
+ ALLOW_HEX_FLOATS = 128,
};
+ static const uc16 kNoSeparator = '\0';
+
// Flags should be a bit-or combination of the possible Flags-enum.
// - NO_FLAGS: no special flags.
// - ALLOW_HEX: recognizes the prefix "0x". Hex numbers may only be integers.
@@ -421,6 +430,13 @@ class StringToDoubleConverter {
// - ALLOW_SPACES_AFTER_SIGN: ignore whitespace after the sign.
// Ex: StringToDouble("- 123.2") -> -123.2.
// StringToDouble("+ 123.2") -> 123.2
+ // - ALLOW_CASE_INSENSIBILITY: ignore case of characters for special values:
+ // infinity and nan.
+ // - ALLOW_HEX_FLOATS: allows hexadecimal float literals.
+ // This *must* start with "0x" and separate the exponent with "p".
+ // Examples: 0x1.2p3 == 9.0
+ // 0x10.1p0 == 16.0625
+ // ALLOW_HEX and ALLOW_HEX_FLOATS are indendent.
//
// empty_string_value is returned when an empty string is given as input.
// If ALLOW_LEADING_SPACES or ALLOW_TRAILING_SPACES are set, then a string
@@ -445,6 +461,12 @@ class StringToDoubleConverter {
// - they must not have the same first character.
// - they must not start with digits.
//
+ // If the separator character is not kNoSeparator, then that specific
+ // character is ignored when in between two valid digits of the significant.
+ // It is not allowed to appear in the exponent.
+ // It is not allowed to lead or trail the number.
+ // It is not allowed to appear twice next to each other.
+ //
// Examples:
// flags = ALLOW_HEX | ALLOW_TRAILING_JUNK,
// empty_string_value = 0.0,
@@ -484,16 +506,26 @@ class StringToDoubleConverter {
// StringToDouble("01239E45") -> 1239e45.
// StringToDouble("-infinity") -> NaN // junk_string_value.
// StringToDouble("NaN") -> NaN // junk_string_value.
+ //
+ // flags = NO_FLAGS,
+ // separator = ' ':
+ // StringToDouble("1 2 3 4") -> 1234.0
+ // StringToDouble("1 2") -> NaN // junk_string_value
+ // StringToDouble("1 000 000.0") -> 1000000.0
+ // StringToDouble("1.000 000") -> 1.0
+ // StringToDouble("1.0e1 000") -> NaN // junk_string_value
StringToDoubleConverter(int flags,
double empty_string_value,
double junk_string_value,
const char* infinity_symbol,
- const char* nan_symbol)
+ const char* nan_symbol,
+ uc16 separator = kNoSeparator)
: flags_(flags),
empty_string_value_(empty_string_value),
junk_string_value_(junk_string_value),
infinity_symbol_(infinity_symbol),
- nan_symbol_(nan_symbol) {
+ nan_symbol_(nan_symbol),
+ separator_(separator) {
}
// Performs the conversion.
@@ -528,6 +560,7 @@ class StringToDoubleConverter {
const double junk_string_value_;
const char* const infinity_symbol_;
const char* const nan_symbol_;
+ const uc16 separator_;
template <class Iterator>
double StringToIeee(Iterator start_pointer,
@@ -535,7 +568,7 @@ class StringToDoubleConverter {
bool read_as_double,
int* processed_characters_count) const;
- DISALLOW_IMPLICIT_CONSTRUCTORS(StringToDoubleConverter);
+ DC_DISALLOW_IMPLICIT_CONSTRUCTORS(StringToDoubleConverter);
};
} // namespace double_conversion
diff --git a/src/3rdparty/double-conversion/include/double-conversion/utils.h b/src/3rdparty/double-conversion/include/double-conversion/utils.h
index ff00855bea..7622fe6162 100644
--- a/src/3rdparty/double-conversion/include/double-conversion/utils.h
+++ b/src/3rdparty/double-conversion/include/double-conversion/utils.h
@@ -28,10 +28,10 @@
#ifndef DOUBLE_CONVERSION_UTILS_H_
#define DOUBLE_CONVERSION_UTILS_H_
-#include <stdlib.h>
-#include <string.h>
+#include <cstdlib>
+#include <cstring>
-#include <assert.h>
+#include <cassert>
#ifndef ASSERT
#define ASSERT(condition) \
assert(condition);
@@ -67,8 +67,24 @@ inline void abort_noreturn() { abort(); }
// the output of the division with the expected result. (Inlining must be
// disabled.)
// On Linux,x86 89255e-22 != Div_double(89255.0/1e22)
+//
+// For example:
+/*
+// -- in div.c
+double Div_double(double x, double y) { return x / y; }
+
+// -- in main.c
+double Div_double(double x, double y); // Forward declaration.
+
+int main(int argc, char** argv) {
+ return Div_double(89255.0, 1e22) == 89255e-22;
+}
+*/
+// Run as follows ./main || echo "correct"
+//
+// If it prints "correct" then the architecture should be here, in the "correct" section.
#if defined(_M_X64) || defined(__x86_64__) || \
- defined(__ARMEL__) || defined(__avr32__) || _M_ARM_FP || \
+ defined(__ARMEL__) || defined(__avr32__) || defined(_M_ARM) || defined(_M_ARM64) || \
defined(__hppa__) || defined(__ia64__) || \
defined(__mips__) || \
defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) || \
@@ -76,10 +92,12 @@ inline void abort_noreturn() { abort(); }
defined(__sparc__) || defined(__sparc) || defined(__s390__) || \
defined(__SH4__) || defined(__alpha__) || \
defined(_MIPS_ARCH_MIPS32R2) || \
- defined(__AARCH64EL__) || defined(__aarch64__) || \
- defined(__riscv) || defined(__EMSCRIPTEN__)
+ defined(__AARCH64EL__) || defined(__aarch64__) || defined(__AARCH64EB__) || \
+ defined(__riscv) || defined(__EMSCRIPTEN__) || \
+ defined(__or1k__)
#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
-#elif defined(__mc68000__)
+#elif defined(__mc68000__) || \
+ defined(__pnacl__) || defined(__native_client__)
#undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS
#elif defined(_M_IX86) || defined(__i386__) || defined(__i386)
#if defined(_WIN32)
@@ -95,12 +113,6 @@ inline void abort_noreturn() { abort(); }
#error Target architecture was not detected as supported by Double-Conversion.
#endif
-#if defined(__GNUC__)
-#define DOUBLE_CONVERSION_UNUSED __attribute__((unused))
-#else
-#define DOUBLE_CONVERSION_UNUSED
-#endif
-
#if defined(_WIN32) && !defined(__MINGW32__)
typedef signed char int8_t;
@@ -139,8 +151,8 @@ typedef uint16_t uc16;
// A macro to disallow the evil copy constructor and operator= functions
// This should be used in the private: declarations for a class
-#ifndef DISALLOW_COPY_AND_ASSIGN
-#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
+#ifndef DC_DISALLOW_COPY_AND_ASSIGN
+#define DC_DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&); \
void operator=(const TypeName&)
#endif
@@ -151,10 +163,10 @@ typedef uint16_t uc16;
// This should be used in the private: declarations for a class
// that wants to prevent anyone from instantiating it. This is
// especially useful for classes containing only static methods.
-#ifndef DISALLOW_IMPLICIT_CONSTRUCTORS
-#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
+#ifndef DC_DISALLOW_IMPLICIT_CONSTRUCTORS
+#define DC_DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
TypeName(); \
- DISALLOW_COPY_AND_ASSIGN(TypeName)
+ DC_DISALLOW_COPY_AND_ASSIGN(TypeName)
#endif
namespace double_conversion {
@@ -296,7 +308,7 @@ class StringBuilder {
bool is_finalized() const { return position_ < 0; }
- DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder);
+ DC_DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder);
};
// The type-based aliasing rule allows the compiler to assume that pointers of
@@ -327,8 +339,12 @@ template <class Dest, class Source>
inline Dest BitCast(const Source& source) {
// Compile time assertion: sizeof(Dest) == sizeof(Source)
// A compile error here means your Dest and Source have different sizes.
- DOUBLE_CONVERSION_UNUSED
- typedef char VerifySizesAreEqual[sizeof(Dest) == sizeof(Source) ? 1 : -1];
+#if __cplusplus >= 201103L
+ static_assert(sizeof(Dest) == sizeof(Source),
+ "source and destination size mismatch");
+#else
+ typedef char VerifySizesAreEqual[sizeof(Dest) == sizeof(Source) ? 1 : -1];
+#endif
Dest dest;
memmove(&dest, &source, sizeof(dest));
diff --git a/src/3rdparty/double-conversion/qt_attribution.json b/src/3rdparty/double-conversion/qt_attribution.json
index d41a7ef332..1d244a69b4 100644
--- a/src/3rdparty/double-conversion/qt_attribution.json
+++ b/src/3rdparty/double-conversion/qt_attribution.json
@@ -5,8 +5,8 @@
"QtUsage": "Used in Qt Core. Configure with -system-doubleconversion or -no-doubleconversion to avoid.",
"Homepage": "https://github.com/google/double-conversion",
- "Version": "3.0.0",
- "DownloadLocation": "https://github.com/google/double-conversion/commit/ca220cbafa83ca706f028bfbb5adc7eb2f1f90e1",
+ "Version": "3.1.1",
+ "DownloadLocation": "https://github.com/google/double-conversion/commit/4199ef3d456ed0549e5665cf4186f0ee6210db3b",
"License": "BSD 3-clause \"New\" or \"Revised\" License",
"LicenseId": "BSD-3-Clause",
"LicenseFile": "LICENSE",
diff --git a/src/3rdparty/double-conversion/strtod.cc b/src/3rdparty/double-conversion/strtod.cc
index 17abcbb2a5..e8cc13f2de 100644
--- a/src/3rdparty/double-conversion/strtod.cc
+++ b/src/3rdparty/double-conversion/strtod.cc
@@ -25,13 +25,13 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include <stdarg.h>
-#include <limits.h>
+#include <climits>
+#include <cstdarg>
-#include "strtod.h"
-#include "bignum.h"
-#include "cached-powers.h"
-#include "ieee.h"
+#include <double-conversion/bignum.h>
+#include <double-conversion/cached-powers.h>
+#include <double-conversion/ieee.h>
+#include <double-conversion/strtod.h>
namespace double_conversion {
@@ -205,7 +205,7 @@ static bool DoubleStrtod(Vector<const char> trimmed,
// Note that the ARM simulator is compiled for 32bits. It therefore exhibits
// the same problem.
return false;
-#endif
+#else
if (trimmed.length() <= kMaxExactDoubleIntegerDecimalDigits) {
int read_digits;
// The trimmed input fits into a double.
@@ -243,6 +243,7 @@ static bool DoubleStrtod(Vector<const char> trimmed,
}
}
return false;
+#endif
}
@@ -471,6 +472,30 @@ double Strtod(Vector<const char> buffer, int exponent) {
}
}
+static float SanitizedDoubletof(double d) {
+ ASSERT(d >= 0.0);
+ // ASAN has a sanitize check that disallows casting doubles to floats if
+ // they are too big.
+ // https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#available-checks
+ // The behavior should be covered by IEEE 754, but some projects use this
+ // flag, so work around it.
+ float max_finite = 3.4028234663852885981170418348451692544e+38;
+ // The half-way point between the max-finite and infinity value.
+ // Since infinity has an even significand everything equal or greater than
+ // this value should become infinity.
+ double half_max_finite_infinity =
+ 3.40282356779733661637539395458142568448e+38;
+ if (d >= max_finite) {
+ if (d >= half_max_finite_infinity) {
+ return Single::Infinity();
+ } else {
+ return max_finite;
+ }
+ } else {
+ return static_cast<float>(d);
+ }
+}
+
float Strtof(Vector<const char> buffer, int exponent) {
char copy_buffer[kMaxSignificantDecimalDigits];
Vector<const char> trimmed;
@@ -482,7 +507,7 @@ float Strtof(Vector<const char> buffer, int exponent) {
double double_guess;
bool is_correct = ComputeGuess(trimmed, exponent, &double_guess);
- float float_guess = static_cast<float>(double_guess);
+ float float_guess = SanitizedDoubletof(double_guess);
if (float_guess == double_guess) {
// This shortcut triggers for integer values.
return float_guess;
@@ -505,15 +530,15 @@ float Strtof(Vector<const char> buffer, int exponent) {
double double_next = Double(double_guess).NextDouble();
double double_previous = Double(double_guess).PreviousDouble();
- float f1 = static_cast<float>(double_previous);
+ float f1 = SanitizedDoubletof(double_previous);
float f2 = float_guess;
- float f3 = static_cast<float>(double_next);
+ float f3 = SanitizedDoubletof(double_next);
float f4;
if (is_correct) {
f4 = f3;
} else {
double double_next2 = Double(double_next).NextDouble();
- f4 = static_cast<float>(double_next2);
+ f4 = SanitizedDoubletof(double_next2);
}
(void) f2; // Mark variable as used.
ASSERT(f1 <= f2 && f2 <= f3 && f3 <= f4);
@@ -528,7 +553,7 @@ float Strtof(Vector<const char> buffer, int exponent) {
(f1 == f2 && f2 != f3 && f3 == f4) ||
(f1 == f2 && f2 == f3 && f3 != f4));
- // guess and next are the two possible canditates (in the same way that
+ // guess and next are the two possible candidates (in the same way that
// double_guess was the lower candidate for a double-precision guess).
float guess = f1;
float next = f4;
diff --git a/src/3rdparty/double-conversion/strtod.h b/src/3rdparty/double-conversion/strtod.h
index ed0293b8f5..322651621f 100644
--- a/src/3rdparty/double-conversion/strtod.h
+++ b/src/3rdparty/double-conversion/strtod.h
@@ -28,7 +28,7 @@
#ifndef DOUBLE_CONVERSION_STRTOD_H_
#define DOUBLE_CONVERSION_STRTOD_H_
-#include "utils.h"
+#include <double-conversion/utils.h>
namespace double_conversion {
diff --git a/src/3rdparty/harfbuzz-ng/qt_attribution.json b/src/3rdparty/harfbuzz-ng/qt_attribution.json
index 0cf6a746f5..2f1aed8a87 100644
--- a/src/3rdparty/harfbuzz-ng/qt_attribution.json
+++ b/src/3rdparty/harfbuzz-ng/qt_attribution.json
@@ -2,7 +2,7 @@
"Id": "harfbuzz-ng",
"Name": "HarfBuzz-NG",
"QDocModule": "qtgui",
- "QtUsage": "Optionally used in Qt GUI. Configure with -system-harfbuzz or -qt-harfbuzz to avoid.",
+ "QtUsage": "Optionally used in Qt GUI. Configure with -system-harfbuzz to force the use of the system library, or -qt-harfbuzz to link statically to the library that is bundled with your Qt version.",
"Description": "HarfBuzz is an OpenType text shaping engine.",
"Homepage": "http://harfbuzz.org",
diff --git a/src/3rdparty/harfbuzz/qt_attribution.json b/src/3rdparty/harfbuzz/qt_attribution.json
index 51449f2adb..986171fb7b 100644
--- a/src/3rdparty/harfbuzz/qt_attribution.json
+++ b/src/3rdparty/harfbuzz/qt_attribution.json
@@ -2,7 +2,7 @@
"Id": "harfbuzz",
"Name": "HarfBuzz",
"QDocModule": "qtgui",
- "QtUsage": "Optionally used in Qt GUI. Configure with -system-harfbuzz or -qt-harfbuzz to avoid.",
+ "QtUsage": "Optionally used in Qt GUI. Configure with -system-harfbuzz to force the use of the system library, or -no-harfbuzz to disable the use of HarfBuzz entirely.",
"License": "MIT License",
"LicenseId": "MIT",
diff --git a/src/3rdparty/iaccessible2/qt_attribution.json b/src/3rdparty/iaccessible2/qt_attribution.json
index 545ffe4d63..290d0d4b7d 100644
--- a/src/3rdparty/iaccessible2/qt_attribution.json
+++ b/src/3rdparty/iaccessible2/qt_attribution.json
@@ -6,6 +6,7 @@
"Description": "IAccessible2 is a new accessibility API which complements Microsoft's earlier work on MSAA",
"Homepage": "http://www.linuxfoundation.org/collaborate/workgroups/accessibility/iaccessible2",
+ "Version": "1.3.0",
"License": "BSD 3-clause \"New\" or \"Revised\" License",
"LicenseId": "BSD-3-Clause",
"LicenseFile": "LICENSE",
diff --git a/src/3rdparty/libjpeg.pri b/src/3rdparty/libjpeg.pri
index 0d35bf8941..5effbe9d26 100644
--- a/src/3rdparty/libjpeg.pri
+++ b/src/3rdparty/libjpeg.pri
@@ -1,17 +1,13 @@
winrt: DEFINES += NO_GETENV
-DEFINES += \
- C_ARITH_CODING_SUPPORTED=1 \
- D_ARITH_CODING_SUPPORTED=1 \
- BITS_IN_JSAMPLE=8 \
- JPEG_LIB_VERSION=80 \
- SIZEOF_SIZE_T=__SIZEOF_SIZE_T__
-
# Disable warnings in 3rdparty code due to unused arguments
gcc: QMAKE_CFLAGS_WARN_ON += -Wno-unused-parameter -Wno-main
-INCLUDEPATH += $$PWD/libjpeg/src
+INCLUDEPATH += \
+ $$PWD/libjpeg \
+ $$PWD/libjpeg/src
+
SOURCES += \
$$PWD/libjpeg/src/jaricom.c \
$$PWD/libjpeg/src/jcapimin.c \
diff --git a/src/3rdparty/libjpeg/LICENSE b/src/3rdparty/libjpeg/LICENSE
index 0572390635..0f6ec4b30a 100644
--- a/src/3rdparty/libjpeg/LICENSE
+++ b/src/3rdparty/libjpeg/LICENSE
@@ -11,7 +11,8 @@ libjpeg-turbo is covered by three compatible BSD-style open source licenses:
- The Modified (3-clause) BSD License, which is listed below
- This license covers the TurboJPEG API library and associated programs.
+ This license covers the TurboJPEG API library and associated programs, as
+ well as the build system.
- The zlib License, which is listed below
@@ -137,3 +138,16 @@ freely, subject to the following restrictions:
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
+
+
+Why Three Licenses?
+===================
+
+The zlib License could have been used instead of the Modified (3-clause) BSD
+License, and since the IJG License effectively subsumes the distribution
+conditions of the zlib License, this would have effectively placed
+libjpeg-turbo binary distributions under the IJG License. However, the IJG
+License specifically refers to the Independent JPEG Group and does not extend
+attribution and endorsement protections to other entities. Thus, it was
+desirable to choose a license that granted us the same protections for new code
+that were granted to the IJG for code derived from their software.
diff --git a/src/3rdparty/libjpeg/import_from_libjpeg_tarball.sh b/src/3rdparty/libjpeg/import_from_libjpeg_tarball.sh
index b22f6b0d47..8dafbda64d 100755
--- a/src/3rdparty/libjpeg/import_from_libjpeg_tarball.sh
+++ b/src/3rdparty/libjpeg/import_from_libjpeg_tarball.sh
@@ -42,7 +42,7 @@
# into 3rdparty/libjpeg/.
if [ $# -ne 2 ]; then
- echo "Usage: $0 LIBJPEG_tarball_dir/ \$QTDIR/src/3rdparty/LIBJPEG/"
+ echo "Usage: $0 LIBJPEG_tarball_dir/ \$QTDIR/src/3rdparty/libjpeg/"
exit 1
fi
@@ -75,14 +75,14 @@ copy_file() {
}
copy_file "LICENSE.md" "LICENSE"
-copy_file "jconfig.txt" "src/jconfig.h"
-copy_file "win/jconfigint.h.in" "src/jconfigint.h"
FILES="
change.log
ChangeLog.md
README.md
README.ijg
+ jconfig.h.in
+ jconfigint.h.in
jaricom.c
jcapimin.c
@@ -163,3 +163,5 @@ FILES="
for i in $FILES; do
copy_file "$i" "src/$i"
done
+
+echo Done. $TARGET_DIR/jconfig.h and jconfigint.h may need manual updating.
diff --git a/src/3rdparty/libjpeg/jconfig.h b/src/3rdparty/libjpeg/jconfig.h
new file mode 100644
index 0000000000..bcfef5f0b6
--- /dev/null
+++ b/src/3rdparty/libjpeg/jconfig.h
@@ -0,0 +1,23 @@
+// Definitions for building in Qt source, ref. src/jconfig.h.in
+
+#define JPEG_LIB_VERSION 80
+
+#define LIBJPEG_TURBO_VERSION 2.0.0
+
+#define LIBJPEG_TURBO_VERSION_NUMBER 2000000
+
+#define C_ARITH_CODING_SUPPORTED
+
+#define D_ARITH_CODING_SUPPORTED
+
+#define MEM_SRCDST_SUPPORTED
+
+#define BITS_IN_JSAMPLE 8
+
+#define HAVE_STDDEF_H
+
+#define HAVE_STDLIB_H
+
+#define HAVE_UNSIGNED_CHAR
+
+#define HAVE_UNSIGNED_SHORT
diff --git a/src/3rdparty/libjpeg/jconfigint.h b/src/3rdparty/libjpeg/jconfigint.h
new file mode 100644
index 0000000000..c3549bfd25
--- /dev/null
+++ b/src/3rdparty/libjpeg/jconfigint.h
@@ -0,0 +1,17 @@
+// Definitions for building in Qt source, ref. src/jconfigint.h.in
+
+#include <stdint.h>
+
+#define BUILD ""
+
+#define INLINE inline
+
+#define PACKAGE_NAME "libjpeg-turbo"
+
+#define VERSION "2.0.0"
+
+#if SIZE_MAX == 0xffffffff
+#define SIZEOF_SIZE_T 4
+#elif SIZE_MAX == 0xffffffffffffffff
+#define SIZEOF_SIZE_T 8
+#endif
diff --git a/src/3rdparty/libjpeg/qt_attribution.json b/src/3rdparty/libjpeg/qt_attribution.json
index 9bfc14f29d..57c5001f6c 100644
--- a/src/3rdparty/libjpeg/qt_attribution.json
+++ b/src/3rdparty/libjpeg/qt_attribution.json
@@ -6,13 +6,14 @@
"Description": "The Independent JPEG Group's JPEG software",
"Homepage": "http://libjpeg-turbo.virtualgl.org/",
- "Version": "1.5.3",
+ "Version": "2.0.0",
"License": "Independent JPEG Group License",
"LicenseId": "IJG",
"LicenseFile": "LICENSE",
- "Copyright": "Copyright (C) 2009-2017 D. R. Commander
+ "Copyright": "Copyright (C) 2009-2018 D. R. Commander
Copyright (C) 2011-2016 Siarhei Siamashka
-Copyright (C) 2015-2016 Matthieu Darbois
+Copyright (C) 2015-2016, 2018 Matthieu Darbois
+Copyright (C) 2015 Intel Corporation
Copyright (C) 2015 Google, Inc.
Copyright (C) 2013-2014 MIPS Technologies, Inc.
Copyright (C) 2013 Linaro Limited
diff --git a/src/3rdparty/libjpeg/src/ChangeLog.md b/src/3rdparty/libjpeg/src/ChangeLog.md
index f5fe44bf85..8f0d11b1a6 100644
--- a/src/3rdparty/libjpeg/src/ChangeLog.md
+++ b/src/3rdparty/libjpeg/src/ChangeLog.md
@@ -1,3 +1,195 @@
+2.0.0
+=====
+
+### Significant changes relative to 2.0 beta1:
+
+1. The TurboJPEG API can now decompress CMYK JPEG images that have subsampled M
+and Y components (not to be confused with YCCK JPEG images, in which the C/M/Y
+components have been transformed into luma and chroma.) Previously, an error
+was generated ("Could not determine subsampling type for JPEG image") when such
+an image was passed to `tjDecompressHeader3()`, `tjTransform()`,
+`tjDecompressToYUVPlanes()`, `tjDecompressToYUV2()`, or the equivalent Java
+methods.
+
+2. Fixed an issue (CVE-2018-11813) whereby a specially-crafted malformed input
+file (specifically, a file with a valid Targa header but incomplete pixel data)
+would cause cjpeg to generate a JPEG file that was potentially thousands of
+times larger than the input file. The Targa reader in cjpeg was not properly
+detecting that the end of the input file had been reached prematurely, so after
+all valid pixels had been read from the input, the reader injected dummy pixels
+with values of 255 into the JPEG compressor until the number of pixels
+specified in the Targa header had been compressed. The Targa reader in cjpeg
+now behaves like the PPM reader and aborts compression if the end of the input
+file is reached prematurely. Because this issue only affected cjpeg and not
+the underlying library, and because it did not involve any out-of-bounds reads
+or other exploitable behaviors, it was not believed to represent a security
+threat.
+
+3. Fixed an issue whereby the `tjLoadImage()` and `tjSaveImage()` functions
+would produce a "Bogus message code" error message if the underlying bitmap and
+PPM readers/writers threw an error that was specific to the readers/writers
+(as opposed to a general libjpeg API error.)
+
+4. Fixed an issue whereby a specially-crafted malformed BMP file, one in which
+the header specified an image width of 1073741824 pixels, would trigger a
+floating point exception (division by zero) in the `tjLoadImage()` function
+when attempting to load the BMP file into a 4-component image buffer.
+
+5. Fixed an issue whereby certain combinations of calls to
+`jpeg_skip_scanlines()` and `jpeg_read_scanlines()` could trigger an infinite
+loop when decompressing progressive JPEG images that use vertical chroma
+subsampling (for instance, 4:2:0 or 4:4:0.)
+
+6. Fixed a segfault in `jpeg_skip_scanlines()` that occurred when decompressing
+a 4:2:2 or 4:2:0 JPEG image using the merged (non-fancy) upsampling algorithms
+(that is, when setting `cinfo.do_fancy_upsampling` to `FALSE`.)
+
+7. The new CMake-based build system will now disable the MIPS DSPr2 SIMD
+extensions if it detects that the compiler does not support DSPr2 instructions.
+
+8. Fixed out-of-bounds read in cjpeg that occurred when attempting to compress
+a specially-crafted malformed color-index (8-bit-per-sample) BMP file in which
+some of the samples (color indices) exceeded the bounds of the BMP file's color
+table.
+
+9. Fixed a signed integer overflow in the progressive Huffman decoder, detected
+by the Clang and GCC undefined behavior sanitizers, that could be triggered by
+attempting to decompress a specially-crafted malformed JPEG image. This issue
+did not pose a security threat, but removing the warning made it easier to
+detect actual security issues, should they arise in the future.
+
+
+1.5.90 (2.0 beta1)
+==================
+
+### Significant changes relative to 1.5.3:
+
+1. Added AVX2 SIMD implementations of the colorspace conversion, chroma
+downsampling and upsampling, integer quantization and sample conversion, and
+slow integer DCT/IDCT algorithms. When using the slow integer DCT/IDCT
+algorithms on AVX2-equipped CPUs, the compression of RGB images is
+approximately 13-36% (avg. 22%) faster (relative to libjpeg-turbo 1.5.x) with
+64-bit code and 11-21% (avg. 17%) faster with 32-bit code, and the
+decompression of RGB images is approximately 9-35% (avg. 17%) faster with
+64-bit code and 7-17% (avg. 12%) faster with 32-bit code. (As tested on a
+3 GHz Intel Core i7. Actual mileage may vary.)
+
+2. Overhauled the build system to use CMake on all platforms, and removed the
+autotools-based build system. This decision resulted from extensive
+discussions within the libjpeg-turbo community. libjpeg-turbo traditionally
+used CMake only for Windows builds, but there was an increasing amount of
+demand to extend CMake support to other platforms. However, because of the
+unique nature of our code base (the need to support different assemblers on
+each platform, the need for Java support, etc.), providing dual build systems
+as other OSS imaging libraries do (including libpng and libtiff) would have
+created a maintenance burden. The use of CMake greatly simplifies some aspects
+of our build system, owing to CMake's built-in support for various assemblers,
+Java, and unit testing, as well as generally fewer quirks that have to be
+worked around in order to implement our packaging system. Eliminating
+autotools puts our project slightly at odds with the traditional practices of
+the OSS community, since most "system libraries" tend to be built with
+autotools, but it is believed that the benefits of this move outweigh the
+risks. In addition to providing a unified build environment, switching to
+CMake allows for the use of various build tools and IDEs that aren't supported
+under autotools, including XCode, Ninja, and Eclipse. It also eliminates the
+need to install autotools via MacPorts/Homebrew on OS X and allows
+libjpeg-turbo to be configured without the use of a terminal/command prompt.
+Extensive testing was conducted to ensure that all features provided by the
+autotools-based build system are provided by the new build system.
+
+3. The libjpeg API in this version of libjpeg-turbo now includes two additional
+functions, `jpeg_read_icc_profile()` and `jpeg_write_icc_profile()`, that can
+be used to extract ICC profile data from a JPEG file while decompressing or to
+embed ICC profile data in a JPEG file while compressing or transforming. This
+eliminates the need for downstream projects, such as color management libraries
+and browsers, to include their own glueware for accomplishing this.
+
+4. Improved error handling in the TurboJPEG API library:
+
+ - Introduced a new function (`tjGetErrorStr2()`) in the TurboJPEG C API
+that allows compression/decompression/transform error messages to be retrieved
+in a thread-safe manner. Retrieving error messages from global functions, such
+as `tjInitCompress()` or `tjBufSize()`, is still thread-unsafe, but since those
+functions will only throw errors if passed an invalid argument or if a memory
+allocation failure occurs, thread safety is not as much of a concern.
+ - Introduced a new function (`tjGetErrorCode()`) in the TurboJPEG C API
+and a new method (`TJException.getErrorCode()`) in the TurboJPEG Java API that
+can be used to determine the severity of the last
+compression/decompression/transform error. This allows applications to
+choose whether to ignore warnings (non-fatal errors) from the underlying
+libjpeg API or to treat them as fatal.
+ - Introduced a new flag (`TJFLAG_STOPONWARNING` in the TurboJPEG C API and
+`TJ.FLAG_STOPONWARNING` in the TurboJPEG Java API) that causes the library to
+immediately halt a compression/decompression/transform operation if it
+encounters a warning from the underlying libjpeg API (the default behavior is
+to allow the operation to complete unless a fatal error is encountered.)
+
+5. Introduced a new flag in the TurboJPEG C and Java APIs (`TJFLAG_PROGRESSIVE`
+and `TJ.FLAG_PROGRESSIVE`, respectively) that causes the library to use
+progressive entropy coding in JPEG images generated by compression and
+transform operations. Additionally, a new transform option
+(`TJXOPT_PROGRESSIVE` in the C API and `TJTransform.OPT_PROGRESSIVE` in the
+Java API) has been introduced, allowing progressive entropy coding to be
+enabled for selected transforms in a multi-transform operation.
+
+6. Introduced a new transform option in the TurboJPEG API (`TJXOPT_COPYNONE` in
+the C API and `TJTransform.OPT_COPYNONE` in the Java API) that allows the
+copying of markers (including EXIF and ICC profile data) to be disabled for a
+particular transform.
+
+7. Added two functions to the TurboJPEG C API (`tjLoadImage()` and
+`tjSaveImage()`) that can be used to load/save a BMP or PPM/PGM image to/from a
+memory buffer with a specified pixel format and layout. These functions
+replace the project-private (and slow) bmp API, which was previously used by
+TJBench, and they also provide a convenient way for first-time users of
+libjpeg-turbo to quickly develop a complete JPEG compression/decompression
+program.
+
+8. The TurboJPEG C API now includes a new convenience array (`tjAlphaOffset[]`)
+that contains the alpha component index for each pixel format (or -1 if the
+pixel format lacks an alpha component.) The TurboJPEG Java API now includes a
+new method (`TJ.getAlphaOffset()`) that returns the same value. In addition,
+the `tjRedOffset[]`, `tjGreenOffset[]`, and `tjBlueOffset[]` arrays-- and the
+corresponding `TJ.getRedOffset()`, `TJ.getGreenOffset()`, and
+`TJ.getBlueOffset()` methods-- now return -1 for `TJPF_GRAY`/`TJ.PF_GRAY`
+rather than 0. This allows programs to easily determine whether a pixel format
+has red, green, blue, and alpha components.
+
+9. Added a new example (tjexample.c) that demonstrates the basic usage of the
+TurboJPEG C API. This example mirrors the functionality of TJExample.java.
+Both files are now included in the libjpeg-turbo documentation.
+
+10. Fixed two signed integer overflows in the arithmetic decoder, detected by
+the Clang undefined behavior sanitizer, that could be triggered by attempting
+to decompress a specially-crafted malformed JPEG image. These issues did not
+pose a security threat, but removing the warnings makes it easier to detect
+actual security issues, should they arise in the future.
+
+11. Fixed a bug in the merged 4:2:0 upsampling/dithered RGB565 color conversion
+algorithm that caused incorrect dithering in the output image. This algorithm
+now produces bitwise-identical results to the unmerged algorithms.
+
+12. The SIMD function symbols for x86[-64]/ELF, MIPS/ELF, macOS/x86[-64] (if
+libjpeg-turbo is built with YASM), and iOS/ARM[64] builds are now private.
+This prevents those symbols from being exposed in applications or shared
+libraries that link statically with libjpeg-turbo.
+
+13. Added Loongson MMI SIMD implementations of the RGB-to-YCbCr and
+YCbCr-to-RGB colorspace conversion, 4:2:0 chroma downsampling, 4:2:0 fancy
+chroma upsampling, integer quantization, and slow integer DCT/IDCT algorithms.
+When using the slow integer DCT/IDCT, this speeds up the compression of RGB
+images by approximately 70-100% and the decompression of RGB images by
+approximately 2-3.5x.
+
+14. Fixed a build error when building with older MinGW releases (regression
+caused by 1.5.1[7].)
+
+15. Added SIMD acceleration for progressive Huffman encoding on SSE2-capable
+x86 and x86-64 platforms. This speeds up the compression of full-color
+progressive JPEGs by about 85-90% on average (relative to libjpeg-turbo 1.5.x)
+when using modern Intel and AMD CPUs.
+
+
1.5.3
=====
@@ -174,8 +366,8 @@ specified.)
2x2 luminance sampling factors and 2x1 or 1x2 chrominance sampling factors.
This is a non-standard way of specifying 2x subsampling (normally 4:2:2 JPEGs
have 2x1 luminance and 1x1 chrominance sampling factors, and 4:4:0 JPEGs have
-1x2 luminance and 1x1 chrominance sampling factors), but the JPEG specification
-and the libjpeg API both allow it.
+1x2 luminance and 1x1 chrominance sampling factors), but the JPEG format and
+the libjpeg API both allow it.
7. Fixed an unsigned integer overflow in the libjpeg memory manager, detected
by the Clang undefined behavior sanitizer, that could be triggered by
diff --git a/src/3rdparty/libjpeg/src/README.ijg b/src/3rdparty/libjpeg/src/README.ijg
index 9c450ceb07..2e39f965c2 100644
--- a/src/3rdparty/libjpeg/src/README.ijg
+++ b/src/3rdparty/libjpeg/src/README.ijg
@@ -43,7 +43,7 @@ User documentation:
change.log Version-to-version change highlights.
Programmer and internal documentation:
libjpeg.txt How to use the JPEG library in your own programs.
- example.c Sample code for calling the JPEG library.
+ example.txt Sample code for calling the JPEG library.
structure.txt Overview of the JPEG library's internal structure.
coderules.txt Coding style rules --- please read if you contribute code.
@@ -159,12 +159,6 @@ commercial products, provided that all warranty or liability claims are
assumed by the product vendor.
-The Unix configuration script "configure" was produced with GNU Autoconf.
-It is copyright by the Free Software Foundation but is freely distributable.
-The same holds for its supporting scripts (config.guess, config.sub,
-ltmain.sh). Another support script, install-sh, is copyright by X Consortium
-but is also freely distributable.
-
The IJG distribution formerly included code to read and write GIF files.
To avoid entanglement with the Unisys LZW patent (now expired), GIF reading
support has been removed altogether, and the GIF writer has been simplified
@@ -185,8 +179,8 @@ We recommend reading one or more of these references before trying to
understand the innards of the JPEG software.
The best short technical introduction to the JPEG compression algorithm is
- Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
- Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44.
+ Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
+ Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44.
(Adjacent articles in that issue discuss MPEG motion picture compression,
applications of JPEG, and related topics.) If you don't have the CACM issue
handy, a PDF file containing a revised version of Wallace's article is
@@ -220,14 +214,14 @@ Continuous-tone Still Images, Part 2: Compliance testing" and has document
numbers ISO/IEC IS 10918-2, ITU-T T.83.
The JPEG standard does not specify all details of an interchangeable file
-format. For the omitted details we follow the "JFIF" conventions, revision
-1.02. JFIF 1.02 has been adopted as an Ecma International Technical Report
-and thus received a formal publication status. It is available as a free
-download in PDF format from
-http://www.ecma-international.org/publications/techreports/E-TR-098.htm.
-A PostScript version of the JFIF document is available at
-http://www.ijg.org/files/jfif.ps.gz. There is also a plain text version at
-http://www.ijg.org/files/jfif.txt.gz, but it is missing the figures.
+format. For the omitted details, we follow the "JFIF" conventions, revision
+1.02. JFIF version 1 has been adopted as ISO/IEC 10918-5 (05/2013) and
+Recommendation ITU-T T.871 (05/2011): Information technology - Digital
+compression and coding of continuous-tone still images: JPEG File Interchange
+Format (JFIF). It is available as a free download in PDF file format from
+https://www.iso.org/standard/54989.html and http://www.itu.int/rec/T-REC-T.871.
+A PDF file of the older JFIF 1.02 specification is available at
+http://www.w3.org/Graphics/JPEG/jfif3.pdf.
The TIFF 6.0 file format specification can be obtained by FTP from
ftp://ftp.sgi.com/graphics/tiff/TIFF6.ps.gz. The JPEG incorporation scheme
@@ -255,22 +249,26 @@ and other news.answers archive sites, including the official news.answers
archive at rtfm.mit.edu: ftp://rtfm.mit.edu/pub/usenet/news.answers/jpeg-faq/.
If you don't have Web or FTP access, send e-mail to mail-server@rtfm.mit.edu
with body
- send usenet/news.answers/jpeg-faq/part1
- send usenet/news.answers/jpeg-faq/part2
-
-
-FILE FORMAT WARS
-================
-
-The ISO/IEC JTC1/SC29/WG1 standards committee (also known as JPEG, together
-with ITU-T SG16) currently promotes different formats containing the name
-"JPEG" which are incompatible with original DCT-based JPEG. IJG therefore does
-not support these formats (see REFERENCES). Indeed, one of the original
-reasons for developing this free software was to help force convergence on
-common, interoperable format standards for JPEG files.
-Don't use an incompatible file format!
-(In any case, our decoder will remain capable of reading existing JPEG
-image files indefinitely.)
+ send usenet/news.answers/jpeg-faq/part1
+ send usenet/news.answers/jpeg-faq/part2
+
+
+FILE FORMAT COMPATIBILITY
+=========================
+
+This software implements ITU T.81 | ISO/IEC 10918 with some extensions from
+ITU T.871 | ISO/IEC 10918-5 (JPEG File Interchange Format-- see REFERENCES).
+Informally, the term "JPEG image" or "JPEG file" most often refers to JFIF or
+a subset thereof, but there are other formats containing the name "JPEG" that
+are incompatible with the DCT-based JPEG standard or with JFIF (for instance,
+JPEG 2000 and JPEG XR). This software therefore does not support these
+formats. Indeed, one of the original reasons for developing this free software
+was to help force convergence on a common, interoperable format standard for
+JPEG files.
+
+JFIF is a minimal or "low end" representation. TIFF/JPEG (TIFF revision 6.0 as
+modified by TIFF Technical Note #2) can be used for "high end" applications
+that need to record a lot of additional data about an image.
TO DO
diff --git a/src/3rdparty/libjpeg/src/README.md b/src/3rdparty/libjpeg/src/README.md
index 74e6eac45a..a769259891 100755..100644
--- a/src/3rdparty/libjpeg/src/README.md
+++ b/src/3rdparty/libjpeg/src/README.md
@@ -2,8 +2,9 @@ Background
==========
libjpeg-turbo is a JPEG image codec that uses SIMD instructions (MMX, SSE2,
-NEON, AltiVec) to accelerate baseline JPEG compression and decompression on
-x86, x86-64, ARM, and PowerPC systems. On such systems, libjpeg-turbo is
+AVX2, NEON, AltiVec) to accelerate baseline JPEG compression and decompression
+on x86, x86-64, ARM, and PowerPC systems, as well as progressive JPEG
+compression on x86 and x86-64 systems. On such systems, libjpeg-turbo is
generally 2-6x as fast as libjpeg, all else being equal. On other types of
systems, libjpeg-turbo can still outperform libjpeg by a significant amount, by
virtue of its highly-optimized Huffman coding routines. In many cases, the
@@ -48,7 +49,10 @@ JPEG images:
straightforward to achieve using the underlying libjpeg API, such as
generating planar YUV images and performing multiple simultaneous lossless
transforms on an image. The Java interface for libjpeg-turbo is written on
- top of the TurboJPEG API.
+ top of the TurboJPEG API. The TurboJPEG API is recommended for first-time
+ users of libjpeg-turbo. Refer to [tjexample.c](tjexample.c) and
+ [TJExample.java](java/TJExample.java) for examples of its usage and to
+ <http://libjpeg-turbo.org/Documentation/Documentation> for API documentation.
- **libjpeg API**<br>
This is the de facto industry-standard API for compressing and decompressing
@@ -56,7 +60,8 @@ JPEG images:
more powerful. The libjpeg API implementation in libjpeg-turbo is both
API/ABI-compatible and mathematically compatible with libjpeg v6b. It can
also optionally be configured to be API/ABI-compatible with libjpeg v7 and v8
- (see below.)
+ (see below.) Refer to [cjpeg.c](cjpeg.c) and [djpeg.c](djpeg.c) for examples
+ of its usage and to [libjpeg.txt](libjpeg.txt) for API documentation.
There is no significant performance advantage to either API when both are used
to perform similar operations.
diff --git a/src/3rdparty/libjpeg/src/jaricom.c b/src/3rdparty/libjpeg/src/jaricom.c
index 3bb557f7a3..215640cc44 100644
--- a/src/3rdparty/libjpeg/src/jaricom.c
+++ b/src/3rdparty/libjpeg/src/jaricom.c
@@ -4,16 +4,16 @@
* This file was part of the Independent JPEG Group's software:
* Developed 1997-2009 by Guido Vollbeding.
* libjpeg-turbo Modifications:
- * Copyright (C) 2015, D. R. Commander.
+ * Copyright (C) 2015, 2018, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
* This file contains probability estimation tables for common use in
* arithmetic entropy encoding and decoding routines.
*
- * This data represents Table D.2 in the JPEG spec (ISO/IEC IS 10918-1
- * and CCITT Recommendation ITU-T T.81) and Table 24 in the JBIG spec
- * (ISO/IEC IS 11544 and CCITT Recommendation ITU-T T.82).
+ * This data represents Table D.2 in
+ * Recommendation ITU-T T.81 (1992) | ISO/IEC 10918-1:1994 and Table 24 in
+ * Recommendation ITU-T T.82 (1993) | ISO/IEC 11544:1993.
*/
#define JPEG_INTERNALS
@@ -29,9 +29,10 @@
* implementation (jbig_tab.c).
*/
-#define V(i,a,b,c,d) (((JLONG)a << 16) | ((JLONG)c << 8) | ((JLONG)d << 7) | b)
+#define V(i, a, b, c, d) \
+ (((JLONG)a << 16) | ((JLONG)c << 8) | ((JLONG)d << 7) | b)
-const JLONG jpeg_aritab[113+1] = {
+const JLONG jpeg_aritab[113 + 1] = {
/*
* Index, Qe_Value, Next_Index_LPS, Next_Index_MPS, Switch_MPS
*/
diff --git a/src/3rdparty/libjpeg/src/jcapimin.c b/src/3rdparty/libjpeg/src/jcapimin.c
index 15674be54a..178c55ba47 100644
--- a/src/3rdparty/libjpeg/src/jcapimin.c
+++ b/src/3rdparty/libjpeg/src/jcapimin.c
@@ -31,7 +31,7 @@
*/
GLOBAL(void)
-jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize)
+jpeg_CreateCompress(j_compress_ptr cinfo, int version, size_t structsize)
{
int i;
@@ -41,7 +41,7 @@ jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize)
ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version);
if (structsize != sizeof(struct jpeg_compress_struct))
ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE,
- (int) sizeof(struct jpeg_compress_struct), (int) structsize);
+ (int)sizeof(struct jpeg_compress_struct), (int)structsize);
/* For debugging purposes, we zero the whole master structure.
* But the application has already set the err pointer, and may have set
@@ -59,7 +59,7 @@ jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize)
cinfo->is_decompressor = FALSE;
/* Initialize a memory manager instance for this object */
- jinit_memory_mgr((j_common_ptr) cinfo);
+ jinit_memory_mgr((j_common_ptr)cinfo);
/* Zero out pointers to permanent structures. */
cinfo->progress = NULL;
@@ -83,7 +83,7 @@ jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize)
/* Must do it here for emit_dqt in case jpeg_write_tables is used */
cinfo->block_size = DCTSIZE;
cinfo->natural_order = jpeg_natural_order;
- cinfo->lim_Se = DCTSIZE2-1;
+ cinfo->lim_Se = DCTSIZE2 - 1;
#endif
cinfo->script_space = NULL;
@@ -100,9 +100,9 @@ jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize)
*/
GLOBAL(void)
-jpeg_destroy_compress (j_compress_ptr cinfo)
+jpeg_destroy_compress(j_compress_ptr cinfo)
{
- jpeg_destroy((j_common_ptr) cinfo); /* use common routine */
+ jpeg_destroy((j_common_ptr)cinfo); /* use common routine */
}
@@ -112,9 +112,9 @@ jpeg_destroy_compress (j_compress_ptr cinfo)
*/
GLOBAL(void)
-jpeg_abort_compress (j_compress_ptr cinfo)
+jpeg_abort_compress(j_compress_ptr cinfo)
{
- jpeg_abort((j_common_ptr) cinfo); /* use common routine */
+ jpeg_abort((j_common_ptr)cinfo); /* use common routine */
}
@@ -131,7 +131,7 @@ jpeg_abort_compress (j_compress_ptr cinfo)
*/
GLOBAL(void)
-jpeg_suppress_tables (j_compress_ptr cinfo, boolean suppress)
+jpeg_suppress_tables(j_compress_ptr cinfo, boolean suppress)
{
int i;
JQUANT_TBL *qtbl;
@@ -159,7 +159,7 @@ jpeg_suppress_tables (j_compress_ptr cinfo, boolean suppress)
*/
GLOBAL(void)
-jpeg_finish_compress (j_compress_ptr cinfo)
+jpeg_finish_compress(j_compress_ptr cinfo)
{
JDIMENSION iMCU_row;
@@ -172,18 +172,18 @@ jpeg_finish_compress (j_compress_ptr cinfo)
} else if (cinfo->global_state != CSTATE_WRCOEFS)
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
/* Perform any remaining passes */
- while (! cinfo->master->is_last_pass) {
+ while (!cinfo->master->is_last_pass) {
(*cinfo->master->prepare_for_pass) (cinfo);
for (iMCU_row = 0; iMCU_row < cinfo->total_iMCU_rows; iMCU_row++) {
if (cinfo->progress != NULL) {
- cinfo->progress->pass_counter = (long) iMCU_row;
- cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows;
- (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
+ cinfo->progress->pass_counter = (long)iMCU_row;
+ cinfo->progress->pass_limit = (long)cinfo->total_iMCU_rows;
+ (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
}
/* We bypass the main controller and invoke coef controller directly;
* all work is being done from the coefficient buffer.
*/
- if (! (*cinfo->coef->compress_data) (cinfo, (JSAMPIMAGE) NULL))
+ if (!(*cinfo->coef->compress_data) (cinfo, (JSAMPIMAGE)NULL))
ERREXIT(cinfo, JERR_CANT_SUSPEND);
}
(*cinfo->master->finish_pass) (cinfo);
@@ -192,7 +192,7 @@ jpeg_finish_compress (j_compress_ptr cinfo)
(*cinfo->marker->write_file_trailer) (cinfo);
(*cinfo->dest->term_destination) (cinfo);
/* We can use jpeg_abort to release memory and reset global_state */
- jpeg_abort((j_common_ptr) cinfo);
+ jpeg_abort((j_common_ptr)cinfo);
}
@@ -204,8 +204,8 @@ jpeg_finish_compress (j_compress_ptr cinfo)
*/
GLOBAL(void)
-jpeg_write_marker (j_compress_ptr cinfo, int marker,
- const JOCTET *dataptr, unsigned int datalen)
+jpeg_write_marker(j_compress_ptr cinfo, int marker, const JOCTET *dataptr,
+ unsigned int datalen)
{
void (*write_marker_byte) (j_compress_ptr info, int val);
@@ -226,7 +226,7 @@ jpeg_write_marker (j_compress_ptr cinfo, int marker,
/* Same, but piecemeal. */
GLOBAL(void)
-jpeg_write_m_header (j_compress_ptr cinfo, int marker, unsigned int datalen)
+jpeg_write_m_header(j_compress_ptr cinfo, int marker, unsigned int datalen)
{
if (cinfo->next_scanline != 0 ||
(cinfo->global_state != CSTATE_SCANNING &&
@@ -238,7 +238,7 @@ jpeg_write_m_header (j_compress_ptr cinfo, int marker, unsigned int datalen)
}
GLOBAL(void)
-jpeg_write_m_byte (j_compress_ptr cinfo, int val)
+jpeg_write_m_byte(j_compress_ptr cinfo, int val)
{
(*cinfo->marker->write_marker_byte) (cinfo, val);
}
@@ -266,13 +266,13 @@ jpeg_write_m_byte (j_compress_ptr cinfo, int val)
*/
GLOBAL(void)
-jpeg_write_tables (j_compress_ptr cinfo)
+jpeg_write_tables(j_compress_ptr cinfo)
{
if (cinfo->global_state != CSTATE_START)
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
/* (Re)initialize error mgr and destination modules */
- (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
+ (*cinfo->err->reset_error_mgr) ((j_common_ptr)cinfo);
(*cinfo->dest->init_destination) (cinfo);
/* Initialize the marker writer ... bit of a crock to do it here. */
jinit_marker_writer(cinfo);
diff --git a/src/3rdparty/libjpeg/src/jcapistd.c b/src/3rdparty/libjpeg/src/jcapistd.c
index 5c6d0be255..aa2aad9f66 100644
--- a/src/3rdparty/libjpeg/src/jcapistd.c
+++ b/src/3rdparty/libjpeg/src/jcapistd.c
@@ -36,7 +36,7 @@
*/
GLOBAL(void)
-jpeg_start_compress (j_compress_ptr cinfo, boolean write_all_tables)
+jpeg_start_compress(j_compress_ptr cinfo, boolean write_all_tables)
{
if (cinfo->global_state != CSTATE_START)
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
@@ -45,7 +45,7 @@ jpeg_start_compress (j_compress_ptr cinfo, boolean write_all_tables)
jpeg_suppress_tables(cinfo, FALSE); /* mark all tables to be written */
/* (Re)initialize error mgr and destination modules */
- (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
+ (*cinfo->err->reset_error_mgr) ((j_common_ptr)cinfo);
(*cinfo->dest->init_destination) (cinfo);
/* Perform master selection of active modules */
jinit_compress_master(cinfo);
@@ -75,8 +75,8 @@ jpeg_start_compress (j_compress_ptr cinfo, boolean write_all_tables)
*/
GLOBAL(JDIMENSION)
-jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines,
- JDIMENSION num_lines)
+jpeg_write_scanlines(j_compress_ptr cinfo, JSAMPARRAY scanlines,
+ JDIMENSION num_lines)
{
JDIMENSION row_ctr, rows_left;
@@ -87,9 +87,9 @@ jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines,
/* Call progress monitor hook if present */
if (cinfo->progress != NULL) {
- cinfo->progress->pass_counter = (long) cinfo->next_scanline;
- cinfo->progress->pass_limit = (long) cinfo->image_height;
- (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
+ cinfo->progress->pass_counter = (long)cinfo->next_scanline;
+ cinfo->progress->pass_limit = (long)cinfo->image_height;
+ (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
}
/* Give master control module another chance if this is first call to
@@ -118,8 +118,8 @@ jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines,
*/
GLOBAL(JDIMENSION)
-jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data,
- JDIMENSION num_lines)
+jpeg_write_raw_data(j_compress_ptr cinfo, JSAMPIMAGE data,
+ JDIMENSION num_lines)
{
JDIMENSION lines_per_iMCU_row;
@@ -132,9 +132,9 @@ jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data,
/* Call progress monitor hook if present */
if (cinfo->progress != NULL) {
- cinfo->progress->pass_counter = (long) cinfo->next_scanline;
- cinfo->progress->pass_limit = (long) cinfo->image_height;
- (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
+ cinfo->progress->pass_counter = (long)cinfo->next_scanline;
+ cinfo->progress->pass_limit = (long)cinfo->image_height;
+ (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
}
/* Give master control module another chance if this is first call to
@@ -151,7 +151,7 @@ jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data,
ERREXIT(cinfo, JERR_BUFFER_SIZE);
/* Directly compress the row. */
- if (! (*cinfo->coef->compress_data) (cinfo, data)) {
+ if (!(*cinfo->coef->compress_data) (cinfo, data)) {
/* If compressor did not consume the whole row, suspend processing. */
return 0;
}
diff --git a/src/3rdparty/libjpeg/src/jcarith.c b/src/3rdparty/libjpeg/src/jcarith.c
index 6d3b8af5b4..b6d093f70e 100644
--- a/src/3rdparty/libjpeg/src/jcarith.c
+++ b/src/3rdparty/libjpeg/src/jcarith.c
@@ -4,16 +4,19 @@
* This file was part of the Independent JPEG Group's software:
* Developed 1997-2009 by Guido Vollbeding.
* libjpeg-turbo Modifications:
- * Copyright (C) 2015, D. R. Commander.
+ * Copyright (C) 2015, 2018, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
* This file contains portable arithmetic entropy encoding routines for JPEG
- * (implementing the ISO/IEC IS 10918-1 and CCITT Recommendation ITU-T T.81).
+ * (implementing Recommendation ITU-T T.81 | ISO/IEC 10918-1).
*
* Both sequential and progressive modes are supported in this single module.
*
* Suspension is not currently supported in this module.
+ *
+ * NOTE: All referenced figures are from
+ * Recommendation ITU-T T.81 (1992) | ISO/IEC 10918-1:1994.
*/
#define JPEG_INTERNALS
@@ -63,8 +66,8 @@ typedef arith_entropy_encoder *arith_entropy_ptr;
* in the lower bits (mask 0x7F).
*/
-#define DC_STAT_BINS 64
-#define AC_STAT_BINS 256
+#define DC_STAT_BINS 64
+#define AC_STAT_BINS 256
/* NOTE: Uncomment the following #define if you want to use the
* given formula for calculating the AC conditioning parameter Kx
@@ -105,25 +108,25 @@ typedef arith_entropy_encoder *arith_entropy_ptr;
#ifdef RIGHT_SHIFT_IS_UNSIGNED
#define ISHIFT_TEMPS int ishift_temp;
-#define IRIGHT_SHIFT(x,shft) \
- ((ishift_temp = (x)) < 0 ? \
- (ishift_temp >> (shft)) | ((~0) << (16-(shft))) : \
- (ishift_temp >> (shft)))
+#define IRIGHT_SHIFT(x, shft) \
+ ((ishift_temp = (x)) < 0 ? \
+ (ishift_temp >> (shft)) | ((~0) << (16 - (shft))) : \
+ (ishift_temp >> (shft)))
#else
#define ISHIFT_TEMPS
-#define IRIGHT_SHIFT(x,shft) ((x) >> (shft))
+#define IRIGHT_SHIFT(x, shft) ((x) >> (shft))
#endif
LOCAL(void)
-emit_byte (int val, j_compress_ptr cinfo)
+emit_byte(int val, j_compress_ptr cinfo)
/* Write next output byte; we do not support suspension in this module. */
{
struct jpeg_destination_mgr *dest = cinfo->dest;
- *dest->next_output_byte++ = (JOCTET) val;
+ *dest->next_output_byte++ = (JOCTET)val;
if (--dest->free_in_buffer == 0)
- if (! (*dest->empty_output_buffer) (cinfo))
+ if (!(*dest->empty_output_buffer) (cinfo))
ERREXIT(cinfo, JERR_CANT_SUSPEND);
}
@@ -133,22 +136,22 @@ emit_byte (int val, j_compress_ptr cinfo)
*/
METHODDEF(void)
-finish_pass (j_compress_ptr cinfo)
+finish_pass(j_compress_ptr cinfo)
{
- arith_entropy_ptr e = (arith_entropy_ptr) cinfo->entropy;
+ arith_entropy_ptr e = (arith_entropy_ptr)cinfo->entropy;
JLONG temp;
/* Section D.1.8: Termination of encoding */
/* Find the e->c in the coding interval with the largest
* number of trailing zero bits */
- if ((temp = (e->a - 1 + e->c) & 0xFFFF0000L) < e->c)
+ if ((temp = (e->a - 1 + e->c) & 0xFFFF0000UL) < e->c)
e->c = temp + 0x8000L;
else
e->c = temp;
/* Send remaining bytes to output */
e->c <<= e->ct;
- if (e->c & 0xF8000000L) {
+ if (e->c & 0xF8000000UL) {
/* One final overflow has to be handled */
if (e->buffer >= 0) {
if (e->zc)
@@ -219,9 +222,9 @@ finish_pass (j_compress_ptr cinfo)
*/
LOCAL(void)
-arith_encode (j_compress_ptr cinfo, unsigned char *st, int val)
+arith_encode(j_compress_ptr cinfo, unsigned char *st, int val)
{
- register arith_entropy_ptr e = (arith_entropy_ptr) cinfo->entropy;
+ register arith_entropy_ptr e = (arith_entropy_ptr)cinfo->entropy;
register unsigned char nl, nm;
register JLONG qe, temp;
register int sv;
@@ -231,8 +234,8 @@ arith_encode (j_compress_ptr cinfo, unsigned char *st, int val)
*/
sv = *st;
qe = jpeg_aritab[sv & 0x7F]; /* => Qe_Value */
- nl = qe & 0xFF; qe >>= 8; /* Next_Index_LPS + Switch_MPS */
- nm = qe & 0xFF; qe >>= 8; /* Next_Index_MPS */
+ nl = qe & 0xFF; qe >>= 8; /* Next_Index_LPS + Switch_MPS */
+ nm = qe & 0xFF; qe >>= 8; /* Next_Index_MPS */
/* Encode & estimation procedures per sections D.1.4 & D.1.5 */
e->a -= qe;
@@ -319,9 +322,9 @@ arith_encode (j_compress_ptr cinfo, unsigned char *st, int val)
*/
LOCAL(void)
-emit_restart (j_compress_ptr cinfo, int restart_num)
+emit_restart(j_compress_ptr cinfo, int restart_num)
{
- arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
+ arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
int ci;
jpeg_component_info *compptr;
@@ -362,9 +365,9 @@ emit_restart (j_compress_ptr cinfo, int restart_num)
*/
METHODDEF(boolean)
-encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
+encode_mcu_DC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{
- arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
+ arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
JBLOCKROW block;
unsigned char *st;
int blkn, ci, tbl;
@@ -391,7 +394,7 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
/* Compute the DC value after the required point transform by Al.
* This is simply an arithmetic right shift.
*/
- m = IRIGHT_SHIFT((int) ((*block)[0]), cinfo->Al);
+ m = IRIGHT_SHIFT((int)((*block)[0]), cinfo->Al);
/* Sections F.1.4.1 & F.1.4.4.1: Encoding of DC coefficients */
@@ -432,9 +435,9 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
}
arith_encode(cinfo, st, 0);
/* Section F.1.4.4.1.2: Establish dc_context conditioning category */
- if (m < (int) ((1L << cinfo->arith_dc_L[tbl]) >> 1))
+ if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
entropy->dc_context[ci] = 0; /* zero diff category */
- else if (m > (int) ((1L << cinfo->arith_dc_U[tbl]) >> 1))
+ else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
entropy->dc_context[ci] += 8; /* large diff category */
/* Figure F.9: Encoding the magnitude bit pattern of v */
st += 14;
@@ -453,9 +456,9 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
*/
METHODDEF(boolean)
-encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
+encode_mcu_AC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{
- arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
+ arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
JBLOCKROW block;
unsigned char *st;
int tbl, k, ke;
@@ -510,7 +513,7 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
break;
}
}
- arith_encode(cinfo, st + 1, 0); st += 3; k++;
+ arith_encode(cinfo, st + 1, 0); st += 3; k++;
}
st += 2;
/* Figure F.8: Encoding the magnitude category of v */
@@ -552,9 +555,9 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
*/
METHODDEF(boolean)
-encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
+encode_mcu_DC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{
- arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
+ arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
unsigned char *st;
int Al, blkn;
@@ -587,9 +590,9 @@ encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
*/
METHODDEF(boolean)
-encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
+encode_mcu_AC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{
- arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
+ arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
JBLOCKROW block;
unsigned char *st;
int tbl, k, ke, kex;
@@ -662,7 +665,7 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
break;
}
}
- arith_encode(cinfo, st + 1, 0); st += 3; k++;
+ arith_encode(cinfo, st + 1, 0); st += 3; k++;
}
}
/* Encode EOB decision only if k <= cinfo->Se */
@@ -680,9 +683,9 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
*/
METHODDEF(boolean)
-encode_mcu (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
+encode_mcu(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{
- arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
+ arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
jpeg_component_info *compptr;
JBLOCKROW block;
unsigned char *st;
@@ -747,9 +750,9 @@ encode_mcu (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
}
arith_encode(cinfo, st, 0);
/* Section F.1.4.4.1.2: Establish dc_context conditioning category */
- if (m < (int) ((1L << cinfo->arith_dc_L[tbl]) >> 1))
+ if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
entropy->dc_context[ci] = 0; /* zero diff category */
- else if (m > (int) ((1L << cinfo->arith_dc_U[tbl]) >> 1))
+ else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
entropy->dc_context[ci] += 8; /* large diff category */
/* Figure F.9: Encoding the magnitude bit pattern of v */
st += 14;
@@ -770,7 +773,7 @@ encode_mcu (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
st = entropy->ac_stats[tbl] + 3 * (k - 1);
arith_encode(cinfo, st, 0); /* EOB decision */
while ((v = (*block)[jpeg_natural_order[k]]) == 0) {
- arith_encode(cinfo, st + 1, 0); st += 3; k++;
+ arith_encode(cinfo, st + 1, 0); st += 3; k++;
}
arith_encode(cinfo, st + 1, 1);
/* Figure F.6: Encoding nonzero value v */
@@ -822,9 +825,9 @@ encode_mcu (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
*/
METHODDEF(void)
-start_pass (j_compress_ptr cinfo, boolean gather_statistics)
+start_pass(j_compress_ptr cinfo, boolean gather_statistics)
{
- arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
+ arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
int ci, tbl;
jpeg_component_info *compptr;
@@ -862,8 +865,8 @@ start_pass (j_compress_ptr cinfo, boolean gather_statistics)
if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
if (entropy->dc_stats[tbl] == NULL)
- entropy->dc_stats[tbl] = (unsigned char *) (*cinfo->mem->alloc_small)
- ((j_common_ptr) cinfo, JPOOL_IMAGE, DC_STAT_BINS);
+ entropy->dc_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
+ ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
MEMZERO(entropy->dc_stats[tbl], DC_STAT_BINS);
/* Initialize DC predictions to 0 */
entropy->last_dc_val[ci] = 0;
@@ -875,13 +878,14 @@ start_pass (j_compress_ptr cinfo, boolean gather_statistics)
if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
if (entropy->ac_stats[tbl] == NULL)
- entropy->ac_stats[tbl] = (unsigned char *) (*cinfo->mem->alloc_small)
- ((j_common_ptr) cinfo, JPOOL_IMAGE, AC_STAT_BINS);
+ entropy->ac_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
+ ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
MEMZERO(entropy->ac_stats[tbl], AC_STAT_BINS);
#ifdef CALCULATE_SPECTRAL_CONDITIONING
if (cinfo->progressive_mode)
/* Section G.1.3.2: Set appropriate arithmetic conditioning value Kx */
- cinfo->arith_ac_K[tbl] = cinfo->Ss + ((8 + cinfo->Se - cinfo->Ss) >> 4);
+ cinfo->arith_ac_K[tbl] = cinfo->Ss +
+ ((8 + cinfo->Se - cinfo->Ss) >> 4);
#endif
}
}
@@ -905,15 +909,15 @@ start_pass (j_compress_ptr cinfo, boolean gather_statistics)
*/
GLOBAL(void)
-jinit_arith_encoder (j_compress_ptr cinfo)
+jinit_arith_encoder(j_compress_ptr cinfo)
{
arith_entropy_ptr entropy;
int i;
entropy = (arith_entropy_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(arith_entropy_encoder));
- cinfo->entropy = (struct jpeg_entropy_encoder *) entropy;
+ cinfo->entropy = (struct jpeg_entropy_encoder *)entropy;
entropy->pub.start_pass = start_pass;
entropy->pub.finish_pass = finish_pass;
diff --git a/src/3rdparty/libjpeg/src/jccoefct.c b/src/3rdparty/libjpeg/src/jccoefct.c
index a08d6e3230..068232a527 100644
--- a/src/3rdparty/libjpeg/src/jccoefct.c
+++ b/src/3rdparty/libjpeg/src/jccoefct.c
@@ -58,21 +58,19 @@ typedef my_coef_controller *my_coef_ptr;
/* Forward declarations */
-METHODDEF(boolean) compress_data
- (j_compress_ptr cinfo, JSAMPIMAGE input_buf);
+METHODDEF(boolean) compress_data(j_compress_ptr cinfo, JSAMPIMAGE input_buf);
#ifdef FULL_COEF_BUFFER_SUPPORTED
-METHODDEF(boolean) compress_first_pass
- (j_compress_ptr cinfo, JSAMPIMAGE input_buf);
-METHODDEF(boolean) compress_output
- (j_compress_ptr cinfo, JSAMPIMAGE input_buf);
+METHODDEF(boolean) compress_first_pass(j_compress_ptr cinfo,
+ JSAMPIMAGE input_buf);
+METHODDEF(boolean) compress_output(j_compress_ptr cinfo, JSAMPIMAGE input_buf);
#endif
LOCAL(void)
-start_iMCU_row (j_compress_ptr cinfo)
+start_iMCU_row(j_compress_ptr cinfo)
/* Reset within-iMCU-row counters for a new row */
{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+ my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
/* In an interleaved scan, an MCU row is the same as an iMCU row.
* In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
@@ -81,7 +79,7 @@ start_iMCU_row (j_compress_ptr cinfo)
if (cinfo->comps_in_scan > 1) {
coef->MCU_rows_per_iMCU_row = 1;
} else {
- if (coef->iMCU_row_num < (cinfo->total_iMCU_rows-1))
+ if (coef->iMCU_row_num < (cinfo->total_iMCU_rows - 1))
coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
else
coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
@@ -97,9 +95,9 @@ start_iMCU_row (j_compress_ptr cinfo)
*/
METHODDEF(void)
-start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
+start_pass_coef(j_compress_ptr cinfo, J_BUF_MODE pass_mode)
{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+ my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
coef->iMCU_row_num = 0;
start_iMCU_row(cinfo);
@@ -140,9 +138,9 @@ start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
*/
METHODDEF(boolean)
-compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
+compress_data(j_compress_ptr cinfo, JSAMPIMAGE input_buf)
{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+ my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
JDIMENSION MCU_col_num; /* index of current MCU within row */
JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
@@ -167,31 +165,33 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
blkn = 0;
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
compptr = cinfo->cur_comp_info[ci];
- blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width
- : compptr->last_col_width;
+ blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width :
+ compptr->last_col_width;
xpos = MCU_col_num * compptr->MCU_sample_width;
ypos = yoffset * DCTSIZE; /* ypos == (yoffset+yindex) * DCTSIZE */
for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
if (coef->iMCU_row_num < last_iMCU_row ||
- yoffset+yindex < compptr->last_row_height) {
+ yoffset + yindex < compptr->last_row_height) {
(*cinfo->fdct->forward_DCT) (cinfo, compptr,
input_buf[compptr->component_index],
coef->MCU_buffer[blkn],
- ypos, xpos, (JDIMENSION) blockcnt);
+ ypos, xpos, (JDIMENSION)blockcnt);
if (blockcnt < compptr->MCU_width) {
/* Create some dummy blocks at the right edge of the image. */
- jzero_far((void *) coef->MCU_buffer[blkn + blockcnt],
+ jzero_far((void *)coef->MCU_buffer[blkn + blockcnt],
(compptr->MCU_width - blockcnt) * sizeof(JBLOCK));
for (bi = blockcnt; bi < compptr->MCU_width; bi++) {
- coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn+bi-1][0][0];
+ coef->MCU_buffer[blkn + bi][0][0] =
+ coef->MCU_buffer[blkn + bi - 1][0][0];
}
}
} else {
/* Create a row of dummy blocks at the bottom of the image. */
- jzero_far((void *) coef->MCU_buffer[blkn],
+ jzero_far((void *)coef->MCU_buffer[blkn],
compptr->MCU_width * sizeof(JBLOCK));
for (bi = 0; bi < compptr->MCU_width; bi++) {
- coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn-1][0][0];
+ coef->MCU_buffer[blkn + bi][0][0] =
+ coef->MCU_buffer[blkn - 1][0][0];
}
}
blkn += compptr->MCU_width;
@@ -201,7 +201,7 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
/* Try to write the MCU. In event of a suspension failure, we will
* re-DCT the MCU on restart (a bit inefficient, could be fixed...)
*/
- if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) {
+ if (!(*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) {
/* Suspension forced; update state counters and exit */
coef->MCU_vert_offset = yoffset;
coef->mcu_ctr = MCU_col_num;
@@ -242,9 +242,9 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
*/
METHODDEF(boolean)
-compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
+compress_first_pass(j_compress_ptr cinfo, JSAMPIMAGE input_buf)
{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+ my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
JDIMENSION blocks_across, MCUs_across, MCUindex;
int bi, ci, h_samp_factor, block_row, block_rows, ndummy;
@@ -257,21 +257,21 @@ compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
ci++, compptr++) {
/* Align the virtual buffer for this component. */
buffer = (*cinfo->mem->access_virt_barray)
- ((j_common_ptr) cinfo, coef->whole_image[ci],
+ ((j_common_ptr)cinfo, coef->whole_image[ci],
coef->iMCU_row_num * compptr->v_samp_factor,
- (JDIMENSION) compptr->v_samp_factor, TRUE);
+ (JDIMENSION)compptr->v_samp_factor, TRUE);
/* Count non-dummy DCT block rows in this iMCU row. */
if (coef->iMCU_row_num < last_iMCU_row)
block_rows = compptr->v_samp_factor;
else {
/* NB: can't use last_row_height here, since may not be set! */
- block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor);
+ block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
if (block_rows == 0) block_rows = compptr->v_samp_factor;
}
blocks_across = compptr->width_in_blocks;
h_samp_factor = compptr->h_samp_factor;
/* Count number of dummy blocks to be added at the right margin. */
- ndummy = (int) (blocks_across % h_samp_factor);
+ ndummy = (int)(blocks_across % h_samp_factor);
if (ndummy > 0)
ndummy = h_samp_factor - ndummy;
/* Perform DCT for all non-dummy blocks in this iMCU row. Each call
@@ -281,12 +281,12 @@ compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
thisblockrow = buffer[block_row];
(*cinfo->fdct->forward_DCT) (cinfo, compptr,
input_buf[ci], thisblockrow,
- (JDIMENSION) (block_row * DCTSIZE),
- (JDIMENSION) 0, blocks_across);
+ (JDIMENSION)(block_row * DCTSIZE),
+ (JDIMENSION)0, blocks_across);
if (ndummy > 0) {
/* Create dummy blocks at the right edge of the image. */
thisblockrow += blocks_across; /* => first dummy block */
- jzero_far((void *) thisblockrow, ndummy * sizeof(JBLOCK));
+ jzero_far((void *)thisblockrow, ndummy * sizeof(JBLOCK));
lastDC = thisblockrow[-1][0];
for (bi = 0; bi < ndummy; bi++) {
thisblockrow[bi][0] = lastDC;
@@ -304,11 +304,11 @@ compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
for (block_row = block_rows; block_row < compptr->v_samp_factor;
block_row++) {
thisblockrow = buffer[block_row];
- lastblockrow = buffer[block_row-1];
- jzero_far((void *) thisblockrow,
- (size_t) (blocks_across * sizeof(JBLOCK)));
+ lastblockrow = buffer[block_row - 1];
+ jzero_far((void *)thisblockrow,
+ (size_t)(blocks_across * sizeof(JBLOCK)));
for (MCUindex = 0; MCUindex < MCUs_across; MCUindex++) {
- lastDC = lastblockrow[h_samp_factor-1][0];
+ lastDC = lastblockrow[h_samp_factor - 1][0];
for (bi = 0; bi < h_samp_factor; bi++) {
thisblockrow[bi][0] = lastDC;
}
@@ -338,9 +338,9 @@ compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
*/
METHODDEF(boolean)
-compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
+compress_output(j_compress_ptr cinfo, JSAMPIMAGE input_buf)
{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+ my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
JDIMENSION MCU_col_num; /* index of current MCU within row */
int blkn, ci, xindex, yindex, yoffset;
JDIMENSION start_col;
@@ -355,9 +355,9 @@ compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
compptr = cinfo->cur_comp_info[ci];
buffer[ci] = (*cinfo->mem->access_virt_barray)
- ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index],
+ ((j_common_ptr)cinfo, coef->whole_image[compptr->component_index],
coef->iMCU_row_num * compptr->v_samp_factor,
- (JDIMENSION) compptr->v_samp_factor, FALSE);
+ (JDIMENSION)compptr->v_samp_factor, FALSE);
}
/* Loop to process one whole iMCU row */
@@ -371,14 +371,14 @@ compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
compptr = cinfo->cur_comp_info[ci];
start_col = MCU_col_num * compptr->MCU_width;
for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
- buffer_ptr = buffer[ci][yindex+yoffset] + start_col;
+ buffer_ptr = buffer[ci][yindex + yoffset] + start_col;
for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
coef->MCU_buffer[blkn++] = buffer_ptr++;
}
}
}
/* Try to write the MCU. */
- if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) {
+ if (!(*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) {
/* Suspension forced; update state counters and exit */
coef->MCU_vert_offset = yoffset;
coef->mcu_ctr = MCU_col_num;
@@ -402,14 +402,14 @@ compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
*/
GLOBAL(void)
-jinit_c_coef_controller (j_compress_ptr cinfo, boolean need_full_buffer)
+jinit_c_coef_controller(j_compress_ptr cinfo, boolean need_full_buffer)
{
my_coef_ptr coef;
coef = (my_coef_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(my_coef_controller));
- cinfo->coef = (struct jpeg_c_coef_controller *) coef;
+ cinfo->coef = (struct jpeg_c_coef_controller *)coef;
coef->pub.start_pass = start_pass_coef;
/* Create the coefficient buffer. */
@@ -423,12 +423,12 @@ jinit_c_coef_controller (j_compress_ptr cinfo, boolean need_full_buffer)
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) {
coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
- ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
- (JDIMENSION) jround_up((long) compptr->width_in_blocks,
- (long) compptr->h_samp_factor),
- (JDIMENSION) jround_up((long) compptr->height_in_blocks,
- (long) compptr->v_samp_factor),
- (JDIMENSION) compptr->v_samp_factor);
+ ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
+ (JDIMENSION)jround_up((long)compptr->width_in_blocks,
+ (long)compptr->h_samp_factor),
+ (JDIMENSION)jround_up((long)compptr->height_in_blocks,
+ (long)compptr->v_samp_factor),
+ (JDIMENSION)compptr->v_samp_factor);
}
#else
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
@@ -439,7 +439,7 @@ jinit_c_coef_controller (j_compress_ptr cinfo, boolean need_full_buffer)
int i;
buffer = (JBLOCKROW)
- (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
C_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) {
coef->MCU_buffer[i] = buffer + i;
diff --git a/src/3rdparty/libjpeg/src/jccolext.c b/src/3rdparty/libjpeg/src/jccolext.c
index 479b320446..19c955c9d6 100644
--- a/src/3rdparty/libjpeg/src/jccolext.c
+++ b/src/3rdparty/libjpeg/src/jccolext.c
@@ -29,13 +29,13 @@
INLINE
LOCAL(void)
-rgb_ycc_convert_internal (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
- JDIMENSION output_row, int num_rows)
+rgb_ycc_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf,
+ JSAMPIMAGE output_buf, JDIMENSION output_row,
+ int num_rows)
{
- my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
+ my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
register int r, g, b;
- register JLONG * ctab = cconvert->rgb_ycc_tab;
+ register JLONG *ctab = cconvert->rgb_ycc_tab;
register JSAMPROW inptr;
register JSAMPROW outptr0, outptr1, outptr2;
register JDIMENSION col;
@@ -58,17 +58,14 @@ rgb_ycc_convert_internal (j_compress_ptr cinfo,
* need the general RIGHT_SHIFT macro.
*/
/* Y */
- outptr0[col] = (JSAMPLE)
- ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
- >> SCALEBITS);
+ outptr0[col] = (JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
+ ctab[b + B_Y_OFF]) >> SCALEBITS);
/* Cb */
- outptr1[col] = (JSAMPLE)
- ((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF])
- >> SCALEBITS);
+ outptr1[col] = (JSAMPLE)((ctab[r + R_CB_OFF] + ctab[g + G_CB_OFF] +
+ ctab[b + B_CB_OFF]) >> SCALEBITS);
/* Cr */
- outptr2[col] = (JSAMPLE)
- ((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF])
- >> SCALEBITS);
+ outptr2[col] = (JSAMPLE)((ctab[r + R_CR_OFF] + ctab[g + G_CR_OFF] +
+ ctab[b + B_CR_OFF]) >> SCALEBITS);
}
}
}
@@ -86,13 +83,13 @@ rgb_ycc_convert_internal (j_compress_ptr cinfo,
INLINE
LOCAL(void)
-rgb_gray_convert_internal (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
- JDIMENSION output_row, int num_rows)
+rgb_gray_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf,
+ JSAMPIMAGE output_buf, JDIMENSION output_row,
+ int num_rows)
{
- my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
+ my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
register int r, g, b;
- register JLONG * ctab = cconvert->rgb_ycc_tab;
+ register JLONG *ctab = cconvert->rgb_ycc_tab;
register JSAMPROW inptr;
register JSAMPROW outptr;
register JDIMENSION col;
@@ -108,9 +105,8 @@ rgb_gray_convert_internal (j_compress_ptr cinfo,
b = GETJSAMPLE(inptr[RGB_BLUE]);
inptr += RGB_PIXELSIZE;
/* Y */
- outptr[col] = (JSAMPLE)
- ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
- >> SCALEBITS);
+ outptr[col] = (JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
+ ctab[b + B_Y_OFF]) >> SCALEBITS);
}
}
}
@@ -123,9 +119,9 @@ rgb_gray_convert_internal (j_compress_ptr cinfo,
INLINE
LOCAL(void)
-rgb_rgb_convert_internal (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
- JDIMENSION output_row, int num_rows)
+rgb_rgb_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf,
+ JSAMPIMAGE output_buf, JDIMENSION output_row,
+ int num_rows)
{
register JSAMPROW inptr;
register JSAMPROW outptr0, outptr1, outptr2;
diff --git a/src/3rdparty/libjpeg/src/jccolor.c b/src/3rdparty/libjpeg/src/jccolor.c
index b973d101d6..036f6016d1 100644
--- a/src/3rdparty/libjpeg/src/jccolor.c
+++ b/src/3rdparty/libjpeg/src/jccolor.c
@@ -63,9 +63,9 @@ typedef my_color_converter *my_cconvert_ptr;
*/
#define SCALEBITS 16 /* speediest right-shift on some machines */
-#define CBCR_OFFSET ((JLONG) CENTERJSAMPLE << SCALEBITS)
-#define ONE_HALF ((JLONG) 1 << (SCALEBITS-1))
-#define FIX(x) ((JLONG) ((x) * (1L<<SCALEBITS) + 0.5))
+#define CBCR_OFFSET ((JLONG)CENTERJSAMPLE << SCALEBITS)
+#define ONE_HALF ((JLONG)1 << (SCALEBITS - 1))
+#define FIX(x) ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
/* We allocate one big table and divide it up into eight parts, instead of
* doing eight alloc_small requests. This lets us use a single table base
@@ -74,15 +74,15 @@ typedef my_color_converter *my_cconvert_ptr;
*/
#define R_Y_OFF 0 /* offset to R => Y section */
-#define G_Y_OFF (1*(MAXJSAMPLE+1)) /* offset to G => Y section */
-#define B_Y_OFF (2*(MAXJSAMPLE+1)) /* etc. */
-#define R_CB_OFF (3*(MAXJSAMPLE+1))
-#define G_CB_OFF (4*(MAXJSAMPLE+1))
-#define B_CB_OFF (5*(MAXJSAMPLE+1))
+#define G_Y_OFF (1 * (MAXJSAMPLE + 1)) /* offset to G => Y section */
+#define B_Y_OFF (2 * (MAXJSAMPLE + 1)) /* etc. */
+#define R_CB_OFF (3 * (MAXJSAMPLE + 1))
+#define G_CB_OFF (4 * (MAXJSAMPLE + 1))
+#define B_CB_OFF (5 * (MAXJSAMPLE + 1))
#define R_CR_OFF B_CB_OFF /* B=>Cb, R=>Cr are the same */
-#define G_CR_OFF (6*(MAXJSAMPLE+1))
-#define B_CR_OFF (7*(MAXJSAMPLE+1))
-#define TABLE_SIZE (8*(MAXJSAMPLE+1))
+#define G_CR_OFF (6 * (MAXJSAMPLE + 1))
+#define B_CR_OFF (7 * (MAXJSAMPLE + 1))
+#define TABLE_SIZE (8 * (MAXJSAMPLE + 1))
/* Include inline routines for colorspace extensions */
@@ -93,13 +93,13 @@ typedef my_color_converter *my_cconvert_ptr;
#undef RGB_BLUE
#undef RGB_PIXELSIZE
-#define RGB_RED EXT_RGB_RED
-#define RGB_GREEN EXT_RGB_GREEN
-#define RGB_BLUE EXT_RGB_BLUE
-#define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
-#define rgb_ycc_convert_internal extrgb_ycc_convert_internal
-#define rgb_gray_convert_internal extrgb_gray_convert_internal
-#define rgb_rgb_convert_internal extrgb_rgb_convert_internal
+#define RGB_RED EXT_RGB_RED
+#define RGB_GREEN EXT_RGB_GREEN
+#define RGB_BLUE EXT_RGB_BLUE
+#define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
+#define rgb_ycc_convert_internal extrgb_ycc_convert_internal
+#define rgb_gray_convert_internal extrgb_gray_convert_internal
+#define rgb_rgb_convert_internal extrgb_rgb_convert_internal
#include "jccolext.c"
#undef RGB_RED
#undef RGB_GREEN
@@ -109,13 +109,13 @@ typedef my_color_converter *my_cconvert_ptr;
#undef rgb_gray_convert_internal
#undef rgb_rgb_convert_internal
-#define RGB_RED EXT_RGBX_RED
-#define RGB_GREEN EXT_RGBX_GREEN
-#define RGB_BLUE EXT_RGBX_BLUE
-#define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
-#define rgb_ycc_convert_internal extrgbx_ycc_convert_internal
-#define rgb_gray_convert_internal extrgbx_gray_convert_internal
-#define rgb_rgb_convert_internal extrgbx_rgb_convert_internal
+#define RGB_RED EXT_RGBX_RED
+#define RGB_GREEN EXT_RGBX_GREEN
+#define RGB_BLUE EXT_RGBX_BLUE
+#define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
+#define rgb_ycc_convert_internal extrgbx_ycc_convert_internal
+#define rgb_gray_convert_internal extrgbx_gray_convert_internal
+#define rgb_rgb_convert_internal extrgbx_rgb_convert_internal
#include "jccolext.c"
#undef RGB_RED
#undef RGB_GREEN
@@ -125,13 +125,13 @@ typedef my_color_converter *my_cconvert_ptr;
#undef rgb_gray_convert_internal
#undef rgb_rgb_convert_internal
-#define RGB_RED EXT_BGR_RED
-#define RGB_GREEN EXT_BGR_GREEN
-#define RGB_BLUE EXT_BGR_BLUE
-#define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
-#define rgb_ycc_convert_internal extbgr_ycc_convert_internal
-#define rgb_gray_convert_internal extbgr_gray_convert_internal
-#define rgb_rgb_convert_internal extbgr_rgb_convert_internal
+#define RGB_RED EXT_BGR_RED
+#define RGB_GREEN EXT_BGR_GREEN
+#define RGB_BLUE EXT_BGR_BLUE
+#define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
+#define rgb_ycc_convert_internal extbgr_ycc_convert_internal
+#define rgb_gray_convert_internal extbgr_gray_convert_internal
+#define rgb_rgb_convert_internal extbgr_rgb_convert_internal
#include "jccolext.c"
#undef RGB_RED
#undef RGB_GREEN
@@ -141,13 +141,13 @@ typedef my_color_converter *my_cconvert_ptr;
#undef rgb_gray_convert_internal
#undef rgb_rgb_convert_internal
-#define RGB_RED EXT_BGRX_RED
-#define RGB_GREEN EXT_BGRX_GREEN
-#define RGB_BLUE EXT_BGRX_BLUE
-#define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
-#define rgb_ycc_convert_internal extbgrx_ycc_convert_internal
-#define rgb_gray_convert_internal extbgrx_gray_convert_internal
-#define rgb_rgb_convert_internal extbgrx_rgb_convert_internal
+#define RGB_RED EXT_BGRX_RED
+#define RGB_GREEN EXT_BGRX_GREEN
+#define RGB_BLUE EXT_BGRX_BLUE
+#define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
+#define rgb_ycc_convert_internal extbgrx_ycc_convert_internal
+#define rgb_gray_convert_internal extbgrx_gray_convert_internal
+#define rgb_rgb_convert_internal extbgrx_rgb_convert_internal
#include "jccolext.c"
#undef RGB_RED
#undef RGB_GREEN
@@ -157,13 +157,13 @@ typedef my_color_converter *my_cconvert_ptr;
#undef rgb_gray_convert_internal
#undef rgb_rgb_convert_internal
-#define RGB_RED EXT_XBGR_RED
-#define RGB_GREEN EXT_XBGR_GREEN
-#define RGB_BLUE EXT_XBGR_BLUE
-#define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
-#define rgb_ycc_convert_internal extxbgr_ycc_convert_internal
-#define rgb_gray_convert_internal extxbgr_gray_convert_internal
-#define rgb_rgb_convert_internal extxbgr_rgb_convert_internal
+#define RGB_RED EXT_XBGR_RED
+#define RGB_GREEN EXT_XBGR_GREEN
+#define RGB_BLUE EXT_XBGR_BLUE
+#define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
+#define rgb_ycc_convert_internal extxbgr_ycc_convert_internal
+#define rgb_gray_convert_internal extxbgr_gray_convert_internal
+#define rgb_rgb_convert_internal extxbgr_rgb_convert_internal
#include "jccolext.c"
#undef RGB_RED
#undef RGB_GREEN
@@ -173,13 +173,13 @@ typedef my_color_converter *my_cconvert_ptr;
#undef rgb_gray_convert_internal
#undef rgb_rgb_convert_internal
-#define RGB_RED EXT_XRGB_RED
-#define RGB_GREEN EXT_XRGB_GREEN
-#define RGB_BLUE EXT_XRGB_BLUE
-#define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
-#define rgb_ycc_convert_internal extxrgb_ycc_convert_internal
-#define rgb_gray_convert_internal extxrgb_gray_convert_internal
-#define rgb_rgb_convert_internal extxrgb_rgb_convert_internal
+#define RGB_RED EXT_XRGB_RED
+#define RGB_GREEN EXT_XRGB_GREEN
+#define RGB_BLUE EXT_XRGB_BLUE
+#define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
+#define rgb_ycc_convert_internal extxrgb_ycc_convert_internal
+#define rgb_gray_convert_internal extxrgb_gray_convert_internal
+#define rgb_rgb_convert_internal extxrgb_rgb_convert_internal
#include "jccolext.c"
#undef RGB_RED
#undef RGB_GREEN
@@ -195,33 +195,33 @@ typedef my_color_converter *my_cconvert_ptr;
*/
METHODDEF(void)
-rgb_ycc_start (j_compress_ptr cinfo)
+rgb_ycc_start(j_compress_ptr cinfo)
{
- my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
+ my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
JLONG *rgb_ycc_tab;
JLONG i;
/* Allocate and fill in the conversion tables. */
cconvert->rgb_ycc_tab = rgb_ycc_tab = (JLONG *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
(TABLE_SIZE * sizeof(JLONG)));
for (i = 0; i <= MAXJSAMPLE; i++) {
- rgb_ycc_tab[i+R_Y_OFF] = FIX(0.29900) * i;
- rgb_ycc_tab[i+G_Y_OFF] = FIX(0.58700) * i;
- rgb_ycc_tab[i+B_Y_OFF] = FIX(0.11400) * i + ONE_HALF;
- rgb_ycc_tab[i+R_CB_OFF] = (-FIX(0.16874)) * i;
- rgb_ycc_tab[i+G_CB_OFF] = (-FIX(0.33126)) * i;
+ rgb_ycc_tab[i + R_Y_OFF] = FIX(0.29900) * i;
+ rgb_ycc_tab[i + G_Y_OFF] = FIX(0.58700) * i;
+ rgb_ycc_tab[i + B_Y_OFF] = FIX(0.11400) * i + ONE_HALF;
+ rgb_ycc_tab[i + R_CB_OFF] = (-FIX(0.16874)) * i;
+ rgb_ycc_tab[i + G_CB_OFF] = (-FIX(0.33126)) * i;
/* We use a rounding fudge-factor of 0.5-epsilon for Cb and Cr.
* This ensures that the maximum output will round to MAXJSAMPLE
* not MAXJSAMPLE+1, and thus that we don't have to range-limit.
*/
- rgb_ycc_tab[i+B_CB_OFF] = FIX(0.50000) * i + CBCR_OFFSET + ONE_HALF-1;
+ rgb_ycc_tab[i + B_CB_OFF] = FIX(0.50000) * i + CBCR_OFFSET + ONE_HALF - 1;
/* B=>Cb and R=>Cr tables are the same
- rgb_ycc_tab[i+R_CR_OFF] = FIX(0.50000) * i + CBCR_OFFSET + ONE_HALF-1;
+ rgb_ycc_tab[i + R_CR_OFF] = FIX(0.50000) * i + CBCR_OFFSET + ONE_HALF - 1;
*/
- rgb_ycc_tab[i+G_CR_OFF] = (-FIX(0.41869)) * i;
- rgb_ycc_tab[i+B_CR_OFF] = (-FIX(0.08131)) * i;
+ rgb_ycc_tab[i + G_CR_OFF] = (-FIX(0.41869)) * i;
+ rgb_ycc_tab[i + B_CR_OFF] = (-FIX(0.08131)) * i;
}
}
@@ -231,43 +231,42 @@ rgb_ycc_start (j_compress_ptr cinfo)
*/
METHODDEF(void)
-rgb_ycc_convert (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
- JDIMENSION output_row, int num_rows)
+rgb_ycc_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
+ JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
{
switch (cinfo->in_color_space) {
- case JCS_EXT_RGB:
- extrgb_ycc_convert_internal(cinfo, input_buf, output_buf, output_row,
- num_rows);
- break;
- case JCS_EXT_RGBX:
- case JCS_EXT_RGBA:
- extrgbx_ycc_convert_internal(cinfo, input_buf, output_buf, output_row,
- num_rows);
- break;
- case JCS_EXT_BGR:
- extbgr_ycc_convert_internal(cinfo, input_buf, output_buf, output_row,
- num_rows);
- break;
- case JCS_EXT_BGRX:
- case JCS_EXT_BGRA:
- extbgrx_ycc_convert_internal(cinfo, input_buf, output_buf, output_row,
- num_rows);
- break;
- case JCS_EXT_XBGR:
- case JCS_EXT_ABGR:
- extxbgr_ycc_convert_internal(cinfo, input_buf, output_buf, output_row,
- num_rows);
- break;
- case JCS_EXT_XRGB:
- case JCS_EXT_ARGB:
- extxrgb_ycc_convert_internal(cinfo, input_buf, output_buf, output_row,
- num_rows);
- break;
- default:
- rgb_ycc_convert_internal(cinfo, input_buf, output_buf, output_row,
- num_rows);
- break;
+ case JCS_EXT_RGB:
+ extrgb_ycc_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ case JCS_EXT_RGBX:
+ case JCS_EXT_RGBA:
+ extrgbx_ycc_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ case JCS_EXT_BGR:
+ extbgr_ycc_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ case JCS_EXT_BGRX:
+ case JCS_EXT_BGRA:
+ extbgrx_ycc_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ case JCS_EXT_XBGR:
+ case JCS_EXT_ABGR:
+ extxbgr_ycc_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ case JCS_EXT_XRGB:
+ case JCS_EXT_ARGB:
+ extxrgb_ycc_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ default:
+ rgb_ycc_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
}
}
@@ -280,43 +279,42 @@ rgb_ycc_convert (j_compress_ptr cinfo,
*/
METHODDEF(void)
-rgb_gray_convert (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
- JDIMENSION output_row, int num_rows)
+rgb_gray_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
+ JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
{
switch (cinfo->in_color_space) {
- case JCS_EXT_RGB:
- extrgb_gray_convert_internal(cinfo, input_buf, output_buf, output_row,
- num_rows);
- break;
- case JCS_EXT_RGBX:
- case JCS_EXT_RGBA:
- extrgbx_gray_convert_internal(cinfo, input_buf, output_buf, output_row,
- num_rows);
- break;
- case JCS_EXT_BGR:
- extbgr_gray_convert_internal(cinfo, input_buf, output_buf, output_row,
- num_rows);
- break;
- case JCS_EXT_BGRX:
- case JCS_EXT_BGRA:
- extbgrx_gray_convert_internal(cinfo, input_buf, output_buf, output_row,
- num_rows);
- break;
- case JCS_EXT_XBGR:
- case JCS_EXT_ABGR:
- extxbgr_gray_convert_internal(cinfo, input_buf, output_buf, output_row,
- num_rows);
- break;
- case JCS_EXT_XRGB:
- case JCS_EXT_ARGB:
- extxrgb_gray_convert_internal(cinfo, input_buf, output_buf, output_row,
- num_rows);
- break;
- default:
- rgb_gray_convert_internal(cinfo, input_buf, output_buf, output_row,
- num_rows);
- break;
+ case JCS_EXT_RGB:
+ extrgb_gray_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ case JCS_EXT_RGBX:
+ case JCS_EXT_RGBA:
+ extrgbx_gray_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ case JCS_EXT_BGR:
+ extbgr_gray_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ case JCS_EXT_BGRX:
+ case JCS_EXT_BGRA:
+ extbgrx_gray_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ case JCS_EXT_XBGR:
+ case JCS_EXT_ABGR:
+ extxbgr_gray_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ case JCS_EXT_XRGB:
+ case JCS_EXT_ARGB:
+ extxrgb_gray_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ default:
+ rgb_gray_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
}
}
@@ -326,43 +324,42 @@ rgb_gray_convert (j_compress_ptr cinfo,
*/
METHODDEF(void)
-rgb_rgb_convert (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
- JDIMENSION output_row, int num_rows)
+rgb_rgb_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
+ JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
{
switch (cinfo->in_color_space) {
- case JCS_EXT_RGB:
- extrgb_rgb_convert_internal(cinfo, input_buf, output_buf, output_row,
- num_rows);
- break;
- case JCS_EXT_RGBX:
- case JCS_EXT_RGBA:
- extrgbx_rgb_convert_internal(cinfo, input_buf, output_buf, output_row,
- num_rows);
- break;
- case JCS_EXT_BGR:
- extbgr_rgb_convert_internal(cinfo, input_buf, output_buf, output_row,
- num_rows);
- break;
- case JCS_EXT_BGRX:
- case JCS_EXT_BGRA:
- extbgrx_rgb_convert_internal(cinfo, input_buf, output_buf, output_row,
- num_rows);
- break;
- case JCS_EXT_XBGR:
- case JCS_EXT_ABGR:
- extxbgr_rgb_convert_internal(cinfo, input_buf, output_buf, output_row,
- num_rows);
- break;
- case JCS_EXT_XRGB:
- case JCS_EXT_ARGB:
- extxrgb_rgb_convert_internal(cinfo, input_buf, output_buf, output_row,
- num_rows);
- break;
- default:
- rgb_rgb_convert_internal(cinfo, input_buf, output_buf, output_row,
- num_rows);
- break;
+ case JCS_EXT_RGB:
+ extrgb_rgb_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ case JCS_EXT_RGBX:
+ case JCS_EXT_RGBA:
+ extrgbx_rgb_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ case JCS_EXT_BGR:
+ extbgr_rgb_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ case JCS_EXT_BGRX:
+ case JCS_EXT_BGRA:
+ extbgrx_rgb_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ case JCS_EXT_XBGR:
+ case JCS_EXT_ABGR:
+ extxbgr_rgb_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ case JCS_EXT_XRGB:
+ case JCS_EXT_ARGB:
+ extxrgb_rgb_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ default:
+ rgb_rgb_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
}
}
@@ -376,11 +373,10 @@ rgb_rgb_convert (j_compress_ptr cinfo,
*/
METHODDEF(void)
-cmyk_ycck_convert (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
- JDIMENSION output_row, int num_rows)
+cmyk_ycck_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
+ JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
{
- my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
+ my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
register int r, g, b;
register JLONG *ctab = cconvert->rgb_ycc_tab;
register JSAMPROW inptr;
@@ -408,17 +404,14 @@ cmyk_ycck_convert (j_compress_ptr cinfo,
* need the general RIGHT_SHIFT macro.
*/
/* Y */
- outptr0[col] = (JSAMPLE)
- ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
- >> SCALEBITS);
+ outptr0[col] = (JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
+ ctab[b + B_Y_OFF]) >> SCALEBITS);
/* Cb */
- outptr1[col] = (JSAMPLE)
- ((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF])
- >> SCALEBITS);
+ outptr1[col] = (JSAMPLE)((ctab[r + R_CB_OFF] + ctab[g + G_CB_OFF] +
+ ctab[b + B_CB_OFF]) >> SCALEBITS);
/* Cr */
- outptr2[col] = (JSAMPLE)
- ((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF])
- >> SCALEBITS);
+ outptr2[col] = (JSAMPLE)((ctab[r + R_CR_OFF] + ctab[g + G_CR_OFF] +
+ ctab[b + B_CR_OFF]) >> SCALEBITS);
}
}
}
@@ -431,9 +424,8 @@ cmyk_ycck_convert (j_compress_ptr cinfo,
*/
METHODDEF(void)
-grayscale_convert (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
- JDIMENSION output_row, int num_rows)
+grayscale_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
+ JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
{
register JSAMPROW inptr;
register JSAMPROW outptr;
@@ -460,9 +452,8 @@ grayscale_convert (j_compress_ptr cinfo,
*/
METHODDEF(void)
-null_convert (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
- JDIMENSION output_row, int num_rows)
+null_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows)
{
register JSAMPROW inptr;
register JSAMPROW outptr, outptr0, outptr1, outptr2, outptr3;
@@ -522,7 +513,7 @@ null_convert (j_compress_ptr cinfo,
*/
METHODDEF(void)
-null_method (j_compress_ptr cinfo)
+null_method(j_compress_ptr cinfo)
{
/* no work needed */
}
@@ -533,14 +524,14 @@ null_method (j_compress_ptr cinfo)
*/
GLOBAL(void)
-jinit_color_converter (j_compress_ptr cinfo)
+jinit_color_converter(j_compress_ptr cinfo)
{
my_cconvert_ptr cconvert;
cconvert = (my_cconvert_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(my_color_converter));
- cinfo->cconvert = (struct jpeg_color_converter *) cconvert;
+ cinfo->cconvert = (struct jpeg_color_converter *)cconvert;
/* set start_pass to null method until we find out differently */
cconvert->pub.start_pass = null_method;
diff --git a/src/3rdparty/libjpeg/src/jcdctmgr.c b/src/3rdparty/libjpeg/src/jcdctmgr.c
index 6e3b19bcb3..c04058e6ce 100644
--- a/src/3rdparty/libjpeg/src/jcdctmgr.c
+++ b/src/3rdparty/libjpeg/src/jcdctmgr.c
@@ -41,7 +41,7 @@ typedef void (*float_quantize_method_ptr) (JCOEFPTR coef_block,
FAST_FLOAT *divisors,
FAST_FLOAT *workspace);
-METHODDEF(void) quantize (JCOEFPTR, DCTELEM *, DCTELEM *);
+METHODDEF(void) quantize(JCOEFPTR, DCTELEM *, DCTELEM *);
typedef struct {
struct jpeg_forward_dct pub; /* public fields */
@@ -80,7 +80,7 @@ typedef my_fdct_controller *my_fdct_ptr;
*/
LOCAL(int)
-flss (UINT16 val)
+flss(UINT16 val)
{
int bit;
@@ -170,7 +170,7 @@ flss (UINT16 val)
*/
LOCAL(int)
-compute_reciprocal (UINT16 divisor, DCTELEM *dtbl)
+compute_reciprocal(UINT16 divisor, DCTELEM *dtbl)
{
UDCTELEM2 fq, fr;
UDCTELEM c;
@@ -182,10 +182,10 @@ compute_reciprocal (UINT16 divisor, DCTELEM *dtbl)
* identity function. Since only the C quantization algorithm is used in
* these cases, the scale value is irrelevant.
*/
- dtbl[DCTSIZE2 * 0] = (DCTELEM) 1; /* reciprocal */
- dtbl[DCTSIZE2 * 1] = (DCTELEM) 0; /* correction */
- dtbl[DCTSIZE2 * 2] = (DCTELEM) 1; /* scale */
- dtbl[DCTSIZE2 * 3] = -(DCTELEM) (sizeof(DCTELEM) * 8); /* shift */
+ dtbl[DCTSIZE2 * 0] = (DCTELEM)1; /* reciprocal */
+ dtbl[DCTSIZE2 * 1] = (DCTELEM)0; /* correction */
+ dtbl[DCTSIZE2 * 2] = (DCTELEM)1; /* scale */
+ dtbl[DCTSIZE2 * 3] = -(DCTELEM)(sizeof(DCTELEM) * 8); /* shift */
return 0;
}
@@ -195,26 +195,26 @@ compute_reciprocal (UINT16 divisor, DCTELEM *dtbl)
fq = ((UDCTELEM2)1 << r) / divisor;
fr = ((UDCTELEM2)1 << r) % divisor;
- c = divisor / 2; /* for rounding */
+ c = divisor / 2; /* for rounding */
- if (fr == 0) { /* divisor is power of two */
+ if (fr == 0) { /* divisor is power of two */
/* fq will be one bit too large to fit in DCTELEM, so adjust */
fq >>= 1;
r--;
- } else if (fr <= (divisor / 2U)) { /* fractional part is < 0.5 */
+ } else if (fr <= (divisor / 2U)) { /* fractional part is < 0.5 */
c++;
- } else { /* fractional part is > 0.5 */
+ } else { /* fractional part is > 0.5 */
fq++;
}
- dtbl[DCTSIZE2 * 0] = (DCTELEM) fq; /* reciprocal */
- dtbl[DCTSIZE2 * 1] = (DCTELEM) c; /* correction + roundfactor */
+ dtbl[DCTSIZE2 * 0] = (DCTELEM)fq; /* reciprocal */
+ dtbl[DCTSIZE2 * 1] = (DCTELEM)c; /* correction + roundfactor */
#ifdef WITH_SIMD
- dtbl[DCTSIZE2 * 2] = (DCTELEM) (1 << (sizeof(DCTELEM)*8*2 - r)); /* scale */
+ dtbl[DCTSIZE2 * 2] = (DCTELEM)(1 << (sizeof(DCTELEM) * 8 * 2 - r)); /* scale */
#else
dtbl[DCTSIZE2 * 2] = 1;
#endif
- dtbl[DCTSIZE2 * 3] = (DCTELEM) r - sizeof(DCTELEM)*8; /* shift */
+ dtbl[DCTSIZE2 * 3] = (DCTELEM)r - sizeof(DCTELEM) * 8; /* shift */
if (r <= 16) return 0;
else return 1;
@@ -233,9 +233,9 @@ compute_reciprocal (UINT16 divisor, DCTELEM *dtbl)
*/
METHODDEF(void)
-start_pass_fdctmgr (j_compress_ptr cinfo)
+start_pass_fdctmgr(j_compress_ptr cinfo)
{
- my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;
+ my_fdct_ptr fdct = (my_fdct_ptr)cinfo->fdct;
int ci, qtblno, i;
jpeg_component_info *compptr;
JQUANT_TBL *qtbl;
@@ -259,7 +259,7 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
*/
if (fdct->divisors[qtblno] == NULL) {
fdct->divisors[qtblno] = (DCTELEM *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
(DCTSIZE2 * 4) * sizeof(DCTELEM));
}
dtbl = fdct->divisors[qtblno];
@@ -269,7 +269,7 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
fdct->quantize == jsimd_quantize)
fdct->quantize = quantize;
#else
- dtbl[i] = ((DCTELEM) qtbl->quantval[i]) << 3;
+ dtbl[i] = ((DCTELEM)qtbl->quantval[i]) << 3;
#endif
}
break;
@@ -283,7 +283,7 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
* scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7
* We apply a further scale factor of 8.
*/
-#define CONST_BITS 14
+#define CONST_BITS 14
static const INT16 aanscales[DCTSIZE2] = {
/* precomputed values scaled up by 14 bits */
16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520,
@@ -299,23 +299,23 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
if (fdct->divisors[qtblno] == NULL) {
fdct->divisors[qtblno] = (DCTELEM *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
(DCTSIZE2 * 4) * sizeof(DCTELEM));
}
dtbl = fdct->divisors[qtblno];
for (i = 0; i < DCTSIZE2; i++) {
#if BITS_IN_JSAMPLE == 8
if (!compute_reciprocal(
- DESCALE(MULTIPLY16V16((JLONG) qtbl->quantval[i],
- (JLONG) aanscales[i]),
- CONST_BITS-3), &dtbl[i]) &&
+ DESCALE(MULTIPLY16V16((JLONG)qtbl->quantval[i],
+ (JLONG)aanscales[i]),
+ CONST_BITS - 3), &dtbl[i]) &&
fdct->quantize == jsimd_quantize)
fdct->quantize = quantize;
#else
- dtbl[i] = (DCTELEM)
- DESCALE(MULTIPLY16V16((JLONG) qtbl->quantval[i],
- (JLONG) aanscales[i]),
- CONST_BITS-3);
+ dtbl[i] = (DCTELEM)
+ DESCALE(MULTIPLY16V16((JLONG)qtbl->quantval[i],
+ (JLONG)aanscales[i]),
+ CONST_BITS - 3);
#endif
}
}
@@ -341,7 +341,7 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
if (fdct->float_divisors[qtblno] == NULL) {
fdct->float_divisors[qtblno] = (FAST_FLOAT *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
DCTSIZE2 * sizeof(FAST_FLOAT));
}
fdtbl = fdct->float_divisors[qtblno];
@@ -349,7 +349,7 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
for (row = 0; row < DCTSIZE; row++) {
for (col = 0; col < DCTSIZE; col++) {
fdtbl[i] = (FAST_FLOAT)
- (1.0 / (((double) qtbl->quantval[i] *
+ (1.0 / (((double)qtbl->quantval[i] *
aanscalefactor[row] * aanscalefactor[col] * 8.0)));
i++;
}
@@ -370,7 +370,7 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
*/
METHODDEF(void)
-convsamp (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM *workspace)
+convsamp(JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM *workspace)
{
register DCTELEM *workspaceptr;
register JSAMPROW elemptr;
@@ -405,7 +405,7 @@ convsamp (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM *workspace)
*/
METHODDEF(void)
-quantize (JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace)
+quantize(JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace)
{
int i;
DCTELEM temp;
@@ -426,15 +426,15 @@ quantize (JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace)
if (temp < 0) {
temp = -temp;
product = (UDCTELEM2)(temp + corr) * recip;
- product >>= shift + sizeof(DCTELEM)*8;
+ product >>= shift + sizeof(DCTELEM) * 8;
temp = (DCTELEM)product;
temp = -temp;
} else {
product = (UDCTELEM2)(temp + corr) * recip;
- product >>= shift + sizeof(DCTELEM)*8;
+ product >>= shift + sizeof(DCTELEM) * 8;
temp = (DCTELEM)product;
}
- output_ptr[i] = (JCOEF) temp;
+ output_ptr[i] = (JCOEF)temp;
}
#else
@@ -457,20 +457,20 @@ quantize (JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace)
* If your machine's division is fast enough, define FAST_DIVIDE.
*/
#ifdef FAST_DIVIDE
-#define DIVIDE_BY(a,b) a /= b
+#define DIVIDE_BY(a, b) a /= b
#else
-#define DIVIDE_BY(a,b) if (a >= b) a /= b; else a = 0
+#define DIVIDE_BY(a, b) if (a >= b) a /= b; else a = 0
#endif
if (temp < 0) {
temp = -temp;
- temp += qval>>1; /* for rounding */
+ temp += qval >> 1; /* for rounding */
DIVIDE_BY(temp, qval);
temp = -temp;
} else {
- temp += qval>>1; /* for rounding */
+ temp += qval >> 1; /* for rounding */
DIVIDE_BY(temp, qval);
}
- output_ptr[i] = (JCOEF) temp;
+ output_ptr[i] = (JCOEF)temp;
}
#endif
@@ -487,14 +487,13 @@ quantize (JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace)
*/
METHODDEF(void)
-forward_DCT (j_compress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
- JDIMENSION start_row, JDIMENSION start_col,
- JDIMENSION num_blocks)
+forward_DCT(j_compress_ptr cinfo, jpeg_component_info *compptr,
+ JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
+ JDIMENSION start_row, JDIMENSION start_col, JDIMENSION num_blocks)
/* This version is used for integer DCT implementations. */
{
/* This routine is heavily used, so it's worth coding it tightly. */
- my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;
+ my_fdct_ptr fdct = (my_fdct_ptr)cinfo->fdct;
DCTELEM *divisors = fdct->divisors[compptr->quant_tbl_no];
DCTELEM *workspace;
JDIMENSION bi;
@@ -522,9 +521,9 @@ forward_DCT (j_compress_ptr cinfo, jpeg_component_info *compptr,
#ifdef DCT_FLOAT_SUPPORTED
-
METHODDEF(void)
-convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT *workspace)
+convsamp_float(JSAMPARRAY sample_data, JDIMENSION start_col,
+ FAST_FLOAT *workspace)
{
register FAST_FLOAT *workspaceptr;
register JSAMPROW elemptr;
@@ -555,7 +554,8 @@ convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT *worksp
METHODDEF(void)
-quantize_float (JCOEFPTR coef_block, FAST_FLOAT *divisors, FAST_FLOAT *workspace)
+quantize_float(JCOEFPTR coef_block, FAST_FLOAT *divisors,
+ FAST_FLOAT *workspace)
{
register FAST_FLOAT temp;
register int i;
@@ -571,20 +571,20 @@ quantize_float (JCOEFPTR coef_block, FAST_FLOAT *divisors, FAST_FLOAT *workspace
* The maximum coefficient size is +-16K (for 12-bit data), so this
* code should work for either 16-bit or 32-bit ints.
*/
- output_ptr[i] = (JCOEF) ((int) (temp + (FAST_FLOAT) 16384.5) - 16384);
+ output_ptr[i] = (JCOEF)((int)(temp + (FAST_FLOAT)16384.5) - 16384);
}
}
METHODDEF(void)
-forward_DCT_float (j_compress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
- JDIMENSION start_row, JDIMENSION start_col,
- JDIMENSION num_blocks)
+forward_DCT_float(j_compress_ptr cinfo, jpeg_component_info *compptr,
+ JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
+ JDIMENSION start_row, JDIMENSION start_col,
+ JDIMENSION num_blocks)
/* This version is used for floating-point DCT implementations. */
{
/* This routine is heavily used, so it's worth coding it tightly. */
- my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;
+ my_fdct_ptr fdct = (my_fdct_ptr)cinfo->fdct;
FAST_FLOAT *divisors = fdct->float_divisors[compptr->quant_tbl_no];
FAST_FLOAT *workspace;
JDIMENSION bi;
@@ -618,15 +618,15 @@ forward_DCT_float (j_compress_ptr cinfo, jpeg_component_info *compptr,
*/
GLOBAL(void)
-jinit_forward_dct (j_compress_ptr cinfo)
+jinit_forward_dct(j_compress_ptr cinfo)
{
my_fdct_ptr fdct;
int i;
fdct = (my_fdct_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(my_fdct_controller));
- cinfo->fdct = (struct jpeg_forward_dct *) fdct;
+ cinfo->fdct = (struct jpeg_forward_dct *)fdct;
fdct->pub.start_pass = start_pass_fdctmgr;
/* First determine the DCT... */
@@ -703,12 +703,12 @@ jinit_forward_dct (j_compress_ptr cinfo)
#ifdef DCT_FLOAT_SUPPORTED
if (cinfo->dct_method == JDCT_FLOAT)
fdct->float_workspace = (FAST_FLOAT *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(FAST_FLOAT) * DCTSIZE2);
else
#endif
fdct->workspace = (DCTELEM *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(DCTELEM) * DCTSIZE2);
/* Mark divisor tables unallocated */
diff --git a/src/3rdparty/libjpeg/src/jchuff.c b/src/3rdparty/libjpeg/src/jchuff.c
index fffaacebce..939b3e76a1 100644
--- a/src/3rdparty/libjpeg/src/jchuff.c
+++ b/src/3rdparty/libjpeg/src/jchuff.c
@@ -4,7 +4,7 @@
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1991-1997, Thomas G. Lane.
* libjpeg-turbo Modifications:
- * Copyright (C) 2009-2011, 2014-2016, D. R. Commander.
+ * Copyright (C) 2009-2011, 2014-2016, 2018, D. R. Commander.
* Copyright (C) 2015, Matthieu Darbois.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
@@ -16,6 +16,9 @@
* back up to the start of the current MCU. To do this, we copy state
* variables into local working storage, and update them back to the
* permanent JPEG objects only upon successful completion of an MCU.
+ *
+ * NOTE: All referenced figures are from
+ * Recommendation ITU-T T.81 (1992) | ISO/IEC 10918-1:1994.
*/
#define JPEG_INTERNALS
@@ -47,16 +50,12 @@
#endif
#ifdef USE_CLZ_INTRINSIC
-#define JPEG_NBITS_NONZERO(x) (32 - __builtin_clz(x))
-#define JPEG_NBITS(x) (x ? JPEG_NBITS_NONZERO(x) : 0)
+#define JPEG_NBITS_NONZERO(x) (32 - __builtin_clz(x))
+#define JPEG_NBITS(x) (x ? JPEG_NBITS_NONZERO(x) : 0)
#else
#include "jpeg_nbits_table.h"
-#define JPEG_NBITS(x) (jpeg_nbits_table[x])
-#define JPEG_NBITS_NONZERO(x) JPEG_NBITS(x)
-#endif
-
-#ifndef min
- #define min(a,b) ((a)<(b)?(a):(b))
+#define JPEG_NBITS(x) (jpeg_nbits_table[x])
+#define JPEG_NBITS_NONZERO(x) JPEG_NBITS(x)
#endif
@@ -67,9 +66,9 @@
*/
typedef struct {
- size_t put_buffer; /* current bit-accumulation buffer */
- int put_bits; /* # of bits now in it */
- int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */
+ size_t put_buffer; /* current bit-accumulation buffer */
+ int put_bits; /* # of bits now in it */
+ int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */
} savable_state;
/* This macro is to work around compilers with missing or broken
@@ -78,16 +77,16 @@ typedef struct {
*/
#ifndef NO_STRUCT_ASSIGN
-#define ASSIGN_STATE(dest,src) ((dest) = (src))
+#define ASSIGN_STATE(dest, src) ((dest) = (src))
#else
#if MAX_COMPS_IN_SCAN == 4
-#define ASSIGN_STATE(dest,src) \
- ((dest).put_buffer = (src).put_buffer, \
- (dest).put_bits = (src).put_bits, \
- (dest).last_dc_val[0] = (src).last_dc_val[0], \
- (dest).last_dc_val[1] = (src).last_dc_val[1], \
- (dest).last_dc_val[2] = (src).last_dc_val[2], \
- (dest).last_dc_val[3] = (src).last_dc_val[3])
+#define ASSIGN_STATE(dest, src) \
+ ((dest).put_buffer = (src).put_buffer, \
+ (dest).put_bits = (src).put_bits, \
+ (dest).last_dc_val[0] = (src).last_dc_val[0], \
+ (dest).last_dc_val[1] = (src).last_dc_val[1], \
+ (dest).last_dc_val[2] = (src).last_dc_val[2], \
+ (dest).last_dc_val[3] = (src).last_dc_val[3])
#endif
#endif
@@ -128,12 +127,12 @@ typedef struct {
/* Forward declarations */
-METHODDEF(boolean) encode_mcu_huff (j_compress_ptr cinfo, JBLOCKROW *MCU_data);
-METHODDEF(void) finish_pass_huff (j_compress_ptr cinfo);
+METHODDEF(boolean) encode_mcu_huff(j_compress_ptr cinfo, JBLOCKROW *MCU_data);
+METHODDEF(void) finish_pass_huff(j_compress_ptr cinfo);
#ifdef ENTROPY_OPT_SUPPORTED
-METHODDEF(boolean) encode_mcu_gather (j_compress_ptr cinfo,
- JBLOCKROW *MCU_data);
-METHODDEF(void) finish_pass_gather (j_compress_ptr cinfo);
+METHODDEF(boolean) encode_mcu_gather(j_compress_ptr cinfo,
+ JBLOCKROW *MCU_data);
+METHODDEF(void) finish_pass_gather(j_compress_ptr cinfo);
#endif
@@ -144,9 +143,9 @@ METHODDEF(void) finish_pass_gather (j_compress_ptr cinfo);
*/
METHODDEF(void)
-start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics)
+start_pass_huff(j_compress_ptr cinfo, boolean gather_statistics)
{
- huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
+ huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
int ci, dctbl, actbl;
jpeg_component_info *compptr;
@@ -180,12 +179,12 @@ start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics)
/* Note that jpeg_gen_optimal_table expects 257 entries in each table! */
if (entropy->dc_count_ptrs[dctbl] == NULL)
entropy->dc_count_ptrs[dctbl] = (long *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
257 * sizeof(long));
MEMZERO(entropy->dc_count_ptrs[dctbl], 257 * sizeof(long));
if (entropy->ac_count_ptrs[actbl] == NULL)
entropy->ac_count_ptrs[actbl] = (long *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
257 * sizeof(long));
MEMZERO(entropy->ac_count_ptrs[actbl], 257 * sizeof(long));
#endif
@@ -193,9 +192,9 @@ start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics)
/* Compute derived values for Huffman tables */
/* We may do this more than once for a table, but it's not expensive */
jpeg_make_c_derived_tbl(cinfo, TRUE, dctbl,
- & entropy->dc_derived_tbls[dctbl]);
+ &entropy->dc_derived_tbls[dctbl]);
jpeg_make_c_derived_tbl(cinfo, FALSE, actbl,
- & entropy->ac_derived_tbls[actbl]);
+ &entropy->ac_derived_tbls[actbl]);
}
/* Initialize DC predictions to 0 */
entropy->saved.last_dc_val[ci] = 0;
@@ -219,8 +218,8 @@ start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics)
*/
GLOBAL(void)
-jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno,
- c_derived_tbl **pdtbl)
+jpeg_make_c_derived_tbl(j_compress_ptr cinfo, boolean isDC, int tblno,
+ c_derived_tbl **pdtbl)
{
JHUFF_TBL *htbl;
c_derived_tbl *dtbl;
@@ -244,7 +243,7 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno,
/* Allocate a workspace if we haven't already done so. */
if (*pdtbl == NULL)
*pdtbl = (c_derived_tbl *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(c_derived_tbl));
dtbl = *pdtbl;
@@ -252,11 +251,11 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno,
p = 0;
for (l = 1; l <= 16; l++) {
- i = (int) htbl->bits[l];
+ i = (int)htbl->bits[l];
if (i < 0 || p + i > 256) /* protect against table overrun */
ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
while (i--)
- huffsize[p++] = (char) l;
+ huffsize[p++] = (char)l;
}
huffsize[p] = 0;
lastp = p;
@@ -268,14 +267,14 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno,
si = huffsize[0];
p = 0;
while (huffsize[p]) {
- while (((int) huffsize[p]) == si) {
+ while (((int)huffsize[p]) == si) {
huffcode[p++] = code;
code++;
}
/* code is now 1 more than the last code used for codelength si; but
* it must still fit in si bits, since no code is allowed to be all ones.
*/
- if (((JLONG) code) >= (((JLONG) 1) << si))
+ if (((JLONG)code) >= (((JLONG)1) << si))
ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
code <<= 1;
si++;
@@ -310,20 +309,21 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno,
/* Outputting bytes to the file */
/* Emit a byte, taking 'action' if must suspend. */
-#define emit_byte(state,val,action) \
- { *(state)->next_output_byte++ = (JOCTET) (val); \
- if (--(state)->free_in_buffer == 0) \
- if (! dump_buffer(state)) \
- { action; } }
+#define emit_byte(state, val, action) { \
+ *(state)->next_output_byte++ = (JOCTET)(val); \
+ if (--(state)->free_in_buffer == 0) \
+ if (!dump_buffer(state)) \
+ { action; } \
+}
LOCAL(boolean)
-dump_buffer (working_state *state)
+dump_buffer(working_state *state)
/* Empty the output buffer; return TRUE if successful, FALSE if must suspend */
{
struct jpeg_destination_mgr *dest = state->cinfo->dest;
- if (! (*dest->empty_output_buffer) (state->cinfo))
+ if (!(*dest->empty_output_buffer) (state->cinfo))
return FALSE;
/* After a successful buffer dump, must reset buffer pointers */
state->next_output_byte = dest->next_output_byte;
@@ -349,7 +349,7 @@ dump_buffer (working_state *state)
*buffer++ = c; \
if (c == 0xFF) /* need to stuff a zero byte? */ \
*buffer++ = 0; \
- }
+}
#define PUT_BITS(code, size) { \
put_bits += size; \
@@ -387,7 +387,7 @@ dump_buffer (working_state *state)
#error Cannot determine word size
#endif
-#if SIZEOF_SIZE_T==8 || defined(_WIN64)
+#if SIZEOF_SIZE_T == 8 || defined(_WIN64)
#define EMIT_BITS(code, size) { \
CHECKBUF47() \
@@ -395,11 +395,11 @@ dump_buffer (working_state *state)
}
#define EMIT_CODE(code, size) { \
- temp2 &= (((JLONG) 1)<<nbits) - 1; \
+ temp2 &= (((JLONG)1) << nbits) - 1; \
CHECKBUF31() \
PUT_BITS(code, size) \
PUT_BITS(temp2, nbits) \
- }
+}
#else
@@ -409,12 +409,12 @@ dump_buffer (working_state *state)
}
#define EMIT_CODE(code, size) { \
- temp2 &= (((JLONG) 1)<<nbits) - 1; \
+ temp2 &= (((JLONG)1) << nbits) - 1; \
PUT_BITS(code, size) \
CHECKBUF15() \
PUT_BITS(temp2, nbits) \
CHECKBUF15() \
- }
+}
#endif
@@ -428,40 +428,39 @@ dump_buffer (working_state *state)
* scanning order-- 1, 8, 16, etc.), then this will produce an encoded block
* larger than 200 bytes.
*/
-#define BUFSIZE (DCTSIZE2 * 4)
+#define BUFSIZE (DCTSIZE2 * 4)
#define LOAD_BUFFER() { \
if (state->free_in_buffer < BUFSIZE) { \
localbuf = 1; \
buffer = _buffer; \
- } \
- else buffer = state->next_output_byte; \
- }
+ } else \
+ buffer = state->next_output_byte; \
+}
#define STORE_BUFFER() { \
if (localbuf) { \
bytes = buffer - _buffer; \
buffer = _buffer; \
while (bytes > 0) { \
- bytestocopy = min(bytes, state->free_in_buffer); \
+ bytestocopy = MIN(bytes, state->free_in_buffer); \
MEMCOPY(state->next_output_byte, buffer, bytestocopy); \
state->next_output_byte += bytestocopy; \
buffer += bytestocopy; \
state->free_in_buffer -= bytestocopy; \
if (state->free_in_buffer == 0) \
- if (! dump_buffer(state)) return FALSE; \
+ if (!dump_buffer(state)) return FALSE; \
bytes -= bytestocopy; \
} \
- } \
- else { \
+ } else { \
state->free_in_buffer -= (buffer - state->next_output_byte); \
state->next_output_byte = buffer; \
} \
- }
+}
LOCAL(boolean)
-flush_bits (working_state *state)
+flush_bits(working_state *state)
{
JOCTET _buffer[BUFSIZE], *buffer;
size_t put_buffer; int put_bits;
@@ -486,8 +485,8 @@ flush_bits (working_state *state)
/* Encode a single block's worth of coefficients */
LOCAL(boolean)
-encode_one_block_simd (working_state *state, JCOEFPTR block, int last_dc_val,
- c_derived_tbl *dctbl, c_derived_tbl *actbl)
+encode_one_block_simd(working_state *state, JCOEFPTR block, int last_dc_val,
+ c_derived_tbl *dctbl, c_derived_tbl *actbl)
{
JOCTET _buffer[BUFSIZE], *buffer;
size_t bytes, bytestocopy; int localbuf = 0;
@@ -503,8 +502,8 @@ encode_one_block_simd (working_state *state, JCOEFPTR block, int last_dc_val,
}
LOCAL(boolean)
-encode_one_block (working_state *state, JCOEFPTR block, int last_dc_val,
- c_derived_tbl *dctbl, c_derived_tbl *actbl)
+encode_one_block(working_state *state, JCOEFPTR block, int last_dc_val,
+ c_derived_tbl *dctbl, c_derived_tbl *actbl)
{
int temp, temp2, temp3;
int nbits;
@@ -522,11 +521,11 @@ encode_one_block (working_state *state, JCOEFPTR block, int last_dc_val,
temp = temp2 = block[0] - last_dc_val;
- /* This is a well-known technique for obtaining the absolute value without a
- * branch. It is derived from an assembly language technique presented in
- * "How to Optimize for the Pentium Processors", Copyright (c) 1996, 1997 by
- * Agner Fog.
- */
+ /* This is a well-known technique for obtaining the absolute value without a
+ * branch. It is derived from an assembly language technique presented in
+ * "How to Optimize for the Pentium Processors", Copyright (c) 1996, 1997 by
+ * Agner Fog.
+ */
temp3 = temp >> (CHAR_BIT * sizeof(int) - 1);
temp ^= temp3;
temp -= temp3;
@@ -544,7 +543,7 @@ encode_one_block (working_state *state, JCOEFPTR block, int last_dc_val,
EMIT_BITS(code, size)
/* Mask off any extra bits in code */
- temp2 &= (((JLONG) 1)<<nbits) - 1;
+ temp2 &= (((JLONG)1) << nbits) - 1;
/* Emit that number of bits of the value, if positive, */
/* or the complement of its magnitude, if negative. */
@@ -558,7 +557,7 @@ encode_one_block (working_state *state, JCOEFPTR block, int last_dc_val,
* improves performance greatly on systems with a limited number of
* registers (such as x86.)
*/
-#define kloop(jpeg_natural_order_of_k) { \
+#define kloop(jpeg_natural_order_of_k) { \
if ((temp = block[jpeg_natural_order_of_k]) == 0) { \
r++; \
} else { \
@@ -575,11 +574,11 @@ encode_one_block (working_state *state, JCOEFPTR block, int last_dc_val,
r -= 16; \
} \
/* Emit Huffman symbol for run length / number of bits */ \
- temp3 = (r << 4) + nbits; \
+ temp3 = (r << 4) + nbits; \
code = actbl->ehufco[temp3]; \
size = actbl->ehufsi[temp3]; \
EMIT_CODE(code, size) \
- r = 0; \
+ r = 0; \
} \
}
@@ -616,11 +615,11 @@ encode_one_block (working_state *state, JCOEFPTR block, int last_dc_val,
*/
LOCAL(boolean)
-emit_restart (working_state *state, int restart_num)
+emit_restart(working_state *state, int restart_num)
{
int ci;
- if (! flush_bits(state))
+ if (!flush_bits(state))
return FALSE;
emit_byte(state, 0xFF, return FALSE);
@@ -641,9 +640,9 @@ emit_restart (working_state *state, int restart_num)
*/
METHODDEF(boolean)
-encode_mcu_huff (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
+encode_mcu_huff(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{
- huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
+ huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
working_state state;
int blkn, ci;
jpeg_component_info *compptr;
@@ -657,7 +656,7 @@ encode_mcu_huff (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
/* Emit restart marker if needed */
if (cinfo->restart_interval) {
if (entropy->restarts_to_go == 0)
- if (! emit_restart(&state, entropy->next_restart_num))
+ if (!emit_restart(&state, entropy->next_restart_num))
return FALSE;
}
@@ -666,10 +665,10 @@ encode_mcu_huff (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
ci = cinfo->MCU_membership[blkn];
compptr = cinfo->cur_comp_info[ci];
- if (! encode_one_block_simd(&state,
- MCU_data[blkn][0], state.cur.last_dc_val[ci],
- entropy->dc_derived_tbls[compptr->dc_tbl_no],
- entropy->ac_derived_tbls[compptr->ac_tbl_no]))
+ if (!encode_one_block_simd(&state,
+ MCU_data[blkn][0], state.cur.last_dc_val[ci],
+ entropy->dc_derived_tbls[compptr->dc_tbl_no],
+ entropy->ac_derived_tbls[compptr->ac_tbl_no]))
return FALSE;
/* Update last_dc_val */
state.cur.last_dc_val[ci] = MCU_data[blkn][0][0];
@@ -678,10 +677,10 @@ encode_mcu_huff (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
ci = cinfo->MCU_membership[blkn];
compptr = cinfo->cur_comp_info[ci];
- if (! encode_one_block(&state,
- MCU_data[blkn][0], state.cur.last_dc_val[ci],
- entropy->dc_derived_tbls[compptr->dc_tbl_no],
- entropy->ac_derived_tbls[compptr->ac_tbl_no]))
+ if (!encode_one_block(&state,
+ MCU_data[blkn][0], state.cur.last_dc_val[ci],
+ entropy->dc_derived_tbls[compptr->dc_tbl_no],
+ entropy->ac_derived_tbls[compptr->ac_tbl_no]))
return FALSE;
/* Update last_dc_val */
state.cur.last_dc_val[ci] = MCU_data[blkn][0][0];
@@ -712,9 +711,9 @@ encode_mcu_huff (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
*/
METHODDEF(void)
-finish_pass_huff (j_compress_ptr cinfo)
+finish_pass_huff(j_compress_ptr cinfo)
{
- huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
+ huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
working_state state;
/* Load up working state ... flush_bits needs it */
@@ -724,7 +723,7 @@ finish_pass_huff (j_compress_ptr cinfo)
state.cinfo = cinfo;
/* Flush out the last data */
- if (! flush_bits(&state))
+ if (!flush_bits(&state))
ERREXIT(cinfo, JERR_CANT_SUSPEND);
/* Update state */
@@ -751,8 +750,8 @@ finish_pass_huff (j_compress_ptr cinfo)
/* Process a single block's worth of coefficients */
LOCAL(void)
-htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
- long dc_counts[], long ac_counts[])
+htest_one_block(j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
+ long dc_counts[], long ac_counts[])
{
register int temp;
register int nbits;
@@ -773,7 +772,7 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
/* Check for out-of-range coefficient values.
* Since we're encoding a difference, the range limit is twice as much.
*/
- if (nbits > MAX_COEF_BITS+1)
+ if (nbits > MAX_COEF_BITS + 1)
ERREXIT(cinfo, JERR_BAD_DCT_COEF);
/* Count the Huffman symbol for the number of bits */
@@ -824,9 +823,9 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
*/
METHODDEF(boolean)
-encode_mcu_gather (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
+encode_mcu_gather(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{
- huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
+ huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
int blkn, ci;
jpeg_component_info *compptr;
@@ -863,13 +862,14 @@ encode_mcu_gather (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
* one bits (so that padding bits added at the end of a compressed segment
* can't look like a valid code). Because of the canonical ordering of
* codewords, this just means that there must be an unused slot in the
- * longest codeword length category. Section K.2 of the JPEG spec suggests
- * reserving such a slot by pretending that symbol 256 is a valid symbol
- * with count 1. In theory that's not optimal; giving it count zero but
- * including it in the symbol set anyway should give a better Huffman code.
- * But the theoretically better code actually seems to come out worse in
- * practice, because it produces more all-ones bytes (which incur stuffed
- * zero bytes in the final file). In any case the difference is tiny.
+ * longest codeword length category. Annex K (Clause K.2) of
+ * Rec. ITU-T T.81 (1992) | ISO/IEC 10918-1:1994 suggests reserving such a slot
+ * by pretending that symbol 256 is a valid symbol with count 1. In theory
+ * that's not optimal; giving it count zero but including it in the symbol set
+ * anyway should give a better Huffman code. But the theoretically better code
+ * actually seems to come out worse in practice, because it produces more
+ * all-ones bytes (which incur stuffed zero bytes in the final file). In any
+ * case the difference is tiny.
*
* The JPEG standard requires Huffman codes to be no more than 16 bits long.
* If some symbols have a very small but nonzero probability, the Huffman tree
@@ -884,10 +884,10 @@ encode_mcu_gather (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
*/
GLOBAL(void)
-jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL *htbl, long freq[])
+jpeg_gen_optimal_table(j_compress_ptr cinfo, JHUFF_TBL *htbl, long freq[])
{
-#define MAX_CLEN 32 /* assumed maximum initial code length */
- UINT8 bits[MAX_CLEN+1]; /* bits[k] = # of symbols with code length k */
+#define MAX_CLEN 32 /* assumed maximum initial code length */
+ UINT8 bits[MAX_CLEN + 1]; /* bits[k] = # of symbols with code length k */
int codesize[257]; /* codesize[k] = code length of symbol k */
int others[257]; /* next symbol in current branch of tree */
int c1, c2;
@@ -971,13 +971,13 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL *htbl, long freq[])
/* JPEG doesn't allow symbols with code lengths over 16 bits, so if the pure
* Huffman procedure assigned any such lengths, we must adjust the coding.
- * Here is what the JPEG spec says about how this next bit works:
- * Since symbols are paired for the longest Huffman code, the symbols are
- * removed from this length category two at a time. The prefix for the pair
- * (which is one bit shorter) is allocated to one of the pair; then,
- * skipping the BITS entry for that prefix length, a code word from the next
- * shortest nonzero BITS entry is converted into a prefix for two code words
- * one bit longer.
+ * Here is what Rec. ITU-T T.81 | ISO/IEC 10918-1 says about how this next
+ * bit works: Since symbols are paired for the longest Huffman code, the
+ * symbols are removed from this length category two at a time. The prefix
+ * for the pair (which is one bit shorter) is allocated to one of the pair;
+ * then, skipping the BITS entry for that prefix length, a code word from the
+ * next shortest nonzero BITS entry is converted into a prefix for two code
+ * words one bit longer.
*/
for (i = MAX_CLEN; i > 16; i--) {
@@ -987,8 +987,8 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL *htbl, long freq[])
j--;
bits[i] -= 2; /* remove two symbols */
- bits[i-1]++; /* one goes in this length */
- bits[j+1] += 2; /* two new symbols in this length */
+ bits[i - 1]++; /* one goes in this length */
+ bits[j + 1] += 2; /* two new symbols in this length */
bits[j]--; /* symbol of this length is now a prefix */
}
}
@@ -1003,13 +1003,14 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL *htbl, long freq[])
/* Return a list of the symbols sorted by code length */
/* It's not real clear to me why we don't need to consider the codelength
- * changes made above, but the JPEG spec seems to think this works.
+ * changes made above, but Rec. ITU-T T.81 | ISO/IEC 10918-1 seems to think
+ * this works.
*/
p = 0;
for (i = 1; i <= MAX_CLEN; i++) {
for (j = 0; j <= 255; j++) {
if (codesize[j] == i) {
- htbl->huffval[p] = (UINT8) j;
+ htbl->huffval[p] = (UINT8)j;
p++;
}
}
@@ -1025,9 +1026,9 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL *htbl, long freq[])
*/
METHODDEF(void)
-finish_pass_gather (j_compress_ptr cinfo)
+finish_pass_gather(j_compress_ptr cinfo)
{
- huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
+ huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
int ci, dctbl, actbl;
jpeg_component_info *compptr;
JHUFF_TBL **htblptr;
@@ -1044,17 +1045,17 @@ finish_pass_gather (j_compress_ptr cinfo)
compptr = cinfo->cur_comp_info[ci];
dctbl = compptr->dc_tbl_no;
actbl = compptr->ac_tbl_no;
- if (! did_dc[dctbl]) {
- htblptr = & cinfo->dc_huff_tbl_ptrs[dctbl];
+ if (!did_dc[dctbl]) {
+ htblptr = &cinfo->dc_huff_tbl_ptrs[dctbl];
if (*htblptr == NULL)
- *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
+ *htblptr = jpeg_alloc_huff_table((j_common_ptr)cinfo);
jpeg_gen_optimal_table(cinfo, *htblptr, entropy->dc_count_ptrs[dctbl]);
did_dc[dctbl] = TRUE;
}
- if (! did_ac[actbl]) {
- htblptr = & cinfo->ac_huff_tbl_ptrs[actbl];
+ if (!did_ac[actbl]) {
+ htblptr = &cinfo->ac_huff_tbl_ptrs[actbl];
if (*htblptr == NULL)
- *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
+ *htblptr = jpeg_alloc_huff_table((j_common_ptr)cinfo);
jpeg_gen_optimal_table(cinfo, *htblptr, entropy->ac_count_ptrs[actbl]);
did_ac[actbl] = TRUE;
}
@@ -1070,15 +1071,15 @@ finish_pass_gather (j_compress_ptr cinfo)
*/
GLOBAL(void)
-jinit_huff_encoder (j_compress_ptr cinfo)
+jinit_huff_encoder(j_compress_ptr cinfo)
{
huff_entropy_ptr entropy;
int i;
entropy = (huff_entropy_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(huff_entropy_encoder));
- cinfo->entropy = (struct jpeg_entropy_encoder *) entropy;
+ cinfo->entropy = (struct jpeg_entropy_encoder *)entropy;
entropy->pub.start_pass = start_pass_huff;
/* Mark tables unallocated */
diff --git a/src/3rdparty/libjpeg/src/jchuff.h b/src/3rdparty/libjpeg/src/jchuff.h
index 4236089adc..314a2325c9 100644
--- a/src/3rdparty/libjpeg/src/jchuff.h
+++ b/src/3rdparty/libjpeg/src/jchuff.h
@@ -20,9 +20,9 @@
*/
#if BITS_IN_JSAMPLE == 8
-#define MAX_COEF_BITS 10
+#define MAX_COEF_BITS 10
#else
-#define MAX_COEF_BITS 14
+#define MAX_COEF_BITS 14
#endif
/* Derived data constructed for each Huffman table */
@@ -34,10 +34,9 @@ typedef struct {
} c_derived_tbl;
/* Expand a Huffman table definition into the derived format */
-EXTERN(void) jpeg_make_c_derived_tbl
- (j_compress_ptr cinfo, boolean isDC, int tblno,
- c_derived_tbl ** pdtbl);
+EXTERN(void) jpeg_make_c_derived_tbl(j_compress_ptr cinfo, boolean isDC,
+ int tblno, c_derived_tbl **pdtbl);
/* Generate an optimal table definition given the specified counts */
-EXTERN(void) jpeg_gen_optimal_table
- (j_compress_ptr cinfo, JHUFF_TBL *htbl, long freq[]);
+EXTERN(void) jpeg_gen_optimal_table(j_compress_ptr cinfo, JHUFF_TBL *htbl,
+ long freq[]);
diff --git a/src/3rdparty/libjpeg/src/jcinit.c b/src/3rdparty/libjpeg/src/jcinit.c
index 463bd8c6dd..78aa465786 100644
--- a/src/3rdparty/libjpeg/src/jcinit.c
+++ b/src/3rdparty/libjpeg/src/jcinit.c
@@ -28,13 +28,13 @@
*/
GLOBAL(void)
-jinit_compress_master (j_compress_ptr cinfo)
+jinit_compress_master(j_compress_ptr cinfo)
{
/* Initialize master control (includes parameter checking/processing) */
jinit_c_master_control(cinfo, FALSE /* full compression */);
/* Preprocessing */
- if (! cinfo->raw_data_in) {
+ if (!cinfo->raw_data_in) {
jinit_color_converter(cinfo);
jinit_downsampler(cinfo);
jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */);
@@ -60,14 +60,14 @@ jinit_compress_master (j_compress_ptr cinfo)
}
/* Need a full-image coefficient buffer in any multi-pass mode. */
- jinit_c_coef_controller(cinfo,
- (boolean) (cinfo->num_scans > 1 || cinfo->optimize_coding));
+ jinit_c_coef_controller(cinfo, (boolean)(cinfo->num_scans > 1 ||
+ cinfo->optimize_coding));
jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */);
jinit_marker_writer(cinfo);
/* We can now tell the memory manager to allocate virtual arrays. */
- (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
+ (*cinfo->mem->realize_virt_arrays) ((j_common_ptr)cinfo);
/* Write the datastream header (SOI) immediately.
* Frame and scan headers are postponed till later.
diff --git a/src/3rdparty/libjpeg/src/jcmainct.c b/src/3rdparty/libjpeg/src/jcmainct.c
index d01f46364b..3f23028c46 100644
--- a/src/3rdparty/libjpeg/src/jcmainct.c
+++ b/src/3rdparty/libjpeg/src/jcmainct.c
@@ -39,9 +39,10 @@ typedef my_main_controller *my_main_ptr;
/* Forward declarations */
-METHODDEF(void) process_data_simple_main
- (j_compress_ptr cinfo, JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
- JDIMENSION in_rows_avail);
+METHODDEF(void) process_data_simple_main(j_compress_ptr cinfo,
+ JSAMPARRAY input_buf,
+ JDIMENSION *in_row_ctr,
+ JDIMENSION in_rows_avail);
/*
@@ -49,9 +50,9 @@ METHODDEF(void) process_data_simple_main
*/
METHODDEF(void)
-start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
+start_pass_main(j_compress_ptr cinfo, J_BUF_MODE pass_mode)
{
- my_main_ptr main_ptr = (my_main_ptr) cinfo->main;
+ my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
/* Do nothing in raw-data mode. */
if (cinfo->raw_data_in)
@@ -75,19 +76,18 @@ start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
*/
METHODDEF(void)
-process_data_simple_main (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
- JDIMENSION in_rows_avail)
+process_data_simple_main(j_compress_ptr cinfo, JSAMPARRAY input_buf,
+ JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail)
{
- my_main_ptr main_ptr = (my_main_ptr) cinfo->main;
+ my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
while (main_ptr->cur_iMCU_row < cinfo->total_iMCU_rows) {
/* Read input data if we haven't filled the main buffer yet */
if (main_ptr->rowgroup_ctr < DCTSIZE)
- (*cinfo->prep->pre_process_data) (cinfo,
- input_buf, in_row_ctr, in_rows_avail,
- main_ptr->buffer, &main_ptr->rowgroup_ctr,
- (JDIMENSION) DCTSIZE);
+ (*cinfo->prep->pre_process_data) (cinfo, input_buf, in_row_ctr,
+ in_rows_avail, main_ptr->buffer,
+ &main_ptr->rowgroup_ctr,
+ (JDIMENSION)DCTSIZE);
/* If we don't have a full iMCU row buffered, return to application for
* more data. Note that preprocessor will always pad to fill the iMCU row
@@ -97,14 +97,14 @@ process_data_simple_main (j_compress_ptr cinfo,
return;
/* Send the completed row to the compressor */
- if (! (*cinfo->coef->compress_data) (cinfo, main_ptr->buffer)) {
+ if (!(*cinfo->coef->compress_data) (cinfo, main_ptr->buffer)) {
/* If compressor did not consume the whole row, then we must need to
* suspend processing and return to the application. In this situation
* we pretend we didn't yet consume the last input row; otherwise, if
* it happened to be the last row of the image, the application would
* think we were done.
*/
- if (! main_ptr->suspended) {
+ if (!main_ptr->suspended) {
(*in_row_ctr)--;
main_ptr->suspended = TRUE;
}
@@ -128,16 +128,16 @@ process_data_simple_main (j_compress_ptr cinfo,
*/
GLOBAL(void)
-jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer)
+jinit_c_main_controller(j_compress_ptr cinfo, boolean need_full_buffer)
{
my_main_ptr main_ptr;
int ci;
jpeg_component_info *compptr;
main_ptr = (my_main_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(my_main_controller));
- cinfo->main = (struct jpeg_c_main_controller *) main_ptr;
+ cinfo->main = (struct jpeg_c_main_controller *)main_ptr;
main_ptr->pub.start_pass = start_pass_main;
/* We don't need to create a buffer in raw-data mode. */
@@ -154,9 +154,9 @@ jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer)
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) {
main_ptr->buffer[ci] = (*cinfo->mem->alloc_sarray)
- ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ ((j_common_ptr)cinfo, JPOOL_IMAGE,
compptr->width_in_blocks * DCTSIZE,
- (JDIMENSION) (compptr->v_samp_factor * DCTSIZE));
+ (JDIMENSION)(compptr->v_samp_factor * DCTSIZE));
}
}
}
diff --git a/src/3rdparty/libjpeg/src/jcmarker.c b/src/3rdparty/libjpeg/src/jcmarker.c
index 463f665927..801fbab4ef 100644
--- a/src/3rdparty/libjpeg/src/jcmarker.c
+++ b/src/3rdparty/libjpeg/src/jcmarker.c
@@ -110,30 +110,30 @@ typedef my_marker_writer *my_marker_ptr;
*/
LOCAL(void)
-emit_byte (j_compress_ptr cinfo, int val)
+emit_byte(j_compress_ptr cinfo, int val)
/* Emit a byte */
{
struct jpeg_destination_mgr *dest = cinfo->dest;
- *(dest->next_output_byte)++ = (JOCTET) val;
+ *(dest->next_output_byte)++ = (JOCTET)val;
if (--dest->free_in_buffer == 0) {
- if (! (*dest->empty_output_buffer) (cinfo))
+ if (!(*dest->empty_output_buffer) (cinfo))
ERREXIT(cinfo, JERR_CANT_SUSPEND);
}
}
LOCAL(void)
-emit_marker (j_compress_ptr cinfo, JPEG_MARKER mark)
+emit_marker(j_compress_ptr cinfo, JPEG_MARKER mark)
/* Emit a marker code */
{
emit_byte(cinfo, 0xFF);
- emit_byte(cinfo, (int) mark);
+ emit_byte(cinfo, (int)mark);
}
LOCAL(void)
-emit_2bytes (j_compress_ptr cinfo, int value)
+emit_2bytes(j_compress_ptr cinfo, int value)
/* Emit a 2-byte integer; these are always MSB first in JPEG files */
{
emit_byte(cinfo, (value >> 8) & 0xFF);
@@ -146,7 +146,7 @@ emit_2bytes (j_compress_ptr cinfo, int value)
*/
LOCAL(int)
-emit_dqt (j_compress_ptr cinfo, int index)
+emit_dqt(j_compress_ptr cinfo, int index)
/* Emit a DQT marker */
/* Returns the precision used (0 = 8bits, 1 = 16bits) for baseline checking */
{
@@ -163,19 +163,19 @@ emit_dqt (j_compress_ptr cinfo, int index)
prec = 1;
}
- if (! qtbl->sent_table) {
+ if (!qtbl->sent_table) {
emit_marker(cinfo, M_DQT);
- emit_2bytes(cinfo, prec ? DCTSIZE2*2 + 1 + 2 : DCTSIZE2 + 1 + 2);
+ emit_2bytes(cinfo, prec ? DCTSIZE2 * 2 + 1 + 2 : DCTSIZE2 + 1 + 2);
- emit_byte(cinfo, index + (prec<<4));
+ emit_byte(cinfo, index + (prec << 4));
for (i = 0; i < DCTSIZE2; i++) {
/* The table entries must be emitted in zigzag order. */
unsigned int qval = qtbl->quantval[jpeg_natural_order[i]];
if (prec)
- emit_byte(cinfo, (int) (qval >> 8));
- emit_byte(cinfo, (int) (qval & 0xFF));
+ emit_byte(cinfo, (int)(qval >> 8));
+ emit_byte(cinfo, (int)(qval & 0xFF));
}
qtbl->sent_table = TRUE;
@@ -186,7 +186,7 @@ emit_dqt (j_compress_ptr cinfo, int index)
LOCAL(void)
-emit_dht (j_compress_ptr cinfo, int index, boolean is_ac)
+emit_dht(j_compress_ptr cinfo, int index, boolean is_ac)
/* Emit a DHT marker */
{
JHUFF_TBL *htbl;
@@ -202,7 +202,7 @@ emit_dht (j_compress_ptr cinfo, int index, boolean is_ac)
if (htbl == NULL)
ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, index);
- if (! htbl->sent_table) {
+ if (!htbl->sent_table) {
emit_marker(cinfo, M_DHT);
length = 0;
@@ -224,7 +224,7 @@ emit_dht (j_compress_ptr cinfo, int index, boolean is_ac)
LOCAL(void)
-emit_dac (j_compress_ptr cinfo)
+emit_dac(j_compress_ptr cinfo)
/* Emit a DAC marker */
/* Since the useful info is so small, we want to emit all the tables in */
/* one DAC marker. Therefore this routine does its own scan of the table. */
@@ -255,12 +255,12 @@ emit_dac (j_compress_ptr cinfo)
if (length) {
emit_marker(cinfo, M_DAC);
- emit_2bytes(cinfo, length*2 + 2);
+ emit_2bytes(cinfo, length * 2 + 2);
for (i = 0; i < NUM_ARITH_TBLS; i++) {
if (dc_in_use[i]) {
emit_byte(cinfo, i);
- emit_byte(cinfo, cinfo->arith_dc_L[i] + (cinfo->arith_dc_U[i]<<4));
+ emit_byte(cinfo, cinfo->arith_dc_L[i] + (cinfo->arith_dc_U[i] << 4));
}
if (ac_in_use[i]) {
emit_byte(cinfo, i + 0x10);
@@ -273,19 +273,19 @@ emit_dac (j_compress_ptr cinfo)
LOCAL(void)
-emit_dri (j_compress_ptr cinfo)
+emit_dri(j_compress_ptr cinfo)
/* Emit a DRI marker */
{
emit_marker(cinfo, M_DRI);
emit_2bytes(cinfo, 4); /* fixed length */
- emit_2bytes(cinfo, (int) cinfo->restart_interval);
+ emit_2bytes(cinfo, (int)cinfo->restart_interval);
}
LOCAL(void)
-emit_sof (j_compress_ptr cinfo, JPEG_MARKER code)
+emit_sof(j_compress_ptr cinfo, JPEG_MARKER code)
/* Emit a SOF marker */
{
int ci;
@@ -296,13 +296,12 @@ emit_sof (j_compress_ptr cinfo, JPEG_MARKER code)
emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */
/* Make sure image isn't bigger than SOF field can handle */
- if ((long) cinfo->_jpeg_height > 65535L ||
- (long) cinfo->_jpeg_width > 65535L)
- ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) 65535);
+ if ((long)cinfo->_jpeg_height > 65535L || (long)cinfo->_jpeg_width > 65535L)
+ ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int)65535);
emit_byte(cinfo, cinfo->data_precision);
- emit_2bytes(cinfo, (int) cinfo->_jpeg_height);
- emit_2bytes(cinfo, (int) cinfo->_jpeg_width);
+ emit_2bytes(cinfo, (int)cinfo->_jpeg_height);
+ emit_2bytes(cinfo, (int)cinfo->_jpeg_width);
emit_byte(cinfo, cinfo->num_components);
@@ -316,7 +315,7 @@ emit_sof (j_compress_ptr cinfo, JPEG_MARKER code)
LOCAL(void)
-emit_sos (j_compress_ptr cinfo)
+emit_sos(j_compress_ptr cinfo)
/* Emit a SOS marker */
{
int i, td, ta;
@@ -351,7 +350,7 @@ emit_sos (j_compress_ptr cinfo)
LOCAL(void)
-emit_jfif_app0 (j_compress_ptr cinfo)
+emit_jfif_app0(j_compress_ptr cinfo)
/* Emit a JFIF-compliant APP0 marker */
{
/*
@@ -378,15 +377,15 @@ emit_jfif_app0 (j_compress_ptr cinfo)
emit_byte(cinfo, cinfo->JFIF_major_version); /* Version fields */
emit_byte(cinfo, cinfo->JFIF_minor_version);
emit_byte(cinfo, cinfo->density_unit); /* Pixel size information */
- emit_2bytes(cinfo, (int) cinfo->X_density);
- emit_2bytes(cinfo, (int) cinfo->Y_density);
+ emit_2bytes(cinfo, (int)cinfo->X_density);
+ emit_2bytes(cinfo, (int)cinfo->Y_density);
emit_byte(cinfo, 0); /* No thumbnail image */
emit_byte(cinfo, 0);
}
LOCAL(void)
-emit_adobe_app14 (j_compress_ptr cinfo)
+emit_adobe_app14(j_compress_ptr cinfo)
/* Emit an Adobe APP14 marker */
{
/*
@@ -440,19 +439,19 @@ emit_adobe_app14 (j_compress_ptr cinfo)
*/
METHODDEF(void)
-write_marker_header (j_compress_ptr cinfo, int marker, unsigned int datalen)
+write_marker_header(j_compress_ptr cinfo, int marker, unsigned int datalen)
/* Emit an arbitrary marker header */
{
- if (datalen > (unsigned int) 65533) /* safety check */
+ if (datalen > (unsigned int)65533) /* safety check */
ERREXIT(cinfo, JERR_BAD_LENGTH);
- emit_marker(cinfo, (JPEG_MARKER) marker);
+ emit_marker(cinfo, (JPEG_MARKER)marker);
- emit_2bytes(cinfo, (int) (datalen + 2)); /* total length */
+ emit_2bytes(cinfo, (int)(datalen + 2)); /* total length */
}
METHODDEF(void)
-write_marker_byte (j_compress_ptr cinfo, int val)
+write_marker_byte(j_compress_ptr cinfo, int val)
/* Emit one byte of marker parameters following write_marker_header */
{
emit_byte(cinfo, val);
@@ -471,9 +470,9 @@ write_marker_byte (j_compress_ptr cinfo, int val)
*/
METHODDEF(void)
-write_file_header (j_compress_ptr cinfo)
+write_file_header(j_compress_ptr cinfo)
{
- my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
+ my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
emit_marker(cinfo, M_SOI); /* first the SOI */
@@ -496,7 +495,7 @@ write_file_header (j_compress_ptr cinfo)
*/
METHODDEF(void)
-write_frame_header (j_compress_ptr cinfo)
+write_frame_header(j_compress_ptr cinfo)
{
int ci, prec;
boolean is_baseline;
@@ -556,9 +555,9 @@ write_frame_header (j_compress_ptr cinfo)
*/
METHODDEF(void)
-write_scan_header (j_compress_ptr cinfo)
+write_scan_header(j_compress_ptr cinfo)
{
- my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
+ my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
int i;
jpeg_component_info *compptr;
@@ -600,7 +599,7 @@ write_scan_header (j_compress_ptr cinfo)
*/
METHODDEF(void)
-write_file_trailer (j_compress_ptr cinfo)
+write_file_trailer(j_compress_ptr cinfo)
{
emit_marker(cinfo, M_EOI);
}
@@ -614,7 +613,7 @@ write_file_trailer (j_compress_ptr cinfo)
*/
METHODDEF(void)
-write_tables_only (j_compress_ptr cinfo)
+write_tables_only(j_compress_ptr cinfo)
{
int i;
@@ -622,10 +621,10 @@ write_tables_only (j_compress_ptr cinfo)
for (i = 0; i < NUM_QUANT_TBLS; i++) {
if (cinfo->quant_tbl_ptrs[i] != NULL)
- (void) emit_dqt(cinfo, i);
+ (void)emit_dqt(cinfo, i);
}
- if (! cinfo->arith_code) {
+ if (!cinfo->arith_code) {
for (i = 0; i < NUM_HUFF_TBLS; i++) {
if (cinfo->dc_huff_tbl_ptrs[i] != NULL)
emit_dht(cinfo, i, FALSE);
@@ -643,15 +642,15 @@ write_tables_only (j_compress_ptr cinfo)
*/
GLOBAL(void)
-jinit_marker_writer (j_compress_ptr cinfo)
+jinit_marker_writer(j_compress_ptr cinfo)
{
my_marker_ptr marker;
/* Create the subobject */
marker = (my_marker_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(my_marker_writer));
- cinfo->marker = (struct jpeg_marker_writer *) marker;
+ cinfo->marker = (struct jpeg_marker_writer *)marker;
/* Initialize method pointers */
marker->pub.write_file_header = write_file_header;
marker->pub.write_frame_header = write_frame_header;
diff --git a/src/3rdparty/libjpeg/src/jcmaster.c b/src/3rdparty/libjpeg/src/jcmaster.c
index 03a8b40ea9..93b3de6826 100644
--- a/src/3rdparty/libjpeg/src/jcmaster.c
+++ b/src/3rdparty/libjpeg/src/jcmaster.c
@@ -5,7 +5,7 @@
* Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 2003-2010 by Guido Vollbeding.
* libjpeg-turbo Modifications:
- * Copyright (C) 2010, 2016, D. R. Commander.
+ * Copyright (C) 2010, 2016, 2018, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@@ -25,9 +25,9 @@
/* Private state */
typedef enum {
- main_pass, /* input data, also do first output step */
- huff_opt_pass, /* Huffman code optimization pass */
- output_pass /* data output pass */
+ main_pass, /* input data, also do first output step */
+ huff_opt_pass, /* Huffman code optimization pass */
+ output_pass /* data output pass */
} c_pass_type;
typedef struct {
@@ -66,7 +66,7 @@ typedef my_comp_master *my_master_ptr;
*/
GLOBAL(void)
-jpeg_calc_jpeg_dimensions (j_compress_ptr cinfo)
+jpeg_calc_jpeg_dimensions(j_compress_ptr cinfo)
/* Do computations that are needed before master selection phase */
{
/* Hardwire it to "no scaling" */
@@ -79,7 +79,7 @@ jpeg_calc_jpeg_dimensions (j_compress_ptr cinfo)
LOCAL(void)
-initial_setup (j_compress_ptr cinfo, boolean transcode_only)
+initial_setup(j_compress_ptr cinfo, boolean transcode_only)
/* Do computations that are needed before master selection phase */
{
int ci;
@@ -95,19 +95,19 @@ initial_setup (j_compress_ptr cinfo, boolean transcode_only)
#endif
/* Sanity check on image dimensions */
- if (cinfo->_jpeg_height <= 0 || cinfo->_jpeg_width <= 0
- || cinfo->num_components <= 0 || cinfo->input_components <= 0)
+ if (cinfo->_jpeg_height <= 0 || cinfo->_jpeg_width <= 0 ||
+ cinfo->num_components <= 0 || cinfo->input_components <= 0)
ERREXIT(cinfo, JERR_EMPTY_IMAGE);
/* Make sure image isn't bigger than I can handle */
- if ((long) cinfo->_jpeg_height > (long) JPEG_MAX_DIMENSION ||
- (long) cinfo->_jpeg_width > (long) JPEG_MAX_DIMENSION)
- ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION);
+ if ((long)cinfo->_jpeg_height > (long)JPEG_MAX_DIMENSION ||
+ (long)cinfo->_jpeg_width > (long)JPEG_MAX_DIMENSION)
+ ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int)JPEG_MAX_DIMENSION);
/* Width of an input scanline must be representable as JDIMENSION. */
- samplesperrow = (long) cinfo->image_width * (long) cinfo->input_components;
- jd_samplesperrow = (JDIMENSION) samplesperrow;
- if ((long) jd_samplesperrow != samplesperrow)
+ samplesperrow = (long)cinfo->image_width * (long)cinfo->input_components;
+ jd_samplesperrow = (JDIMENSION)samplesperrow;
+ if ((long)jd_samplesperrow != samplesperrow)
ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
/* For now, precision must match compiled-in value... */
@@ -124,8 +124,10 @@ initial_setup (j_compress_ptr cinfo, boolean transcode_only)
cinfo->max_v_samp_factor = 1;
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) {
- if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR ||
- compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR)
+ if (compptr->h_samp_factor <= 0 ||
+ compptr->h_samp_factor > MAX_SAMP_FACTOR ||
+ compptr->v_samp_factor <= 0 ||
+ compptr->v_samp_factor > MAX_SAMP_FACTOR)
ERREXIT(cinfo, JERR_BAD_SAMPLING);
cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
compptr->h_samp_factor);
@@ -146,18 +148,18 @@ initial_setup (j_compress_ptr cinfo, boolean transcode_only)
#endif
/* Size in DCT blocks */
compptr->width_in_blocks = (JDIMENSION)
- jdiv_round_up((long) cinfo->_jpeg_width * (long) compptr->h_samp_factor,
- (long) (cinfo->max_h_samp_factor * DCTSIZE));
+ jdiv_round_up((long)cinfo->_jpeg_width * (long)compptr->h_samp_factor,
+ (long)(cinfo->max_h_samp_factor * DCTSIZE));
compptr->height_in_blocks = (JDIMENSION)
- jdiv_round_up((long) cinfo->_jpeg_height * (long) compptr->v_samp_factor,
- (long) (cinfo->max_v_samp_factor * DCTSIZE));
+ jdiv_round_up((long)cinfo->_jpeg_height * (long)compptr->v_samp_factor,
+ (long)(cinfo->max_v_samp_factor * DCTSIZE));
/* Size in samples */
compptr->downsampled_width = (JDIMENSION)
- jdiv_round_up((long) cinfo->_jpeg_width * (long) compptr->h_samp_factor,
- (long) cinfo->max_h_samp_factor);
+ jdiv_round_up((long)cinfo->_jpeg_width * (long)compptr->h_samp_factor,
+ (long)cinfo->max_h_samp_factor);
compptr->downsampled_height = (JDIMENSION)
- jdiv_round_up((long) cinfo->_jpeg_height * (long) compptr->v_samp_factor,
- (long) cinfo->max_v_samp_factor);
+ jdiv_round_up((long)cinfo->_jpeg_height * (long)compptr->v_samp_factor,
+ (long)cinfo->max_v_samp_factor);
/* Mark component needed (this flag isn't actually used for compression) */
compptr->component_needed = TRUE;
}
@@ -166,15 +168,15 @@ initial_setup (j_compress_ptr cinfo, boolean transcode_only)
* main controller will call coefficient controller).
*/
cinfo->total_iMCU_rows = (JDIMENSION)
- jdiv_round_up((long) cinfo->_jpeg_height,
- (long) (cinfo->max_v_samp_factor*DCTSIZE));
+ jdiv_round_up((long)cinfo->_jpeg_height,
+ (long)(cinfo->max_v_samp_factor * DCTSIZE));
}
#ifdef C_MULTISCAN_FILES_SUPPORTED
LOCAL(void)
-validate_script (j_compress_ptr cinfo)
+validate_script(j_compress_ptr cinfo)
/* Verify that the scan script in cinfo->scan_info[] is valid; also
* determine whether it uses progressive JPEG, and set cinfo->progressive_mode.
*/
@@ -196,10 +198,10 @@ validate_script (j_compress_ptr cinfo)
* for progressive JPEG, no scan can have this.
*/
scanptr = cinfo->scan_info;
- if (scanptr->Ss != 0 || scanptr->Se != DCTSIZE2-1) {
+ if (scanptr->Ss != 0 || scanptr->Se != DCTSIZE2 - 1) {
#ifdef C_PROGRESSIVE_SUPPORTED
cinfo->progressive_mode = TRUE;
- last_bitpos_ptr = & last_bitpos[0][0];
+ last_bitpos_ptr = &last_bitpos[0][0];
for (ci = 0; ci < cinfo->num_components; ci++)
for (coefi = 0; coefi < DCTSIZE2; coefi++)
*last_bitpos_ptr++ = -1;
@@ -222,7 +224,7 @@ validate_script (j_compress_ptr cinfo)
if (thisi < 0 || thisi >= cinfo->num_components)
ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
/* Components must appear in SOF order within each scan */
- if (ci > 0 && thisi <= scanptr->component_index[ci-1])
+ if (ci > 0 && thisi <= scanptr->component_index[ci - 1])
ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
}
/* Validate progression parameters */
@@ -232,17 +234,17 @@ validate_script (j_compress_ptr cinfo)
Al = scanptr->Al;
if (cinfo->progressive_mode) {
#ifdef C_PROGRESSIVE_SUPPORTED
- /* The JPEG spec simply gives the ranges 0..13 for Ah and Al, but that
- * seems wrong: the upper bound ought to depend on data precision.
- * Perhaps they really meant 0..N+1 for N-bit precision.
+ /* Rec. ITU-T T.81 | ISO/IEC 10918-1 simply gives the ranges 0..13 for Ah
+ * and Al, but that seems wrong: the upper bound ought to depend on data
+ * precision. Perhaps they really meant 0..N+1 for N-bit precision.
* Here we allow 0..10 for 8-bit data; Al larger than 10 results in
* out-of-range reconstructed DC values during the first DC scan,
* which might cause problems for some decoders.
*/
#if BITS_IN_JSAMPLE == 8
-#define MAX_AH_AL 10
+#define MAX_AH_AL 10
#else
-#define MAX_AH_AL 13
+#define MAX_AH_AL 13
#endif
if (Ss < 0 || Ss >= DCTSIZE2 || Se < Ss || Se >= DCTSIZE2 ||
Ah < 0 || Ah > MAX_AH_AL || Al < 0 || Al > MAX_AH_AL)
@@ -255,7 +257,7 @@ validate_script (j_compress_ptr cinfo)
ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
}
for (ci = 0; ci < ncomps; ci++) {
- last_bitpos_ptr = & last_bitpos[scanptr->component_index[ci]][0];
+ last_bitpos_ptr = &last_bitpos[scanptr->component_index[ci]][0];
if (Ss != 0 && last_bitpos_ptr[0] < 0) /* AC without prior DC scan */
ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
for (coefi = Ss; coefi <= Se; coefi++) {
@@ -265,7 +267,7 @@ validate_script (j_compress_ptr cinfo)
ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
} else {
/* not first scan */
- if (Ah != last_bitpos_ptr[coefi] || Al != Ah-1)
+ if (Ah != last_bitpos_ptr[coefi] || Al != Ah - 1)
ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
}
last_bitpos_ptr[coefi] = Al;
@@ -274,7 +276,7 @@ validate_script (j_compress_ptr cinfo)
#endif
} else {
/* For sequential JPEG, all progression parameters must be these: */
- if (Ss != 0 || Se != DCTSIZE2-1 || Ah != 0 || Al != 0)
+ if (Ss != 0 || Se != DCTSIZE2 - 1 || Ah != 0 || Al != 0)
ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
/* Make sure components are not sent twice */
for (ci = 0; ci < ncomps; ci++) {
@@ -301,7 +303,7 @@ validate_script (j_compress_ptr cinfo)
#endif
} else {
for (ci = 0; ci < cinfo->num_components; ci++) {
- if (! component_sent[ci])
+ if (!component_sent[ci])
ERREXIT(cinfo, JERR_MISSING_DATA);
}
}
@@ -311,7 +313,7 @@ validate_script (j_compress_ptr cinfo)
LOCAL(void)
-select_scan_parameters (j_compress_ptr cinfo)
+select_scan_parameters(j_compress_ptr cinfo)
/* Set up the scan parameters for the current scan */
{
int ci;
@@ -319,7 +321,7 @@ select_scan_parameters (j_compress_ptr cinfo)
#ifdef C_MULTISCAN_FILES_SUPPORTED
if (cinfo->scan_info != NULL) {
/* Prepare for current scan --- the script is already validated */
- my_master_ptr master = (my_master_ptr) cinfo->master;
+ my_master_ptr master = (my_master_ptr)cinfo->master;
const jpeg_scan_info *scanptr = cinfo->scan_info + master->scan_number;
cinfo->comps_in_scan = scanptr->comps_in_scan;
@@ -331,8 +333,7 @@ select_scan_parameters (j_compress_ptr cinfo)
cinfo->Se = scanptr->Se;
cinfo->Ah = scanptr->Ah;
cinfo->Al = scanptr->Al;
- }
- else
+ } else
#endif
{
/* Prepare for single sequential-JPEG scan containing all components */
@@ -344,7 +345,7 @@ select_scan_parameters (j_compress_ptr cinfo)
cinfo->cur_comp_info[ci] = &cinfo->comp_info[ci];
}
cinfo->Ss = 0;
- cinfo->Se = DCTSIZE2-1;
+ cinfo->Se = DCTSIZE2 - 1;
cinfo->Ah = 0;
cinfo->Al = 0;
}
@@ -352,7 +353,7 @@ select_scan_parameters (j_compress_ptr cinfo)
LOCAL(void)
-per_scan_setup (j_compress_ptr cinfo)
+per_scan_setup(j_compress_ptr cinfo)
/* Do computations that are needed before processing a JPEG scan */
/* cinfo->comps_in_scan and cinfo->cur_comp_info[] are already set */
{
@@ -377,7 +378,7 @@ per_scan_setup (j_compress_ptr cinfo)
/* For noninterleaved scans, it is convenient to define last_row_height
* as the number of block rows present in the last iMCU row.
*/
- tmp = (int) (compptr->height_in_blocks % compptr->v_samp_factor);
+ tmp = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
if (tmp == 0) tmp = compptr->v_samp_factor;
compptr->last_row_height = tmp;
@@ -394,11 +395,11 @@ per_scan_setup (j_compress_ptr cinfo)
/* Overall image size in MCUs */
cinfo->MCUs_per_row = (JDIMENSION)
- jdiv_round_up((long) cinfo->_jpeg_width,
- (long) (cinfo->max_h_samp_factor*DCTSIZE));
+ jdiv_round_up((long)cinfo->_jpeg_width,
+ (long)(cinfo->max_h_samp_factor * DCTSIZE));
cinfo->MCU_rows_in_scan = (JDIMENSION)
- jdiv_round_up((long) cinfo->_jpeg_height,
- (long) (cinfo->max_v_samp_factor*DCTSIZE));
+ jdiv_round_up((long)cinfo->_jpeg_height,
+ (long)(cinfo->max_v_samp_factor * DCTSIZE));
cinfo->blocks_in_MCU = 0;
@@ -410,10 +411,10 @@ per_scan_setup (j_compress_ptr cinfo)
compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height;
compptr->MCU_sample_width = compptr->MCU_width * DCTSIZE;
/* Figure number of non-dummy blocks in last MCU column & row */
- tmp = (int) (compptr->width_in_blocks % compptr->MCU_width);
+ tmp = (int)(compptr->width_in_blocks % compptr->MCU_width);
if (tmp == 0) tmp = compptr->MCU_width;
compptr->last_col_width = tmp;
- tmp = (int) (compptr->height_in_blocks % compptr->MCU_height);
+ tmp = (int)(compptr->height_in_blocks % compptr->MCU_height);
if (tmp == 0) tmp = compptr->MCU_height;
compptr->last_row_height = tmp;
/* Prepare array describing MCU composition */
@@ -430,8 +431,8 @@ per_scan_setup (j_compress_ptr cinfo)
/* Convert restart specified in rows to actual MCU count. */
/* Note that count must fit in 16 bits, so we provide limiting. */
if (cinfo->restart_in_rows > 0) {
- long nominal = (long) cinfo->restart_in_rows * (long) cinfo->MCUs_per_row;
- cinfo->restart_interval = (unsigned int) MIN(nominal, 65535L);
+ long nominal = (long)cinfo->restart_in_rows * (long)cinfo->MCUs_per_row;
+ cinfo->restart_interval = (unsigned int)MIN(nominal, 65535L);
}
}
@@ -445,9 +446,9 @@ per_scan_setup (j_compress_ptr cinfo)
*/
METHODDEF(void)
-prepare_for_pass (j_compress_ptr cinfo)
+prepare_for_pass(j_compress_ptr cinfo)
{
- my_master_ptr master = (my_master_ptr) cinfo->master;
+ my_master_ptr master = (my_master_ptr)cinfo->master;
switch (master->pass_type) {
case main_pass:
@@ -456,7 +457,7 @@ prepare_for_pass (j_compress_ptr cinfo)
*/
select_scan_parameters(cinfo);
per_scan_setup(cinfo);
- if (! cinfo->raw_data_in) {
+ if (!cinfo->raw_data_in) {
(*cinfo->cconvert->start_pass) (cinfo);
(*cinfo->downsample->start_pass) (cinfo);
(*cinfo->prep->start_pass) (cinfo, JBUF_PASS_THRU);
@@ -496,7 +497,7 @@ prepare_for_pass (j_compress_ptr cinfo)
case output_pass:
/* Do a data-output pass. */
/* We need not repeat per-scan setup if prior optimization pass did it. */
- if (! cinfo->optimize_coding) {
+ if (!cinfo->optimize_coding) {
select_scan_parameters(cinfo);
per_scan_setup(cinfo);
}
@@ -512,7 +513,7 @@ prepare_for_pass (j_compress_ptr cinfo)
ERREXIT(cinfo, JERR_NOT_COMPILED);
}
- master->pub.is_last_pass = (master->pass_number == master->total_passes-1);
+ master->pub.is_last_pass = (master->pass_number == master->total_passes - 1);
/* Set up progress monitor's pass info if present */
if (cinfo->progress != NULL) {
@@ -533,7 +534,7 @@ prepare_for_pass (j_compress_ptr cinfo)
*/
METHODDEF(void)
-pass_startup (j_compress_ptr cinfo)
+pass_startup(j_compress_ptr cinfo)
{
cinfo->master->call_pass_startup = FALSE; /* reset flag so call only once */
@@ -547,9 +548,9 @@ pass_startup (j_compress_ptr cinfo)
*/
METHODDEF(void)
-finish_pass_master (j_compress_ptr cinfo)
+finish_pass_master(j_compress_ptr cinfo)
{
- my_master_ptr master = (my_master_ptr) cinfo->master;
+ my_master_ptr master = (my_master_ptr)cinfo->master;
/* The entropy coder always needs an end-of-pass call,
* either to analyze statistics or to flush its output buffer.
@@ -563,7 +564,7 @@ finish_pass_master (j_compress_ptr cinfo)
* or output of scan 1 (if no optimization).
*/
master->pass_type = output_pass;
- if (! cinfo->optimize_coding)
+ if (!cinfo->optimize_coding)
master->scan_number++;
break;
case huff_opt_pass:
@@ -587,14 +588,14 @@ finish_pass_master (j_compress_ptr cinfo)
*/
GLOBAL(void)
-jinit_c_master_control (j_compress_ptr cinfo, boolean transcode_only)
+jinit_c_master_control(j_compress_ptr cinfo, boolean transcode_only)
{
my_master_ptr master;
master = (my_master_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- sizeof(my_comp_master));
- cinfo->master = (struct jpeg_comp_master *) master;
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
+ sizeof(my_comp_master));
+ cinfo->master = (struct jpeg_comp_master *)master;
master->pub.prepare_for_pass = prepare_for_pass;
master->pub.pass_startup = pass_startup;
master->pub.finish_pass = finish_pass_master;
diff --git a/src/3rdparty/libjpeg/src/jcomapi.c b/src/3rdparty/libjpeg/src/jcomapi.c
index 6e5bf3dba9..efbb8357b0 100644
--- a/src/3rdparty/libjpeg/src/jcomapi.c
+++ b/src/3rdparty/libjpeg/src/jcomapi.c
@@ -29,7 +29,7 @@
*/
GLOBAL(void)
-jpeg_abort (j_common_ptr cinfo)
+jpeg_abort(j_common_ptr cinfo)
{
int pool;
@@ -40,7 +40,7 @@ jpeg_abort (j_common_ptr cinfo)
/* Releasing pools in reverse order might help avoid fragmentation
* with some (brain-damaged) malloc libraries.
*/
- for (pool = JPOOL_NUMPOOLS-1; pool > JPOOL_PERMANENT; pool--) {
+ for (pool = JPOOL_NUMPOOLS - 1; pool > JPOOL_PERMANENT; pool--) {
(*cinfo->mem->free_pool) (cinfo, pool);
}
@@ -50,7 +50,7 @@ jpeg_abort (j_common_ptr cinfo)
/* Try to keep application from accessing now-deleted marker list.
* A bit kludgy to do it here, but this is the most central place.
*/
- ((j_decompress_ptr) cinfo)->marker_list = NULL;
+ ((j_decompress_ptr)cinfo)->marker_list = NULL;
} else {
cinfo->global_state = CSTATE_START;
}
@@ -69,7 +69,7 @@ jpeg_abort (j_common_ptr cinfo)
*/
GLOBAL(void)
-jpeg_destroy (j_common_ptr cinfo)
+jpeg_destroy(j_common_ptr cinfo)
{
/* We need only tell the memory manager to release everything. */
/* NB: mem pointer is NULL if memory mgr failed to initialize. */
@@ -86,7 +86,7 @@ jpeg_destroy (j_common_ptr cinfo)
*/
GLOBAL(JQUANT_TBL *)
-jpeg_alloc_quant_table (j_common_ptr cinfo)
+jpeg_alloc_quant_table(j_common_ptr cinfo)
{
JQUANT_TBL *tbl;
@@ -98,7 +98,7 @@ jpeg_alloc_quant_table (j_common_ptr cinfo)
GLOBAL(JHUFF_TBL *)
-jpeg_alloc_huff_table (j_common_ptr cinfo)
+jpeg_alloc_huff_table(j_common_ptr cinfo)
{
JHUFF_TBL *tbl;
diff --git a/src/3rdparty/libjpeg/src/jconfig.h b/src/3rdparty/libjpeg/src/jconfig.h
deleted file mode 100644
index 808f87fcd4..0000000000
--- a/src/3rdparty/libjpeg/src/jconfig.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * jconfig.txt
- *
- * This file was part of the Independent JPEG Group's software:
- * Copyright (C) 1991-1994, Thomas G. Lane.
- * It was modified by The libjpeg-turbo Project to include only code relevant
- * to libjpeg-turbo.
- * For conditions of distribution and use, see the accompanying README.ijg
- * file.
- *
- * This file documents the configuration options that are required to
- * customize the JPEG software for a particular system.
- *
- * The actual configuration options for a particular installation are stored
- * in jconfig.h. On many machines, jconfig.h can be generated automatically
- * or copied from one of the "canned" jconfig files that we supply. But if
- * you need to generate a jconfig.h file by hand, this file tells you how.
- *
- * DO NOT EDIT THIS FILE --- IT WON'T ACCOMPLISH ANYTHING.
- * EDIT A COPY NAMED JCONFIG.H.
- */
-
-
-/*
- * These symbols indicate the properties of your machine or compiler.
- * #define the symbol if yes, #undef it if no.
- */
-
-/* Does your compiler support the declaration "unsigned char" ?
- * How about "unsigned short" ?
- */
-#define HAVE_UNSIGNED_CHAR
-#define HAVE_UNSIGNED_SHORT
-
-/* Define "void" as "char" if your compiler doesn't know about type void.
- * NOTE: be sure to define void such that "void *" represents the most general
- * pointer type, e.g., that returned by malloc().
- */
-/* #define void char */
-
-/* Define "const" as empty if your compiler doesn't know the "const" keyword.
- */
-/* #define const */
-
-/* Define this if an ordinary "char" type is unsigned.
- * If you're not sure, leaving it undefined will work at some cost in speed.
- * If you defined HAVE_UNSIGNED_CHAR then the speed difference is minimal.
- */
-#undef __CHAR_UNSIGNED__
-
-/* Define this if your system has an ANSI-conforming <stddef.h> file.
- */
-#define HAVE_STDDEF_H
-
-/* Define this if your system has an ANSI-conforming <stdlib.h> file.
- */
-#define HAVE_STDLIB_H
-
-/* Define this if your system does not have an ANSI/SysV <string.h>,
- * but does have a BSD-style <strings.h>.
- */
-#undef NEED_BSD_STRINGS
-
-/* Define this if your system does not provide typedef size_t in any of the
- * ANSI-standard places (stddef.h, stdlib.h, or stdio.h), but places it in
- * <sys/types.h> instead.
- */
-#undef NEED_SYS_TYPES_H
-
-/* Although a real ANSI C compiler can deal perfectly well with pointers to
- * unspecified structures (see "incomplete types" in the spec), a few pre-ANSI
- * and pseudo-ANSI compilers get confused. To keep one of these bozos happy,
- * define INCOMPLETE_TYPES_BROKEN. This is not recommended unless you
- * actually get "missing structure definition" warnings or errors while
- * compiling the JPEG code.
- */
-#undef INCOMPLETE_TYPES_BROKEN
-
-/* Define "boolean" as unsigned char, not int, on Windows systems.
- */
-#ifdef _WIN32
-#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
-typedef unsigned char boolean;
-#endif
-#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
-#endif
-
-
-/*
- * The following options affect code selection within the JPEG library,
- * but they don't need to be visible to applications using the library.
- * To minimize application namespace pollution, the symbols won't be
- * defined unless JPEG_INTERNALS has been defined.
- */
-
-#ifdef JPEG_INTERNALS
-
-/* Define this if your compiler implements ">>" on signed values as a logical
- * (unsigned) shift; leave it undefined if ">>" is a signed (arithmetic) shift,
- * which is the normal and rational definition.
- */
-#undef RIGHT_SHIFT_IS_UNSIGNED
-
-
-#endif /* JPEG_INTERNALS */
-
-
-/*
- * The remaining options do not affect the JPEG library proper,
- * but only the sample applications cjpeg/djpeg (see cjpeg.c, djpeg.c).
- * Other applications can ignore these.
- */
-
-#ifdef JPEG_CJPEG_DJPEG
-
-/* These defines indicate which image (non-JPEG) file formats are allowed. */
-
-#define BMP_SUPPORTED /* BMP image file format */
-#define GIF_SUPPORTED /* GIF image file format */
-#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */
-#undef RLE_SUPPORTED /* Utah RLE image file format */
-#define TARGA_SUPPORTED /* Targa image file format */
-
-/* Define this if you want to name both input and output files on the command
- * line, rather than using stdout and optionally stdin. You MUST do this if
- * your system can't cope with binary I/O to stdin/stdout. See comments at
- * head of cjpeg.c or djpeg.c.
- */
-#undef TWO_FILE_COMMANDLINE
-
-/* By default, we open image files with fopen(...,"rb") or fopen(...,"wb").
- * This is necessary on systems that distinguish text files from binary files,
- * and is harmless on most systems that don't. If you have one of the rare
- * systems that complains about the "b" spec, define this symbol.
- */
-#undef DONT_USE_B_MODE
-
-/* Define this if you want percent-done progress reports from cjpeg/djpeg.
- */
-#undef PROGRESS_REPORT
-
-
-#endif /* JPEG_CJPEG_DJPEG */
diff --git a/src/3rdparty/libjpeg/src/jconfig.h.in b/src/3rdparty/libjpeg/src/jconfig.h.in
new file mode 100644
index 0000000000..28427548e8
--- /dev/null
+++ b/src/3rdparty/libjpeg/src/jconfig.h.in
@@ -0,0 +1,73 @@
+/* Version ID for the JPEG library.
+ * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60".
+ */
+#define JPEG_LIB_VERSION @JPEG_LIB_VERSION@
+
+/* libjpeg-turbo version */
+#define LIBJPEG_TURBO_VERSION @VERSION@
+
+/* libjpeg-turbo version in integer form */
+#define LIBJPEG_TURBO_VERSION_NUMBER @LIBJPEG_TURBO_VERSION_NUMBER@
+
+/* Support arithmetic encoding */
+#cmakedefine C_ARITH_CODING_SUPPORTED
+
+/* Support arithmetic decoding */
+#cmakedefine D_ARITH_CODING_SUPPORTED
+
+/* Support in-memory source/destination managers */
+#cmakedefine MEM_SRCDST_SUPPORTED
+
+/* Use accelerated SIMD routines. */
+#cmakedefine WITH_SIMD
+
+/*
+ * Define BITS_IN_JSAMPLE as either
+ * 8 for 8-bit sample values (the usual setting)
+ * 12 for 12-bit sample values
+ * Only 8 and 12 are legal data precisions for lossy JPEG according to the
+ * JPEG standard, and the IJG code does not support anything else!
+ * We do not support run-time selection of data precision, sorry.
+ */
+
+#define BITS_IN_JSAMPLE @BITS_IN_JSAMPLE@ /* use 8 or 12 */
+
+/* Define to 1 if you have the <locale.h> header file. */
+#cmakedefine HAVE_LOCALE_H
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#cmakedefine HAVE_STDDEF_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#cmakedefine HAVE_STDLIB_H
+
+/* Define if you need to include <sys/types.h> to get size_t. */
+#cmakedefine NEED_SYS_TYPES_H
+
+/* Define if you have BSD-like bzero and bcopy in <strings.h> rather than
+ memset/memcpy in <string.h>. */
+#cmakedefine NEED_BSD_STRINGS
+
+/* Define to 1 if the system has the type `unsigned char'. */
+#cmakedefine HAVE_UNSIGNED_CHAR
+
+/* Define to 1 if the system has the type `unsigned short'. */
+#cmakedefine HAVE_UNSIGNED_SHORT
+
+/* Compiler does not support pointers to undefined structures. */
+#cmakedefine INCOMPLETE_TYPES_BROKEN
+
+/* Define if your (broken) compiler shifts signed values as if they were
+ unsigned. */
+#cmakedefine RIGHT_SHIFT_IS_UNSIGNED
+
+/* Define to 1 if type `char' is unsigned and you are not using gcc. */
+#ifndef __CHAR_UNSIGNED__
+ #cmakedefine __CHAR_UNSIGNED__
+#endif
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
diff --git a/src/3rdparty/libjpeg/src/jconfigint.h b/src/3rdparty/libjpeg/src/jconfigint.h
deleted file mode 100644
index 2131bf52a1..0000000000
--- a/src/3rdparty/libjpeg/src/jconfigint.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#define VERSION "@VERSION@"
-#define BUILD "@BUILD@"
-#define PACKAGE_NAME "@CMAKE_PROJECT_NAME@"
-
-#ifndef INLINE
-#if defined(__GNUC__)
-#define INLINE inline __attribute__((always_inline))
-#elif defined(_MSC_VER)
-#define INLINE __forceinline
-#else
-#define INLINE
-#endif
-#endif
diff --git a/src/3rdparty/libjpeg/src/jconfigint.h.in b/src/3rdparty/libjpeg/src/jconfigint.h.in
new file mode 100644
index 0000000000..55df053676
--- /dev/null
+++ b/src/3rdparty/libjpeg/src/jconfigint.h.in
@@ -0,0 +1,31 @@
+/* libjpeg-turbo build number */
+#define BUILD "@BUILD@"
+
+/* Compiler's inline keyword */
+#undef inline
+
+/* How to obtain function inlining. */
+#define INLINE @INLINE@
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "@CMAKE_PROJECT_NAME@"
+
+/* Version number of package */
+#define VERSION "@VERSION@"
+
+/* The size of `size_t', as computed by sizeof. */
+#define SIZEOF_SIZE_T @SIZE_T@
+
+/* Define if your compiler has __builtin_ctzl() and sizeof(unsigned long) == sizeof(size_t). */
+#cmakedefine HAVE_BUILTIN_CTZL
+
+/* Define to 1 if you have the <intrin.h> header file. */
+#cmakedefine HAVE_INTRIN_H
+
+#if defined(_MSC_VER) && defined(HAVE_INTRIN_H)
+#if (SIZEOF_SIZE_T == 8)
+#define HAVE_BITSCANFORWARD64
+#elif (SIZEOF_SIZE_T == 4)
+#define HAVE_BITSCANFORWARD
+#endif
+#endif
diff --git a/src/3rdparty/libjpeg/src/jcparam.c b/src/3rdparty/libjpeg/src/jcparam.c
index 18b2d487ae..5bc7174dcb 100644
--- a/src/3rdparty/libjpeg/src/jcparam.c
+++ b/src/3rdparty/libjpeg/src/jcparam.c
@@ -5,7 +5,7 @@
* Copyright (C) 1991-1998, Thomas G. Lane.
* Modified 2003-2008 by Guido Vollbeding.
* libjpeg-turbo Modifications:
- * Copyright (C) 2009-2011, D. R. Commander.
+ * Copyright (C) 2009-2011, 2018, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@@ -25,9 +25,9 @@
*/
GLOBAL(void)
-jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl,
- const unsigned int *basic_table,
- int scale_factor, boolean force_baseline)
+jpeg_add_quant_table(j_compress_ptr cinfo, int which_tbl,
+ const unsigned int *basic_table, int scale_factor,
+ boolean force_baseline)
/* Define a quantization table equal to the basic_table times
* a scale factor (given as a percentage).
* If force_baseline is TRUE, the computed quantization table entries
@@ -45,19 +45,19 @@ jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl,
if (which_tbl < 0 || which_tbl >= NUM_QUANT_TBLS)
ERREXIT1(cinfo, JERR_DQT_INDEX, which_tbl);
- qtblptr = & cinfo->quant_tbl_ptrs[which_tbl];
+ qtblptr = &cinfo->quant_tbl_ptrs[which_tbl];
if (*qtblptr == NULL)
- *qtblptr = jpeg_alloc_quant_table((j_common_ptr) cinfo);
+ *qtblptr = jpeg_alloc_quant_table((j_common_ptr)cinfo);
for (i = 0; i < DCTSIZE2; i++) {
- temp = ((long) basic_table[i] * scale_factor + 50L) / 100L;
+ temp = ((long)basic_table[i] * scale_factor + 50L) / 100L;
/* limit the values to the valid range */
if (temp <= 0L) temp = 1L;
if (temp > 32767L) temp = 32767L; /* max quantizer needed for 12 bits */
if (force_baseline && temp > 255L)
temp = 255L; /* limit to baseline range if requested */
- (*qtblptr)->quantval[i] = (UINT16) temp;
+ (*qtblptr)->quantval[i] = (UINT16)temp;
}
/* Initialize sent_table FALSE so table will be written to JPEG file. */
@@ -65,7 +65,8 @@ jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl,
}
-/* These are the sample quantization tables given in JPEG spec section K.1.
+/* These are the sample quantization tables given in Annex K (Clause K.1) of
+ * Recommendation ITU-T T.81 (1992) | ISO/IEC 10918-1:1994.
* The spec says that the values given produce "good" quality, and
* when divided by 2, "very good" quality.
*/
@@ -93,7 +94,7 @@ static const unsigned int std_chrominance_quant_tbl[DCTSIZE2] = {
#if JPEG_LIB_VERSION >= 70
GLOBAL(void)
-jpeg_default_qtables (j_compress_ptr cinfo, boolean force_baseline)
+jpeg_default_qtables(j_compress_ptr cinfo, boolean force_baseline)
/* Set or change the 'quality' (quantization) setting, using default tables
* and straight percentage-scaling quality scales.
* This entry point allows different scalings for luminance and chrominance.
@@ -109,8 +110,8 @@ jpeg_default_qtables (j_compress_ptr cinfo, boolean force_baseline)
GLOBAL(void)
-jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor,
- boolean force_baseline)
+jpeg_set_linear_quality(j_compress_ptr cinfo, int scale_factor,
+ boolean force_baseline)
/* Set or change the 'quality' (quantization) setting, using default tables
* and a straight percentage-scaling quality scale. In most cases it's better
* to use jpeg_set_quality (below); this entry point is provided for
@@ -126,7 +127,7 @@ jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor,
GLOBAL(int)
-jpeg_quality_scaling (int quality)
+jpeg_quality_scaling(int quality)
/* Convert a user-specified quality rating to a percentage scaling factor
* for an underlying quantization table, using our recommended scaling curve.
* The input 'quality' factor should be 0 (terrible) to 100 (very good).
@@ -145,14 +146,14 @@ jpeg_quality_scaling (int quality)
if (quality < 50)
quality = 5000 / quality;
else
- quality = 200 - quality*2;
+ quality = 200 - quality * 2;
return quality;
}
GLOBAL(void)
-jpeg_set_quality (j_compress_ptr cinfo, int quality, boolean force_baseline)
+jpeg_set_quality(j_compress_ptr cinfo, int quality, boolean force_baseline)
/* Set or change the 'quality' (quantization) setting, using default tables.
* This is the standard quality-adjusting entry point for typical user
* interfaces; only those who want detailed control over quantization tables
@@ -178,7 +179,7 @@ jpeg_set_quality (j_compress_ptr cinfo, int quality, boolean force_baseline)
*/
GLOBAL(void)
-jpeg_set_defaults (j_compress_ptr cinfo)
+jpeg_set_defaults(j_compress_ptr cinfo)
{
int i;
@@ -192,7 +193,7 @@ jpeg_set_defaults (j_compress_ptr cinfo)
*/
if (cinfo->comp_info == NULL)
cinfo->comp_info = (jpeg_component_info *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
MAX_COMPONENTS * sizeof(jpeg_component_info));
/* Initialize everything not dependent on the color space */
@@ -205,7 +206,7 @@ jpeg_set_defaults (j_compress_ptr cinfo)
/* Set up two quantization tables using default quality of 75 */
jpeg_set_quality(cinfo, 75, TRUE);
/* Set up two Huffman tables */
- std_huff_tables((j_common_ptr) cinfo);
+ std_huff_tables((j_common_ptr)cinfo);
/* Initialize default arithmetic coding conditioning */
for (i = 0; i < NUM_ARITH_TBLS; i++) {
@@ -278,7 +279,7 @@ jpeg_set_defaults (j_compress_ptr cinfo)
*/
GLOBAL(void)
-jpeg_default_colorspace (j_compress_ptr cinfo)
+jpeg_default_colorspace(j_compress_ptr cinfo)
{
switch (cinfo->in_color_space) {
case JCS_GRAYSCALE:
@@ -320,12 +321,12 @@ jpeg_default_colorspace (j_compress_ptr cinfo)
*/
GLOBAL(void)
-jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace)
+jpeg_set_colorspace(j_compress_ptr cinfo, J_COLOR_SPACE colorspace)
{
jpeg_component_info *compptr;
int ci;
-#define SET_COMP(index,id,hsamp,vsamp,quant,dctbl,actbl) \
+#define SET_COMP(index, id, hsamp, vsamp, quant, dctbl, actbl) \
(compptr = &cinfo->comp_info[index], \
compptr->component_id = (id), \
compptr->h_samp_factor = (hsamp), \
@@ -352,39 +353,39 @@ jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace)
cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */
cinfo->num_components = 1;
/* JFIF specifies component ID 1 */
- SET_COMP(0, 1, 1,1, 0, 0,0);
+ SET_COMP(0, 1, 1, 1, 0, 0, 0);
break;
case JCS_RGB:
cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag RGB */
cinfo->num_components = 3;
- SET_COMP(0, 0x52 /* 'R' */, 1,1, 0, 0,0);
- SET_COMP(1, 0x47 /* 'G' */, 1,1, 0, 0,0);
- SET_COMP(2, 0x42 /* 'B' */, 1,1, 0, 0,0);
+ SET_COMP(0, 0x52 /* 'R' */, 1, 1, 0, 0, 0);
+ SET_COMP(1, 0x47 /* 'G' */, 1, 1, 0, 0, 0);
+ SET_COMP(2, 0x42 /* 'B' */, 1, 1, 0, 0, 0);
break;
case JCS_YCbCr:
cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */
cinfo->num_components = 3;
/* JFIF specifies component IDs 1,2,3 */
/* We default to 2x2 subsamples of chrominance */
- SET_COMP(0, 1, 2,2, 0, 0,0);
- SET_COMP(1, 2, 1,1, 1, 1,1);
- SET_COMP(2, 3, 1,1, 1, 1,1);
+ SET_COMP(0, 1, 2, 2, 0, 0, 0);
+ SET_COMP(1, 2, 1, 1, 1, 1, 1);
+ SET_COMP(2, 3, 1, 1, 1, 1, 1);
break;
case JCS_CMYK:
cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag CMYK */
cinfo->num_components = 4;
- SET_COMP(0, 0x43 /* 'C' */, 1,1, 0, 0,0);
- SET_COMP(1, 0x4D /* 'M' */, 1,1, 0, 0,0);
- SET_COMP(2, 0x59 /* 'Y' */, 1,1, 0, 0,0);
- SET_COMP(3, 0x4B /* 'K' */, 1,1, 0, 0,0);
+ SET_COMP(0, 0x43 /* 'C' */, 1, 1, 0, 0, 0);
+ SET_COMP(1, 0x4D /* 'M' */, 1, 1, 0, 0, 0);
+ SET_COMP(2, 0x59 /* 'Y' */, 1, 1, 0, 0, 0);
+ SET_COMP(3, 0x4B /* 'K' */, 1, 1, 0, 0, 0);
break;
case JCS_YCCK:
cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag YCCK */
cinfo->num_components = 4;
- SET_COMP(0, 1, 2,2, 0, 0,0);
- SET_COMP(1, 2, 1,1, 1, 1,1);
- SET_COMP(2, 3, 1,1, 1, 1,1);
- SET_COMP(3, 4, 2,2, 0, 0,0);
+ SET_COMP(0, 1, 2, 2, 0, 0, 0);
+ SET_COMP(1, 2, 1, 1, 1, 1, 1);
+ SET_COMP(2, 3, 1, 1, 1, 1, 1);
+ SET_COMP(3, 4, 2, 2, 0, 0, 0);
break;
case JCS_UNKNOWN:
cinfo->num_components = cinfo->input_components;
@@ -392,7 +393,7 @@ jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace)
ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
MAX_COMPONENTS);
for (ci = 0; ci < cinfo->num_components; ci++) {
- SET_COMP(ci, ci, 1,1, 0, 0,0);
+ SET_COMP(ci, ci, 1, 1, 0, 0, 0);
}
break;
default:
@@ -404,8 +405,7 @@ jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace)
#ifdef C_PROGRESSIVE_SUPPORTED
LOCAL(jpeg_scan_info *)
-fill_a_scan (jpeg_scan_info *scanptr, int ci,
- int Ss, int Se, int Ah, int Al)
+fill_a_scan(jpeg_scan_info *scanptr, int ci, int Ss, int Se, int Ah, int Al)
/* Support routine: generate one scan for specified component */
{
scanptr->comps_in_scan = 1;
@@ -419,8 +419,7 @@ fill_a_scan (jpeg_scan_info *scanptr, int ci,
}
LOCAL(jpeg_scan_info *)
-fill_scans (jpeg_scan_info *scanptr, int ncomps,
- int Ss, int Se, int Ah, int Al)
+fill_scans(jpeg_scan_info *scanptr, int ncomps, int Ss, int Se, int Ah, int Al)
/* Support routine: generate one scan for each component */
{
int ci;
@@ -438,7 +437,7 @@ fill_scans (jpeg_scan_info *scanptr, int ncomps,
}
LOCAL(jpeg_scan_info *)
-fill_dc_scans (jpeg_scan_info *scanptr, int ncomps, int Ah, int Al)
+fill_dc_scans(jpeg_scan_info *scanptr, int ncomps, int Ah, int Al)
/* Support routine: generate interleaved DC scan if possible, else N scans */
{
int ci;
@@ -466,7 +465,7 @@ fill_dc_scans (jpeg_scan_info *scanptr, int ncomps, int Ah, int Al)
*/
GLOBAL(void)
-jpeg_simple_progression (j_compress_ptr cinfo)
+jpeg_simple_progression(j_compress_ptr cinfo)
{
int ncomps = cinfo->num_components;
int nscans;
@@ -498,7 +497,7 @@ jpeg_simple_progression (j_compress_ptr cinfo)
if (cinfo->script_space == NULL || cinfo->script_space_size < nscans) {
cinfo->script_space_size = MAX(nscans, 10);
cinfo->script_space = (jpeg_scan_info *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
cinfo->script_space_size * sizeof(jpeg_scan_info));
}
scanptr = cinfo->script_space;
diff --git a/src/3rdparty/libjpeg/src/jcphuff.c b/src/3rdparty/libjpeg/src/jcphuff.c
index 046e2e18d4..024d3af0fb 100644
--- a/src/3rdparty/libjpeg/src/jcphuff.c
+++ b/src/3rdparty/libjpeg/src/jcphuff.c
@@ -4,7 +4,8 @@
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1995-1997, Thomas G. Lane.
* libjpeg-turbo Modifications:
- * Copyright (C) 2015, D. R. Commander.
+ * Copyright (C) 2011, 2015, 2018, D. R. Commander.
+ * Copyright (C) 2016, 2018, Matthieu Darbois.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@@ -18,15 +19,69 @@
#define JPEG_INTERNALS
#include "jinclude.h"
#include "jpeglib.h"
-#include "jchuff.h" /* Declarations shared with jchuff.c */
+#include "jsimd.h"
+#include "jconfigint.h"
+#include <limits.h>
+
+#ifdef HAVE_INTRIN_H
+#include <intrin.h>
+#ifdef _MSC_VER
+#ifdef HAVE_BITSCANFORWARD64
+#pragma intrinsic(_BitScanForward64)
+#endif
+#ifdef HAVE_BITSCANFORWARD
+#pragma intrinsic(_BitScanForward)
+#endif
+#endif
+#endif
#ifdef C_PROGRESSIVE_SUPPORTED
+/*
+ * NOTE: If USE_CLZ_INTRINSIC is defined, then clz/bsr instructions will be
+ * used for bit counting rather than the lookup table. This will reduce the
+ * memory footprint by 64k, which is important for some mobile applications
+ * that create many isolated instances of libjpeg-turbo (web browsers, for
+ * instance.) This may improve performance on some mobile platforms as well.
+ * This feature is enabled by default only on ARM processors, because some x86
+ * chips have a slow implementation of bsr, and the use of clz/bsr cannot be
+ * shown to have a significant performance impact even on the x86 chips that
+ * have a fast implementation of it. When building for ARMv6, you can
+ * explicitly disable the use of clz/bsr by adding -mthumb to the compiler
+ * flags (this defines __thumb__).
+ */
+
+/* NOTE: Both GCC and Clang define __GNUC__ */
+#if defined __GNUC__ && (defined __arm__ || defined __aarch64__)
+#if !defined __thumb__ || defined __thumb2__
+#define USE_CLZ_INTRINSIC
+#endif
+#endif
+
+#ifdef USE_CLZ_INTRINSIC
+#define JPEG_NBITS_NONZERO(x) (32 - __builtin_clz(x))
+#define JPEG_NBITS(x) (x ? JPEG_NBITS_NONZERO(x) : 0)
+#else
+#include "jpeg_nbits_table.h"
+#define JPEG_NBITS(x) (jpeg_nbits_table[x])
+#define JPEG_NBITS_NONZERO(x) JPEG_NBITS(x)
+#endif
+
+
/* Expanded entropy encoder object for progressive Huffman encoding. */
typedef struct {
struct jpeg_entropy_encoder pub; /* public fields */
+ /* Pointer to routine to prepare data for encode_mcu_AC_first() */
+ void (*AC_first_prepare) (const JCOEF *block,
+ const int *jpeg_natural_order_start, int Sl,
+ int Al, JCOEF *values, size_t *zerobits);
+ /* Pointer to routine to prepare data for encode_mcu_AC_refine() */
+ int (*AC_refine_prepare) (const JCOEF *block,
+ const int *jpeg_natural_order_start, int Sl,
+ int Al, JCOEF *absvalues, size_t *bits);
+
/* Mode flag: TRUE for optimization, FALSE for actual data output */
boolean gather_statistics;
@@ -79,26 +134,60 @@ typedef phuff_entropy_encoder *phuff_entropy_ptr;
#ifdef RIGHT_SHIFT_IS_UNSIGNED
#define ISHIFT_TEMPS int ishift_temp;
-#define IRIGHT_SHIFT(x,shft) \
- ((ishift_temp = (x)) < 0 ? \
- (ishift_temp >> (shft)) | ((~0) << (16-(shft))) : \
- (ishift_temp >> (shft)))
+#define IRIGHT_SHIFT(x, shft) \
+ ((ishift_temp = (x)) < 0 ? \
+ (ishift_temp >> (shft)) | ((~0) << (16 - (shft))) : \
+ (ishift_temp >> (shft)))
#else
#define ISHIFT_TEMPS
-#define IRIGHT_SHIFT(x,shft) ((x) >> (shft))
+#define IRIGHT_SHIFT(x, shft) ((x) >> (shft))
#endif
+#define PAD(v, p) ((v + (p) - 1) & (~((p) - 1)))
+
/* Forward declarations */
-METHODDEF(boolean) encode_mcu_DC_first (j_compress_ptr cinfo,
+METHODDEF(boolean) encode_mcu_DC_first(j_compress_ptr cinfo,
+ JBLOCKROW *MCU_data);
+METHODDEF(void) encode_mcu_AC_first_prepare
+ (const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al,
+ JCOEF *values, size_t *zerobits);
+METHODDEF(boolean) encode_mcu_AC_first(j_compress_ptr cinfo,
+ JBLOCKROW *MCU_data);
+METHODDEF(boolean) encode_mcu_DC_refine(j_compress_ptr cinfo,
JBLOCKROW *MCU_data);
-METHODDEF(boolean) encode_mcu_AC_first (j_compress_ptr cinfo,
+METHODDEF(int) encode_mcu_AC_refine_prepare
+ (const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al,
+ JCOEF *absvalues, size_t *bits);
+METHODDEF(boolean) encode_mcu_AC_refine(j_compress_ptr cinfo,
JBLOCKROW *MCU_data);
-METHODDEF(boolean) encode_mcu_DC_refine (j_compress_ptr cinfo,
- JBLOCKROW *MCU_data);
-METHODDEF(boolean) encode_mcu_AC_refine (j_compress_ptr cinfo,
- JBLOCKROW *MCU_data);
-METHODDEF(void) finish_pass_phuff (j_compress_ptr cinfo);
-METHODDEF(void) finish_pass_gather_phuff (j_compress_ptr cinfo);
+METHODDEF(void) finish_pass_phuff(j_compress_ptr cinfo);
+METHODDEF(void) finish_pass_gather_phuff(j_compress_ptr cinfo);
+
+
+/* Count bit loop zeroes */
+INLINE
+METHODDEF(int)
+count_zeroes(size_t *x)
+{
+ int result;
+#if defined(HAVE_BUILTIN_CTZL)
+ result = __builtin_ctzl(*x);
+ *x >>= result;
+#elif defined(HAVE_BITSCANFORWARD64)
+ _BitScanForward64(&result, *x);
+ *x >>= result;
+#elif defined(HAVE_BITSCANFORWARD)
+ _BitScanForward(&result, *x);
+ *x >>= result;
+#else
+ result = 0;
+ while ((*x & 1) == 0) {
+ ++result;
+ *x >>= 1;
+ }
+#endif
+ return result;
+}
/*
@@ -106,9 +195,9 @@ METHODDEF(void) finish_pass_gather_phuff (j_compress_ptr cinfo);
*/
METHODDEF(void)
-start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics)
+start_pass_phuff(j_compress_ptr cinfo, boolean gather_statistics)
{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
+ phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
boolean is_DC_band;
int ci, tbl;
jpeg_component_info *compptr;
@@ -126,15 +215,23 @@ start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics)
entropy->pub.encode_mcu = encode_mcu_DC_first;
else
entropy->pub.encode_mcu = encode_mcu_AC_first;
+ if (jsimd_can_encode_mcu_AC_first_prepare())
+ entropy->AC_first_prepare = jsimd_encode_mcu_AC_first_prepare;
+ else
+ entropy->AC_first_prepare = encode_mcu_AC_first_prepare;
} else {
if (is_DC_band)
entropy->pub.encode_mcu = encode_mcu_DC_refine;
else {
entropy->pub.encode_mcu = encode_mcu_AC_refine;
+ if (jsimd_can_encode_mcu_AC_refine_prepare())
+ entropy->AC_refine_prepare = jsimd_encode_mcu_AC_refine_prepare;
+ else
+ entropy->AC_refine_prepare = encode_mcu_AC_refine_prepare;
/* AC refinement needs a correction bit buffer */
if (entropy->bit_buffer == NULL)
entropy->bit_buffer = (char *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
MAX_CORR_BITS * sizeof(char));
}
}
@@ -167,14 +264,14 @@ start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics)
/* Note that jpeg_gen_optimal_table expects 257 entries in each table! */
if (entropy->count_ptrs[tbl] == NULL)
entropy->count_ptrs[tbl] = (long *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
257 * sizeof(long));
MEMZERO(entropy->count_ptrs[tbl], 257 * sizeof(long));
} else {
/* Compute derived values for Huffman table */
/* We may do this more than once for a table, but it's not expensive */
jpeg_make_c_derived_tbl(cinfo, is_DC_band, tbl,
- & entropy->derived_tbls[tbl]);
+ &entropy->derived_tbls[tbl]);
}
}
@@ -198,19 +295,20 @@ start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics)
*/
/* Emit a byte */
-#define emit_byte(entropy,val) \
- { *(entropy)->next_output_byte++ = (JOCTET) (val); \
- if (--(entropy)->free_in_buffer == 0) \
- dump_buffer(entropy); }
+#define emit_byte(entropy, val) { \
+ *(entropy)->next_output_byte++ = (JOCTET)(val); \
+ if (--(entropy)->free_in_buffer == 0) \
+ dump_buffer(entropy); \
+}
LOCAL(void)
-dump_buffer (phuff_entropy_ptr entropy)
+dump_buffer(phuff_entropy_ptr entropy)
/* Empty the output buffer; we do not support suspension in this module. */
{
struct jpeg_destination_mgr *dest = entropy->cinfo->dest;
- if (! (*dest->empty_output_buffer) (entropy->cinfo))
+ if (!(*dest->empty_output_buffer) (entropy->cinfo))
ERREXIT(entropy->cinfo, JERR_CANT_SUSPEND);
/* After a successful buffer dump, must reset buffer pointers */
entropy->next_output_byte = dest->next_output_byte;
@@ -227,11 +325,11 @@ dump_buffer (phuff_entropy_ptr entropy)
*/
LOCAL(void)
-emit_bits (phuff_entropy_ptr entropy, unsigned int code, int size)
+emit_bits(phuff_entropy_ptr entropy, unsigned int code, int size)
/* Emit some bits, unless we are in gather mode */
{
/* This routine is heavily used, so it's worth coding tightly. */
- register size_t put_buffer = (size_t) code;
+ register size_t put_buffer = (size_t)code;
register int put_bits = entropy->put_bits;
/* if size is 0, caller used an invalid Huffman table entry */
@@ -241,7 +339,7 @@ emit_bits (phuff_entropy_ptr entropy, unsigned int code, int size)
if (entropy->gather_statistics)
return; /* do nothing if we're only getting stats */
- put_buffer &= (((size_t) 1)<<size) - 1; /* mask off any extra bits in code */
+ put_buffer &= (((size_t)1) << size) - 1; /* mask off any extra bits in code */
put_bits += size; /* new number of bits in buffer */
@@ -250,7 +348,7 @@ emit_bits (phuff_entropy_ptr entropy, unsigned int code, int size)
put_buffer |= entropy->put_buffer; /* and merge with old buffer contents */
while (put_bits >= 8) {
- int c = (int) ((put_buffer >> 16) & 0xFF);
+ int c = (int)((put_buffer >> 16) & 0xFF);
emit_byte(entropy, c);
if (c == 0xFF) { /* need to stuff a zero byte? */
@@ -266,7 +364,7 @@ emit_bits (phuff_entropy_ptr entropy, unsigned int code, int size)
LOCAL(void)
-flush_bits (phuff_entropy_ptr entropy)
+flush_bits(phuff_entropy_ptr entropy)
{
emit_bits(entropy, 0x7F, 7); /* fill any partial byte with ones */
entropy->put_buffer = 0; /* and reset bit-buffer to empty */
@@ -279,7 +377,7 @@ flush_bits (phuff_entropy_ptr entropy)
*/
LOCAL(void)
-emit_symbol (phuff_entropy_ptr entropy, int tbl_no, int symbol)
+emit_symbol(phuff_entropy_ptr entropy, int tbl_no, int symbol)
{
if (entropy->gather_statistics)
entropy->count_ptrs[tbl_no][symbol]++;
@@ -295,14 +393,14 @@ emit_symbol (phuff_entropy_ptr entropy, int tbl_no, int symbol)
*/
LOCAL(void)
-emit_buffered_bits (phuff_entropy_ptr entropy, char *bufstart,
- unsigned int nbits)
+emit_buffered_bits(phuff_entropy_ptr entropy, char *bufstart,
+ unsigned int nbits)
{
if (entropy->gather_statistics)
return; /* no real work */
while (nbits > 0) {
- emit_bits(entropy, (unsigned int) (*bufstart), 1);
+ emit_bits(entropy, (unsigned int)(*bufstart), 1);
bufstart++;
nbits--;
}
@@ -314,15 +412,13 @@ emit_buffered_bits (phuff_entropy_ptr entropy, char *bufstart,
*/
LOCAL(void)
-emit_eobrun (phuff_entropy_ptr entropy)
+emit_eobrun(phuff_entropy_ptr entropy)
{
register int temp, nbits;
if (entropy->EOBRUN > 0) { /* if there is any pending EOBRUN */
temp = entropy->EOBRUN;
- nbits = 0;
- while ((temp >>= 1))
- nbits++;
+ nbits = JPEG_NBITS_NONZERO(temp) - 1;
/* safety check: shouldn't happen given limited correction-bit buffer */
if (nbits > 14)
ERREXIT(entropy->cinfo, JERR_HUFF_MISSING_CODE);
@@ -345,13 +441,13 @@ emit_eobrun (phuff_entropy_ptr entropy)
*/
LOCAL(void)
-emit_restart (phuff_entropy_ptr entropy, int restart_num)
+emit_restart(phuff_entropy_ptr entropy, int restart_num)
{
int ci;
emit_eobrun(entropy);
- if (! entropy->gather_statistics) {
+ if (!entropy->gather_statistics) {
flush_bits(entropy);
emit_byte(entropy, 0xFF);
emit_byte(entropy, JPEG_RST0 + restart_num);
@@ -375,10 +471,10 @@ emit_restart (phuff_entropy_ptr entropy, int restart_num)
*/
METHODDEF(boolean)
-encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
+encode_mcu_DC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
- register int temp, temp2;
+ phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
+ register int temp, temp2, temp3;
register int nbits;
int blkn, ci;
int Al = cinfo->Al;
@@ -403,31 +499,31 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
/* Compute the DC value after the required point transform by Al.
* This is simply an arithmetic right shift.
*/
- temp2 = IRIGHT_SHIFT((int) ((*block)[0]), Al);
+ temp2 = IRIGHT_SHIFT((int)((*block)[0]), Al);
/* DC differences are figured on the point-transformed values. */
temp = temp2 - entropy->last_dc_val[ci];
entropy->last_dc_val[ci] = temp2;
/* Encode the DC coefficient difference per section G.1.2.1 */
- temp2 = temp;
- if (temp < 0) {
- temp = -temp; /* temp is abs value of input */
- /* For a negative input, want temp2 = bitwise complement of abs(input) */
- /* This code assumes we are on a two's complement machine */
- temp2--;
- }
+
+ /* This is a well-known technique for obtaining the absolute value without
+ * a branch. It is derived from an assembly language technique presented
+ * in "How to Optimize for the Pentium Processors", Copyright (c) 1996,
+ * 1997 by Agner Fog.
+ */
+ temp3 = temp >> (CHAR_BIT * sizeof(int) - 1);
+ temp ^= temp3;
+ temp -= temp3; /* temp is abs value of input */
+ /* For a negative input, want temp2 = bitwise complement of abs(input) */
+ temp2 = temp ^ temp3;
/* Find the number of bits needed for the magnitude of the coefficient */
- nbits = 0;
- while (temp) {
- nbits++;
- temp >>= 1;
- }
+ nbits = JPEG_NBITS(temp);
/* Check for out-of-range coefficient values.
* Since we're encoding a difference, the range limit is twice as much.
*/
- if (nbits > MAX_COEF_BITS+1)
+ if (nbits > MAX_COEF_BITS + 1)
ERREXIT(cinfo, JERR_BAD_DCT_COEF);
/* Count/emit the Huffman-coded symbol for the number of bits */
@@ -436,7 +532,7 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
/* Emit that number of bits of the value, if positive, */
/* or the complement of its magnitude, if negative. */
if (nbits) /* emit_bits rejects calls with size 0 */
- emit_bits(entropy, (unsigned int) temp2, nbits);
+ emit_bits(entropy, (unsigned int)temp2, nbits);
}
cinfo->dest->next_output_byte = entropy->next_output_byte;
@@ -457,20 +553,115 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
/*
+ * Data preparation for encode_mcu_AC_first().
+ */
+
+#define COMPUTE_ABSVALUES_AC_FIRST(Sl) { \
+ for (k = 0; k < Sl; k++) { \
+ temp = block[jpeg_natural_order_start[k]]; \
+ if (temp == 0) \
+ continue; \
+ /* We must apply the point transform by Al. For AC coefficients this \
+ * is an integer division with rounding towards 0. To do this portably \
+ * in C, we shift after obtaining the absolute value; so the code is \
+ * interwoven with finding the abs value (temp) and output bits (temp2). \
+ */ \
+ temp2 = temp >> (CHAR_BIT * sizeof(int) - 1); \
+ temp ^= temp2; \
+ temp -= temp2; /* temp is abs value of input */ \
+ temp >>= Al; /* apply the point transform */ \
+ /* Watch out for case that nonzero coef is zero after point transform */ \
+ if (temp == 0) \
+ continue; \
+ /* For a negative coef, want temp2 = bitwise complement of abs(coef) */ \
+ temp2 ^= temp; \
+ values[k] = temp; \
+ values[k + DCTSIZE2] = temp2; \
+ zerobits |= ((size_t)1U) << k; \
+ } \
+}
+
+METHODDEF(void)
+encode_mcu_AC_first_prepare(const JCOEF *block,
+ const int *jpeg_natural_order_start, int Sl,
+ int Al, JCOEF *values, size_t *bits)
+{
+ register int k, temp, temp2;
+ size_t zerobits = 0U;
+ int Sl0 = Sl;
+
+#if SIZEOF_SIZE_T == 4
+ if (Sl0 > 32)
+ Sl0 = 32;
+#endif
+
+ COMPUTE_ABSVALUES_AC_FIRST(Sl0);
+
+ bits[0] = zerobits;
+#if SIZEOF_SIZE_T == 4
+ zerobits = 0U;
+
+ if (Sl > 32) {
+ Sl -= 32;
+ jpeg_natural_order_start += 32;
+ values += 32;
+
+ COMPUTE_ABSVALUES_AC_FIRST(Sl);
+ }
+ bits[1] = zerobits;
+#endif
+}
+
+/*
* MCU encoding for AC initial scan (either spectral selection,
* or first pass of successive approximation).
*/
+#define ENCODE_COEFS_AC_FIRST(label) { \
+ while (zerobits) { \
+ r = count_zeroes(&zerobits); \
+ cvalue += r; \
+label \
+ temp = cvalue[0]; \
+ temp2 = cvalue[DCTSIZE2]; \
+ \
+ /* if run length > 15, must emit special run-length-16 codes (0xF0) */ \
+ while (r > 15) { \
+ emit_symbol(entropy, entropy->ac_tbl_no, 0xF0); \
+ r -= 16; \
+ } \
+ \
+ /* Find the number of bits needed for the magnitude of the coefficient */ \
+ nbits = JPEG_NBITS_NONZERO(temp); /* there must be at least one 1 bit */ \
+ /* Check for out-of-range coefficient values */ \
+ if (nbits > MAX_COEF_BITS) \
+ ERREXIT(cinfo, JERR_BAD_DCT_COEF); \
+ \
+ /* Count/emit Huffman symbol for run length / number of bits */ \
+ emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + nbits); \
+ \
+ /* Emit that number of bits of the value, if positive, */ \
+ /* or the complement of its magnitude, if negative. */ \
+ emit_bits(entropy, (unsigned int)temp2, nbits); \
+ \
+ cvalue++; \
+ zerobits >>= 1; \
+ } \
+}
+
METHODDEF(boolean)
-encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
+encode_mcu_AC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
+ phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
register int temp, temp2;
- register int nbits;
- register int r, k;
- int Se = cinfo->Se;
+ register int nbits, r;
+ int Sl = cinfo->Se - cinfo->Ss + 1;
int Al = cinfo->Al;
- JBLOCKROW block;
+ JCOEF values_unaligned[2 * DCTSIZE2 + 15];
+ JCOEF *values;
+ const JCOEF *cvalue;
+ size_t zerobits;
+ size_t bits[8 / SIZEOF_SIZE_T];
entropy->next_output_byte = cinfo->dest->next_output_byte;
entropy->free_in_buffer = cinfo->dest->free_in_buffer;
@@ -480,66 +671,48 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
if (entropy->restarts_to_go == 0)
emit_restart(entropy, entropy->next_restart_num);
- /* Encode the MCU data block */
- block = MCU_data[0];
+#ifdef WITH_SIMD
+ cvalue = values = (JCOEF *)PAD((size_t)values_unaligned, 16);
+#else
+ /* Not using SIMD, so alignment is not needed */
+ cvalue = values = values_unaligned;
+#endif
- /* Encode the AC coefficients per section G.1.2.2, fig. G.3 */
+ /* Prepare data */
+ entropy->AC_first_prepare(MCU_data[0][0], jpeg_natural_order + cinfo->Ss,
+ Sl, Al, values, bits);
- r = 0; /* r = run length of zeros */
-
- for (k = cinfo->Ss; k <= Se; k++) {
- if ((temp = (*block)[jpeg_natural_order[k]]) == 0) {
- r++;
- continue;
- }
- /* We must apply the point transform by Al. For AC coefficients this
- * is an integer division with rounding towards 0. To do this portably
- * in C, we shift after obtaining the absolute value; so the code is
- * interwoven with finding the abs value (temp) and output bits (temp2).
- */
- if (temp < 0) {
- temp = -temp; /* temp is abs value of input */
- temp >>= Al; /* apply the point transform */
- /* For a negative coef, want temp2 = bitwise complement of abs(coef) */
- temp2 = ~temp;
- } else {
- temp >>= Al; /* apply the point transform */
- temp2 = temp;
- }
- /* Watch out for case that nonzero coef is zero after point transform */
- if (temp == 0) {
- r++;
- continue;
- }
+ zerobits = bits[0];
+#if SIZEOF_SIZE_T == 4
+ zerobits |= bits[1];
+#endif
- /* Emit any pending EOBRUN */
- if (entropy->EOBRUN > 0)
- emit_eobrun(entropy);
- /* if run length > 15, must emit special run-length-16 codes (0xF0) */
- while (r > 15) {
- emit_symbol(entropy, entropy->ac_tbl_no, 0xF0);
- r -= 16;
- }
+ /* Emit any pending EOBRUN */
+ if (zerobits && (entropy->EOBRUN > 0))
+ emit_eobrun(entropy);
- /* Find the number of bits needed for the magnitude of the coefficient */
- nbits = 1; /* there must be at least one 1 bit */
- while ((temp >>= 1))
- nbits++;
- /* Check for out-of-range coefficient values */
- if (nbits > MAX_COEF_BITS)
- ERREXIT(cinfo, JERR_BAD_DCT_COEF);
+#if SIZEOF_SIZE_T == 4
+ zerobits = bits[0];
+#endif
- /* Count/emit Huffman symbol for run length / number of bits */
- emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + nbits);
+ /* Encode the AC coefficients per section G.1.2.2, fig. G.3 */
- /* Emit that number of bits of the value, if positive, */
- /* or the complement of its magnitude, if negative. */
- emit_bits(entropy, (unsigned int) temp2, nbits);
+ ENCODE_COEFS_AC_FIRST((void)0;);
- r = 0; /* reset zero run length */
+#if SIZEOF_SIZE_T == 4
+ zerobits = bits[1];
+ if (zerobits) {
+ int diff = ((values + DCTSIZE2 / 2) - cvalue);
+ r = count_zeroes(&zerobits);
+ r += diff;
+ cvalue += r;
+ goto first_iter_ac_first;
}
- if (r > 0) { /* If there are trailing zeroes, */
+ ENCODE_COEFS_AC_FIRST(first_iter_ac_first:);
+#endif
+
+ if (cvalue < (values + Sl)) { /* If there are trailing zeroes, */
entropy->EOBRUN++; /* count an EOB */
if (entropy->EOBRUN == 0x7FFF)
emit_eobrun(entropy); /* force it out to avoid overflow */
@@ -569,9 +742,9 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
*/
METHODDEF(boolean)
-encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
+encode_mcu_DC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
+ phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
register int temp;
int blkn;
int Al = cinfo->Al;
@@ -591,7 +764,7 @@ encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
/* We simply emit the Al'th bit of the DC coefficient value. */
temp = (*block)[0];
- emit_bits(entropy, (unsigned int) (temp >> Al), 1);
+ emit_bits(entropy, (unsigned int)(temp >> Al), 1);
}
cinfo->dest->next_output_byte = entropy->next_output_byte;
@@ -612,22 +785,148 @@ encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
/*
+ * Data preparation for encode_mcu_AC_refine().
+ */
+
+#define COMPUTE_ABSVALUES_AC_REFINE(Sl, koffset) { \
+ /* It is convenient to make a pre-pass to determine the transformed \
+ * coefficients' absolute values and the EOB position. \
+ */ \
+ for (k = 0; k < Sl; k++) { \
+ temp = block[jpeg_natural_order_start[k]]; \
+ /* We must apply the point transform by Al. For AC coefficients this \
+ * is an integer division with rounding towards 0. To do this portably \
+ * in C, we shift after obtaining the absolute value. \
+ */ \
+ temp2 = temp >> (CHAR_BIT * sizeof(int) - 1); \
+ temp ^= temp2; \
+ temp -= temp2; /* temp is abs value of input */ \
+ temp >>= Al; /* apply the point transform */ \
+ if (temp != 0) { \
+ zerobits |= ((size_t)1U) << k; \
+ signbits |= ((size_t)(temp2 + 1)) << k; \
+ } \
+ absvalues[k] = (JCOEF)temp; /* save abs value for main pass */ \
+ if (temp == 1) \
+ EOB = k + koffset; /* EOB = index of last newly-nonzero coef */ \
+ } \
+}
+
+METHODDEF(int)
+encode_mcu_AC_refine_prepare(const JCOEF *block,
+ const int *jpeg_natural_order_start, int Sl,
+ int Al, JCOEF *absvalues, size_t *bits)
+{
+ register int k, temp, temp2;
+ int EOB = 0;
+ size_t zerobits = 0U, signbits = 0U;
+ int Sl0 = Sl;
+
+#if SIZEOF_SIZE_T == 4
+ if (Sl0 > 32)
+ Sl0 = 32;
+#endif
+
+ COMPUTE_ABSVALUES_AC_REFINE(Sl0, 0);
+
+ bits[0] = zerobits;
+#if SIZEOF_SIZE_T == 8
+ bits[1] = signbits;
+#else
+ bits[2] = signbits;
+
+ zerobits = 0U;
+ signbits = 0U;
+
+ if (Sl > 32) {
+ Sl -= 32;
+ jpeg_natural_order_start += 32;
+ absvalues += 32;
+
+ COMPUTE_ABSVALUES_AC_REFINE(Sl, 32);
+ }
+
+ bits[1] = zerobits;
+ bits[3] = signbits;
+#endif
+
+ return EOB;
+}
+
+
+/*
* MCU encoding for AC successive approximation refinement scan.
*/
+#define ENCODE_COEFS_AC_REFINE(label) { \
+ while (zerobits) { \
+ int idx = count_zeroes(&zerobits); \
+ r += idx; \
+ cabsvalue += idx; \
+ signbits >>= idx; \
+label \
+ /* Emit any required ZRLs, but not if they can be folded into EOB */ \
+ while (r > 15 && (cabsvalue <= EOBPTR)) { \
+ /* emit any pending EOBRUN and the BE correction bits */ \
+ emit_eobrun(entropy); \
+ /* Emit ZRL */ \
+ emit_symbol(entropy, entropy->ac_tbl_no, 0xF0); \
+ r -= 16; \
+ /* Emit buffered correction bits that must be associated with ZRL */ \
+ emit_buffered_bits(entropy, BR_buffer, BR); \
+ BR_buffer = entropy->bit_buffer; /* BE bits are gone now */ \
+ BR = 0; \
+ } \
+ \
+ temp = *cabsvalue++; \
+ \
+ /* If the coef was previously nonzero, it only needs a correction bit. \
+ * NOTE: a straight translation of the spec's figure G.7 would suggest \
+ * that we also need to test r > 15. But if r > 15, we can only get here \
+ * if k > EOB, which implies that this coefficient is not 1. \
+ */ \
+ if (temp > 1) { \
+ /* The correction bit is the next bit of the absolute value. */ \
+ BR_buffer[BR++] = (char)(temp & 1); \
+ signbits >>= 1; \
+ zerobits >>= 1; \
+ continue; \
+ } \
+ \
+ /* Emit any pending EOBRUN and the BE correction bits */ \
+ emit_eobrun(entropy); \
+ \
+ /* Count/emit Huffman symbol for run length / number of bits */ \
+ emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + 1); \
+ \
+ /* Emit output bit for newly-nonzero coef */ \
+ temp = signbits & 1; /* ((*block)[jpeg_natural_order_start[k]] < 0) ? 0 : 1 */ \
+ emit_bits(entropy, (unsigned int)temp, 1); \
+ \
+ /* Emit buffered correction bits that must be associated with this code */ \
+ emit_buffered_bits(entropy, BR_buffer, BR); \
+ BR_buffer = entropy->bit_buffer; /* BE bits are gone now */ \
+ BR = 0; \
+ r = 0; /* reset zero run length */ \
+ signbits >>= 1; \
+ zerobits >>= 1; \
+ } \
+}
+
METHODDEF(boolean)
-encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
+encode_mcu_AC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
- register int temp;
- register int r, k;
- int EOB;
+ phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
+ register int temp, r;
char *BR_buffer;
unsigned int BR;
- int Se = cinfo->Se;
+ int Sl = cinfo->Se - cinfo->Ss + 1;
int Al = cinfo->Al;
- JBLOCKROW block;
- int absvalues[DCTSIZE2];
+ JCOEF absvalues_unaligned[DCTSIZE2 + 15];
+ JCOEF *absvalues;
+ const JCOEF *cabsvalue, *EOBPTR;
+ size_t zerobits, signbits;
+ size_t bits[16 / SIZEOF_SIZE_T];
entropy->next_output_byte = cinfo->dest->next_output_byte;
entropy->free_in_buffer = cinfo->dest->free_in_buffer;
@@ -637,26 +936,17 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
if (entropy->restarts_to_go == 0)
emit_restart(entropy, entropy->next_restart_num);
- /* Encode the MCU data block */
- block = MCU_data[0];
+#ifdef WITH_SIMD
+ cabsvalue = absvalues = (JCOEF *)PAD((size_t)absvalues_unaligned, 16);
+#else
+ /* Not using SIMD, so alignment is not needed */
+ cabsvalue = absvalues = absvalues_unaligned;
+#endif
- /* It is convenient to make a pre-pass to determine the transformed
- * coefficients' absolute values and the EOB position.
- */
- EOB = 0;
- for (k = cinfo->Ss; k <= Se; k++) {
- temp = (*block)[jpeg_natural_order[k]];
- /* We must apply the point transform by Al. For AC coefficients this
- * is an integer division with rounding towards 0. To do this portably
- * in C, we shift after obtaining the absolute value.
- */
- if (temp < 0)
- temp = -temp; /* temp is abs value of input */
- temp >>= Al; /* apply the point transform */
- absvalues[k] = temp; /* save abs value for main pass */
- if (temp == 1)
- EOB = k; /* EOB = index of last newly-nonzero coef */
- }
+ /* Prepare data */
+ EOBPTR = absvalues +
+ entropy->AC_refine_prepare(MCU_data[0][0], jpeg_natural_order + cinfo->Ss,
+ Sl, Al, absvalues, bits);
/* Encode the AC coefficients per section G.1.2.3, fig. G.7 */
@@ -664,52 +954,32 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
BR = 0; /* BR = count of buffered bits added now */
BR_buffer = entropy->bit_buffer + entropy->BE; /* Append bits to buffer */
- for (k = cinfo->Ss; k <= Se; k++) {
- if ((temp = absvalues[k]) == 0) {
- r++;
- continue;
- }
-
- /* Emit any required ZRLs, but not if they can be folded into EOB */
- while (r > 15 && k <= EOB) {
- /* emit any pending EOBRUN and the BE correction bits */
- emit_eobrun(entropy);
- /* Emit ZRL */
- emit_symbol(entropy, entropy->ac_tbl_no, 0xF0);
- r -= 16;
- /* Emit buffered correction bits that must be associated with ZRL */
- emit_buffered_bits(entropy, BR_buffer, BR);
- BR_buffer = entropy->bit_buffer; /* BE bits are gone now */
- BR = 0;
- }
-
- /* If the coef was previously nonzero, it only needs a correction bit.
- * NOTE: a straight translation of the spec's figure G.7 would suggest
- * that we also need to test r > 15. But if r > 15, we can only get here
- * if k > EOB, which implies that this coefficient is not 1.
- */
- if (temp > 1) {
- /* The correction bit is the next bit of the absolute value. */
- BR_buffer[BR++] = (char) (temp & 1);
- continue;
- }
-
- /* Emit any pending EOBRUN and the BE correction bits */
- emit_eobrun(entropy);
-
- /* Count/emit Huffman symbol for run length / number of bits */
- emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + 1);
+ zerobits = bits[0];
+#if SIZEOF_SIZE_T == 8
+ signbits = bits[1];
+#else
+ signbits = bits[2];
+#endif
+ ENCODE_COEFS_AC_REFINE((void)0;);
+
+#if SIZEOF_SIZE_T == 4
+ zerobits = bits[1];
+ signbits = bits[3];
+
+ if (zerobits) {
+ int diff = ((absvalues + DCTSIZE2 / 2) - cabsvalue);
+ int idx = count_zeroes(&zerobits);
+ signbits >>= idx;
+ idx += diff;
+ r += idx;
+ cabsvalue += idx;
+ goto first_iter_ac_refine;
+ }
- /* Emit output bit for newly-nonzero coef */
- temp = ((*block)[jpeg_natural_order[k]] < 0) ? 0 : 1;
- emit_bits(entropy, (unsigned int) temp, 1);
+ ENCODE_COEFS_AC_REFINE(first_iter_ac_refine:);
+#endif
- /* Emit buffered correction bits that must be associated with this code */
- emit_buffered_bits(entropy, BR_buffer, BR);
- BR_buffer = entropy->bit_buffer; /* BE bits are gone now */
- BR = 0;
- r = 0; /* reset zero run length */
- }
+ r |= (int)((absvalues + Sl) - cabsvalue);
if (r > 0 || BR > 0) { /* If there are trailing zeroes, */
entropy->EOBRUN++; /* count an EOB */
@@ -718,7 +988,8 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
* 1. overflow of the EOB counter;
* 2. overflow of the correction bit buffer during the next MCU.
*/
- if (entropy->EOBRUN == 0x7FFF || entropy->BE > (MAX_CORR_BITS-DCTSIZE2+1))
+ if (entropy->EOBRUN == 0x7FFF ||
+ entropy->BE > (MAX_CORR_BITS - DCTSIZE2 + 1))
emit_eobrun(entropy);
}
@@ -744,9 +1015,9 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
*/
METHODDEF(void)
-finish_pass_phuff (j_compress_ptr cinfo)
+finish_pass_phuff(j_compress_ptr cinfo)
{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
+ phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
entropy->next_output_byte = cinfo->dest->next_output_byte;
entropy->free_in_buffer = cinfo->dest->free_in_buffer;
@@ -765,9 +1036,9 @@ finish_pass_phuff (j_compress_ptr cinfo)
*/
METHODDEF(void)
-finish_pass_gather_phuff (j_compress_ptr cinfo)
+finish_pass_gather_phuff(j_compress_ptr cinfo)
{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
+ phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
boolean is_DC_band;
int ci, tbl;
jpeg_component_info *compptr;
@@ -793,13 +1064,13 @@ finish_pass_gather_phuff (j_compress_ptr cinfo)
} else {
tbl = compptr->ac_tbl_no;
}
- if (! did[tbl]) {
+ if (!did[tbl]) {
if (is_DC_band)
- htblptr = & cinfo->dc_huff_tbl_ptrs[tbl];
+ htblptr = &cinfo->dc_huff_tbl_ptrs[tbl];
else
- htblptr = & cinfo->ac_huff_tbl_ptrs[tbl];
+ htblptr = &cinfo->ac_huff_tbl_ptrs[tbl];
if (*htblptr == NULL)
- *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
+ *htblptr = jpeg_alloc_huff_table((j_common_ptr)cinfo);
jpeg_gen_optimal_table(cinfo, *htblptr, entropy->count_ptrs[tbl]);
did[tbl] = TRUE;
}
@@ -812,15 +1083,15 @@ finish_pass_gather_phuff (j_compress_ptr cinfo)
*/
GLOBAL(void)
-jinit_phuff_encoder (j_compress_ptr cinfo)
+jinit_phuff_encoder(j_compress_ptr cinfo)
{
phuff_entropy_ptr entropy;
int i;
entropy = (phuff_entropy_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(phuff_entropy_encoder));
- cinfo->entropy = (struct jpeg_entropy_encoder *) entropy;
+ cinfo->entropy = (struct jpeg_entropy_encoder *)entropy;
entropy->pub.start_pass = start_pass_phuff;
/* Mark tables unallocated */
diff --git a/src/3rdparty/libjpeg/src/jcprepct.c b/src/3rdparty/libjpeg/src/jcprepct.c
index e72ebd87d2..d59713ae68 100644
--- a/src/3rdparty/libjpeg/src/jcprepct.c
+++ b/src/3rdparty/libjpeg/src/jcprepct.c
@@ -78,9 +78,9 @@ typedef my_prep_controller *my_prep_ptr;
*/
METHODDEF(void)
-start_pass_prep (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
+start_pass_prep(j_compress_ptr cinfo, J_BUF_MODE pass_mode)
{
- my_prep_ptr prep = (my_prep_ptr) cinfo->prep;
+ my_prep_ptr prep = (my_prep_ptr)cinfo->prep;
if (pass_mode != JBUF_PASS_THRU)
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
@@ -106,14 +106,14 @@ start_pass_prep (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
*/
LOCAL(void)
-expand_bottom_edge (JSAMPARRAY image_data, JDIMENSION num_cols,
- int input_rows, int output_rows)
+expand_bottom_edge(JSAMPARRAY image_data, JDIMENSION num_cols, int input_rows,
+ int output_rows)
{
register int row;
for (row = input_rows; row < output_rows; row++) {
- jcopy_sample_rows(image_data, input_rows-1, image_data, row,
- 1, num_cols);
+ jcopy_sample_rows(image_data, input_rows - 1, image_data, row, 1,
+ num_cols);
}
}
@@ -128,13 +128,12 @@ expand_bottom_edge (JSAMPARRAY image_data, JDIMENSION num_cols,
*/
METHODDEF(void)
-pre_process_data (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
- JDIMENSION in_rows_avail,
- JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr,
- JDIMENSION out_row_groups_avail)
+pre_process_data(j_compress_ptr cinfo, JSAMPARRAY input_buf,
+ JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail,
+ JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr,
+ JDIMENSION out_row_groups_avail)
{
- my_prep_ptr prep = (my_prep_ptr) cinfo->prep;
+ my_prep_ptr prep = (my_prep_ptr)cinfo->prep;
int numrows, ci;
JDIMENSION inrows;
jpeg_component_info *compptr;
@@ -144,10 +143,10 @@ pre_process_data (j_compress_ptr cinfo,
/* Do color conversion to fill the conversion buffer. */
inrows = in_rows_avail - *in_row_ctr;
numrows = cinfo->max_v_samp_factor - prep->next_buf_row;
- numrows = (int) MIN((JDIMENSION) numrows, inrows);
+ numrows = (int)MIN((JDIMENSION)numrows, inrows);
(*cinfo->cconvert->color_convert) (cinfo, input_buf + *in_row_ctr,
prep->color_buf,
- (JDIMENSION) prep->next_buf_row,
+ (JDIMENSION)prep->next_buf_row,
numrows);
*in_row_ctr += numrows;
prep->next_buf_row += numrows;
@@ -164,7 +163,7 @@ pre_process_data (j_compress_ptr cinfo,
/* If we've filled the conversion buffer, empty it. */
if (prep->next_buf_row == cinfo->max_v_samp_factor) {
(*cinfo->downsample->downsample) (cinfo,
- prep->color_buf, (JDIMENSION) 0,
+ prep->color_buf, (JDIMENSION)0,
output_buf, *out_row_group_ctr);
prep->next_buf_row = 0;
(*out_row_group_ctr)++;
@@ -172,14 +171,12 @@ pre_process_data (j_compress_ptr cinfo,
/* If at bottom of image, pad the output to a full iMCU height.
* Note we assume the caller is providing a one-iMCU-height output buffer!
*/
- if (prep->rows_to_go == 0 &&
- *out_row_group_ctr < out_row_groups_avail) {
+ if (prep->rows_to_go == 0 && *out_row_group_ctr < out_row_groups_avail) {
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) {
- expand_bottom_edge(output_buf[ci],
- compptr->width_in_blocks * DCTSIZE,
- (int) (*out_row_group_ctr * compptr->v_samp_factor),
- (int) (out_row_groups_avail * compptr->v_samp_factor));
+ expand_bottom_edge(output_buf[ci], compptr->width_in_blocks * DCTSIZE,
+ (int)(*out_row_group_ctr * compptr->v_samp_factor),
+ (int)(out_row_groups_avail * compptr->v_samp_factor));
}
*out_row_group_ctr = out_row_groups_avail;
break; /* can exit outer loop without test */
@@ -195,13 +192,12 @@ pre_process_data (j_compress_ptr cinfo,
*/
METHODDEF(void)
-pre_process_context (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
- JDIMENSION in_rows_avail,
- JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr,
- JDIMENSION out_row_groups_avail)
+pre_process_context(j_compress_ptr cinfo, JSAMPARRAY input_buf,
+ JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail,
+ JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr,
+ JDIMENSION out_row_groups_avail)
{
- my_prep_ptr prep = (my_prep_ptr) cinfo->prep;
+ my_prep_ptr prep = (my_prep_ptr)cinfo->prep;
int numrows, ci;
int buf_height = cinfo->max_v_samp_factor * 3;
JDIMENSION inrows;
@@ -211,19 +207,18 @@ pre_process_context (j_compress_ptr cinfo,
/* Do color conversion to fill the conversion buffer. */
inrows = in_rows_avail - *in_row_ctr;
numrows = prep->next_buf_stop - prep->next_buf_row;
- numrows = (int) MIN((JDIMENSION) numrows, inrows);
+ numrows = (int)MIN((JDIMENSION)numrows, inrows);
(*cinfo->cconvert->color_convert) (cinfo, input_buf + *in_row_ctr,
prep->color_buf,
- (JDIMENSION) prep->next_buf_row,
+ (JDIMENSION)prep->next_buf_row,
numrows);
/* Pad at top of image, if first time through */
if (prep->rows_to_go == cinfo->image_height) {
for (ci = 0; ci < cinfo->num_components; ci++) {
int row;
for (row = 1; row <= cinfo->max_v_samp_factor; row++) {
- jcopy_sample_rows(prep->color_buf[ci], 0,
- prep->color_buf[ci], -row,
- 1, cinfo->image_width);
+ jcopy_sample_rows(prep->color_buf[ci], 0, prep->color_buf[ci],
+ -row, 1, cinfo->image_width);
}
}
}
@@ -245,9 +240,8 @@ pre_process_context (j_compress_ptr cinfo,
}
/* If we've gotten enough data, downsample a row group. */
if (prep->next_buf_row == prep->next_buf_stop) {
- (*cinfo->downsample->downsample) (cinfo,
- prep->color_buf,
- (JDIMENSION) prep->this_row_group,
+ (*cinfo->downsample->downsample) (cinfo, prep->color_buf,
+ (JDIMENSION)prep->this_row_group,
output_buf, *out_row_group_ctr);
(*out_row_group_ctr)++;
/* Advance pointers with wraparound as necessary. */
@@ -267,9 +261,9 @@ pre_process_context (j_compress_ptr cinfo,
*/
LOCAL(void)
-create_context_buffer (j_compress_ptr cinfo)
+create_context_buffer(j_compress_ptr cinfo)
{
- my_prep_ptr prep = (my_prep_ptr) cinfo->prep;
+ my_prep_ptr prep = (my_prep_ptr)cinfo->prep;
int rgroup_height = cinfo->max_v_samp_factor;
int ci, i;
jpeg_component_info *compptr;
@@ -279,7 +273,7 @@ create_context_buffer (j_compress_ptr cinfo)
* we need five row groups' worth of pointers for each component.
*/
fake_buffer = (JSAMPARRAY)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
(cinfo->num_components * 5 * rgroup_height) *
sizeof(JSAMPROW));
@@ -290,10 +284,10 @@ create_context_buffer (j_compress_ptr cinfo)
* horizontally within the buffer, if it so chooses.
*/
true_buffer = (*cinfo->mem->alloc_sarray)
- ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (JDIMENSION) (((long) compptr->width_in_blocks * DCTSIZE *
- cinfo->max_h_samp_factor) / compptr->h_samp_factor),
- (JDIMENSION) (3 * rgroup_height));
+ ((j_common_ptr)cinfo, JPOOL_IMAGE,
+ (JDIMENSION)(((long)compptr->width_in_blocks * DCTSIZE *
+ cinfo->max_h_samp_factor) / compptr->h_samp_factor),
+ (JDIMENSION)(3 * rgroup_height));
/* Copy true buffer row pointers into the middle of the fake row array */
MEMCOPY(fake_buffer + rgroup_height, true_buffer,
3 * rgroup_height * sizeof(JSAMPROW));
@@ -315,7 +309,7 @@ create_context_buffer (j_compress_ptr cinfo)
*/
GLOBAL(void)
-jinit_c_prep_controller (j_compress_ptr cinfo, boolean need_full_buffer)
+jinit_c_prep_controller(j_compress_ptr cinfo, boolean need_full_buffer)
{
my_prep_ptr prep;
int ci;
@@ -325,9 +319,9 @@ jinit_c_prep_controller (j_compress_ptr cinfo, boolean need_full_buffer)
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
prep = (my_prep_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(my_prep_controller));
- cinfo->prep = (struct jpeg_c_prep_controller *) prep;
+ cinfo->prep = (struct jpeg_c_prep_controller *)prep;
prep->pub.start_pass = start_pass_prep;
/* Allocate the color conversion buffer.
@@ -348,10 +342,10 @@ jinit_c_prep_controller (j_compress_ptr cinfo, boolean need_full_buffer)
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) {
prep->color_buf[ci] = (*cinfo->mem->alloc_sarray)
- ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (JDIMENSION) (((long) compptr->width_in_blocks * DCTSIZE *
- cinfo->max_h_samp_factor) / compptr->h_samp_factor),
- (JDIMENSION) cinfo->max_v_samp_factor);
+ ((j_common_ptr)cinfo, JPOOL_IMAGE,
+ (JDIMENSION)(((long)compptr->width_in_blocks * DCTSIZE *
+ cinfo->max_h_samp_factor) / compptr->h_samp_factor),
+ (JDIMENSION)cinfo->max_v_samp_factor);
}
}
}
diff --git a/src/3rdparty/libjpeg/src/jcsample.c b/src/3rdparty/libjpeg/src/jcsample.c
index c4b4991487..bd27b84e06 100644
--- a/src/3rdparty/libjpeg/src/jcsample.c
+++ b/src/3rdparty/libjpeg/src/jcsample.c
@@ -79,7 +79,7 @@ typedef my_downsampler *my_downsample_ptr;
*/
METHODDEF(void)
-start_pass_downsample (j_compress_ptr cinfo)
+start_pass_downsample(j_compress_ptr cinfo)
{
/* no work for now */
}
@@ -91,14 +91,14 @@ start_pass_downsample (j_compress_ptr cinfo)
*/
LOCAL(void)
-expand_right_edge (JSAMPARRAY image_data, int num_rows,
- JDIMENSION input_cols, JDIMENSION output_cols)
+expand_right_edge(JSAMPARRAY image_data, int num_rows, JDIMENSION input_cols,
+ JDIMENSION output_cols)
{
register JSAMPROW ptr;
register JSAMPLE pixval;
register int count;
int row;
- int numcols = (int) (output_cols - input_cols);
+ int numcols = (int)(output_cols - input_cols);
if (numcols > 0) {
for (row = 0; row < num_rows; row++) {
@@ -118,11 +118,11 @@ expand_right_edge (JSAMPARRAY image_data, int num_rows,
*/
METHODDEF(void)
-sep_downsample (j_compress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION in_row_index,
- JSAMPIMAGE output_buf, JDIMENSION out_row_group_index)
+sep_downsample(j_compress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION in_row_index, JSAMPIMAGE output_buf,
+ JDIMENSION out_row_group_index)
{
- my_downsample_ptr downsample = (my_downsample_ptr) cinfo->downsample;
+ my_downsample_ptr downsample = (my_downsample_ptr)cinfo->downsample;
int ci;
jpeg_component_info *compptr;
JSAMPARRAY in_ptr, out_ptr;
@@ -144,8 +144,8 @@ sep_downsample (j_compress_ptr cinfo,
*/
METHODDEF(void)
-int_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY output_data)
+int_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
+ JSAMPARRAY input_data, JSAMPARRAY output_data)
{
int inrow, outrow, h_expand, v_expand, numpix, numpix2, h, v;
JDIMENSION outcol, outcol_h; /* outcol_h == outcol*h_expand */
@@ -156,14 +156,14 @@ int_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
h_expand = cinfo->max_h_samp_factor / compptr->h_samp_factor;
v_expand = cinfo->max_v_samp_factor / compptr->v_samp_factor;
numpix = h_expand * v_expand;
- numpix2 = numpix/2;
+ numpix2 = numpix / 2;
/* Expand input data enough to let all the output samples be generated
* by the standard loop. Special-casing padded output would be more
* efficient.
*/
- expand_right_edge(input_data, cinfo->max_v_samp_factor,
- cinfo->image_width, output_cols * h_expand);
+ expand_right_edge(input_data, cinfo->max_v_samp_factor, cinfo->image_width,
+ output_cols * h_expand);
inrow = 0;
for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
@@ -172,12 +172,12 @@ int_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
outcol++, outcol_h += h_expand) {
outvalue = 0;
for (v = 0; v < v_expand; v++) {
- inptr = input_data[inrow+v] + outcol_h;
+ inptr = input_data[inrow + v] + outcol_h;
for (h = 0; h < h_expand; h++) {
- outvalue += (JLONG) GETJSAMPLE(*inptr++);
+ outvalue += (JLONG)GETJSAMPLE(*inptr++);
}
}
- *outptr++ = (JSAMPLE) ((outvalue + numpix2) / numpix);
+ *outptr++ = (JSAMPLE)((outvalue + numpix2) / numpix);
}
inrow += v_expand;
}
@@ -191,15 +191,15 @@ int_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
*/
METHODDEF(void)
-fullsize_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY output_data)
+fullsize_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
+ JSAMPARRAY input_data, JSAMPARRAY output_data)
{
/* Copy the data */
- jcopy_sample_rows(input_data, 0, output_data, 0,
- cinfo->max_v_samp_factor, cinfo->image_width);
+ jcopy_sample_rows(input_data, 0, output_data, 0, cinfo->max_v_samp_factor,
+ cinfo->image_width);
/* Edge-expand */
- expand_right_edge(output_data, cinfo->max_v_samp_factor,
- cinfo->image_width, compptr->width_in_blocks * DCTSIZE);
+ expand_right_edge(output_data, cinfo->max_v_samp_factor, cinfo->image_width,
+ compptr->width_in_blocks * DCTSIZE);
}
@@ -216,8 +216,8 @@ fullsize_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
*/
METHODDEF(void)
-h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY output_data)
+h2v1_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
+ JSAMPARRAY input_data, JSAMPARRAY output_data)
{
int outrow;
JDIMENSION outcol;
@@ -229,16 +229,16 @@ h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
* by the standard loop. Special-casing padded output would be more
* efficient.
*/
- expand_right_edge(input_data, cinfo->max_v_samp_factor,
- cinfo->image_width, output_cols * 2);
+ expand_right_edge(input_data, cinfo->max_v_samp_factor, cinfo->image_width,
+ output_cols * 2);
for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
outptr = output_data[outrow];
inptr = input_data[outrow];
bias = 0; /* bias = 0,1,0,1,... for successive samples */
for (outcol = 0; outcol < output_cols; outcol++) {
- *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr) + GETJSAMPLE(inptr[1])
- + bias) >> 1);
+ *outptr++ =
+ (JSAMPLE)((GETJSAMPLE(*inptr) + GETJSAMPLE(inptr[1]) + bias) >> 1);
bias ^= 1; /* 0=>1, 1=>0 */
inptr += 2;
}
@@ -253,8 +253,8 @@ h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
*/
METHODDEF(void)
-h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY output_data)
+h2v2_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
+ JSAMPARRAY input_data, JSAMPARRAY output_data)
{
int inrow, outrow;
JDIMENSION outcol;
@@ -266,21 +266,21 @@ h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
* by the standard loop. Special-casing padded output would be more
* efficient.
*/
- expand_right_edge(input_data, cinfo->max_v_samp_factor,
- cinfo->image_width, output_cols * 2);
+ expand_right_edge(input_data, cinfo->max_v_samp_factor, cinfo->image_width,
+ output_cols * 2);
inrow = 0;
for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
outptr = output_data[outrow];
inptr0 = input_data[inrow];
- inptr1 = input_data[inrow+1];
+ inptr1 = input_data[inrow + 1];
bias = 1; /* bias = 1,2,1,2,... for successive samples */
for (outcol = 0; outcol < output_cols; outcol++) {
- *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
- GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1])
- + bias) >> 2);
+ *outptr++ =
+ (JSAMPLE)((GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
+ GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]) + bias) >> 2);
bias ^= 3; /* 1=>2, 2=>1 */
- inptr0 += 2; inptr1 += 2;
+ inptr0 += 2; inptr1 += 2;
}
inrow += 2;
}
@@ -296,8 +296,8 @@ h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
*/
METHODDEF(void)
-h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY output_data)
+h2v2_smooth_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
+ JSAMPARRAY input_data, JSAMPARRAY output_data)
{
int inrow, outrow;
JDIMENSION colctr;
@@ -332,9 +332,9 @@ h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
outptr = output_data[outrow];
inptr0 = input_data[inrow];
- inptr1 = input_data[inrow+1];
- above_ptr = input_data[inrow-1];
- below_ptr = input_data[inrow+2];
+ inptr1 = input_data[inrow + 1];
+ above_ptr = input_data[inrow - 1];
+ below_ptr = input_data[inrow + 2];
/* Special case for first column: pretend column -1 is same as column 0 */
membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
@@ -347,8 +347,8 @@ h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
neighsum += GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[2]) +
GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[2]);
membersum = membersum * memberscale + neighsum * neighscale;
- *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
- inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
+ *outptr++ = (JSAMPLE)((membersum + 32768) >> 16);
+ inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
for (colctr = output_cols - 2; colctr > 0; colctr--) {
/* sum of pixels directly mapped to this output element */
@@ -367,8 +367,8 @@ h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
/* form final output scaled up by 2^16 */
membersum = membersum * memberscale + neighsum * neighscale;
/* round, descale and output it */
- *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
- inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
+ *outptr++ = (JSAMPLE)((membersum + 32768) >> 16);
+ inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
}
/* Special case for last column */
@@ -382,7 +382,7 @@ h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[1]) +
GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[1]);
membersum = membersum * memberscale + neighsum * neighscale;
- *outptr = (JSAMPLE) ((membersum + 32768) >> 16);
+ *outptr = (JSAMPLE)((membersum + 32768) >> 16);
inrow += 2;
}
@@ -396,8 +396,8 @@ h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
*/
METHODDEF(void)
-fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY output_data)
+fullsize_smooth_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
+ JSAMPARRAY input_data, JSAMPARRAY output_data)
{
int outrow;
JDIMENSION colctr;
@@ -425,8 +425,8 @@ fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
outptr = output_data[outrow];
inptr = input_data[outrow];
- above_ptr = input_data[outrow-1];
- below_ptr = input_data[outrow+1];
+ above_ptr = input_data[outrow - 1];
+ below_ptr = input_data[outrow + 1];
/* Special case for first column */
colsum = GETJSAMPLE(*above_ptr++) + GETJSAMPLE(*below_ptr++) +
@@ -436,25 +436,25 @@ fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
GETJSAMPLE(*inptr);
neighsum = colsum + (colsum - membersum) + nextcolsum;
membersum = membersum * memberscale + neighsum * neighscale;
- *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
- lastcolsum = colsum; colsum = nextcolsum;
+ *outptr++ = (JSAMPLE)((membersum + 32768) >> 16);
+ lastcolsum = colsum; colsum = nextcolsum;
for (colctr = output_cols - 2; colctr > 0; colctr--) {
membersum = GETJSAMPLE(*inptr++);
- above_ptr++; below_ptr++;
+ above_ptr++; below_ptr++;
nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) +
GETJSAMPLE(*inptr);
neighsum = lastcolsum + (colsum - membersum) + nextcolsum;
membersum = membersum * memberscale + neighsum * neighscale;
- *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
- lastcolsum = colsum; colsum = nextcolsum;
+ *outptr++ = (JSAMPLE)((membersum + 32768) >> 16);
+ lastcolsum = colsum; colsum = nextcolsum;
}
/* Special case for last column */
membersum = GETJSAMPLE(*inptr);
neighsum = lastcolsum + (colsum - membersum) + colsum;
membersum = membersum * memberscale + neighsum * neighscale;
- *outptr = (JSAMPLE) ((membersum + 32768) >> 16);
+ *outptr = (JSAMPLE)((membersum + 32768) >> 16);
}
}
@@ -468,7 +468,7 @@ fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
*/
GLOBAL(void)
-jinit_downsampler (j_compress_ptr cinfo)
+jinit_downsampler(j_compress_ptr cinfo)
{
my_downsample_ptr downsample;
int ci;
@@ -476,9 +476,9 @@ jinit_downsampler (j_compress_ptr cinfo)
boolean smoothok = TRUE;
downsample = (my_downsample_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(my_downsampler));
- cinfo->downsample = (struct jpeg_downsampler *) downsample;
+ cinfo->downsample = (struct jpeg_downsampler *)downsample;
downsample->pub.start_pass = start_pass_downsample;
downsample->pub.downsample = sep_downsample;
downsample->pub.need_context_rows = FALSE;
diff --git a/src/3rdparty/libjpeg/src/jctrans.c b/src/3rdparty/libjpeg/src/jctrans.c
index 6f16b052cf..ce70a30940 100644
--- a/src/3rdparty/libjpeg/src/jctrans.c
+++ b/src/3rdparty/libjpeg/src/jctrans.c
@@ -20,10 +20,10 @@
/* Forward declarations */
-LOCAL(void) transencode_master_selection
- (j_compress_ptr cinfo, jvirt_barray_ptr *coef_arrays);
-LOCAL(void) transencode_coef_controller
- (j_compress_ptr cinfo, jvirt_barray_ptr *coef_arrays);
+LOCAL(void) transencode_master_selection(j_compress_ptr cinfo,
+ jvirt_barray_ptr *coef_arrays);
+LOCAL(void) transencode_coef_controller(j_compress_ptr cinfo,
+ jvirt_barray_ptr *coef_arrays);
/*
@@ -39,14 +39,14 @@ LOCAL(void) transencode_coef_controller
*/
GLOBAL(void)
-jpeg_write_coefficients (j_compress_ptr cinfo, jvirt_barray_ptr *coef_arrays)
+jpeg_write_coefficients(j_compress_ptr cinfo, jvirt_barray_ptr *coef_arrays)
{
if (cinfo->global_state != CSTATE_START)
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
/* Mark all tables to be written */
jpeg_suppress_tables(cinfo, FALSE);
/* (Re)initialize error mgr and destination modules */
- (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
+ (*cinfo->err->reset_error_mgr) ((j_common_ptr)cinfo);
(*cinfo->dest->init_destination) (cinfo);
/* Perform master selection of active modules */
transencode_master_selection(cinfo, coef_arrays);
@@ -64,8 +64,7 @@ jpeg_write_coefficients (j_compress_ptr cinfo, jvirt_barray_ptr *coef_arrays)
*/
GLOBAL(void)
-jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
- j_compress_ptr dstinfo)
+jpeg_copy_critical_parameters(j_decompress_ptr srcinfo, j_compress_ptr dstinfo)
{
JQUANT_TBL **qtblptr;
jpeg_component_info *incomp, *outcomp;
@@ -97,11 +96,10 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
/* Copy the source's quantization tables. */
for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) {
if (srcinfo->quant_tbl_ptrs[tblno] != NULL) {
- qtblptr = & dstinfo->quant_tbl_ptrs[tblno];
+ qtblptr = &dstinfo->quant_tbl_ptrs[tblno];
if (*qtblptr == NULL)
- *qtblptr = jpeg_alloc_quant_table((j_common_ptr) dstinfo);
- MEMCOPY((*qtblptr)->quantval,
- srcinfo->quant_tbl_ptrs[tblno]->quantval,
+ *qtblptr = jpeg_alloc_quant_table((j_common_ptr)dstinfo);
+ MEMCOPY((*qtblptr)->quantval, srcinfo->quant_tbl_ptrs[tblno]->quantval,
sizeof((*qtblptr)->quantval));
(*qtblptr)->sent_table = FALSE;
}
@@ -165,8 +163,8 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
*/
LOCAL(void)
-transencode_master_selection (j_compress_ptr cinfo,
- jvirt_barray_ptr *coef_arrays)
+transencode_master_selection(j_compress_ptr cinfo,
+ jvirt_barray_ptr *coef_arrays)
{
/* Although we don't actually use input_components for transcoding,
* jcmaster.c's initial_setup will complain if input_components is 0.
@@ -199,7 +197,7 @@ transencode_master_selection (j_compress_ptr cinfo,
jinit_marker_writer(cinfo);
/* We can now tell the memory manager to allocate virtual arrays. */
- (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
+ (*cinfo->mem->realize_virt_arrays) ((j_common_ptr)cinfo);
/* Write the datastream header (SOI, JFIF) immediately.
* Frame and scan headers are postponed till later.
@@ -238,10 +236,10 @@ typedef my_coef_controller *my_coef_ptr;
LOCAL(void)
-start_iMCU_row (j_compress_ptr cinfo)
+start_iMCU_row(j_compress_ptr cinfo)
/* Reset within-iMCU-row counters for a new row */
{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+ my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
/* In an interleaved scan, an MCU row is the same as an iMCU row.
* In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
@@ -250,7 +248,7 @@ start_iMCU_row (j_compress_ptr cinfo)
if (cinfo->comps_in_scan > 1) {
coef->MCU_rows_per_iMCU_row = 1;
} else {
- if (coef->iMCU_row_num < (cinfo->total_iMCU_rows-1))
+ if (coef->iMCU_row_num < (cinfo->total_iMCU_rows - 1))
coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
else
coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
@@ -266,9 +264,9 @@ start_iMCU_row (j_compress_ptr cinfo)
*/
METHODDEF(void)
-start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
+start_pass_coef(j_compress_ptr cinfo, J_BUF_MODE pass_mode)
{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+ my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
if (pass_mode != JBUF_CRANK_DEST)
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
@@ -289,9 +287,9 @@ start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
*/
METHODDEF(boolean)
-compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
+compress_output(j_compress_ptr cinfo, JSAMPIMAGE input_buf)
{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+ my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
JDIMENSION MCU_col_num; /* index of current MCU within row */
JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
@@ -306,9 +304,9 @@ compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
compptr = cinfo->cur_comp_info[ci];
buffer[ci] = (*cinfo->mem->access_virt_barray)
- ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index],
+ ((j_common_ptr)cinfo, coef->whole_image[compptr->component_index],
coef->iMCU_row_num * compptr->v_samp_factor,
- (JDIMENSION) compptr->v_samp_factor, FALSE);
+ (JDIMENSION)compptr->v_samp_factor, FALSE);
}
/* Loop to process one whole iMCU row */
@@ -321,13 +319,13 @@ compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
compptr = cinfo->cur_comp_info[ci];
start_col = MCU_col_num * compptr->MCU_width;
- blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width
- : compptr->last_col_width;
+ blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width :
+ compptr->last_col_width;
for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
if (coef->iMCU_row_num < last_iMCU_row ||
- yindex+yoffset < compptr->last_row_height) {
+ yindex + yoffset < compptr->last_row_height) {
/* Fill in pointers to real blocks in this row */
- buffer_ptr = buffer[ci][yindex+yoffset] + start_col;
+ buffer_ptr = buffer[ci][yindex + yoffset] + start_col;
for (xindex = 0; xindex < blockcnt; xindex++)
MCU_buffer[blkn++] = buffer_ptr++;
} else {
@@ -342,13 +340,13 @@ compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
*/
for (; xindex < compptr->MCU_width; xindex++) {
MCU_buffer[blkn] = coef->dummy_buffer[blkn];
- MCU_buffer[blkn][0][0] = MCU_buffer[blkn-1][0][0];
+ MCU_buffer[blkn][0][0] = MCU_buffer[blkn - 1][0][0];
blkn++;
}
}
}
/* Try to write the MCU. */
- if (! (*cinfo->entropy->encode_mcu) (cinfo, MCU_buffer)) {
+ if (!(*cinfo->entropy->encode_mcu) (cinfo, MCU_buffer)) {
/* Suspension forced; update state counters and exit */
coef->MCU_vert_offset = yoffset;
coef->mcu_ctr = MCU_col_num;
@@ -374,17 +372,17 @@ compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
*/
LOCAL(void)
-transencode_coef_controller (j_compress_ptr cinfo,
- jvirt_barray_ptr *coef_arrays)
+transencode_coef_controller(j_compress_ptr cinfo,
+ jvirt_barray_ptr *coef_arrays)
{
my_coef_ptr coef;
JBLOCKROW buffer;
int i;
coef = (my_coef_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(my_coef_controller));
- cinfo->coef = (struct jpeg_c_coef_controller *) coef;
+ cinfo->coef = (struct jpeg_c_coef_controller *)coef;
coef->pub.start_pass = start_pass_coef;
coef->pub.compress_data = compress_output;
@@ -393,9 +391,9 @@ transencode_coef_controller (j_compress_ptr cinfo,
/* Allocate and pre-zero space for dummy DCT blocks. */
buffer = (JBLOCKROW)
- (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
C_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
- jzero_far((void *) buffer, C_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
+ jzero_far((void *)buffer, C_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) {
coef->dummy_buffer[i] = buffer + i;
}
diff --git a/src/3rdparty/libjpeg/src/jdapimin.c b/src/3rdparty/libjpeg/src/jdapimin.c
index f80a14667f..21a41d2e9f 100644
--- a/src/3rdparty/libjpeg/src/jdapimin.c
+++ b/src/3rdparty/libjpeg/src/jdapimin.c
@@ -31,7 +31,7 @@
*/
GLOBAL(void)
-jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, size_t structsize)
+jpeg_CreateDecompress(j_decompress_ptr cinfo, int version, size_t structsize)
{
int i;
@@ -41,7 +41,7 @@ jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, size_t structsize)
ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version);
if (structsize != sizeof(struct jpeg_decompress_struct))
ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE,
- (int) sizeof(struct jpeg_decompress_struct), (int) structsize);
+ (int)sizeof(struct jpeg_decompress_struct), (int)structsize);
/* For debugging purposes, we zero the whole master structure.
* But the application has already set the err pointer, and may have set
@@ -50,8 +50,8 @@ jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, size_t structsize)
* complain here.
*/
{
- struct jpeg_error_mgr * err = cinfo->err;
- void * client_data = cinfo->client_data; /* ignore Purify complaint here */
+ struct jpeg_error_mgr *err = cinfo->err;
+ void *client_data = cinfo->client_data; /* ignore Purify complaint here */
MEMZERO(cinfo, sizeof(struct jpeg_decompress_struct));
cinfo->err = err;
cinfo->client_data = client_data;
@@ -59,7 +59,7 @@ jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, size_t structsize)
cinfo->is_decompressor = TRUE;
/* Initialize a memory manager instance for this object */
- jinit_memory_mgr((j_common_ptr) cinfo);
+ jinit_memory_mgr((j_common_ptr)cinfo);
/* Zero out pointers to permanent structures. */
cinfo->progress = NULL;
@@ -89,8 +89,8 @@ jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, size_t structsize)
* here.
*/
cinfo->master = (struct jpeg_decomp_master *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
- sizeof(my_decomp_master));
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
+ sizeof(my_decomp_master));
MEMZERO(cinfo->master, sizeof(my_decomp_master));
}
@@ -100,9 +100,9 @@ jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, size_t structsize)
*/
GLOBAL(void)
-jpeg_destroy_decompress (j_decompress_ptr cinfo)
+jpeg_destroy_decompress(j_decompress_ptr cinfo)
{
- jpeg_destroy((j_common_ptr) cinfo); /* use common routine */
+ jpeg_destroy((j_common_ptr)cinfo); /* use common routine */
}
@@ -112,9 +112,9 @@ jpeg_destroy_decompress (j_decompress_ptr cinfo)
*/
GLOBAL(void)
-jpeg_abort_decompress (j_decompress_ptr cinfo)
+jpeg_abort_decompress(j_decompress_ptr cinfo)
{
- jpeg_abort((j_common_ptr) cinfo); /* use common routine */
+ jpeg_abort((j_common_ptr)cinfo); /* use common routine */
}
@@ -123,7 +123,7 @@ jpeg_abort_decompress (j_decompress_ptr cinfo)
*/
LOCAL(void)
-default_decompress_parms (j_decompress_ptr cinfo)
+default_decompress_parms(j_decompress_ptr cinfo)
{
/* Guess the input colorspace, and set output colorspace accordingly. */
/* (Wish JPEG committee had provided a real way to specify this...) */
@@ -250,7 +250,7 @@ default_decompress_parms (j_decompress_ptr cinfo)
*/
GLOBAL(int)
-jpeg_read_header (j_decompress_ptr cinfo, boolean require_image)
+jpeg_read_header(j_decompress_ptr cinfo, boolean require_image)
{
int retcode;
@@ -271,7 +271,7 @@ jpeg_read_header (j_decompress_ptr cinfo, boolean require_image)
* call jpeg_abort, but we can't change it now for compatibility reasons.
* A side effect is to free any temporary memory (there shouldn't be any).
*/
- jpeg_abort((j_common_ptr) cinfo); /* sets state = DSTATE_START */
+ jpeg_abort((j_common_ptr)cinfo); /* sets state = DSTATE_START */
retcode = JPEG_HEADER_TABLES_ONLY;
break;
case JPEG_SUSPENDED:
@@ -296,7 +296,7 @@ jpeg_read_header (j_decompress_ptr cinfo, boolean require_image)
*/
GLOBAL(int)
-jpeg_consume_input (j_decompress_ptr cinfo)
+jpeg_consume_input(j_decompress_ptr cinfo)
{
int retcode = JPEG_SUSPENDED;
@@ -343,7 +343,7 @@ jpeg_consume_input (j_decompress_ptr cinfo)
*/
GLOBAL(boolean)
-jpeg_input_complete (j_decompress_ptr cinfo)
+jpeg_input_complete(j_decompress_ptr cinfo)
{
/* Check for valid jpeg object */
if (cinfo->global_state < DSTATE_START ||
@@ -358,7 +358,7 @@ jpeg_input_complete (j_decompress_ptr cinfo)
*/
GLOBAL(boolean)
-jpeg_has_multiple_scans (j_decompress_ptr cinfo)
+jpeg_has_multiple_scans(j_decompress_ptr cinfo)
{
/* Only valid after jpeg_read_header completes */
if (cinfo->global_state < DSTATE_READY ||
@@ -378,10 +378,10 @@ jpeg_has_multiple_scans (j_decompress_ptr cinfo)
*/
GLOBAL(boolean)
-jpeg_finish_decompress (j_decompress_ptr cinfo)
+jpeg_finish_decompress(j_decompress_ptr cinfo)
{
if ((cinfo->global_state == DSTATE_SCANNING ||
- cinfo->global_state == DSTATE_RAW_OK) && ! cinfo->buffered_image) {
+ cinfo->global_state == DSTATE_RAW_OK) && !cinfo->buffered_image) {
/* Terminate final pass of non-buffered mode */
if (cinfo->output_scanline < cinfo->output_height)
ERREXIT(cinfo, JERR_TOO_LITTLE_DATA);
@@ -395,13 +395,13 @@ jpeg_finish_decompress (j_decompress_ptr cinfo)
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
}
/* Read until EOI */
- while (! cinfo->inputctl->eoi_reached) {
+ while (!cinfo->inputctl->eoi_reached) {
if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
return FALSE; /* Suspend, come back later */
}
/* Do final cleanup */
(*cinfo->src->term_source) (cinfo);
/* We can use jpeg_abort to release memory and reset global_state */
- jpeg_abort((j_common_ptr) cinfo);
+ jpeg_abort((j_common_ptr)cinfo);
return TRUE;
}
diff --git a/src/3rdparty/libjpeg/src/jdapistd.c b/src/3rdparty/libjpeg/src/jdapistd.c
index 105121df2b..2c808fa564 100644
--- a/src/3rdparty/libjpeg/src/jdapistd.c
+++ b/src/3rdparty/libjpeg/src/jdapistd.c
@@ -4,7 +4,7 @@
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1994-1996, Thomas G. Lane.
* libjpeg-turbo Modifications:
- * Copyright (C) 2010, 2015-2017, D. R. Commander.
+ * Copyright (C) 2010, 2015-2018, D. R. Commander.
* Copyright (C) 2015, Google, Inc.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
@@ -25,7 +25,7 @@
#include "jmemsys.h"
/* Forward declarations */
-LOCAL(boolean) output_pass_setup (j_decompress_ptr cinfo);
+LOCAL(boolean) output_pass_setup(j_decompress_ptr cinfo);
/*
@@ -40,7 +40,7 @@ LOCAL(boolean) output_pass_setup (j_decompress_ptr cinfo);
*/
GLOBAL(boolean)
-jpeg_start_decompress (j_decompress_ptr cinfo)
+jpeg_start_decompress(j_decompress_ptr cinfo)
{
if (cinfo->global_state == DSTATE_READY) {
/* First call: initialize master control, select active modules */
@@ -60,7 +60,7 @@ jpeg_start_decompress (j_decompress_ptr cinfo)
int retcode;
/* Call progress monitor hook if present */
if (cinfo->progress != NULL)
- (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
+ (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
/* Absorb some more input */
retcode = (*cinfo->inputctl->consume_input) (cinfo);
if (retcode == JPEG_SUSPENDED)
@@ -72,7 +72,7 @@ jpeg_start_decompress (j_decompress_ptr cinfo)
(retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {
/* jdmaster underestimated number of scans; ratchet up one scan */
- cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows;
+ cinfo->progress->pass_limit += (long)cinfo->total_iMCU_rows;
}
}
}
@@ -97,7 +97,7 @@ jpeg_start_decompress (j_decompress_ptr cinfo)
*/
LOCAL(boolean)
-output_pass_setup (j_decompress_ptr cinfo)
+output_pass_setup(j_decompress_ptr cinfo)
{
if (cinfo->global_state != DSTATE_PRESCAN) {
/* First call: do pass setup */
@@ -113,14 +113,14 @@ output_pass_setup (j_decompress_ptr cinfo)
JDIMENSION last_scanline;
/* Call progress monitor hook if present */
if (cinfo->progress != NULL) {
- cinfo->progress->pass_counter = (long) cinfo->output_scanline;
- cinfo->progress->pass_limit = (long) cinfo->output_height;
- (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
+ cinfo->progress->pass_counter = (long)cinfo->output_scanline;
+ cinfo->progress->pass_limit = (long)cinfo->output_height;
+ (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
}
/* Process some data */
last_scanline = cinfo->output_scanline;
- (*cinfo->main->process_data) (cinfo, (JSAMPARRAY) NULL,
- &cinfo->output_scanline, (JDIMENSION) 0);
+ (*cinfo->main->process_data) (cinfo, (JSAMPARRAY)NULL,
+ &cinfo->output_scanline, (JDIMENSION)0);
if (cinfo->output_scanline == last_scanline)
return FALSE; /* No progress made, must suspend */
}
@@ -150,8 +150,8 @@ output_pass_setup (j_decompress_ptr cinfo)
*/
GLOBAL(void)
-jpeg_crop_scanline (j_decompress_ptr cinfo, JDIMENSION *xoffset,
- JDIMENSION *width)
+jpeg_crop_scanline(j_decompress_ptr cinfo, JDIMENSION *xoffset,
+ JDIMENSION *width)
{
int ci, align, orig_downsampled_width;
JDIMENSION input_xoffset;
@@ -210,11 +210,10 @@ jpeg_crop_scanline (j_decompress_ptr cinfo, JDIMENSION *xoffset,
/* Set the first and last iMCU columns that we must decompress. These values
* will be used in single-scan decompressions.
*/
- cinfo->master->first_iMCU_col =
- (JDIMENSION) (long) (*xoffset) / (long) align;
+ cinfo->master->first_iMCU_col = (JDIMENSION)(long)(*xoffset) / (long)align;
cinfo->master->last_iMCU_col =
- (JDIMENSION) jdiv_round_up((long) (*xoffset + cinfo->output_width),
- (long) align) - 1;
+ (JDIMENSION)jdiv_round_up((long)(*xoffset + cinfo->output_width),
+ (long)align) - 1;
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) {
@@ -224,9 +223,9 @@ jpeg_crop_scanline (j_decompress_ptr cinfo, JDIMENSION *xoffset,
/* Set downsampled_width to the new output width. */
orig_downsampled_width = compptr->downsampled_width;
compptr->downsampled_width =
- (JDIMENSION) jdiv_round_up((long) (cinfo->output_width *
- compptr->h_samp_factor),
- (long) cinfo->max_h_samp_factor);
+ (JDIMENSION)jdiv_round_up((long)(cinfo->output_width *
+ compptr->h_samp_factor),
+ (long)cinfo->max_h_samp_factor);
if (compptr->downsampled_width < 2 && orig_downsampled_width >= 2)
reinit_upsampler = TRUE;
@@ -234,11 +233,10 @@ jpeg_crop_scanline (j_decompress_ptr cinfo, JDIMENSION *xoffset,
* values will be used in multi-scan decompressions.
*/
cinfo->master->first_MCU_col[ci] =
- (JDIMENSION) (long) (*xoffset * hsf) / (long) align;
+ (JDIMENSION)(long)(*xoffset * hsf) / (long)align;
cinfo->master->last_MCU_col[ci] =
- (JDIMENSION) jdiv_round_up((long) ((*xoffset + cinfo->output_width) *
- hsf),
- (long) align) - 1;
+ (JDIMENSION)jdiv_round_up((long)((*xoffset + cinfo->output_width) * hsf),
+ (long)align) - 1;
}
if (reinit_upsampler) {
@@ -263,8 +261,8 @@ jpeg_crop_scanline (j_decompress_ptr cinfo, JDIMENSION *xoffset,
*/
GLOBAL(JDIMENSION)
-jpeg_read_scanlines (j_decompress_ptr cinfo, JSAMPARRAY scanlines,
- JDIMENSION max_lines)
+jpeg_read_scanlines(j_decompress_ptr cinfo, JSAMPARRAY scanlines,
+ JDIMENSION max_lines)
{
JDIMENSION row_ctr;
@@ -277,9 +275,9 @@ jpeg_read_scanlines (j_decompress_ptr cinfo, JSAMPARRAY scanlines,
/* Call progress monitor hook if present */
if (cinfo->progress != NULL) {
- cinfo->progress->pass_counter = (long) cinfo->output_scanline;
- cinfo->progress->pass_limit = (long) cinfo->output_height;
- (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
+ cinfo->progress->pass_counter = (long)cinfo->output_scanline;
+ cinfo->progress->pass_limit = (long)cinfo->output_height;
+ (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
}
/* Process some data */
@@ -292,16 +290,16 @@ jpeg_read_scanlines (j_decompress_ptr cinfo, JSAMPARRAY scanlines,
/* Dummy color convert function used by jpeg_skip_scanlines() */
LOCAL(void)
-noop_convert (j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
- JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
+noop_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
{
}
/* Dummy quantize function used by jpeg_skip_scanlines() */
LOCAL(void)
-noop_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
- JSAMPARRAY output_buf, int num_rows)
+noop_quantize(j_decompress_ptr cinfo, JSAMPARRAY input_buf,
+ JSAMPARRAY output_buf, int num_rows)
{
}
@@ -315,17 +313,20 @@ noop_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
*/
LOCAL(void)
-read_and_discard_scanlines (j_decompress_ptr cinfo, JDIMENSION num_lines)
+read_and_discard_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
{
JDIMENSION n;
void (*color_convert) (j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JDIMENSION input_row, JSAMPARRAY output_buf,
- int num_rows);
+ int num_rows) = NULL;
void (*color_quantize) (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY output_buf, int num_rows) = NULL;
- color_convert = cinfo->cconvert->color_convert;
- cinfo->cconvert->color_convert = noop_convert;
+ if (cinfo->cconvert && cinfo->cconvert->color_convert) {
+ color_convert = cinfo->cconvert->color_convert;
+ cinfo->cconvert->color_convert = noop_convert;
+ }
+
if (cinfo->cquantize && cinfo->cquantize->color_quantize) {
color_quantize = cinfo->cquantize->color_quantize;
cinfo->cquantize->color_quantize = noop_quantize;
@@ -334,7 +335,9 @@ read_and_discard_scanlines (j_decompress_ptr cinfo, JDIMENSION num_lines)
for (n = 0; n < num_lines; n++)
jpeg_read_scanlines(cinfo, NULL, 1);
- cinfo->cconvert->color_convert = color_convert;
+ if (color_convert)
+ cinfo->cconvert->color_convert = color_convert;
+
if (color_quantize)
cinfo->cquantize->color_quantize = color_quantize;
}
@@ -346,10 +349,10 @@ read_and_discard_scanlines (j_decompress_ptr cinfo, JDIMENSION num_lines)
*/
LOCAL(void)
-increment_simple_rowgroup_ctr (j_decompress_ptr cinfo, JDIMENSION rows)
+increment_simple_rowgroup_ctr(j_decompress_ptr cinfo, JDIMENSION rows)
{
JDIMENSION rows_left;
- my_main_ptr main_ptr = (my_main_ptr) cinfo->main;
+ my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
/* Increment the counter to the next row group after the skipped rows. */
main_ptr->rowgroup_ctr += rows / cinfo->max_v_samp_factor;
@@ -375,11 +378,11 @@ increment_simple_rowgroup_ctr (j_decompress_ptr cinfo, JDIMENSION rows)
*/
GLOBAL(JDIMENSION)
-jpeg_skip_scanlines (j_decompress_ptr cinfo, JDIMENSION num_lines)
+jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
{
- my_main_ptr main_ptr = (my_main_ptr) cinfo->main;
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
+ my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
+ my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
+ my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
JDIMENSION i, x;
int y;
JDIMENSION lines_per_iMCU_row, lines_left_in_iMCU_row, lines_after_iMCU_row;
@@ -481,7 +484,7 @@ jpeg_skip_scanlines (j_decompress_ptr cinfo, JDIMENSION num_lines)
if (cinfo->upsample->need_context_rows) {
cinfo->output_scanline += lines_to_skip;
cinfo->output_iMCU_row += lines_to_skip / lines_per_iMCU_row;
- main_ptr->iMCU_row_ctr += lines_after_iMCU_row / lines_per_iMCU_row;
+ main_ptr->iMCU_row_ctr += lines_to_skip / lines_per_iMCU_row;
/* It is complex to properly move to the middle of a context block, so
* read the remaining lines instead of skipping them.
*/
@@ -544,8 +547,8 @@ jpeg_skip_scanlines (j_decompress_ptr cinfo, JDIMENSION num_lines)
*/
GLOBAL(JDIMENSION)
-jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data,
- JDIMENSION max_lines)
+jpeg_read_raw_data(j_decompress_ptr cinfo, JSAMPIMAGE data,
+ JDIMENSION max_lines)
{
JDIMENSION lines_per_iMCU_row;
@@ -558,9 +561,9 @@ jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data,
/* Call progress monitor hook if present */
if (cinfo->progress != NULL) {
- cinfo->progress->pass_counter = (long) cinfo->output_scanline;
- cinfo->progress->pass_limit = (long) cinfo->output_height;
- (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
+ cinfo->progress->pass_counter = (long)cinfo->output_scanline;
+ cinfo->progress->pass_limit = (long)cinfo->output_height;
+ (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
}
/* Verify that at least one iMCU row can be returned. */
@@ -569,7 +572,7 @@ jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data,
ERREXIT(cinfo, JERR_BUFFER_SIZE);
/* Decompress directly into user's buffer. */
- if (! (*cinfo->coef->decompress_data) (cinfo, data))
+ if (!(*cinfo->coef->decompress_data) (cinfo, data))
return 0; /* suspension forced, can do nothing more */
/* OK, we processed one iMCU row. */
@@ -587,7 +590,7 @@ jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data,
*/
GLOBAL(boolean)
-jpeg_start_output (j_decompress_ptr cinfo, int scan_number)
+jpeg_start_output(j_decompress_ptr cinfo, int scan_number)
{
if (cinfo->global_state != DSTATE_BUFIMAGE &&
cinfo->global_state != DSTATE_PRESCAN)
@@ -595,8 +598,7 @@ jpeg_start_output (j_decompress_ptr cinfo, int scan_number)
/* Limit scan number to valid range */
if (scan_number <= 0)
scan_number = 1;
- if (cinfo->inputctl->eoi_reached &&
- scan_number > cinfo->input_scan_number)
+ if (cinfo->inputctl->eoi_reached && scan_number > cinfo->input_scan_number)
scan_number = cinfo->input_scan_number;
cinfo->output_scan_number = scan_number;
/* Perform any dummy output passes, and set up for the real pass */
@@ -612,7 +614,7 @@ jpeg_start_output (j_decompress_ptr cinfo, int scan_number)
*/
GLOBAL(boolean)
-jpeg_finish_output (j_decompress_ptr cinfo)
+jpeg_finish_output(j_decompress_ptr cinfo)
{
if ((cinfo->global_state == DSTATE_SCANNING ||
cinfo->global_state == DSTATE_RAW_OK) && cinfo->buffered_image) {
@@ -626,7 +628,7 @@ jpeg_finish_output (j_decompress_ptr cinfo)
}
/* Read markers looking for SOS or EOI */
while (cinfo->input_scan_number <= cinfo->output_scan_number &&
- ! cinfo->inputctl->eoi_reached) {
+ !cinfo->inputctl->eoi_reached) {
if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
return FALSE; /* Suspend, come back later */
}
diff --git a/src/3rdparty/libjpeg/src/jdarith.c b/src/3rdparty/libjpeg/src/jdarith.c
index ce0f920954..6002481e24 100644
--- a/src/3rdparty/libjpeg/src/jdarith.c
+++ b/src/3rdparty/libjpeg/src/jdarith.c
@@ -4,16 +4,19 @@
* This file was part of the Independent JPEG Group's software:
* Developed 1997-2015 by Guido Vollbeding.
* libjpeg-turbo Modifications:
- * Copyright (C) 2015-2016, D. R. Commander.
+ * Copyright (C) 2015-2018, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
- * This file contains portable arithmetic entropy decoding routines for JPEG
- * (implementing the ISO/IEC IS 10918-1 and CCITT Recommendation ITU-T T.81).
+ * This file contains portable arithmetic entropy encoding routines for JPEG
+ * (implementing Recommendation ITU-T T.81 | ISO/IEC 10918-1).
*
* Both sequential and progressive modes are supported in this single module.
*
* Suspension is not currently supported in this module.
+ *
+ * NOTE: All referenced figures are from
+ * Recommendation ITU-T T.81 (1992) | ISO/IEC 10918-1:1994.
*/
#define JPEG_INTERNALS
@@ -21,7 +24,7 @@
#include "jpeglib.h"
-#define NEG_1 ((unsigned int)-1)
+#define NEG_1 ((unsigned int)-1)
/* Expanded entropy decoder object for arithmetic decoding. */
@@ -63,18 +66,18 @@ typedef arith_entropy_decoder *arith_entropy_ptr;
* in the lower bits (mask 0x7F).
*/
-#define DC_STAT_BINS 64
-#define AC_STAT_BINS 256
+#define DC_STAT_BINS 64
+#define AC_STAT_BINS 256
LOCAL(int)
-get_byte (j_decompress_ptr cinfo)
+get_byte(j_decompress_ptr cinfo)
/* Read next input byte; we do not support suspension in this module. */
{
struct jpeg_source_mgr *src = cinfo->src;
if (src->bytes_in_buffer == 0)
- if (! (*src->fill_input_buffer) (cinfo))
+ if (!(*src->fill_input_buffer) (cinfo))
ERREXIT(cinfo, JERR_CANT_SUSPEND);
src->bytes_in_buffer--;
return GETJOCTET(*src->next_input_byte++);
@@ -109,9 +112,9 @@ get_byte (j_decompress_ptr cinfo)
*/
LOCAL(int)
-arith_decode (j_decompress_ptr cinfo, unsigned char *st)
+arith_decode(j_decompress_ptr cinfo, unsigned char *st)
{
- register arith_entropy_ptr e = (arith_entropy_ptr) cinfo->entropy;
+ register arith_entropy_ptr e = (arith_entropy_ptr)cinfo->entropy;
register unsigned char nl, nm;
register JLONG qe, temp;
register int sv, data;
@@ -156,8 +159,8 @@ arith_decode (j_decompress_ptr cinfo, unsigned char *st)
*/
sv = *st;
qe = jpeg_aritab[sv & 0x7F]; /* => Qe_Value */
- nl = qe & 0xFF; qe >>= 8; /* Next_Index_LPS + Switch_MPS */
- nm = qe & 0xFF; qe >>= 8; /* Next_Index_MPS */
+ nl = qe & 0xFF; qe >>= 8; /* Next_Index_LPS + Switch_MPS */
+ nm = qe & 0xFF; qe >>= 8; /* Next_Index_MPS */
/* Decode & estimation procedures per sections D.2.4 & D.2.5 */
temp = e->a - qe;
@@ -193,14 +196,14 @@ arith_decode (j_decompress_ptr cinfo, unsigned char *st)
*/
LOCAL(void)
-process_restart (j_decompress_ptr cinfo)
+process_restart(j_decompress_ptr cinfo)
{
- arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
+ arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
int ci;
jpeg_component_info *compptr;
/* Advance past the RSTn marker */
- if (! (*cinfo->marker->read_restart_marker) (cinfo))
+ if (!(*cinfo->marker->read_restart_marker) (cinfo))
ERREXIT(cinfo, JERR_CANT_SUSPEND);
/* Re-initialize statistics areas */
@@ -244,9 +247,9 @@ process_restart (j_decompress_ptr cinfo)
*/
METHODDEF(boolean)
-decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
+decode_mcu_DC_first(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
- arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
+ arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
JBLOCKROW block;
unsigned char *st;
int blkn, ci, tbl, sign;
@@ -280,7 +283,7 @@ decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
/* Figure F.21: Decoding nonzero value v */
/* Figure F.22: Decoding the sign of v */
sign = arith_decode(cinfo, st + 1);
- st += 2; st += sign;
+ st += 2; st += sign;
/* Figure F.23: Decoding the magnitude category of v */
if ((m = arith_decode(cinfo, st)) != 0) {
st = entropy->dc_stats[tbl] + 20; /* Table F.4: X1 = 20 */
@@ -294,9 +297,9 @@ decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
}
}
/* Section F.1.4.4.1.2: Establish dc_context conditioning category */
- if (m < (int) ((1L << cinfo->arith_dc_L[tbl]) >> 1))
+ if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
entropy->dc_context[ci] = 0; /* zero diff category */
- else if (m > (int) ((1L << cinfo->arith_dc_U[tbl]) >> 1))
+ else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */
else
entropy->dc_context[ci] = 4 + (sign * 4); /* small diff category */
@@ -305,12 +308,12 @@ decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
st += 14;
while (m >>= 1)
if (arith_decode(cinfo, st)) v |= m;
- v += 1; if (sign) v = -v;
- entropy->last_dc_val[ci] += v;
+ v += 1; if (sign) v = -v;
+ entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
}
/* Scale and output the DC coefficient (assumes jpeg_natural_order[0]=0) */
- (*block)[0] = (JCOEF) LEFT_SHIFT(entropy->last_dc_val[ci], cinfo->Al);
+ (*block)[0] = (JCOEF)LEFT_SHIFT(entropy->last_dc_val[ci], cinfo->Al);
}
return TRUE;
@@ -323,9 +326,9 @@ decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
*/
METHODDEF(boolean)
-decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
+decode_mcu_AC_first(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
- arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
+ arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
JBLOCKROW block;
unsigned char *st;
int tbl, sign, k;
@@ -351,7 +354,7 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
st = entropy->ac_stats[tbl] + 3 * (k - 1);
if (arith_decode(cinfo, st)) break; /* EOB flag */
while (arith_decode(cinfo, st + 1) == 0) {
- st += 3; k++;
+ st += 3; k++;
if (k > cinfo->Se) {
WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
entropy->ct = -1; /* spectral overflow */
@@ -383,9 +386,9 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
st += 14;
while (m >>= 1)
if (arith_decode(cinfo, st)) v |= m;
- v += 1; if (sign) v = -v;
+ v += 1; if (sign) v = -v;
/* Scale and output coefficient in natural (dezigzagged) order */
- (*block)[jpeg_natural_order[k]] = (JCOEF) ((unsigned)v << cinfo->Al);
+ (*block)[jpeg_natural_order[k]] = (JCOEF)((unsigned)v << cinfo->Al);
}
return TRUE;
@@ -397,9 +400,9 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
*/
METHODDEF(boolean)
-decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
+decode_mcu_DC_refine(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
- arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
+ arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
unsigned char *st;
int p1, blkn;
@@ -430,9 +433,9 @@ decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
*/
METHODDEF(boolean)
-decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
+decode_mcu_AC_refine(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
- arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
+ arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
JBLOCKROW block;
JCOEFPTR thiscoef;
unsigned char *st;
@@ -481,7 +484,7 @@ decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
*thiscoef = p1;
break;
}
- st += 3; k++;
+ st += 3; k++;
if (k > cinfo->Se) {
WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
entropy->ct = -1; /* spectral overflow */
@@ -499,9 +502,9 @@ decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
*/
METHODDEF(boolean)
-decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
+decode_mcu(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
- arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
+ arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
jpeg_component_info *compptr;
JBLOCKROW block;
unsigned char *st;
@@ -538,7 +541,7 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
/* Figure F.21: Decoding nonzero value v */
/* Figure F.22: Decoding the sign of v */
sign = arith_decode(cinfo, st + 1);
- st += 2; st += sign;
+ st += 2; st += sign;
/* Figure F.23: Decoding the magnitude category of v */
if ((m = arith_decode(cinfo, st)) != 0) {
st = entropy->dc_stats[tbl] + 20; /* Table F.4: X1 = 20 */
@@ -552,9 +555,9 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
}
}
/* Section F.1.4.4.1.2: Establish dc_context conditioning category */
- if (m < (int) ((1L << cinfo->arith_dc_L[tbl]) >> 1))
+ if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
entropy->dc_context[ci] = 0; /* zero diff category */
- else if (m > (int) ((1L << cinfo->arith_dc_U[tbl]) >> 1))
+ else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */
else
entropy->dc_context[ci] = 4 + (sign * 4); /* small diff category */
@@ -563,12 +566,12 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
st += 14;
while (m >>= 1)
if (arith_decode(cinfo, st)) v |= m;
- v += 1; if (sign) v = -v;
- entropy->last_dc_val[ci] += v;
+ v += 1; if (sign) v = -v;
+ entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
}
if (block)
- (*block)[0] = (JCOEF) entropy->last_dc_val[ci];
+ (*block)[0] = (JCOEF)entropy->last_dc_val[ci];
/* Sections F.2.4.2 & F.1.4.4.2: Decoding of AC coefficients */
@@ -579,7 +582,7 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
st = entropy->ac_stats[tbl] + 3 * (k - 1);
if (arith_decode(cinfo, st)) break; /* EOB flag */
while (arith_decode(cinfo, st + 1) == 0) {
- st += 3; k++;
+ st += 3; k++;
if (k > DCTSIZE2 - 1) {
WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
entropy->ct = -1; /* spectral overflow */
@@ -611,9 +614,9 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
st += 14;
while (m >>= 1)
if (arith_decode(cinfo, st)) v |= m;
- v += 1; if (sign) v = -v;
+ v += 1; if (sign) v = -v;
if (block)
- (*block)[jpeg_natural_order[k]] = (JCOEF) v;
+ (*block)[jpeg_natural_order[k]] = (JCOEF)v;
}
}
@@ -626,9 +629,9 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
*/
METHODDEF(void)
-start_pass (j_decompress_ptr cinfo)
+start_pass(j_decompress_ptr cinfo)
{
- arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
+ arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
int ci, tbl;
jpeg_component_info *compptr;
@@ -647,11 +650,11 @@ start_pass (j_decompress_ptr cinfo)
}
if (cinfo->Ah != 0) {
/* Successive approximation refinement scan: must have Al = Ah-1. */
- if (cinfo->Ah-1 != cinfo->Al)
+ if (cinfo->Ah - 1 != cinfo->Al)
goto bad;
}
if (cinfo->Al > 13) { /* need not check for < 0 */
- bad:
+bad:
ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
}
@@ -661,7 +664,7 @@ start_pass (j_decompress_ptr cinfo)
*/
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
int coefi, cindex = cinfo->cur_comp_info[ci]->component_index;
- int *coef_bit_ptr = & cinfo->coef_bits[cindex][0];
+ int *coef_bit_ptr = &cinfo->coef_bits[cindex][0];
if (cinfo->Ss && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
@@ -702,8 +705,8 @@ start_pass (j_decompress_ptr cinfo)
if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
if (entropy->dc_stats[tbl] == NULL)
- entropy->dc_stats[tbl] = (unsigned char *) (*cinfo->mem->alloc_small)
- ((j_common_ptr) cinfo, JPOOL_IMAGE, DC_STAT_BINS);
+ entropy->dc_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
+ ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
MEMZERO(entropy->dc_stats[tbl], DC_STAT_BINS);
/* Initialize DC predictions to 0 */
entropy->last_dc_val[ci] = 0;
@@ -714,8 +717,8 @@ start_pass (j_decompress_ptr cinfo)
if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
if (entropy->ac_stats[tbl] == NULL)
- entropy->ac_stats[tbl] = (unsigned char *) (*cinfo->mem->alloc_small)
- ((j_common_ptr) cinfo, JPOOL_IMAGE, AC_STAT_BINS);
+ entropy->ac_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
+ ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
MEMZERO(entropy->ac_stats[tbl], AC_STAT_BINS);
}
}
@@ -735,15 +738,15 @@ start_pass (j_decompress_ptr cinfo)
*/
GLOBAL(void)
-jinit_arith_decoder (j_decompress_ptr cinfo)
+jinit_arith_decoder(j_decompress_ptr cinfo)
{
arith_entropy_ptr entropy;
int i;
entropy = (arith_entropy_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(arith_entropy_decoder));
- cinfo->entropy = (struct jpeg_entropy_decoder *) entropy;
+ cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
entropy->pub.start_pass = start_pass;
/* Mark tables unallocated */
@@ -759,9 +762,10 @@ jinit_arith_decoder (j_decompress_ptr cinfo)
/* Create progression status table */
int *coef_bit_ptr, ci;
cinfo->coef_bits = (int (*)[DCTSIZE2])
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- cinfo->num_components*DCTSIZE2*sizeof(int));
- coef_bit_ptr = & cinfo->coef_bits[0][0];
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
+ cinfo->num_components * DCTSIZE2 *
+ sizeof(int));
+ coef_bit_ptr = &cinfo->coef_bits[0][0];
for (ci = 0; ci < cinfo->num_components; ci++)
for (i = 0; i < DCTSIZE2; i++)
*coef_bit_ptr++ = -1;
diff --git a/src/3rdparty/libjpeg/src/jdatadst.c b/src/3rdparty/libjpeg/src/jdatadst.c
index dcaf6f0f96..3168b9693c 100644
--- a/src/3rdparty/libjpeg/src/jdatadst.c
+++ b/src/3rdparty/libjpeg/src/jdatadst.c
@@ -24,8 +24,8 @@
#include "jerror.h"
#ifndef HAVE_STDLIB_H /* <stdlib.h> should declare malloc(),free() */
-extern void *malloc (size_t size);
-extern void free (void *ptr);
+extern void *malloc(size_t size);
+extern void free(void *ptr);
#endif
@@ -66,14 +66,14 @@ typedef my_mem_destination_mgr *my_mem_dest_ptr;
*/
METHODDEF(void)
-init_destination (j_compress_ptr cinfo)
+init_destination(j_compress_ptr cinfo)
{
- my_dest_ptr dest = (my_dest_ptr) cinfo->dest;
+ my_dest_ptr dest = (my_dest_ptr)cinfo->dest;
/* Allocate the output buffer --- it will be released when done with image */
dest->buffer = (JOCTET *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- OUTPUT_BUF_SIZE * sizeof(JOCTET));
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
+ OUTPUT_BUF_SIZE * sizeof(JOCTET));
dest->pub.next_output_byte = dest->buffer;
dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;
@@ -81,7 +81,7 @@ init_destination (j_compress_ptr cinfo)
#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED)
METHODDEF(void)
-init_mem_destination (j_compress_ptr cinfo)
+init_mem_destination(j_compress_ptr cinfo)
{
/* no work necessary here */
}
@@ -112,12 +112,12 @@ init_mem_destination (j_compress_ptr cinfo)
*/
METHODDEF(boolean)
-empty_output_buffer (j_compress_ptr cinfo)
+empty_output_buffer(j_compress_ptr cinfo)
{
- my_dest_ptr dest = (my_dest_ptr) cinfo->dest;
+ my_dest_ptr dest = (my_dest_ptr)cinfo->dest;
if (JFWRITE(dest->outfile, dest->buffer, OUTPUT_BUF_SIZE) !=
- (size_t) OUTPUT_BUF_SIZE)
+ (size_t)OUTPUT_BUF_SIZE)
ERREXIT(cinfo, JERR_FILE_WRITE);
dest->pub.next_output_byte = dest->buffer;
@@ -128,15 +128,15 @@ empty_output_buffer (j_compress_ptr cinfo)
#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED)
METHODDEF(boolean)
-empty_mem_output_buffer (j_compress_ptr cinfo)
+empty_mem_output_buffer(j_compress_ptr cinfo)
{
size_t nextsize;
JOCTET *nextbuffer;
- my_mem_dest_ptr dest = (my_mem_dest_ptr) cinfo->dest;
+ my_mem_dest_ptr dest = (my_mem_dest_ptr)cinfo->dest;
/* Try to allocate new buffer with double size */
nextsize = dest->bufsize * 2;
- nextbuffer = (JOCTET *) malloc(nextsize);
+ nextbuffer = (JOCTET *)malloc(nextsize);
if (nextbuffer == NULL)
ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10);
@@ -169,9 +169,9 @@ empty_mem_output_buffer (j_compress_ptr cinfo)
*/
METHODDEF(void)
-term_destination (j_compress_ptr cinfo)
+term_destination(j_compress_ptr cinfo)
{
- my_dest_ptr dest = (my_dest_ptr) cinfo->dest;
+ my_dest_ptr dest = (my_dest_ptr)cinfo->dest;
size_t datacount = OUTPUT_BUF_SIZE - dest->pub.free_in_buffer;
/* Write any data remaining in the buffer */
@@ -187,9 +187,9 @@ term_destination (j_compress_ptr cinfo)
#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED)
METHODDEF(void)
-term_mem_destination (j_compress_ptr cinfo)
+term_mem_destination(j_compress_ptr cinfo)
{
- my_mem_dest_ptr dest = (my_mem_dest_ptr) cinfo->dest;
+ my_mem_dest_ptr dest = (my_mem_dest_ptr)cinfo->dest;
*dest->outbuffer = dest->buffer;
*dest->outsize = (unsigned long)(dest->bufsize - dest->pub.free_in_buffer);
@@ -204,7 +204,7 @@ term_mem_destination (j_compress_ptr cinfo)
*/
GLOBAL(void)
-jpeg_stdio_dest (j_compress_ptr cinfo, FILE *outfile)
+jpeg_stdio_dest(j_compress_ptr cinfo, FILE *outfile)
{
my_dest_ptr dest;
@@ -213,7 +213,7 @@ jpeg_stdio_dest (j_compress_ptr cinfo, FILE *outfile)
*/
if (cinfo->dest == NULL) { /* first time for this JPEG object? */
cinfo->dest = (struct jpeg_destination_mgr *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
sizeof(my_destination_mgr));
} else if (cinfo->dest->init_destination != init_destination) {
/* It is unsafe to reuse the existing destination manager unless it was
@@ -225,7 +225,7 @@ jpeg_stdio_dest (j_compress_ptr cinfo, FILE *outfile)
ERREXIT(cinfo, JERR_BUFFER_SIZE);
}
- dest = (my_dest_ptr) cinfo->dest;
+ dest = (my_dest_ptr)cinfo->dest;
dest->pub.init_destination = init_destination;
dest->pub.empty_output_buffer = empty_output_buffer;
dest->pub.term_destination = term_destination;
@@ -249,8 +249,8 @@ jpeg_stdio_dest (j_compress_ptr cinfo, FILE *outfile)
*/
GLOBAL(void)
-jpeg_mem_dest (j_compress_ptr cinfo,
- unsigned char **outbuffer, unsigned long *outsize)
+jpeg_mem_dest(j_compress_ptr cinfo, unsigned char **outbuffer,
+ unsigned long *outsize)
{
my_mem_dest_ptr dest;
@@ -262,7 +262,7 @@ jpeg_mem_dest (j_compress_ptr cinfo,
*/
if (cinfo->dest == NULL) { /* first time for this JPEG object? */
cinfo->dest = (struct jpeg_destination_mgr *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
sizeof(my_mem_destination_mgr));
} else if (cinfo->dest->init_destination != init_mem_destination) {
/* It is unsafe to reuse the existing destination manager unless it was
@@ -271,7 +271,7 @@ jpeg_mem_dest (j_compress_ptr cinfo,
ERREXIT(cinfo, JERR_BUFFER_SIZE);
}
- dest = (my_mem_dest_ptr) cinfo->dest;
+ dest = (my_mem_dest_ptr)cinfo->dest;
dest->pub.init_destination = init_mem_destination;
dest->pub.empty_output_buffer = empty_mem_output_buffer;
dest->pub.term_destination = term_mem_destination;
@@ -281,7 +281,7 @@ jpeg_mem_dest (j_compress_ptr cinfo,
if (*outbuffer == NULL || *outsize == 0) {
/* Allocate initial buffer */
- dest->newbuffer = *outbuffer = (unsigned char *) malloc(OUTPUT_BUF_SIZE);
+ dest->newbuffer = *outbuffer = (unsigned char *)malloc(OUTPUT_BUF_SIZE);
if (dest->newbuffer == NULL)
ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10);
*outsize = OUTPUT_BUF_SIZE;
diff --git a/src/3rdparty/libjpeg/src/jdatasrc.c b/src/3rdparty/libjpeg/src/jdatasrc.c
index c83183fe19..eadb4a2c90 100644
--- a/src/3rdparty/libjpeg/src/jdatasrc.c
+++ b/src/3rdparty/libjpeg/src/jdatasrc.c
@@ -45,9 +45,9 @@ typedef my_source_mgr *my_src_ptr;
*/
METHODDEF(void)
-init_source (j_decompress_ptr cinfo)
+init_source(j_decompress_ptr cinfo)
{
- my_src_ptr src = (my_src_ptr) cinfo->src;
+ my_src_ptr src = (my_src_ptr)cinfo->src;
/* We reset the empty-input-file flag for each image,
* but we don't clear the input buffer.
@@ -58,7 +58,7 @@ init_source (j_decompress_ptr cinfo)
#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED)
METHODDEF(void)
-init_mem_source (j_decompress_ptr cinfo)
+init_mem_source(j_decompress_ptr cinfo)
{
/* no work necessary here */
}
@@ -99,9 +99,9 @@ init_mem_source (j_decompress_ptr cinfo)
*/
METHODDEF(boolean)
-fill_input_buffer (j_decompress_ptr cinfo)
+fill_input_buffer(j_decompress_ptr cinfo)
{
- my_src_ptr src = (my_src_ptr) cinfo->src;
+ my_src_ptr src = (my_src_ptr)cinfo->src;
size_t nbytes;
nbytes = JFREAD(src->infile, src->buffer, INPUT_BUF_SIZE);
@@ -111,8 +111,8 @@ fill_input_buffer (j_decompress_ptr cinfo)
ERREXIT(cinfo, JERR_INPUT_EMPTY);
WARNMS(cinfo, JWRN_JPEG_EOF);
/* Insert a fake EOI marker */
- src->buffer[0] = (JOCTET) 0xFF;
- src->buffer[1] = (JOCTET) JPEG_EOI;
+ src->buffer[0] = (JOCTET)0xFF;
+ src->buffer[1] = (JOCTET)JPEG_EOI;
nbytes = 2;
}
@@ -125,10 +125,10 @@ fill_input_buffer (j_decompress_ptr cinfo)
#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED)
METHODDEF(boolean)
-fill_mem_input_buffer (j_decompress_ptr cinfo)
+fill_mem_input_buffer(j_decompress_ptr cinfo)
{
static const JOCTET mybuffer[4] = {
- (JOCTET) 0xFF, (JOCTET) JPEG_EOI, 0, 0
+ (JOCTET)0xFF, (JOCTET)JPEG_EOI, 0, 0
};
/* The whole JPEG data is expected to reside in the supplied memory
@@ -160,7 +160,7 @@ fill_mem_input_buffer (j_decompress_ptr cinfo)
*/
METHODDEF(void)
-skip_input_data (j_decompress_ptr cinfo, long num_bytes)
+skip_input_data(j_decompress_ptr cinfo, long num_bytes)
{
struct jpeg_source_mgr *src = cinfo->src;
@@ -169,15 +169,15 @@ skip_input_data (j_decompress_ptr cinfo, long num_bytes)
* any trouble anyway --- large skips are infrequent.
*/
if (num_bytes > 0) {
- while (num_bytes > (long) src->bytes_in_buffer) {
- num_bytes -= (long) src->bytes_in_buffer;
- (void) (*src->fill_input_buffer) (cinfo);
+ while (num_bytes > (long)src->bytes_in_buffer) {
+ num_bytes -= (long)src->bytes_in_buffer;
+ (void)(*src->fill_input_buffer) (cinfo);
/* note we assume that fill_input_buffer will never return FALSE,
* so suspension need not be handled.
*/
}
- src->next_input_byte += (size_t) num_bytes;
- src->bytes_in_buffer -= (size_t) num_bytes;
+ src->next_input_byte += (size_t)num_bytes;
+ src->bytes_in_buffer -= (size_t)num_bytes;
}
}
@@ -201,7 +201,7 @@ skip_input_data (j_decompress_ptr cinfo, long num_bytes)
*/
METHODDEF(void)
-term_source (j_decompress_ptr cinfo)
+term_source(j_decompress_ptr cinfo)
{
/* no work necessary here */
}
@@ -214,7 +214,7 @@ term_source (j_decompress_ptr cinfo)
*/
GLOBAL(void)
-jpeg_stdio_src (j_decompress_ptr cinfo, FILE *infile)
+jpeg_stdio_src(j_decompress_ptr cinfo, FILE *infile)
{
my_src_ptr src;
@@ -225,11 +225,11 @@ jpeg_stdio_src (j_decompress_ptr cinfo, FILE *infile)
*/
if (cinfo->src == NULL) { /* first time for this JPEG object? */
cinfo->src = (struct jpeg_source_mgr *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
sizeof(my_source_mgr));
- src = (my_src_ptr) cinfo->src;
+ src = (my_src_ptr)cinfo->src;
src->buffer = (JOCTET *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
INPUT_BUF_SIZE * sizeof(JOCTET));
} else if (cinfo->src->init_source != init_source) {
/* It is unsafe to reuse the existing source manager unless it was created
@@ -241,7 +241,7 @@ jpeg_stdio_src (j_decompress_ptr cinfo, FILE *infile)
ERREXIT(cinfo, JERR_BUFFER_SIZE);
}
- src = (my_src_ptr) cinfo->src;
+ src = (my_src_ptr)cinfo->src;
src->pub.init_source = init_source;
src->pub.fill_input_buffer = fill_input_buffer;
src->pub.skip_input_data = skip_input_data;
@@ -260,8 +260,8 @@ jpeg_stdio_src (j_decompress_ptr cinfo, FILE *infile)
*/
GLOBAL(void)
-jpeg_mem_src (j_decompress_ptr cinfo,
- const unsigned char *inbuffer, unsigned long insize)
+jpeg_mem_src(j_decompress_ptr cinfo, const unsigned char *inbuffer,
+ unsigned long insize)
{
struct jpeg_source_mgr *src;
@@ -274,7 +274,7 @@ jpeg_mem_src (j_decompress_ptr cinfo,
*/
if (cinfo->src == NULL) { /* first time for this JPEG object? */
cinfo->src = (struct jpeg_source_mgr *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
sizeof(struct jpeg_source_mgr));
} else if (cinfo->src->init_source != init_mem_source) {
/* It is unsafe to reuse the existing source manager unless it was created
@@ -289,7 +289,7 @@ jpeg_mem_src (j_decompress_ptr cinfo,
src->skip_input_data = skip_input_data;
src->resync_to_restart = jpeg_resync_to_restart; /* use default method */
src->term_source = term_source;
- src->bytes_in_buffer = (size_t) insize;
- src->next_input_byte = (const JOCTET *) inbuffer;
+ src->bytes_in_buffer = (size_t)insize;
+ src->next_input_byte = (const JOCTET *)inbuffer;
}
#endif
diff --git a/src/3rdparty/libjpeg/src/jdcoefct.c b/src/3rdparty/libjpeg/src/jdcoefct.c
index 1a48969b83..723a9ac2be 100644
--- a/src/3rdparty/libjpeg/src/jdcoefct.c
+++ b/src/3rdparty/libjpeg/src/jdcoefct.c
@@ -25,16 +25,15 @@
/* Forward declarations */
-METHODDEF(int) decompress_onepass
- (j_decompress_ptr cinfo, JSAMPIMAGE output_buf);
+METHODDEF(int) decompress_onepass(j_decompress_ptr cinfo,
+ JSAMPIMAGE output_buf);
#ifdef D_MULTISCAN_FILES_SUPPORTED
-METHODDEF(int) decompress_data
- (j_decompress_ptr cinfo, JSAMPIMAGE output_buf);
+METHODDEF(int) decompress_data(j_decompress_ptr cinfo, JSAMPIMAGE output_buf);
#endif
#ifdef BLOCK_SMOOTHING_SUPPORTED
-LOCAL(boolean) smoothing_ok (j_decompress_ptr cinfo);
-METHODDEF(int) decompress_smooth_data
- (j_decompress_ptr cinfo, JSAMPIMAGE output_buf);
+LOCAL(boolean) smoothing_ok(j_decompress_ptr cinfo);
+METHODDEF(int) decompress_smooth_data(j_decompress_ptr cinfo,
+ JSAMPIMAGE output_buf);
#endif
@@ -43,7 +42,7 @@ METHODDEF(int) decompress_smooth_data
*/
METHODDEF(void)
-start_input_pass (j_decompress_ptr cinfo)
+start_input_pass(j_decompress_ptr cinfo)
{
cinfo->input_iMCU_row = 0;
start_iMCU_row(cinfo);
@@ -55,10 +54,10 @@ start_input_pass (j_decompress_ptr cinfo)
*/
METHODDEF(void)
-start_output_pass (j_decompress_ptr cinfo)
+start_output_pass(j_decompress_ptr cinfo)
{
#ifdef BLOCK_SMOOTHING_SUPPORTED
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+ my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
/* If multipass, check to see whether to use block smoothing on this pass */
if (coef->pub.coef_arrays != NULL) {
@@ -83,9 +82,9 @@ start_output_pass (j_decompress_ptr cinfo)
*/
METHODDEF(int)
-decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
+decompress_onepass(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+ my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
JDIMENSION MCU_col_num; /* index of current MCU within row */
JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
@@ -101,9 +100,9 @@ decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col;
MCU_col_num++) {
/* Try to fetch an MCU. Entropy decoder expects buffer to be zeroed. */
- jzero_far((void *) coef->MCU_buffer[0],
- (size_t) (cinfo->blocks_in_MCU * sizeof(JBLOCK)));
- if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
+ jzero_far((void *)coef->MCU_buffer[0],
+ (size_t)(cinfo->blocks_in_MCU * sizeof(JBLOCK)));
+ if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
/* Suspension forced; update state counters and exit */
coef->MCU_vert_offset = yoffset;
coef->MCU_ctr = MCU_col_num;
@@ -120,28 +119,28 @@ decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
* incremented past them!). Note the inner loop relies on having
* allocated the MCU_buffer[] blocks sequentially.
*/
- blkn = 0; /* index of current DCT block within MCU */
+ blkn = 0; /* index of current DCT block within MCU */
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
compptr = cinfo->cur_comp_info[ci];
/* Don't bother to IDCT an uninteresting component. */
- if (! compptr->component_needed) {
+ if (!compptr->component_needed) {
blkn += compptr->MCU_blocks;
continue;
}
inverse_DCT = cinfo->idct->inverse_DCT[compptr->component_index];
- useful_width = (MCU_col_num < last_MCU_col) ? compptr->MCU_width
- : compptr->last_col_width;
+ useful_width = (MCU_col_num < last_MCU_col) ?
+ compptr->MCU_width : compptr->last_col_width;
output_ptr = output_buf[compptr->component_index] +
- yoffset * compptr->_DCT_scaled_size;
+ yoffset * compptr->_DCT_scaled_size;
start_col = (MCU_col_num - cinfo->master->first_iMCU_col) *
- compptr->MCU_sample_width;
+ compptr->MCU_sample_width;
for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
if (cinfo->input_iMCU_row < last_iMCU_row ||
- yoffset+yindex < compptr->last_row_height) {
+ yoffset + yindex < compptr->last_row_height) {
output_col = start_col;
for (xindex = 0; xindex < useful_width; xindex++) {
(*inverse_DCT) (cinfo, compptr,
- (JCOEFPTR) coef->MCU_buffer[blkn+xindex],
+ (JCOEFPTR)coef->MCU_buffer[blkn + xindex],
output_ptr, output_col);
output_col += compptr->_DCT_scaled_size;
}
@@ -172,7 +171,7 @@ decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
*/
METHODDEF(int)
-dummy_consume_data (j_decompress_ptr cinfo)
+dummy_consume_data(j_decompress_ptr cinfo)
{
return JPEG_SUSPENDED; /* Always indicate nothing was done */
}
@@ -188,9 +187,9 @@ dummy_consume_data (j_decompress_ptr cinfo)
*/
METHODDEF(int)
-consume_data (j_decompress_ptr cinfo)
+consume_data(j_decompress_ptr cinfo)
{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+ my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
JDIMENSION MCU_col_num; /* index of current MCU within row */
int blkn, ci, xindex, yindex, yoffset;
JDIMENSION start_col;
@@ -202,9 +201,9 @@ consume_data (j_decompress_ptr cinfo)
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
compptr = cinfo->cur_comp_info[ci];
buffer[ci] = (*cinfo->mem->access_virt_barray)
- ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index],
+ ((j_common_ptr)cinfo, coef->whole_image[compptr->component_index],
cinfo->input_iMCU_row * compptr->v_samp_factor,
- (JDIMENSION) compptr->v_samp_factor, TRUE);
+ (JDIMENSION)compptr->v_samp_factor, TRUE);
/* Note: entropy decoder expects buffer to be zeroed,
* but this is handled automatically by the memory manager
* because we requested a pre-zeroed array.
@@ -222,14 +221,14 @@ consume_data (j_decompress_ptr cinfo)
compptr = cinfo->cur_comp_info[ci];
start_col = MCU_col_num * compptr->MCU_width;
for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
- buffer_ptr = buffer[ci][yindex+yoffset] + start_col;
+ buffer_ptr = buffer[ci][yindex + yoffset] + start_col;
for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
coef->MCU_buffer[blkn++] = buffer_ptr++;
}
}
}
/* Try to fetch the MCU. */
- if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
+ if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
/* Suspension forced; update state counters and exit */
coef->MCU_vert_offset = yoffset;
coef->MCU_ctr = MCU_col_num;
@@ -259,9 +258,9 @@ consume_data (j_decompress_ptr cinfo)
*/
METHODDEF(int)
-decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
+decompress_data(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+ my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
JDIMENSION block_num;
int ci, block_row, block_rows;
@@ -276,7 +275,7 @@ decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
while (cinfo->input_scan_number < cinfo->output_scan_number ||
(cinfo->input_scan_number == cinfo->output_scan_number &&
cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {
- if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED)
+ if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
return JPEG_SUSPENDED;
}
@@ -284,19 +283,19 @@ decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) {
/* Don't bother to IDCT an uninteresting component. */
- if (! compptr->component_needed)
+ if (!compptr->component_needed)
continue;
/* Align the virtual buffer for this component. */
buffer = (*cinfo->mem->access_virt_barray)
- ((j_common_ptr) cinfo, coef->whole_image[ci],
+ ((j_common_ptr)cinfo, coef->whole_image[ci],
cinfo->output_iMCU_row * compptr->v_samp_factor,
- (JDIMENSION) compptr->v_samp_factor, FALSE);
+ (JDIMENSION)compptr->v_samp_factor, FALSE);
/* Count non-dummy DCT block rows in this iMCU row. */
if (cinfo->output_iMCU_row < last_iMCU_row)
block_rows = compptr->v_samp_factor;
else {
/* NB: can't use last_row_height here; it is input-side-dependent! */
- block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor);
+ block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
if (block_rows == 0) block_rows = compptr->v_samp_factor;
}
inverse_DCT = cinfo->idct->inverse_DCT[ci];
@@ -307,8 +306,8 @@ decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
output_col = 0;
for (block_num = cinfo->master->first_MCU_col[ci];
block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
- (*inverse_DCT) (cinfo, compptr, (JCOEFPTR) buffer_ptr,
- output_ptr, output_col);
+ (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)buffer_ptr, output_ptr,
+ output_col);
buffer_ptr++;
output_col += compptr->_DCT_scaled_size;
}
@@ -350,9 +349,9 @@ decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
*/
LOCAL(boolean)
-smoothing_ok (j_decompress_ptr cinfo)
+smoothing_ok(j_decompress_ptr cinfo)
{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+ my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
boolean smoothing_useful = FALSE;
int ci, coefi;
jpeg_component_info *compptr;
@@ -360,13 +359,13 @@ smoothing_ok (j_decompress_ptr cinfo)
int *coef_bits;
int *coef_bits_latch;
- if (! cinfo->progressive_mode || cinfo->coef_bits == NULL)
+ if (!cinfo->progressive_mode || cinfo->coef_bits == NULL)
return FALSE;
/* Allocate latch area if not already done */
if (coef->coef_bits_latch == NULL)
coef->coef_bits_latch = (int *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
cinfo->num_components *
(SAVED_COEFS * sizeof(int)));
coef_bits_latch = coef->coef_bits_latch;
@@ -406,9 +405,9 @@ smoothing_ok (j_decompress_ptr cinfo)
*/
METHODDEF(int)
-decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
+decompress_smooth_data(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+ my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
JDIMENSION block_num, last_block_column;
int ci, block_row, block_rows, access_rows;
@@ -422,8 +421,8 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
JCOEF *workspace;
int *coef_bits;
JQUANT_TBL *quanttbl;
- JLONG Q00,Q01,Q02,Q10,Q11,Q20, num;
- int DC1,DC2,DC3,DC4,DC5,DC6,DC7,DC8,DC9;
+ JLONG Q00, Q01, Q02, Q10, Q11, Q20, num;
+ int DC1, DC2, DC3, DC4, DC5, DC6, DC7, DC8, DC9;
int Al, pred;
/* Keep a local variable to avoid looking it up more than once */
@@ -431,7 +430,7 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
/* Force some input to be done if we are getting ahead of the input. */
while (cinfo->input_scan_number <= cinfo->output_scan_number &&
- ! cinfo->inputctl->eoi_reached) {
+ !cinfo->inputctl->eoi_reached) {
if (cinfo->input_scan_number == cinfo->output_scan_number) {
/* If input is working on current scan, we ordinarily want it to
* have completed the current row. But if input scan is DC,
@@ -439,10 +438,10 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
* values are up to date.
*/
JDIMENSION delta = (cinfo->Ss == 0) ? 1 : 0;
- if (cinfo->input_iMCU_row > cinfo->output_iMCU_row+delta)
+ if (cinfo->input_iMCU_row > cinfo->output_iMCU_row + delta)
break;
}
- if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED)
+ if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
return JPEG_SUSPENDED;
}
@@ -450,7 +449,7 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) {
/* Don't bother to IDCT an uninteresting component. */
- if (! compptr->component_needed)
+ if (!compptr->component_needed)
continue;
/* Count non-dummy DCT block rows in this iMCU row. */
if (cinfo->output_iMCU_row < last_iMCU_row) {
@@ -459,7 +458,7 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
last_row = FALSE;
} else {
/* NB: can't use last_row_height here; it is input-side-dependent! */
- block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor);
+ block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
if (block_rows == 0) block_rows = compptr->v_samp_factor;
access_rows = block_rows; /* this iMCU row only */
last_row = TRUE;
@@ -468,15 +467,15 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
if (cinfo->output_iMCU_row > 0) {
access_rows += compptr->v_samp_factor; /* prior iMCU row too */
buffer = (*cinfo->mem->access_virt_barray)
- ((j_common_ptr) cinfo, coef->whole_image[ci],
+ ((j_common_ptr)cinfo, coef->whole_image[ci],
(cinfo->output_iMCU_row - 1) * compptr->v_samp_factor,
- (JDIMENSION) access_rows, FALSE);
+ (JDIMENSION)access_rows, FALSE);
buffer += compptr->v_samp_factor; /* point to current iMCU row */
first_row = FALSE;
} else {
buffer = (*cinfo->mem->access_virt_barray)
- ((j_common_ptr) cinfo, coef->whole_image[ci],
- (JDIMENSION) 0, (JDIMENSION) access_rows, FALSE);
+ ((j_common_ptr)cinfo, coef->whole_image[ci],
+ (JDIMENSION)0, (JDIMENSION)access_rows, FALSE);
first_row = TRUE;
}
/* Fetch component-dependent info */
@@ -496,115 +495,115 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
if (first_row && block_row == 0)
prev_block_row = buffer_ptr;
else
- prev_block_row = buffer[block_row-1];
- if (last_row && block_row == block_rows-1)
+ prev_block_row = buffer[block_row - 1];
+ if (last_row && block_row == block_rows - 1)
next_block_row = buffer_ptr;
else
- next_block_row = buffer[block_row+1];
+ next_block_row = buffer[block_row + 1];
/* We fetch the surrounding DC values using a sliding-register approach.
* Initialize all nine here so as to do the right thing on narrow pics.
*/
- DC1 = DC2 = DC3 = (int) prev_block_row[0][0];
- DC4 = DC5 = DC6 = (int) buffer_ptr[0][0];
- DC7 = DC8 = DC9 = (int) next_block_row[0][0];
+ DC1 = DC2 = DC3 = (int)prev_block_row[0][0];
+ DC4 = DC5 = DC6 = (int)buffer_ptr[0][0];
+ DC7 = DC8 = DC9 = (int)next_block_row[0][0];
output_col = 0;
last_block_column = compptr->width_in_blocks - 1;
for (block_num = cinfo->master->first_MCU_col[ci];
block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
/* Fetch current DCT block into workspace so we can modify it. */
- jcopy_block_row(buffer_ptr, (JBLOCKROW) workspace, (JDIMENSION) 1);
+ jcopy_block_row(buffer_ptr, (JBLOCKROW)workspace, (JDIMENSION)1);
/* Update DC values */
if (block_num < last_block_column) {
- DC3 = (int) prev_block_row[1][0];
- DC6 = (int) buffer_ptr[1][0];
- DC9 = (int) next_block_row[1][0];
+ DC3 = (int)prev_block_row[1][0];
+ DC6 = (int)buffer_ptr[1][0];
+ DC9 = (int)next_block_row[1][0];
}
/* Compute coefficient estimates per K.8.
* An estimate is applied only if coefficient is still zero,
* and is not known to be fully accurate.
*/
/* AC01 */
- if ((Al=coef_bits[1]) != 0 && workspace[1] == 0) {
+ if ((Al = coef_bits[1]) != 0 && workspace[1] == 0) {
num = 36 * Q00 * (DC4 - DC6);
if (num >= 0) {
- pred = (int) (((Q01<<7) + num) / (Q01<<8));
- if (Al > 0 && pred >= (1<<Al))
- pred = (1<<Al)-1;
+ pred = (int)(((Q01 << 7) + num) / (Q01 << 8));
+ if (Al > 0 && pred >= (1 << Al))
+ pred = (1 << Al) - 1;
} else {
- pred = (int) (((Q01<<7) - num) / (Q01<<8));
- if (Al > 0 && pred >= (1<<Al))
- pred = (1<<Al)-1;
+ pred = (int)(((Q01 << 7) - num) / (Q01 << 8));
+ if (Al > 0 && pred >= (1 << Al))
+ pred = (1 << Al) - 1;
pred = -pred;
}
- workspace[1] = (JCOEF) pred;
+ workspace[1] = (JCOEF)pred;
}
/* AC10 */
- if ((Al=coef_bits[2]) != 0 && workspace[8] == 0) {
+ if ((Al = coef_bits[2]) != 0 && workspace[8] == 0) {
num = 36 * Q00 * (DC2 - DC8);
if (num >= 0) {
- pred = (int) (((Q10<<7) + num) / (Q10<<8));
- if (Al > 0 && pred >= (1<<Al))
- pred = (1<<Al)-1;
+ pred = (int)(((Q10 << 7) + num) / (Q10 << 8));
+ if (Al > 0 && pred >= (1 << Al))
+ pred = (1 << Al) - 1;
} else {
- pred = (int) (((Q10<<7) - num) / (Q10<<8));
- if (Al > 0 && pred >= (1<<Al))
- pred = (1<<Al)-1;
+ pred = (int)(((Q10 << 7) - num) / (Q10 << 8));
+ if (Al > 0 && pred >= (1 << Al))
+ pred = (1 << Al) - 1;
pred = -pred;
}
- workspace[8] = (JCOEF) pred;
+ workspace[8] = (JCOEF)pred;
}
/* AC20 */
- if ((Al=coef_bits[3]) != 0 && workspace[16] == 0) {
- num = 9 * Q00 * (DC2 + DC8 - 2*DC5);
+ if ((Al = coef_bits[3]) != 0 && workspace[16] == 0) {
+ num = 9 * Q00 * (DC2 + DC8 - 2 * DC5);
if (num >= 0) {
- pred = (int) (((Q20<<7) + num) / (Q20<<8));
- if (Al > 0 && pred >= (1<<Al))
- pred = (1<<Al)-1;
+ pred = (int)(((Q20 << 7) + num) / (Q20 << 8));
+ if (Al > 0 && pred >= (1 << Al))
+ pred = (1 << Al) - 1;
} else {
- pred = (int) (((Q20<<7) - num) / (Q20<<8));
- if (Al > 0 && pred >= (1<<Al))
- pred = (1<<Al)-1;
+ pred = (int)(((Q20 << 7) - num) / (Q20 << 8));
+ if (Al > 0 && pred >= (1 << Al))
+ pred = (1 << Al) - 1;
pred = -pred;
}
- workspace[16] = (JCOEF) pred;
+ workspace[16] = (JCOEF)pred;
}
/* AC11 */
- if ((Al=coef_bits[4]) != 0 && workspace[9] == 0) {
+ if ((Al = coef_bits[4]) != 0 && workspace[9] == 0) {
num = 5 * Q00 * (DC1 - DC3 - DC7 + DC9);
if (num >= 0) {
- pred = (int) (((Q11<<7) + num) / (Q11<<8));
- if (Al > 0 && pred >= (1<<Al))
- pred = (1<<Al)-1;
+ pred = (int)(((Q11 << 7) + num) / (Q11 << 8));
+ if (Al > 0 && pred >= (1 << Al))
+ pred = (1 << Al) - 1;
} else {
- pred = (int) (((Q11<<7) - num) / (Q11<<8));
- if (Al > 0 && pred >= (1<<Al))
- pred = (1<<Al)-1;
+ pred = (int)(((Q11 << 7) - num) / (Q11 << 8));
+ if (Al > 0 && pred >= (1 << Al))
+ pred = (1 << Al) - 1;
pred = -pred;
}
- workspace[9] = (JCOEF) pred;
+ workspace[9] = (JCOEF)pred;
}
/* AC02 */
- if ((Al=coef_bits[5]) != 0 && workspace[2] == 0) {
- num = 9 * Q00 * (DC4 + DC6 - 2*DC5);
+ if ((Al = coef_bits[5]) != 0 && workspace[2] == 0) {
+ num = 9 * Q00 * (DC4 + DC6 - 2 * DC5);
if (num >= 0) {
- pred = (int) (((Q02<<7) + num) / (Q02<<8));
- if (Al > 0 && pred >= (1<<Al))
- pred = (1<<Al)-1;
+ pred = (int)(((Q02 << 7) + num) / (Q02 << 8));
+ if (Al > 0 && pred >= (1 << Al))
+ pred = (1 << Al) - 1;
} else {
- pred = (int) (((Q02<<7) - num) / (Q02<<8));
- if (Al > 0 && pred >= (1<<Al))
- pred = (1<<Al)-1;
+ pred = (int)(((Q02 << 7) - num) / (Q02 << 8));
+ if (Al > 0 && pred >= (1 << Al))
+ pred = (1 << Al) - 1;
pred = -pred;
}
- workspace[2] = (JCOEF) pred;
+ workspace[2] = (JCOEF)pred;
}
/* OK, do the IDCT */
- (*inverse_DCT) (cinfo, compptr, (JCOEFPTR) workspace,
- output_ptr, output_col);
+ (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)workspace, output_ptr,
+ output_col);
/* Advance for next column */
- DC1 = DC2; DC2 = DC3;
- DC4 = DC5; DC5 = DC6;
- DC7 = DC8; DC8 = DC9;
+ DC1 = DC2; DC2 = DC3;
+ DC4 = DC5; DC5 = DC6;
+ DC7 = DC8; DC8 = DC9;
buffer_ptr++, prev_block_row++, next_block_row++;
output_col += compptr->_DCT_scaled_size;
}
@@ -625,14 +624,14 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
*/
GLOBAL(void)
-jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
+jinit_d_coef_controller(j_decompress_ptr cinfo, boolean need_full_buffer)
{
my_coef_ptr coef;
coef = (my_coef_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(my_coef_controller));
- cinfo->coef = (struct jpeg_d_coef_controller *) coef;
+ cinfo->coef = (struct jpeg_d_coef_controller *)coef;
coef->pub.start_input_pass = start_input_pass;
coef->pub.start_output_pass = start_output_pass;
#ifdef BLOCK_SMOOTHING_SUPPORTED
@@ -657,12 +656,12 @@ jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
access_rows *= 3;
#endif
coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
- ((j_common_ptr) cinfo, JPOOL_IMAGE, TRUE,
- (JDIMENSION) jround_up((long) compptr->width_in_blocks,
- (long) compptr->h_samp_factor),
- (JDIMENSION) jround_up((long) compptr->height_in_blocks,
- (long) compptr->v_samp_factor),
- (JDIMENSION) access_rows);
+ ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
+ (JDIMENSION)jround_up((long)compptr->width_in_blocks,
+ (long)compptr->h_samp_factor),
+ (JDIMENSION)jround_up((long)compptr->height_in_blocks,
+ (long)compptr->v_samp_factor),
+ (JDIMENSION)access_rows);
}
coef->pub.consume_data = consume_data;
coef->pub.decompress_data = decompress_data;
@@ -676,7 +675,7 @@ jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
int i;
buffer = (JBLOCKROW)
- (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
D_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
coef->MCU_buffer[i] = buffer + i;
@@ -688,6 +687,6 @@ jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
/* Allocate the workspace buffer */
coef->workspace = (JCOEF *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(JCOEF) * DCTSIZE2);
}
diff --git a/src/3rdparty/libjpeg/src/jdcoefct.h b/src/3rdparty/libjpeg/src/jdcoefct.h
index bf6beb274b..c4d1943dd4 100644
--- a/src/3rdparty/libjpeg/src/jdcoefct.h
+++ b/src/3rdparty/libjpeg/src/jdcoefct.h
@@ -59,10 +59,10 @@ typedef my_coef_controller *my_coef_ptr;
LOCAL(void)
-start_iMCU_row (j_decompress_ptr cinfo)
+start_iMCU_row(j_decompress_ptr cinfo)
/* Reset within-iMCU-row counters for a new row (input side) */
{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
+ my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
/* In an interleaved scan, an MCU row is the same as an iMCU row.
* In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
@@ -71,7 +71,7 @@ start_iMCU_row (j_decompress_ptr cinfo)
if (cinfo->comps_in_scan > 1) {
coef->MCU_rows_per_iMCU_row = 1;
} else {
- if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1))
+ if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows - 1))
coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
else
coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
diff --git a/src/3rdparty/libjpeg/src/jdcol565.c b/src/3rdparty/libjpeg/src/jdcol565.c
index 349fce4a66..40068ef84f 100644
--- a/src/3rdparty/libjpeg/src/jdcol565.c
+++ b/src/3rdparty/libjpeg/src/jdcol565.c
@@ -17,22 +17,22 @@
INLINE
LOCAL(void)
-ycc_rgb565_convert_internal (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
+ycc_rgb565_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION input_row, JSAMPARRAY output_buf,
+ int num_rows)
{
- my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
+ my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
register int y, cb, cr;
register JSAMPROW outptr;
register JSAMPROW inptr0, inptr1, inptr2;
register JDIMENSION col;
JDIMENSION num_cols = cinfo->output_width;
/* copy these pointers into registers if possible */
- register JSAMPLE * range_limit = cinfo->sample_range_limit;
- register int * Crrtab = cconvert->Cr_r_tab;
- register int * Cbbtab = cconvert->Cb_b_tab;
- register JLONG * Crgtab = cconvert->Cr_g_tab;
- register JLONG * Cbgtab = cconvert->Cb_g_tab;
+ register JSAMPLE *range_limit = cinfo->sample_range_limit;
+ register int *Crrtab = cconvert->Cr_r_tab;
+ register int *Cbbtab = cconvert->Cb_b_tab;
+ register JLONG *Crgtab = cconvert->Cr_g_tab;
+ register JLONG *Cbgtab = cconvert->Cb_g_tab;
SHIFT_TEMPS
while (--num_rows >= 0) {
@@ -53,7 +53,7 @@ ycc_rgb565_convert_internal (j_decompress_ptr cinfo,
SCALEBITS))];
b = range_limit[y + Cbbtab[cb]];
rgb = PACK_SHORT_565(r, g, b);
- *(INT16*)outptr = (INT16)rgb;
+ *(INT16 *)outptr = (INT16)rgb;
outptr += 2;
num_cols--;
}
@@ -88,7 +88,7 @@ ycc_rgb565_convert_internal (j_decompress_ptr cinfo,
SCALEBITS))];
b = range_limit[y + Cbbtab[cb]];
rgb = PACK_SHORT_565(r, g, b);
- *(INT16*)outptr = (INT16)rgb;
+ *(INT16 *)outptr = (INT16)rgb;
}
}
}
@@ -96,22 +96,22 @@ ycc_rgb565_convert_internal (j_decompress_ptr cinfo,
INLINE
LOCAL(void)
-ycc_rgb565D_convert_internal (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
+ycc_rgb565D_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION input_row, JSAMPARRAY output_buf,
+ int num_rows)
{
- my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
+ my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
register int y, cb, cr;
register JSAMPROW outptr;
register JSAMPROW inptr0, inptr1, inptr2;
register JDIMENSION col;
JDIMENSION num_cols = cinfo->output_width;
/* copy these pointers into registers if possible */
- register JSAMPLE * range_limit = cinfo->sample_range_limit;
- register int * Crrtab = cconvert->Cr_r_tab;
- register int * Cbbtab = cconvert->Cb_b_tab;
- register JLONG * Crgtab = cconvert->Cr_g_tab;
- register JLONG * Cbgtab = cconvert->Cb_g_tab;
+ register JSAMPLE *range_limit = cinfo->sample_range_limit;
+ register int *Crrtab = cconvert->Cr_r_tab;
+ register int *Cbbtab = cconvert->Cb_b_tab;
+ register JLONG *Crgtab = cconvert->Cr_g_tab;
+ register JLONG *Cbgtab = cconvert->Cb_g_tab;
JLONG d0 = dither_matrix[cinfo->output_scanline & DITHER_MASK];
SHIFT_TEMPS
@@ -134,7 +134,7 @@ ycc_rgb565D_convert_internal (j_decompress_ptr cinfo,
SCALEBITS)), d0)];
b = range_limit[DITHER_565_B(y + Cbbtab[cb], d0)];
rgb = PACK_SHORT_565(r, g, b);
- *(INT16*)outptr = (INT16)rgb;
+ *(INT16 *)outptr = (INT16)rgb;
outptr += 2;
num_cols--;
}
@@ -174,7 +174,7 @@ ycc_rgb565D_convert_internal (j_decompress_ptr cinfo,
SCALEBITS)), d0)];
b = range_limit[DITHER_565_B(y + Cbbtab[cb], d0)];
rgb = PACK_SHORT_565(r, g, b);
- *(INT16*)outptr = (INT16)rgb;
+ *(INT16 *)outptr = (INT16)rgb;
}
}
}
@@ -182,9 +182,9 @@ ycc_rgb565D_convert_internal (j_decompress_ptr cinfo,
INLINE
LOCAL(void)
-rgb_rgb565_convert_internal (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
+rgb_rgb565_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION input_row, JSAMPARRAY output_buf,
+ int num_rows)
{
register JSAMPROW outptr;
register JSAMPROW inptr0, inptr1, inptr2;
@@ -206,7 +206,7 @@ rgb_rgb565_convert_internal (j_decompress_ptr cinfo,
g = GETJSAMPLE(*inptr1++);
b = GETJSAMPLE(*inptr2++);
rgb = PACK_SHORT_565(r, g, b);
- *(INT16*)outptr = (INT16)rgb;
+ *(INT16 *)outptr = (INT16)rgb;
outptr += 2;
num_cols--;
}
@@ -229,7 +229,7 @@ rgb_rgb565_convert_internal (j_decompress_ptr cinfo,
g = GETJSAMPLE(*inptr1);
b = GETJSAMPLE(*inptr2);
rgb = PACK_SHORT_565(r, g, b);
- *(INT16*)outptr = (INT16)rgb;
+ *(INT16 *)outptr = (INT16)rgb;
}
}
}
@@ -237,14 +237,14 @@ rgb_rgb565_convert_internal (j_decompress_ptr cinfo,
INLINE
LOCAL(void)
-rgb_rgb565D_convert_internal (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
+rgb_rgb565D_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION input_row, JSAMPARRAY output_buf,
+ int num_rows)
{
register JSAMPROW outptr;
register JSAMPROW inptr0, inptr1, inptr2;
register JDIMENSION col;
- register JSAMPLE * range_limit = cinfo->sample_range_limit;
+ register JSAMPLE *range_limit = cinfo->sample_range_limit;
JDIMENSION num_cols = cinfo->output_width;
JLONG d0 = dither_matrix[cinfo->output_scanline & DITHER_MASK];
SHIFT_TEMPS
@@ -263,7 +263,7 @@ rgb_rgb565D_convert_internal (j_decompress_ptr cinfo,
g = range_limit[DITHER_565_G(GETJSAMPLE(*inptr1++), d0)];
b = range_limit[DITHER_565_B(GETJSAMPLE(*inptr2++), d0)];
rgb = PACK_SHORT_565(r, g, b);
- *(INT16*)outptr = (INT16)rgb;
+ *(INT16 *)outptr = (INT16)rgb;
outptr += 2;
num_cols--;
}
@@ -288,7 +288,7 @@ rgb_rgb565D_convert_internal (j_decompress_ptr cinfo,
g = range_limit[DITHER_565_G(GETJSAMPLE(*inptr1), d0)];
b = range_limit[DITHER_565_B(GETJSAMPLE(*inptr2), d0)];
rgb = PACK_SHORT_565(r, g, b);
- *(INT16*)outptr = (INT16)rgb;
+ *(INT16 *)outptr = (INT16)rgb;
}
}
}
@@ -296,9 +296,9 @@ rgb_rgb565D_convert_internal (j_decompress_ptr cinfo,
INLINE
LOCAL(void)
-gray_rgb565_convert_internal (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
+gray_rgb565_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION input_row, JSAMPARRAY output_buf,
+ int num_rows)
{
register JSAMPROW inptr, outptr;
register JDIMENSION col;
@@ -313,7 +313,7 @@ gray_rgb565_convert_internal (j_decompress_ptr cinfo,
if (PACK_NEED_ALIGNMENT(outptr)) {
g = *inptr++;
rgb = PACK_SHORT_565(g, g, g);
- *(INT16*)outptr = (INT16)rgb;
+ *(INT16 *)outptr = (INT16)rgb;
outptr += 2;
num_cols--;
}
@@ -328,7 +328,7 @@ gray_rgb565_convert_internal (j_decompress_ptr cinfo,
if (num_cols & 1) {
g = *inptr;
rgb = PACK_SHORT_565(g, g, g);
- *(INT16*)outptr = (INT16)rgb;
+ *(INT16 *)outptr = (INT16)rgb;
}
}
}
@@ -336,13 +336,13 @@ gray_rgb565_convert_internal (j_decompress_ptr cinfo,
INLINE
LOCAL(void)
-gray_rgb565D_convert_internal (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
+gray_rgb565D_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION input_row, JSAMPARRAY output_buf,
+ int num_rows)
{
register JSAMPROW inptr, outptr;
register JDIMENSION col;
- register JSAMPLE * range_limit = cinfo->sample_range_limit;
+ register JSAMPLE *range_limit = cinfo->sample_range_limit;
JDIMENSION num_cols = cinfo->output_width;
JLONG d0 = dither_matrix[cinfo->output_scanline & DITHER_MASK];
@@ -356,7 +356,7 @@ gray_rgb565D_convert_internal (j_decompress_ptr cinfo,
g = *inptr++;
g = range_limit[DITHER_565_R(g, d0)];
rgb = PACK_SHORT_565(g, g, g);
- *(INT16*)outptr = (INT16)rgb;
+ *(INT16 *)outptr = (INT16)rgb;
outptr += 2;
num_cols--;
}
@@ -378,7 +378,7 @@ gray_rgb565D_convert_internal (j_decompress_ptr cinfo,
g = *inptr;
g = range_limit[DITHER_565_R(g, d0)];
rgb = PACK_SHORT_565(g, g, g);
- *(INT16*)outptr = (INT16)rgb;
+ *(INT16 *)outptr = (INT16)rgb;
}
}
}
diff --git a/src/3rdparty/libjpeg/src/jdcolext.c b/src/3rdparty/libjpeg/src/jdcolext.c
index 59b676cc4d..72a5301070 100644
--- a/src/3rdparty/libjpeg/src/jdcolext.c
+++ b/src/3rdparty/libjpeg/src/jdcolext.c
@@ -28,22 +28,22 @@
INLINE
LOCAL(void)
-ycc_rgb_convert_internal (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
+ycc_rgb_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION input_row, JSAMPARRAY output_buf,
+ int num_rows)
{
- my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
+ my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
register int y, cb, cr;
register JSAMPROW outptr;
register JSAMPROW inptr0, inptr1, inptr2;
register JDIMENSION col;
JDIMENSION num_cols = cinfo->output_width;
/* copy these pointers into registers if possible */
- register JSAMPLE * range_limit = cinfo->sample_range_limit;
- register int * Crrtab = cconvert->Cr_r_tab;
- register int * Cbbtab = cconvert->Cb_b_tab;
- register JLONG * Crgtab = cconvert->Cr_g_tab;
- register JLONG * Cbgtab = cconvert->Cb_g_tab;
+ register JSAMPLE *range_limit = cinfo->sample_range_limit;
+ register int *Crrtab = cconvert->Cr_r_tab;
+ register int *Cbbtab = cconvert->Cb_b_tab;
+ register JLONG *Crgtab = cconvert->Cr_g_tab;
+ register JLONG *Cbgtab = cconvert->Cb_g_tab;
SHIFT_TEMPS
while (--num_rows >= 0) {
@@ -59,8 +59,8 @@ ycc_rgb_convert_internal (j_decompress_ptr cinfo,
/* Range-limiting is essential due to noise introduced by DCT losses. */
outptr[RGB_RED] = range_limit[y + Crrtab[cr]];
outptr[RGB_GREEN] = range_limit[y +
- ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
- SCALEBITS))];
+ ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
+ SCALEBITS))];
outptr[RGB_BLUE] = range_limit[y + Cbbtab[cb]];
/* Set unused byte to 0xFF so it can be interpreted as an opaque */
/* alpha channel value */
@@ -81,9 +81,9 @@ ycc_rgb_convert_internal (j_decompress_ptr cinfo,
INLINE
LOCAL(void)
-gray_rgb_convert_internal (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
+gray_rgb_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION input_row, JSAMPARRAY output_buf,
+ int num_rows)
{
register JSAMPROW inptr, outptr;
register JDIMENSION col;
@@ -112,9 +112,9 @@ gray_rgb_convert_internal (j_decompress_ptr cinfo,
INLINE
LOCAL(void)
-rgb_rgb_convert_internal (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
+rgb_rgb_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION input_row, JSAMPARRAY output_buf,
+ int num_rows)
{
register JSAMPROW inptr0, inptr1, inptr2;
register JSAMPROW outptr;
diff --git a/src/3rdparty/libjpeg/src/jdcolor.c b/src/3rdparty/libjpeg/src/jdcolor.c
index 05cbf4df1f..fd7f661d5a 100644
--- a/src/3rdparty/libjpeg/src/jdcolor.c
+++ b/src/3rdparty/libjpeg/src/jdcolor.c
@@ -74,8 +74,8 @@ typedef my_color_deconverter *my_cconvert_ptr;
*/
#define SCALEBITS 16 /* speediest right-shift on some machines */
-#define ONE_HALF ((JLONG) 1 << (SCALEBITS-1))
-#define FIX(x) ((JLONG) ((x) * (1L<<SCALEBITS) + 0.5))
+#define ONE_HALF ((JLONG)1 << (SCALEBITS - 1))
+#define FIX(x) ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
/* We allocate one big table for RGB->Y conversion and divide it up into
* three parts, instead of doing three alloc_small requests. This lets us
@@ -85,9 +85,9 @@ typedef my_color_deconverter *my_cconvert_ptr;
*/
#define R_Y_OFF 0 /* offset to R => Y section */
-#define G_Y_OFF (1*(MAXJSAMPLE+1)) /* offset to G => Y section */
-#define B_Y_OFF (2*(MAXJSAMPLE+1)) /* etc. */
-#define TABLE_SIZE (3*(MAXJSAMPLE+1))
+#define G_Y_OFF (1 * (MAXJSAMPLE + 1)) /* offset to G => Y section */
+#define B_Y_OFF (2 * (MAXJSAMPLE + 1)) /* etc. */
+#define TABLE_SIZE (3 * (MAXJSAMPLE + 1))
/* Include inline routines for colorspace extensions */
@@ -98,13 +98,13 @@ typedef my_color_deconverter *my_cconvert_ptr;
#undef RGB_BLUE
#undef RGB_PIXELSIZE
-#define RGB_RED EXT_RGB_RED
-#define RGB_GREEN EXT_RGB_GREEN
-#define RGB_BLUE EXT_RGB_BLUE
-#define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
-#define ycc_rgb_convert_internal ycc_extrgb_convert_internal
-#define gray_rgb_convert_internal gray_extrgb_convert_internal
-#define rgb_rgb_convert_internal rgb_extrgb_convert_internal
+#define RGB_RED EXT_RGB_RED
+#define RGB_GREEN EXT_RGB_GREEN
+#define RGB_BLUE EXT_RGB_BLUE
+#define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
+#define ycc_rgb_convert_internal ycc_extrgb_convert_internal
+#define gray_rgb_convert_internal gray_extrgb_convert_internal
+#define rgb_rgb_convert_internal rgb_extrgb_convert_internal
#include "jdcolext.c"
#undef RGB_RED
#undef RGB_GREEN
@@ -114,14 +114,14 @@ typedef my_color_deconverter *my_cconvert_ptr;
#undef gray_rgb_convert_internal
#undef rgb_rgb_convert_internal
-#define RGB_RED EXT_RGBX_RED
-#define RGB_GREEN EXT_RGBX_GREEN
-#define RGB_BLUE EXT_RGBX_BLUE
-#define RGB_ALPHA 3
-#define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
-#define ycc_rgb_convert_internal ycc_extrgbx_convert_internal
-#define gray_rgb_convert_internal gray_extrgbx_convert_internal
-#define rgb_rgb_convert_internal rgb_extrgbx_convert_internal
+#define RGB_RED EXT_RGBX_RED
+#define RGB_GREEN EXT_RGBX_GREEN
+#define RGB_BLUE EXT_RGBX_BLUE
+#define RGB_ALPHA 3
+#define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
+#define ycc_rgb_convert_internal ycc_extrgbx_convert_internal
+#define gray_rgb_convert_internal gray_extrgbx_convert_internal
+#define rgb_rgb_convert_internal rgb_extrgbx_convert_internal
#include "jdcolext.c"
#undef RGB_RED
#undef RGB_GREEN
@@ -132,13 +132,13 @@ typedef my_color_deconverter *my_cconvert_ptr;
#undef gray_rgb_convert_internal
#undef rgb_rgb_convert_internal
-#define RGB_RED EXT_BGR_RED
-#define RGB_GREEN EXT_BGR_GREEN
-#define RGB_BLUE EXT_BGR_BLUE
-#define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
-#define ycc_rgb_convert_internal ycc_extbgr_convert_internal
-#define gray_rgb_convert_internal gray_extbgr_convert_internal
-#define rgb_rgb_convert_internal rgb_extbgr_convert_internal
+#define RGB_RED EXT_BGR_RED
+#define RGB_GREEN EXT_BGR_GREEN
+#define RGB_BLUE EXT_BGR_BLUE
+#define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
+#define ycc_rgb_convert_internal ycc_extbgr_convert_internal
+#define gray_rgb_convert_internal gray_extbgr_convert_internal
+#define rgb_rgb_convert_internal rgb_extbgr_convert_internal
#include "jdcolext.c"
#undef RGB_RED
#undef RGB_GREEN
@@ -148,14 +148,14 @@ typedef my_color_deconverter *my_cconvert_ptr;
#undef gray_rgb_convert_internal
#undef rgb_rgb_convert_internal
-#define RGB_RED EXT_BGRX_RED
-#define RGB_GREEN EXT_BGRX_GREEN
-#define RGB_BLUE EXT_BGRX_BLUE
-#define RGB_ALPHA 3
-#define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
-#define ycc_rgb_convert_internal ycc_extbgrx_convert_internal
-#define gray_rgb_convert_internal gray_extbgrx_convert_internal
-#define rgb_rgb_convert_internal rgb_extbgrx_convert_internal
+#define RGB_RED EXT_BGRX_RED
+#define RGB_GREEN EXT_BGRX_GREEN
+#define RGB_BLUE EXT_BGRX_BLUE
+#define RGB_ALPHA 3
+#define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
+#define ycc_rgb_convert_internal ycc_extbgrx_convert_internal
+#define gray_rgb_convert_internal gray_extbgrx_convert_internal
+#define rgb_rgb_convert_internal rgb_extbgrx_convert_internal
#include "jdcolext.c"
#undef RGB_RED
#undef RGB_GREEN
@@ -166,14 +166,14 @@ typedef my_color_deconverter *my_cconvert_ptr;
#undef gray_rgb_convert_internal
#undef rgb_rgb_convert_internal
-#define RGB_RED EXT_XBGR_RED
-#define RGB_GREEN EXT_XBGR_GREEN
-#define RGB_BLUE EXT_XBGR_BLUE
-#define RGB_ALPHA 0
-#define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
-#define ycc_rgb_convert_internal ycc_extxbgr_convert_internal
-#define gray_rgb_convert_internal gray_extxbgr_convert_internal
-#define rgb_rgb_convert_internal rgb_extxbgr_convert_internal
+#define RGB_RED EXT_XBGR_RED
+#define RGB_GREEN EXT_XBGR_GREEN
+#define RGB_BLUE EXT_XBGR_BLUE
+#define RGB_ALPHA 0
+#define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
+#define ycc_rgb_convert_internal ycc_extxbgr_convert_internal
+#define gray_rgb_convert_internal gray_extxbgr_convert_internal
+#define rgb_rgb_convert_internal rgb_extxbgr_convert_internal
#include "jdcolext.c"
#undef RGB_RED
#undef RGB_GREEN
@@ -184,14 +184,14 @@ typedef my_color_deconverter *my_cconvert_ptr;
#undef gray_rgb_convert_internal
#undef rgb_rgb_convert_internal
-#define RGB_RED EXT_XRGB_RED
-#define RGB_GREEN EXT_XRGB_GREEN
-#define RGB_BLUE EXT_XRGB_BLUE
-#define RGB_ALPHA 0
-#define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
-#define ycc_rgb_convert_internal ycc_extxrgb_convert_internal
-#define gray_rgb_convert_internal gray_extxrgb_convert_internal
-#define rgb_rgb_convert_internal rgb_extxrgb_convert_internal
+#define RGB_RED EXT_XRGB_RED
+#define RGB_GREEN EXT_XRGB_GREEN
+#define RGB_BLUE EXT_XRGB_BLUE
+#define RGB_ALPHA 0
+#define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
+#define ycc_rgb_convert_internal ycc_extxrgb_convert_internal
+#define gray_rgb_convert_internal gray_extxrgb_convert_internal
+#define rgb_rgb_convert_internal rgb_extxrgb_convert_internal
#include "jdcolext.c"
#undef RGB_RED
#undef RGB_GREEN
@@ -208,25 +208,25 @@ typedef my_color_deconverter *my_cconvert_ptr;
*/
LOCAL(void)
-build_ycc_rgb_table (j_decompress_ptr cinfo)
+build_ycc_rgb_table(j_decompress_ptr cinfo)
{
- my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
+ my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
int i;
JLONG x;
SHIFT_TEMPS
cconvert->Cr_r_tab = (int *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (MAXJSAMPLE+1) * sizeof(int));
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
+ (MAXJSAMPLE + 1) * sizeof(int));
cconvert->Cb_b_tab = (int *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (MAXJSAMPLE+1) * sizeof(int));
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
+ (MAXJSAMPLE + 1) * sizeof(int));
cconvert->Cr_g_tab = (JLONG *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (MAXJSAMPLE+1) * sizeof(JLONG));
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
+ (MAXJSAMPLE + 1) * sizeof(JLONG));
cconvert->Cb_g_tab = (JLONG *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (MAXJSAMPLE+1) * sizeof(JLONG));
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
+ (MAXJSAMPLE + 1) * sizeof(JLONG));
for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
/* i is the actual input pixel value, in the range 0..MAXJSAMPLE */
@@ -238,10 +238,10 @@ build_ycc_rgb_table (j_decompress_ptr cinfo)
cconvert->Cb_b_tab[i] = (int)
RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);
/* Cr=>G value is scaled-up -0.71414 * x */
- cconvert->Cr_g_tab[i] = (- FIX(0.71414)) * x;
+ cconvert->Cr_g_tab[i] = (-FIX(0.71414)) * x;
/* Cb=>G value is scaled-up -0.34414 * x */
/* We also add in ONE_HALF so that need not do it in inner loop */
- cconvert->Cb_g_tab[i] = (- FIX(0.34414)) * x + ONE_HALF;
+ cconvert->Cb_g_tab[i] = (-FIX(0.34414)) * x + ONE_HALF;
}
}
@@ -251,43 +251,42 @@ build_ycc_rgb_table (j_decompress_ptr cinfo)
*/
METHODDEF(void)
-ycc_rgb_convert (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
+ycc_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
{
switch (cinfo->out_color_space) {
- case JCS_EXT_RGB:
- ycc_extrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
- num_rows);
- break;
- case JCS_EXT_RGBX:
- case JCS_EXT_RGBA:
- ycc_extrgbx_convert_internal(cinfo, input_buf, input_row, output_buf,
- num_rows);
- break;
- case JCS_EXT_BGR:
- ycc_extbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
- num_rows);
- break;
- case JCS_EXT_BGRX:
- case JCS_EXT_BGRA:
- ycc_extbgrx_convert_internal(cinfo, input_buf, input_row, output_buf,
- num_rows);
- break;
- case JCS_EXT_XBGR:
- case JCS_EXT_ABGR:
- ycc_extxbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
- num_rows);
- break;
- case JCS_EXT_XRGB:
- case JCS_EXT_ARGB:
- ycc_extxrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
- num_rows);
- break;
- default:
- ycc_rgb_convert_internal(cinfo, input_buf, input_row, output_buf,
- num_rows);
- break;
+ case JCS_EXT_RGB:
+ ycc_extrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ case JCS_EXT_RGBX:
+ case JCS_EXT_RGBA:
+ ycc_extrgbx_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ case JCS_EXT_BGR:
+ ycc_extbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ case JCS_EXT_BGRX:
+ case JCS_EXT_BGRA:
+ ycc_extbgrx_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ case JCS_EXT_XBGR:
+ case JCS_EXT_ABGR:
+ ycc_extxbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ case JCS_EXT_XRGB:
+ case JCS_EXT_ARGB:
+ ycc_extxrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ default:
+ ycc_rgb_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
}
}
@@ -300,21 +299,21 @@ ycc_rgb_convert (j_decompress_ptr cinfo,
*/
LOCAL(void)
-build_rgb_y_table (j_decompress_ptr cinfo)
+build_rgb_y_table(j_decompress_ptr cinfo)
{
- my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
+ my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
JLONG *rgb_y_tab;
JLONG i;
/* Allocate and fill in the conversion tables. */
cconvert->rgb_y_tab = rgb_y_tab = (JLONG *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
(TABLE_SIZE * sizeof(JLONG)));
for (i = 0; i <= MAXJSAMPLE; i++) {
- rgb_y_tab[i+R_Y_OFF] = FIX(0.29900) * i;
- rgb_y_tab[i+G_Y_OFF] = FIX(0.58700) * i;
- rgb_y_tab[i+B_Y_OFF] = FIX(0.11400) * i + ONE_HALF;
+ rgb_y_tab[i + R_Y_OFF] = FIX(0.29900) * i;
+ rgb_y_tab[i + G_Y_OFF] = FIX(0.58700) * i;
+ rgb_y_tab[i + B_Y_OFF] = FIX(0.11400) * i + ONE_HALF;
}
}
@@ -324,11 +323,10 @@ build_rgb_y_table (j_decompress_ptr cinfo)
*/
METHODDEF(void)
-rgb_gray_convert (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
+rgb_gray_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
{
- my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
+ my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
register int r, g, b;
register JLONG *ctab = cconvert->rgb_y_tab;
register JSAMPROW outptr;
@@ -347,9 +345,8 @@ rgb_gray_convert (j_decompress_ptr cinfo,
g = GETJSAMPLE(inptr1[col]);
b = GETJSAMPLE(inptr2[col]);
/* Y */
- outptr[col] = (JSAMPLE)
- ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
- >> SCALEBITS);
+ outptr[col] = (JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
+ ctab[b + B_Y_OFF]) >> SCALEBITS);
}
}
}
@@ -361,9 +358,8 @@ rgb_gray_convert (j_decompress_ptr cinfo,
*/
METHODDEF(void)
-null_convert (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
+null_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
{
register JSAMPROW inptr, inptr0, inptr1, inptr2, inptr3, outptr;
register JDIMENSION col;
@@ -423,12 +419,11 @@ null_convert (j_decompress_ptr cinfo,
*/
METHODDEF(void)
-grayscale_convert (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
+grayscale_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
{
- jcopy_sample_rows(input_buf[0], (int) input_row, output_buf, 0,
- num_rows, cinfo->output_width);
+ jcopy_sample_rows(input_buf[0], (int)input_row, output_buf, 0, num_rows,
+ cinfo->output_width);
}
@@ -437,43 +432,42 @@ grayscale_convert (j_decompress_ptr cinfo,
*/
METHODDEF(void)
-gray_rgb_convert (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
+gray_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
{
switch (cinfo->out_color_space) {
- case JCS_EXT_RGB:
- gray_extrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
- num_rows);
- break;
- case JCS_EXT_RGBX:
- case JCS_EXT_RGBA:
- gray_extrgbx_convert_internal(cinfo, input_buf, input_row, output_buf,
- num_rows);
- break;
- case JCS_EXT_BGR:
- gray_extbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
- num_rows);
- break;
- case JCS_EXT_BGRX:
- case JCS_EXT_BGRA:
- gray_extbgrx_convert_internal(cinfo, input_buf, input_row, output_buf,
- num_rows);
- break;
- case JCS_EXT_XBGR:
- case JCS_EXT_ABGR:
- gray_extxbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
- num_rows);
- break;
- case JCS_EXT_XRGB:
- case JCS_EXT_ARGB:
- gray_extxrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
- num_rows);
- break;
- default:
- gray_rgb_convert_internal(cinfo, input_buf, input_row, output_buf,
- num_rows);
- break;
+ case JCS_EXT_RGB:
+ gray_extrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ case JCS_EXT_RGBX:
+ case JCS_EXT_RGBA:
+ gray_extrgbx_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ case JCS_EXT_BGR:
+ gray_extbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ case JCS_EXT_BGRX:
+ case JCS_EXT_BGRA:
+ gray_extbgrx_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ case JCS_EXT_XBGR:
+ case JCS_EXT_ABGR:
+ gray_extxbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ case JCS_EXT_XRGB:
+ case JCS_EXT_ARGB:
+ gray_extxrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ default:
+ gray_rgb_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
}
}
@@ -483,43 +477,42 @@ gray_rgb_convert (j_decompress_ptr cinfo,
*/
METHODDEF(void)
-rgb_rgb_convert (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
+rgb_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
{
switch (cinfo->out_color_space) {
- case JCS_EXT_RGB:
- rgb_extrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
- num_rows);
- break;
- case JCS_EXT_RGBX:
- case JCS_EXT_RGBA:
- rgb_extrgbx_convert_internal(cinfo, input_buf, input_row, output_buf,
- num_rows);
- break;
- case JCS_EXT_BGR:
- rgb_extbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
- num_rows);
- break;
- case JCS_EXT_BGRX:
- case JCS_EXT_BGRA:
- rgb_extbgrx_convert_internal(cinfo, input_buf, input_row, output_buf,
- num_rows);
- break;
- case JCS_EXT_XBGR:
- case JCS_EXT_ABGR:
- rgb_extxbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
- num_rows);
- break;
- case JCS_EXT_XRGB:
- case JCS_EXT_ARGB:
- rgb_extxrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
- num_rows);
- break;
- default:
- rgb_rgb_convert_internal(cinfo, input_buf, input_row, output_buf,
- num_rows);
- break;
+ case JCS_EXT_RGB:
+ rgb_extrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ case JCS_EXT_RGBX:
+ case JCS_EXT_RGBA:
+ rgb_extrgbx_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ case JCS_EXT_BGR:
+ rgb_extbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ case JCS_EXT_BGRX:
+ case JCS_EXT_BGRA:
+ rgb_extbgrx_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ case JCS_EXT_XBGR:
+ case JCS_EXT_ABGR:
+ rgb_extxbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ case JCS_EXT_XRGB:
+ case JCS_EXT_ARGB:
+ rgb_extxrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ default:
+ rgb_rgb_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
}
}
@@ -532,11 +525,10 @@ rgb_rgb_convert (j_decompress_ptr cinfo,
*/
METHODDEF(void)
-ycck_cmyk_convert (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
+ycck_cmyk_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
{
- my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
+ my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
register int y, cb, cr;
register JSAMPROW outptr;
register JSAMPROW inptr0, inptr1, inptr2, inptr3;
@@ -564,7 +556,7 @@ ycck_cmyk_convert (j_decompress_ptr cinfo,
/* Range-limiting is essential due to noise introduced by DCT losses. */
outptr[0] = range_limit[MAXJSAMPLE - (y + Crrtab[cr])]; /* red */
outptr[1] = range_limit[MAXJSAMPLE - (y + /* green */
- ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
+ ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
SCALEBITS)))];
outptr[2] = range_limit[MAXJSAMPLE - (y + Cbbtab[cb])]; /* blue */
/* K passes through unchanged */
@@ -579,16 +571,16 @@ ycck_cmyk_convert (j_decompress_ptr cinfo,
* RGB565 conversion
*/
-#define PACK_SHORT_565_LE(r, g, b) ((((r) << 8) & 0xF800) | \
- (((g) << 3) & 0x7E0) | ((b) >> 3))
-#define PACK_SHORT_565_BE(r, g, b) (((r) & 0xF8) | ((g) >> 5) | \
- (((g) << 11) & 0xE000) | \
- (((b) << 5) & 0x1F00))
+#define PACK_SHORT_565_LE(r, g, b) ((((r) << 8) & 0xF800) | \
+ (((g) << 3) & 0x7E0) | ((b) >> 3))
+#define PACK_SHORT_565_BE(r, g, b) (((r) & 0xF8) | ((g) >> 5) | \
+ (((g) << 11) & 0xE000) | \
+ (((b) << 5) & 0x1F00))
-#define PACK_TWO_PIXELS_LE(l, r) ((r << 16) | l)
-#define PACK_TWO_PIXELS_BE(l, r) ((l << 16) | r)
+#define PACK_TWO_PIXELS_LE(l, r) ((r << 16) | l)
+#define PACK_TWO_PIXELS_BE(l, r) ((l << 16) | r)
-#define PACK_NEED_ALIGNMENT(ptr) (((size_t)(ptr)) & 3)
+#define PACK_NEED_ALIGNMENT(ptr) (((size_t)(ptr)) & 3)
#define WRITE_TWO_ALIGNED_PIXELS(addr, pixels) ((*(int *)(addr)) = pixels)
@@ -624,14 +616,14 @@ static INLINE boolean is_big_endian(void)
/* Include inline routines for RGB565 conversion */
-#define PACK_SHORT_565 PACK_SHORT_565_LE
-#define PACK_TWO_PIXELS PACK_TWO_PIXELS_LE
-#define ycc_rgb565_convert_internal ycc_rgb565_convert_le
-#define ycc_rgb565D_convert_internal ycc_rgb565D_convert_le
-#define rgb_rgb565_convert_internal rgb_rgb565_convert_le
-#define rgb_rgb565D_convert_internal rgb_rgb565D_convert_le
-#define gray_rgb565_convert_internal gray_rgb565_convert_le
-#define gray_rgb565D_convert_internal gray_rgb565D_convert_le
+#define PACK_SHORT_565 PACK_SHORT_565_LE
+#define PACK_TWO_PIXELS PACK_TWO_PIXELS_LE
+#define ycc_rgb565_convert_internal ycc_rgb565_convert_le
+#define ycc_rgb565D_convert_internal ycc_rgb565D_convert_le
+#define rgb_rgb565_convert_internal rgb_rgb565_convert_le
+#define rgb_rgb565D_convert_internal rgb_rgb565D_convert_le
+#define gray_rgb565_convert_internal gray_rgb565_convert_le
+#define gray_rgb565D_convert_internal gray_rgb565D_convert_le
#include "jdcol565.c"
#undef PACK_SHORT_565
#undef PACK_TWO_PIXELS
@@ -642,14 +634,14 @@ static INLINE boolean is_big_endian(void)
#undef gray_rgb565_convert_internal
#undef gray_rgb565D_convert_internal
-#define PACK_SHORT_565 PACK_SHORT_565_BE
-#define PACK_TWO_PIXELS PACK_TWO_PIXELS_BE
-#define ycc_rgb565_convert_internal ycc_rgb565_convert_be
-#define ycc_rgb565D_convert_internal ycc_rgb565D_convert_be
-#define rgb_rgb565_convert_internal rgb_rgb565_convert_be
-#define rgb_rgb565D_convert_internal rgb_rgb565D_convert_be
-#define gray_rgb565_convert_internal gray_rgb565_convert_be
-#define gray_rgb565D_convert_internal gray_rgb565D_convert_be
+#define PACK_SHORT_565 PACK_SHORT_565_BE
+#define PACK_TWO_PIXELS PACK_TWO_PIXELS_BE
+#define ycc_rgb565_convert_internal ycc_rgb565_convert_be
+#define ycc_rgb565D_convert_internal ycc_rgb565D_convert_be
+#define rgb_rgb565_convert_internal rgb_rgb565_convert_be
+#define rgb_rgb565D_convert_internal rgb_rgb565D_convert_be
+#define gray_rgb565_convert_internal gray_rgb565_convert_be
+#define gray_rgb565D_convert_internal gray_rgb565D_convert_be
#include "jdcol565.c"
#undef PACK_SHORT_565
#undef PACK_TWO_PIXELS
@@ -662,9 +654,8 @@ static INLINE boolean is_big_endian(void)
METHODDEF(void)
-ycc_rgb565_convert (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
+ycc_rgb565_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
{
if (is_big_endian())
ycc_rgb565_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
@@ -674,9 +665,8 @@ ycc_rgb565_convert (j_decompress_ptr cinfo,
METHODDEF(void)
-ycc_rgb565D_convert (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
+ycc_rgb565D_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
{
if (is_big_endian())
ycc_rgb565D_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
@@ -686,9 +676,8 @@ ycc_rgb565D_convert (j_decompress_ptr cinfo,
METHODDEF(void)
-rgb_rgb565_convert (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
+rgb_rgb565_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
{
if (is_big_endian())
rgb_rgb565_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
@@ -698,9 +687,8 @@ rgb_rgb565_convert (j_decompress_ptr cinfo,
METHODDEF(void)
-rgb_rgb565D_convert (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
+rgb_rgb565D_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
{
if (is_big_endian())
rgb_rgb565D_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
@@ -710,9 +698,8 @@ rgb_rgb565D_convert (j_decompress_ptr cinfo,
METHODDEF(void)
-gray_rgb565_convert (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
+gray_rgb565_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
{
if (is_big_endian())
gray_rgb565_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
@@ -722,9 +709,8 @@ gray_rgb565_convert (j_decompress_ptr cinfo,
METHODDEF(void)
-gray_rgb565D_convert (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
+gray_rgb565D_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
{
if (is_big_endian())
gray_rgb565D_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
@@ -738,7 +724,7 @@ gray_rgb565D_convert (j_decompress_ptr cinfo,
*/
METHODDEF(void)
-start_pass_dcolor (j_decompress_ptr cinfo)
+start_pass_dcolor(j_decompress_ptr cinfo)
{
/* no work needed */
}
@@ -749,15 +735,15 @@ start_pass_dcolor (j_decompress_ptr cinfo)
*/
GLOBAL(void)
-jinit_color_deconverter (j_decompress_ptr cinfo)
+jinit_color_deconverter(j_decompress_ptr cinfo)
{
my_cconvert_ptr cconvert;
int ci;
cconvert = (my_cconvert_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(my_color_deconverter));
- cinfo->cconvert = (struct jpeg_color_deconverter *) cconvert;
+ cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
cconvert->pub.start_pass = start_pass_dcolor;
/* Make sure num_components agrees with jpeg_color_space */
@@ -843,11 +829,11 @@ jinit_color_deconverter (j_decompress_ptr cinfo)
cinfo->out_color_components = 3;
if (cinfo->dither_mode == JDITHER_NONE) {
if (cinfo->jpeg_color_space == JCS_YCbCr) {
- if (jsimd_can_ycc_rgb565())
- cconvert->pub.color_convert = jsimd_ycc_rgb565_convert;
- else {
- cconvert->pub.color_convert = ycc_rgb565_convert;
- build_ycc_rgb_table(cinfo);
+ if (jsimd_can_ycc_rgb565())
+ cconvert->pub.color_convert = jsimd_ycc_rgb565_convert;
+ else {
+ cconvert->pub.color_convert = ycc_rgb565_convert;
+ build_ycc_rgb_table(cinfo);
}
} else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
cconvert->pub.color_convert = gray_rgb565_convert;
diff --git a/src/3rdparty/libjpeg/src/jdct.h b/src/3rdparty/libjpeg/src/jdct.h
index faf8e1cf03..66d1718b77 100644
--- a/src/3rdparty/libjpeg/src/jdct.h
+++ b/src/3rdparty/libjpeg/src/jdct.h
@@ -36,7 +36,7 @@ typedef int DCTELEM; /* 16 or 32 bits is fine */
typedef unsigned int UDCTELEM;
typedef unsigned long long UDCTELEM2;
#else
-typedef short DCTELEM; /* prefer 16 bit with SIMD for parellelism */
+typedef short DCTELEM; /* prefer 16 bit with SIMD for parellelism */
typedef unsigned short UDCTELEM;
typedef unsigned int UDCTELEM2;
#endif
@@ -63,15 +63,15 @@ typedef unsigned long long UDCTELEM2;
* Each IDCT routine has its own ideas about the best dct_table element type.
*/
-typedef MULTIPLIER ISLOW_MULT_TYPE; /* short or int, whichever is faster */
+typedef MULTIPLIER ISLOW_MULT_TYPE; /* short or int, whichever is faster */
#if BITS_IN_JSAMPLE == 8
-typedef MULTIPLIER IFAST_MULT_TYPE; /* 16 bits is OK, use short if faster */
-#define IFAST_SCALE_BITS 2 /* fractional bits in scale factors */
+typedef MULTIPLIER IFAST_MULT_TYPE; /* 16 bits is OK, use short if faster */
+#define IFAST_SCALE_BITS 2 /* fractional bits in scale factors */
#else
-typedef JLONG IFAST_MULT_TYPE; /* need 32 bits for scaled quantizers */
-#define IFAST_SCALE_BITS 13 /* fractional bits in scale factors */
+typedef JLONG IFAST_MULT_TYPE; /* need 32 bits for scaled quantizers */
+#define IFAST_SCALE_BITS 13 /* fractional bits in scale factors */
#endif
-typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */
+typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */
/*
@@ -90,64 +90,64 @@ typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */
/* Extern declarations for the forward and inverse DCT routines. */
-EXTERN(void) jpeg_fdct_islow (DCTELEM *data);
-EXTERN(void) jpeg_fdct_ifast (DCTELEM *data);
-EXTERN(void) jpeg_fdct_float (FAST_FLOAT *data);
-
-EXTERN(void) jpeg_idct_islow
- (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col);
-EXTERN(void) jpeg_idct_ifast
- (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col);
-EXTERN(void) jpeg_idct_float
- (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col);
-EXTERN(void) jpeg_idct_7x7
- (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col);
-EXTERN(void) jpeg_idct_6x6
- (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col);
-EXTERN(void) jpeg_idct_5x5
- (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col);
-EXTERN(void) jpeg_idct_4x4
- (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col);
-EXTERN(void) jpeg_idct_3x3
- (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col);
-EXTERN(void) jpeg_idct_2x2
- (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col);
-EXTERN(void) jpeg_idct_1x1
- (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col);
-EXTERN(void) jpeg_idct_9x9
- (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col);
-EXTERN(void) jpeg_idct_10x10
- (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col);
-EXTERN(void) jpeg_idct_11x11
- (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col);
-EXTERN(void) jpeg_idct_12x12
- (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col);
-EXTERN(void) jpeg_idct_13x13
- (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col);
-EXTERN(void) jpeg_idct_14x14
- (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col);
-EXTERN(void) jpeg_idct_15x15
- (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col);
-EXTERN(void) jpeg_idct_16x16
- (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col);
+EXTERN(void) jpeg_fdct_islow(DCTELEM *data);
+EXTERN(void) jpeg_fdct_ifast(DCTELEM *data);
+EXTERN(void) jpeg_fdct_float(FAST_FLOAT *data);
+
+EXTERN(void) jpeg_idct_islow(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr, JCOEFPTR coef_block,
+ JSAMPARRAY output_buf, JDIMENSION output_col);
+EXTERN(void) jpeg_idct_ifast(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr, JCOEFPTR coef_block,
+ JSAMPARRAY output_buf, JDIMENSION output_col);
+EXTERN(void) jpeg_idct_float(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr, JCOEFPTR coef_block,
+ JSAMPARRAY output_buf, JDIMENSION output_col);
+EXTERN(void) jpeg_idct_7x7(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr, JCOEFPTR coef_block,
+ JSAMPARRAY output_buf, JDIMENSION output_col);
+EXTERN(void) jpeg_idct_6x6(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr, JCOEFPTR coef_block,
+ JSAMPARRAY output_buf, JDIMENSION output_col);
+EXTERN(void) jpeg_idct_5x5(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr, JCOEFPTR coef_block,
+ JSAMPARRAY output_buf, JDIMENSION output_col);
+EXTERN(void) jpeg_idct_4x4(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr, JCOEFPTR coef_block,
+ JSAMPARRAY output_buf, JDIMENSION output_col);
+EXTERN(void) jpeg_idct_3x3(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr, JCOEFPTR coef_block,
+ JSAMPARRAY output_buf, JDIMENSION output_col);
+EXTERN(void) jpeg_idct_2x2(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr, JCOEFPTR coef_block,
+ JSAMPARRAY output_buf, JDIMENSION output_col);
+EXTERN(void) jpeg_idct_1x1(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr, JCOEFPTR coef_block,
+ JSAMPARRAY output_buf, JDIMENSION output_col);
+EXTERN(void) jpeg_idct_9x9(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr, JCOEFPTR coef_block,
+ JSAMPARRAY output_buf, JDIMENSION output_col);
+EXTERN(void) jpeg_idct_10x10(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr, JCOEFPTR coef_block,
+ JSAMPARRAY output_buf, JDIMENSION output_col);
+EXTERN(void) jpeg_idct_11x11(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr, JCOEFPTR coef_block,
+ JSAMPARRAY output_buf, JDIMENSION output_col);
+EXTERN(void) jpeg_idct_12x12(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr, JCOEFPTR coef_block,
+ JSAMPARRAY output_buf, JDIMENSION output_col);
+EXTERN(void) jpeg_idct_13x13(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr, JCOEFPTR coef_block,
+ JSAMPARRAY output_buf, JDIMENSION output_col);
+EXTERN(void) jpeg_idct_14x14(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr, JCOEFPTR coef_block,
+ JSAMPARRAY output_buf, JDIMENSION output_col);
+EXTERN(void) jpeg_idct_15x15(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr, JCOEFPTR coef_block,
+ JSAMPARRAY output_buf, JDIMENSION output_col);
+EXTERN(void) jpeg_idct_16x16(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr, JCOEFPTR coef_block,
+ JSAMPARRAY output_buf, JDIMENSION output_col);
/*
@@ -160,22 +160,22 @@ EXTERN(void) jpeg_idct_16x16
* and may differ from one module to the next.
*/
-#define ONE ((JLONG) 1)
-#define CONST_SCALE (ONE << CONST_BITS)
+#define ONE ((JLONG)1)
+#define CONST_SCALE (ONE << CONST_BITS)
/* Convert a positive real constant to an integer scaled by CONST_SCALE.
* Caution: some C compilers fail to reduce "FIX(constant)" at compile time,
* thus causing a lot of useless floating-point operations at run time.
*/
-#define FIX(x) ((JLONG) ((x) * CONST_SCALE + 0.5))
+#define FIX(x) ((JLONG)((x) * CONST_SCALE + 0.5))
/* Descale and correctly round a JLONG value that's scaled by N bits.
* We assume RIGHT_SHIFT rounds towards minus infinity, so adding
* the fudge factor is correct for either sign of X.
*/
-#define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n)-1)), n)
+#define DESCALE(x, n) RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
/* Multiply a JLONG variable by a JLONG constant to yield a JLONG result.
* This macro is used only when the two inputs will actually be no more than
@@ -187,22 +187,22 @@ EXTERN(void) jpeg_idct_16x16
*/
#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */
-#define MULTIPLY16C16(var,const) (((INT16) (var)) * ((INT16) (const)))
+#define MULTIPLY16C16(var, const) (((INT16)(var)) * ((INT16)(const)))
#endif
#ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */
-#define MULTIPLY16C16(var,const) (((INT16) (var)) * ((JLONG) (const)))
+#define MULTIPLY16C16(var, const) (((INT16)(var)) * ((JLONG)(const)))
#endif
#ifndef MULTIPLY16C16 /* default definition */
-#define MULTIPLY16C16(var,const) ((var) * (const))
+#define MULTIPLY16C16(var, const) ((var) * (const))
#endif
/* Same except both inputs are variables. */
#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */
-#define MULTIPLY16V16(var1,var2) (((INT16) (var1)) * ((INT16) (var2)))
+#define MULTIPLY16V16(var1, var2) (((INT16)(var1)) * ((INT16)(var2)))
#endif
#ifndef MULTIPLY16V16 /* default definition */
-#define MULTIPLY16V16(var1,var2) ((var1) * (var2))
+#define MULTIPLY16V16(var1, var2) ((var1) * (var2))
#endif
diff --git a/src/3rdparty/libjpeg/src/jddctmgr.c b/src/3rdparty/libjpeg/src/jddctmgr.c
index 3a5ba7e893..266f446623 100644
--- a/src/3rdparty/libjpeg/src/jddctmgr.c
+++ b/src/3rdparty/libjpeg/src/jddctmgr.c
@@ -94,9 +94,9 @@ typedef union {
*/
METHODDEF(void)
-start_pass (j_decompress_ptr cinfo)
+start_pass(j_decompress_ptr cinfo)
{
- my_idct_ptr idct = (my_idct_ptr) cinfo->idct;
+ my_idct_ptr idct = (my_idct_ptr)cinfo->idct;
int ci, i;
jpeg_component_info *compptr;
int method = 0;
@@ -233,7 +233,7 @@ start_pass (j_decompress_ptr cinfo)
* multiplier table all-zero; we'll be reading zeroes from the
* coefficient controller's buffer anyway.
*/
- if (! compptr->component_needed || idct->cur_method[ci] == method)
+ if (!compptr->component_needed || idct->cur_method[ci] == method)
continue;
qtbl = compptr->quant_table;
if (qtbl == NULL) /* happens if no data yet for component */
@@ -246,9 +246,9 @@ start_pass (j_decompress_ptr cinfo)
/* For LL&M IDCT method, multipliers are equal to raw quantization
* coefficients, but are stored as ints to ensure access efficiency.
*/
- ISLOW_MULT_TYPE *ismtbl = (ISLOW_MULT_TYPE *) compptr->dct_table;
+ ISLOW_MULT_TYPE *ismtbl = (ISLOW_MULT_TYPE *)compptr->dct_table;
for (i = 0; i < DCTSIZE2; i++) {
- ismtbl[i] = (ISLOW_MULT_TYPE) qtbl->quantval[i];
+ ismtbl[i] = (ISLOW_MULT_TYPE)qtbl->quantval[i];
}
}
break;
@@ -263,8 +263,8 @@ start_pass (j_decompress_ptr cinfo)
* For integer operation, the multiplier table is to be scaled by
* IFAST_SCALE_BITS.
*/
- IFAST_MULT_TYPE *ifmtbl = (IFAST_MULT_TYPE *) compptr->dct_table;
-#define CONST_BITS 14
+ IFAST_MULT_TYPE *ifmtbl = (IFAST_MULT_TYPE *)compptr->dct_table;
+#define CONST_BITS 14
static const INT16 aanscales[DCTSIZE2] = {
/* precomputed values scaled up by 14 bits */
16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520,
@@ -280,9 +280,9 @@ start_pass (j_decompress_ptr cinfo)
for (i = 0; i < DCTSIZE2; i++) {
ifmtbl[i] = (IFAST_MULT_TYPE)
- DESCALE(MULTIPLY16V16((JLONG) qtbl->quantval[i],
- (JLONG) aanscales[i]),
- CONST_BITS-IFAST_SCALE_BITS);
+ DESCALE(MULTIPLY16V16((JLONG)qtbl->quantval[i],
+ (JLONG)aanscales[i]),
+ CONST_BITS - IFAST_SCALE_BITS);
}
}
break;
@@ -295,7 +295,7 @@ start_pass (j_decompress_ptr cinfo)
* scalefactor[0] = 1
* scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7
*/
- FLOAT_MULT_TYPE *fmtbl = (FLOAT_MULT_TYPE *) compptr->dct_table;
+ FLOAT_MULT_TYPE *fmtbl = (FLOAT_MULT_TYPE *)compptr->dct_table;
int row, col;
static const double aanscalefactor[DCTSIZE] = {
1.0, 1.387039845, 1.306562965, 1.175875602,
@@ -306,7 +306,7 @@ start_pass (j_decompress_ptr cinfo)
for (row = 0; row < DCTSIZE; row++) {
for (col = 0; col < DCTSIZE; col++) {
fmtbl[i] = (FLOAT_MULT_TYPE)
- ((double) qtbl->quantval[i] *
+ ((double)qtbl->quantval[i] *
aanscalefactor[row] * aanscalefactor[col]);
i++;
}
@@ -327,23 +327,23 @@ start_pass (j_decompress_ptr cinfo)
*/
GLOBAL(void)
-jinit_inverse_dct (j_decompress_ptr cinfo)
+jinit_inverse_dct(j_decompress_ptr cinfo)
{
my_idct_ptr idct;
int ci;
jpeg_component_info *compptr;
idct = (my_idct_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(my_idct_controller));
- cinfo->idct = (struct jpeg_inverse_dct *) idct;
+ cinfo->idct = (struct jpeg_inverse_dct *)idct;
idct->pub.start_pass = start_pass;
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) {
/* Allocate and pre-zero a multiplier table for each component */
compptr->dct_table =
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(multiplier_table));
MEMZERO(compptr->dct_table, sizeof(multiplier_table));
/* Mark multiplier table not yet set up for any method */
diff --git a/src/3rdparty/libjpeg/src/jdhuff.c b/src/3rdparty/libjpeg/src/jdhuff.c
index bb2b84887c..95f38e547e 100644
--- a/src/3rdparty/libjpeg/src/jdhuff.c
+++ b/src/3rdparty/libjpeg/src/jdhuff.c
@@ -4,7 +4,7 @@
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1991-1997, Thomas G. Lane.
* libjpeg-turbo Modifications:
- * Copyright (C) 2009-2011, 2016, D. R. Commander.
+ * Copyright (C) 2009-2011, 2016, 2018, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@@ -15,6 +15,9 @@
* up to the start of the current MCU. To do this, we copy state variables
* into local working storage, and update them back to the permanent
* storage only upon successful completion of an MCU.
+ *
+ * NOTE: All referenced figures are from
+ * Recommendation ITU-T T.81 (1992) | ISO/IEC 10918-1:1994.
*/
#define JPEG_INTERNALS
@@ -42,14 +45,14 @@ typedef struct {
*/
#ifndef NO_STRUCT_ASSIGN
-#define ASSIGN_STATE(dest,src) ((dest) = (src))
+#define ASSIGN_STATE(dest, src) ((dest) = (src))
#else
#if MAX_COMPS_IN_SCAN == 4
-#define ASSIGN_STATE(dest,src) \
- ((dest).last_dc_val[0] = (src).last_dc_val[0], \
- (dest).last_dc_val[1] = (src).last_dc_val[1], \
- (dest).last_dc_val[2] = (src).last_dc_val[2], \
- (dest).last_dc_val[3] = (src).last_dc_val[3])
+#define ASSIGN_STATE(dest, src) \
+ ((dest).last_dc_val[0] = (src).last_dc_val[0], \
+ (dest).last_dc_val[1] = (src).last_dc_val[1], \
+ (dest).last_dc_val[2] = (src).last_dc_val[2], \
+ (dest).last_dc_val[3] = (src).last_dc_val[3])
#endif
#endif
@@ -88,9 +91,9 @@ typedef huff_entropy_decoder *huff_entropy_ptr;
*/
METHODDEF(void)
-start_pass_huff_decoder (j_decompress_ptr cinfo)
+start_pass_huff_decoder(j_decompress_ptr cinfo)
{
- huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
+ huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
int ci, blkn, dctbl, actbl;
d_derived_tbl **pdtbl;
jpeg_component_info *compptr;
@@ -99,7 +102,7 @@ start_pass_huff_decoder (j_decompress_ptr cinfo)
* This ought to be an error condition, but we make it a warning because
* there are some baseline files out there with all zeroes in these bytes.
*/
- if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2-1 ||
+ if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 ||
cinfo->Ah != 0 || cinfo->Al != 0)
WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
@@ -152,8 +155,8 @@ start_pass_huff_decoder (j_decompress_ptr cinfo)
*/
GLOBAL(void)
-jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno,
- d_derived_tbl **pdtbl)
+jpeg_make_d_derived_tbl(j_decompress_ptr cinfo, boolean isDC, int tblno,
+ d_derived_tbl **pdtbl)
{
JHUFF_TBL *htbl;
d_derived_tbl *dtbl;
@@ -178,7 +181,7 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno,
/* Allocate a workspace if we haven't already done so. */
if (*pdtbl == NULL)
*pdtbl = (d_derived_tbl *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(d_derived_tbl));
dtbl = *pdtbl;
dtbl->pub = htbl; /* fill in back link */
@@ -187,11 +190,11 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno,
p = 0;
for (l = 1; l <= 16; l++) {
- i = (int) htbl->bits[l];
+ i = (int)htbl->bits[l];
if (i < 0 || p + i > 256) /* protect against table overrun */
ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
while (i--)
- huffsize[p++] = (char) l;
+ huffsize[p++] = (char)l;
}
huffsize[p] = 0;
numsymbols = p;
@@ -203,14 +206,14 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno,
si = huffsize[0];
p = 0;
while (huffsize[p]) {
- while (((int) huffsize[p]) == si) {
+ while (((int)huffsize[p]) == si) {
huffcode[p++] = code;
code++;
}
/* code is now 1 more than the last code used for codelength si; but
* it must still fit in si bits, since no code is allowed to be all ones.
*/
- if (((JLONG) code) >= (((JLONG) 1) << si))
+ if (((JLONG)code) >= (((JLONG)1) << si))
ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
code <<= 1;
si++;
@@ -224,9 +227,9 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno,
/* valoffset[l] = huffval[] index of 1st symbol of code length l,
* minus the minimum code of length l
*/
- dtbl->valoffset[l] = (JLONG) p - (JLONG) huffcode[p];
+ dtbl->valoffset[l] = (JLONG)p - (JLONG)huffcode[p];
p += htbl->bits[l];
- dtbl->maxcode[l] = huffcode[p-1]; /* maximum code of length l */
+ dtbl->maxcode[l] = huffcode[p - 1]; /* maximum code of length l */
} else {
dtbl->maxcode[l] = -1; /* -1 if no codes of this length */
}
@@ -241,16 +244,16 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno,
* with that code.
*/
- for (i = 0; i < (1 << HUFF_LOOKAHEAD); i++)
- dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
+ for (i = 0; i < (1 << HUFF_LOOKAHEAD); i++)
+ dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
p = 0;
for (l = 1; l <= HUFF_LOOKAHEAD; l++) {
- for (i = 1; i <= (int) htbl->bits[l]; i++, p++) {
+ for (i = 1; i <= (int)htbl->bits[l]; i++, p++) {
/* l = current code's length, p = its index in huffcode[] & huffval[]. */
/* Generate left-justified code followed by all possible bit sequences */
- lookbits = huffcode[p] << (HUFF_LOOKAHEAD-l);
- for (ctr = 1 << (HUFF_LOOKAHEAD-l); ctr > 0; ctr--) {
+ lookbits = huffcode[p] << (HUFF_LOOKAHEAD - l);
+ for (ctr = 1 << (HUFF_LOOKAHEAD - l); ctr > 0; ctr--) {
dtbl->lookup[lookbits] = (l << HUFF_LOOKAHEAD) | htbl->huffval[p];
lookbits++;
}
@@ -291,14 +294,14 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno,
#ifdef SLOW_SHIFT_32
#define MIN_GET_BITS 15 /* minimum allowable value */
#else
-#define MIN_GET_BITS (BIT_BUF_SIZE-7)
+#define MIN_GET_BITS (BIT_BUF_SIZE - 7)
#endif
GLOBAL(boolean)
-jpeg_fill_bit_buffer (bitread_working_state *state,
- register bit_buf_type get_buffer, register int bits_left,
- int nbits)
+jpeg_fill_bit_buffer(bitread_working_state *state,
+ register bit_buf_type get_buffer, register int bits_left,
+ int nbits)
/* Load up the bit buffer to a depth of at least nbits */
{
/* Copy heavily used state fields into locals (hopefully registers) */
@@ -316,7 +319,7 @@ jpeg_fill_bit_buffer (bitread_working_state *state,
/* Attempt to read a byte */
if (bytes_in_buffer == 0) {
- if (! (*cinfo->src->fill_input_buffer) (cinfo))
+ if (!(*cinfo->src->fill_input_buffer) (cinfo))
return FALSE;
next_input_byte = cinfo->src->next_input_byte;
bytes_in_buffer = cinfo->src->bytes_in_buffer;
@@ -333,7 +336,7 @@ jpeg_fill_bit_buffer (bitread_working_state *state,
*/
do {
if (bytes_in_buffer == 0) {
- if (! (*cinfo->src->fill_input_buffer) (cinfo))
+ if (!(*cinfo->src->fill_input_buffer) (cinfo))
return FALSE;
next_input_byte = cinfo->src->next_input_byte;
bytes_in_buffer = cinfo->src->bytes_in_buffer;
@@ -365,7 +368,7 @@ jpeg_fill_bit_buffer (bitread_working_state *state,
bits_left += 8;
} /* end while */
} else {
- no_more_bytes:
+no_more_bytes:
/* We get here if we've read the marker that terminates the compressed
* data segment. There should be enough bits in the buffer register
* to satisfy the request; if so, no problem.
@@ -376,7 +379,7 @@ jpeg_fill_bit_buffer (bitread_working_state *state,
* We use a nonvolatile flag to ensure that only one warning message
* appears per data segment.
*/
- if (! cinfo->entropy->insufficient_data) {
+ if (!cinfo->entropy->insufficient_data) {
WARNMS(cinfo, JWRN_HIT_MARKER);
cinfo->entropy->insufficient_data = TRUE;
}
@@ -400,8 +403,7 @@ jpeg_fill_bit_buffer (bitread_working_state *state,
handle markers. We have to hand off any blocks with markers to the
slower routines. */
-#define GET_BYTE \
-{ \
+#define GET_BYTE { \
register int c0, c1; \
c0 = GETJOCTET(*buffer++); \
c1 = GETJOCTET(*buffer); \
@@ -421,7 +423,7 @@ jpeg_fill_bit_buffer (bitread_working_state *state,
} \
}
-#if SIZEOF_SIZE_T==8 || defined(_WIN64)
+#if SIZEOF_SIZE_T == 8 || defined(_WIN64)
/* Pre-fetch 48 bytes, because the holding register is 64-bit */
#define FILL_BIT_BUFFER_FAST \
@@ -446,9 +448,9 @@ jpeg_fill_bit_buffer (bitread_working_state *state,
*/
GLOBAL(int)
-jpeg_huff_decode (bitread_working_state *state,
- register bit_buf_type get_buffer, register int bits_left,
- d_derived_tbl *htbl, int min_bits)
+jpeg_huff_decode(bitread_working_state *state,
+ register bit_buf_type get_buffer, register int bits_left,
+ d_derived_tbl *htbl, int min_bits)
{
register int l = min_bits;
register JLONG code;
@@ -460,7 +462,7 @@ jpeg_huff_decode (bitread_working_state *state,
code = GET_BITS(l);
/* Collect the rest of the Huffman code one bit at a time. */
- /* This is per Figure F.16 in the JPEG spec. */
+ /* This is per Figure F.16. */
while (code > htbl->maxcode[l]) {
code <<= 1;
@@ -480,7 +482,7 @@ jpeg_huff_decode (bitread_working_state *state,
return 0; /* fake a zero as the safest result */
}
- return htbl->pub->huffval[ (int) (code + htbl->valoffset[l]) ];
+ return htbl->pub->huffval[(int)(code + htbl->valoffset[l])];
}
@@ -492,22 +494,26 @@ jpeg_huff_decode (bitread_working_state *state,
#define AVOID_TABLES
#ifdef AVOID_TABLES
-#define NEG_1 ((unsigned int)-1)
-#define HUFF_EXTEND(x,s) ((x) + ((((x) - (1<<((s)-1))) >> 31) & (((NEG_1)<<(s)) + 1)))
+#define NEG_1 ((unsigned int)-1)
+#define HUFF_EXTEND(x, s) \
+ ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
#else
-#define HUFF_EXTEND(x,s) ((x) < extend_test[s] ? (x) + extend_offset[s] : (x))
+#define HUFF_EXTEND(x, s) \
+ ((x) < extend_test[s] ? (x) + extend_offset[s] : (x))
-static const int extend_test[16] = /* entry n is 2**(n-1) */
- { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
- 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 };
+static const int extend_test[16] = { /* entry n is 2**(n-1) */
+ 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
+ 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000
+};
-static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */
- { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1,
- ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1,
- ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1,
- ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
+static const int extend_offset[16] = { /* entry n is (-1 << n) + 1 */
+ 0, ((-1) << 1) + 1, ((-1) << 2) + 1, ((-1) << 3) + 1, ((-1) << 4) + 1,
+ ((-1) << 5) + 1, ((-1) << 6) + 1, ((-1) << 7) + 1, ((-1) << 8) + 1,
+ ((-1) << 9) + 1, ((-1) << 10) + 1, ((-1) << 11) + 1, ((-1) << 12) + 1,
+ ((-1) << 13) + 1, ((-1) << 14) + 1, ((-1) << 15) + 1
+};
#endif /* AVOID_TABLES */
@@ -518,9 +524,9 @@ static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */
*/
LOCAL(boolean)
-process_restart (j_decompress_ptr cinfo)
+process_restart(j_decompress_ptr cinfo)
{
- huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
+ huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
int ci;
/* Throw away any unused bits remaining in bit buffer; */
@@ -529,7 +535,7 @@ process_restart (j_decompress_ptr cinfo)
entropy->bitstate.bits_left = 0;
/* Advance past the RSTn marker */
- if (! (*cinfo->marker->read_restart_marker) (cinfo))
+ if (!(*cinfo->marker->read_restart_marker) (cinfo))
return FALSE;
/* Re-initialize DC predictions to 0 */
@@ -552,16 +558,16 @@ process_restart (j_decompress_ptr cinfo)
LOCAL(boolean)
-decode_mcu_slow (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
+decode_mcu_slow(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
- huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
+ huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
BITREAD_STATE_VARS;
int blkn;
savable_state state;
/* Outer loop handles each block in the MCU */
/* Load up working state */
- BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
+ BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
ASSIGN_STATE(state, entropy->saved);
for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
@@ -587,7 +593,7 @@ decode_mcu_slow (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
state.last_dc_val[ci] = s;
if (block) {
/* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */
- (*block)[0] = (JCOEF) s;
+ (*block)[0] = (JCOEF)s;
}
}
@@ -610,7 +616,7 @@ decode_mcu_slow (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
* Note: the extra entries in jpeg_natural_order[] will save us
* if k >= DCTSIZE2, which could happen if the data is corrupted.
*/
- (*block)[jpeg_natural_order[k]] = (JCOEF) s;
+ (*block)[jpeg_natural_order[k]] = (JCOEF)s;
} else {
if (r != 15)
break;
@@ -642,16 +648,16 @@ decode_mcu_slow (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
}
/* Completed MCU, so update state */
- BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
+ BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
ASSIGN_STATE(entropy->saved, state);
return TRUE;
}
LOCAL(boolean)
-decode_mcu_fast (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
+decode_mcu_fast(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
- huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
+ huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
BITREAD_STATE_VARS;
JOCTET *buffer;
int blkn;
@@ -659,8 +665,8 @@ decode_mcu_fast (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
/* Outer loop handles each block in the MCU */
/* Load up working state */
- BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
- buffer = (JOCTET *) br_state.next_input_byte;
+ BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
+ buffer = (JOCTET *)br_state.next_input_byte;
ASSIGN_STATE(state, entropy->saved);
for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
@@ -681,7 +687,7 @@ decode_mcu_fast (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
s += state.last_dc_val[ci];
state.last_dc_val[ci] = s;
if (block)
- (*block)[0] = (JCOEF) s;
+ (*block)[0] = (JCOEF)s;
}
if (entropy->ac_needed[blkn] && block) {
@@ -696,7 +702,7 @@ decode_mcu_fast (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
FILL_BIT_BUFFER_FAST
r = GET_BITS(s);
s = HUFF_EXTEND(r, s);
- (*block)[jpeg_natural_order[k]] = (JCOEF) s;
+ (*block)[jpeg_natural_order[k]] = (JCOEF)s;
} else {
if (r != 15) break;
k += 15;
@@ -729,7 +735,7 @@ decode_mcu_fast (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
br_state.bytes_in_buffer -= (buffer - br_state.next_input_byte);
br_state.next_input_byte = buffer;
- BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
+ BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
ASSIGN_STATE(entropy->saved, state);
return TRUE;
}
@@ -750,36 +756,35 @@ decode_mcu_fast (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
* this module, since we'll just re-assign them on the next call.)
*/
-#define BUFSIZE (DCTSIZE2 * 8)
+#define BUFSIZE (DCTSIZE2 * 8)
METHODDEF(boolean)
-decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
+decode_mcu(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
- huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
+ huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
int usefast = 1;
/* Process restart marker if needed; may have to suspend */
if (cinfo->restart_interval) {
if (entropy->restarts_to_go == 0)
- if (! process_restart(cinfo))
+ if (!process_restart(cinfo))
return FALSE;
usefast = 0;
}
- if (cinfo->src->bytes_in_buffer < BUFSIZE * (size_t)cinfo->blocks_in_MCU
- || cinfo->unread_marker != 0)
+ if (cinfo->src->bytes_in_buffer < BUFSIZE * (size_t)cinfo->blocks_in_MCU ||
+ cinfo->unread_marker != 0)
usefast = 0;
/* If we've run out of data, just leave the MCU set to zeroes.
* This way, we return uniform gray for the remainder of the segment.
*/
- if (! entropy->pub.insufficient_data) {
+ if (!entropy->pub.insufficient_data) {
if (usefast) {
if (!decode_mcu_fast(cinfo, MCU_data)) goto use_slow;
- }
- else {
- use_slow:
+ } else {
+use_slow:
if (!decode_mcu_slow(cinfo, MCU_data)) return FALSE;
}
@@ -797,7 +802,7 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
*/
GLOBAL(void)
-jinit_huff_decoder (j_decompress_ptr cinfo)
+jinit_huff_decoder(j_decompress_ptr cinfo)
{
huff_entropy_ptr entropy;
int i;
@@ -806,12 +811,12 @@ jinit_huff_decoder (j_decompress_ptr cinfo)
are the default tables. Thus, if the tables are not set by the time
the Huffman decoder is initialized (usually within the body of
jpeg_start_decompress()), we set them to default values. */
- std_huff_tables((j_common_ptr) cinfo);
+ std_huff_tables((j_common_ptr)cinfo);
entropy = (huff_entropy_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(huff_entropy_decoder));
- cinfo->entropy = (struct jpeg_entropy_decoder *) entropy;
+ cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
entropy->pub.start_pass = start_pass_huff_decoder;
entropy->pub.decode_mcu = decode_mcu;
diff --git a/src/3rdparty/libjpeg/src/jdhuff.h b/src/3rdparty/libjpeg/src/jdhuff.h
index 87d4465ffb..6a8d90f402 100644
--- a/src/3rdparty/libjpeg/src/jdhuff.h
+++ b/src/3rdparty/libjpeg/src/jdhuff.h
@@ -43,13 +43,12 @@ typedef struct {
* if too long. The next 8 bits of each entry contain the
* symbol.
*/
- int lookup[1<<HUFF_LOOKAHEAD];
+ int lookup[1 << HUFF_LOOKAHEAD];
} d_derived_tbl;
/* Expand a Huffman table definition into the derived format */
-EXTERN(void) jpeg_make_d_derived_tbl
- (j_decompress_ptr cinfo, boolean isDC, int tblno,
- d_derived_tbl ** pdtbl);
+EXTERN(void) jpeg_make_d_derived_tbl(j_decompress_ptr cinfo, boolean isDC,
+ int tblno, d_derived_tbl **pdtbl);
/*
@@ -74,7 +73,7 @@ EXTERN(void) jpeg_make_d_derived_tbl
#error Cannot determine word size
#endif
-#if SIZEOF_SIZE_T==8 || defined(_WIN64)
+#if SIZEOF_SIZE_T == 8 || defined(_WIN64)
typedef size_t bit_buf_type; /* type of bit-extraction buffer */
#define BIT_BUF_SIZE 64 /* size of buffer in bits */
@@ -113,23 +112,23 @@ typedef struct { /* Bitreading working state within an MCU */
} bitread_working_state;
/* Macros to declare and load/save bitread local variables. */
-#define BITREAD_STATE_VARS \
- register bit_buf_type get_buffer; \
- register int bits_left; \
- bitread_working_state br_state
-
-#define BITREAD_LOAD_STATE(cinfop,permstate) \
- br_state.cinfo = cinfop; \
- br_state.next_input_byte = cinfop->src->next_input_byte; \
- br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
- get_buffer = permstate.get_buffer; \
- bits_left = permstate.bits_left;
-
-#define BITREAD_SAVE_STATE(cinfop,permstate) \
- cinfop->src->next_input_byte = br_state.next_input_byte; \
- cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
- permstate.get_buffer = get_buffer; \
- permstate.bits_left = bits_left
+#define BITREAD_STATE_VARS \
+ register bit_buf_type get_buffer; \
+ register int bits_left; \
+ bitread_working_state br_state
+
+#define BITREAD_LOAD_STATE(cinfop, permstate) \
+ br_state.cinfo = cinfop; \
+ br_state.next_input_byte = cinfop->src->next_input_byte; \
+ br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
+ get_buffer = permstate.get_buffer; \
+ bits_left = permstate.bits_left;
+
+#define BITREAD_SAVE_STATE(cinfop, permstate) \
+ cinfop->src->next_input_byte = br_state.next_input_byte; \
+ cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
+ permstate.get_buffer = get_buffer; \
+ permstate.bits_left = bits_left
/*
* These macros provide the in-line portion of bit fetching.
@@ -137,7 +136,7 @@ typedef struct { /* Bitreading working state within an MCU */
* before using GET_BITS, PEEK_BITS, or DROP_BITS.
* The variables get_buffer and bits_left are assumed to be locals,
* but the state struct might not be (jpeg_huff_decode needs this).
- * CHECK_BIT_BUFFER(state,n,action);
+ * CHECK_BIT_BUFFER(state, n, action);
* Ensure there are N bits in get_buffer; if suspend, take action.
* val = GET_BITS(n);
* Fetch next N bits.
@@ -149,25 +148,27 @@ typedef struct { /* Bitreading working state within an MCU */
* is evaluated multiple times.
*/
-#define CHECK_BIT_BUFFER(state,nbits,action) \
- { if (bits_left < (nbits)) { \
- if (! jpeg_fill_bit_buffer(&(state),get_buffer,bits_left,nbits)) \
- { action; } \
- get_buffer = (state).get_buffer; bits_left = (state).bits_left; } }
+#define CHECK_BIT_BUFFER(state, nbits, action) { \
+ if (bits_left < (nbits)) { \
+ if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
+ { action; } \
+ get_buffer = (state).get_buffer; bits_left = (state).bits_left; \
+ } \
+}
#define GET_BITS(nbits) \
- (((int) (get_buffer >> (bits_left -= (nbits)))) & ((1<<(nbits))-1))
+ (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
#define PEEK_BITS(nbits) \
- (((int) (get_buffer >> (bits_left - (nbits)))) & ((1<<(nbits))-1))
+ (((int)(get_buffer >> (bits_left - (nbits)))) & ((1 << (nbits)) - 1))
#define DROP_BITS(nbits) \
- (bits_left -= (nbits))
+ (bits_left -= (nbits))
/* Load up the bit buffer to a depth of at least nbits */
-EXTERN(boolean) jpeg_fill_bit_buffer
- (bitread_working_state *state, register bit_buf_type get_buffer,
- register int bits_left, int nbits);
+EXTERN(boolean) jpeg_fill_bit_buffer(bitread_working_state *state,
+ register bit_buf_type get_buffer,
+ register int bits_left, int nbits);
/*
@@ -187,13 +188,14 @@ EXTERN(boolean) jpeg_fill_bit_buffer
* 3. jpeg_huff_decode returns -1 if forced to suspend.
*/
-#define HUFF_DECODE(result,state,htbl,failaction,slowlabel) \
-{ register int nb, look; \
+#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
+ register int nb, look; \
if (bits_left < HUFF_LOOKAHEAD) { \
- if (! jpeg_fill_bit_buffer(&state,get_buffer,bits_left, 0)) {failaction;} \
- get_buffer = state.get_buffer; bits_left = state.bits_left; \
+ if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
+ { failaction; } \
+ get_buffer = state.get_buffer; bits_left = state.bits_left; \
if (bits_left < HUFF_LOOKAHEAD) { \
- nb = 1; goto slowlabel; \
+ nb = 1; goto slowlabel; \
} \
} \
look = PEEK_BITS(HUFF_LOOKAHEAD); \
@@ -202,13 +204,14 @@ EXTERN(boolean) jpeg_fill_bit_buffer
result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
} else { \
slowlabel: \
- if ((result=jpeg_huff_decode(&state,get_buffer,bits_left,htbl,nb)) < 0) \
- { failaction; } \
- get_buffer = state.get_buffer; bits_left = state.bits_left; \
+ if ((result = \
+ jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
+ { failaction; } \
+ get_buffer = state.get_buffer; bits_left = state.bits_left; \
} \
}
-#define HUFF_DECODE_FAST(s,nb,htbl) \
+#define HUFF_DECODE_FAST(s, nb, htbl) \
FILL_BIT_BUFFER_FAST; \
s = PEEK_BITS(HUFF_LOOKAHEAD); \
s = htbl->lookup[s]; \
@@ -225,10 +228,11 @@ slowlabel: \
s |= GET_BITS(1); \
nb++; \
} \
- s = htbl->pub->huffval[ (int) (s + htbl->valoffset[nb]) & 0xFF ]; \
+ s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
}
/* Out-of-line case for Huffman code fetching */
-EXTERN(int) jpeg_huff_decode
- (bitread_working_state *state, register bit_buf_type get_buffer,
- register int bits_left, d_derived_tbl *htbl, int min_bits);
+EXTERN(int) jpeg_huff_decode(bitread_working_state *state,
+ register bit_buf_type get_buffer,
+ register int bits_left, d_derived_tbl *htbl,
+ int min_bits);
diff --git a/src/3rdparty/libjpeg/src/jdinput.c b/src/3rdparty/libjpeg/src/jdinput.c
index 32a6b424e2..deec618f26 100644
--- a/src/3rdparty/libjpeg/src/jdinput.c
+++ b/src/3rdparty/libjpeg/src/jdinput.c
@@ -4,7 +4,7 @@
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1991-1997, Thomas G. Lane.
* libjpeg-turbo Modifications:
- * Copyright (C) 2010, 2016, D. R. Commander.
+ * Copyright (C) 2010, 2016, 2018, D. R. Commander.
* Copyright (C) 2015, Google, Inc.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
@@ -33,7 +33,7 @@ typedef my_input_controller *my_inputctl_ptr;
/* Forward declarations */
-METHODDEF(int) consume_markers (j_decompress_ptr cinfo);
+METHODDEF(int) consume_markers(j_decompress_ptr cinfo);
/*
@@ -41,16 +41,16 @@ METHODDEF(int) consume_markers (j_decompress_ptr cinfo);
*/
LOCAL(void)
-initial_setup (j_decompress_ptr cinfo)
+initial_setup(j_decompress_ptr cinfo)
/* Called once, when first SOS marker is reached */
{
int ci;
jpeg_component_info *compptr;
/* Make sure image isn't bigger than I can handle */
- if ((long) cinfo->image_height > (long) JPEG_MAX_DIMENSION ||
- (long) cinfo->image_width > (long) JPEG_MAX_DIMENSION)
- ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION);
+ if ((long)cinfo->image_height > (long)JPEG_MAX_DIMENSION ||
+ (long)cinfo->image_width > (long)JPEG_MAX_DIMENSION)
+ ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int)JPEG_MAX_DIMENSION);
/* For now, precision must match compiled-in value... */
if (cinfo->data_precision != BITS_IN_JSAMPLE)
@@ -66,8 +66,10 @@ initial_setup (j_decompress_ptr cinfo)
cinfo->max_v_samp_factor = 1;
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) {
- if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR ||
- compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR)
+ if (compptr->h_samp_factor <= 0 ||
+ compptr->h_samp_factor > MAX_SAMP_FACTOR ||
+ compptr->v_samp_factor <= 0 ||
+ compptr->v_samp_factor > MAX_SAMP_FACTOR)
ERREXIT(cinfo, JERR_BAD_SAMPLING);
cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
compptr->h_samp_factor);
@@ -75,10 +77,10 @@ initial_setup (j_decompress_ptr cinfo)
compptr->v_samp_factor);
}
-#if JPEG_LIB_VERSION >=80
- cinfo->block_size = DCTSIZE;
- cinfo->natural_order = jpeg_natural_order;
- cinfo->lim_Se = DCTSIZE2-1;
+#if JPEG_LIB_VERSION >= 80
+ cinfo->block_size = DCTSIZE;
+ cinfo->natural_order = jpeg_natural_order;
+ cinfo->lim_Se = DCTSIZE2 - 1;
#endif
/* We initialize DCT_scaled_size and min_DCT_scaled_size to DCTSIZE.
@@ -101,11 +103,11 @@ initial_setup (j_decompress_ptr cinfo)
#endif
/* Size in DCT blocks */
compptr->width_in_blocks = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,
- (long) (cinfo->max_h_samp_factor * DCTSIZE));
+ jdiv_round_up((long)cinfo->image_width * (long)compptr->h_samp_factor,
+ (long)(cinfo->max_h_samp_factor * DCTSIZE));
compptr->height_in_blocks = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,
- (long) (cinfo->max_v_samp_factor * DCTSIZE));
+ jdiv_round_up((long)cinfo->image_height * (long)compptr->v_samp_factor,
+ (long)(cinfo->max_v_samp_factor * DCTSIZE));
/* Set the first and last MCU columns to decompress from multi-scan images.
* By default, decompress all of the MCU columns.
*/
@@ -117,11 +119,11 @@ initial_setup (j_decompress_ptr cinfo)
*/
/* Size in samples */
compptr->downsampled_width = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,
- (long) cinfo->max_h_samp_factor);
+ jdiv_round_up((long)cinfo->image_width * (long)compptr->h_samp_factor,
+ (long)cinfo->max_h_samp_factor);
compptr->downsampled_height = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,
- (long) cinfo->max_v_samp_factor);
+ jdiv_round_up((long)cinfo->image_height * (long)compptr->v_samp_factor,
+ (long)cinfo->max_v_samp_factor);
/* Mark component needed, until color conversion says otherwise */
compptr->component_needed = TRUE;
/* Mark no quantization table yet saved for component */
@@ -130,8 +132,8 @@ initial_setup (j_decompress_ptr cinfo)
/* Compute number of fully interleaved MCU rows. */
cinfo->total_iMCU_rows = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height,
- (long) (cinfo->max_v_samp_factor*DCTSIZE));
+ jdiv_round_up((long)cinfo->image_height,
+ (long)(cinfo->max_v_samp_factor * DCTSIZE));
/* Decide whether file contains multiple scans */
if (cinfo->comps_in_scan < cinfo->num_components || cinfo->progressive_mode)
@@ -142,7 +144,7 @@ initial_setup (j_decompress_ptr cinfo)
LOCAL(void)
-per_scan_setup (j_decompress_ptr cinfo)
+per_scan_setup(j_decompress_ptr cinfo)
/* Do computations that are needed before processing a JPEG scan */
/* cinfo->comps_in_scan and cinfo->cur_comp_info[] were set from SOS marker */
{
@@ -167,7 +169,7 @@ per_scan_setup (j_decompress_ptr cinfo)
/* For noninterleaved scans, it is convenient to define last_row_height
* as the number of block rows present in the last iMCU row.
*/
- tmp = (int) (compptr->height_in_blocks % compptr->v_samp_factor);
+ tmp = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
if (tmp == 0) tmp = compptr->v_samp_factor;
compptr->last_row_height = tmp;
@@ -184,11 +186,11 @@ per_scan_setup (j_decompress_ptr cinfo)
/* Overall image size in MCUs */
cinfo->MCUs_per_row = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width,
- (long) (cinfo->max_h_samp_factor*DCTSIZE));
+ jdiv_round_up((long)cinfo->image_width,
+ (long)(cinfo->max_h_samp_factor * DCTSIZE));
cinfo->MCU_rows_in_scan = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height,
- (long) (cinfo->max_v_samp_factor*DCTSIZE));
+ jdiv_round_up((long)cinfo->image_height,
+ (long)(cinfo->max_v_samp_factor * DCTSIZE));
cinfo->blocks_in_MCU = 0;
@@ -198,12 +200,13 @@ per_scan_setup (j_decompress_ptr cinfo)
compptr->MCU_width = compptr->h_samp_factor;
compptr->MCU_height = compptr->v_samp_factor;
compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height;
- compptr->MCU_sample_width = compptr->MCU_width * compptr->_DCT_scaled_size;
+ compptr->MCU_sample_width = compptr->MCU_width *
+ compptr->_DCT_scaled_size;
/* Figure number of non-dummy blocks in last MCU column & row */
- tmp = (int) (compptr->width_in_blocks % compptr->MCU_width);
+ tmp = (int)(compptr->width_in_blocks % compptr->MCU_width);
if (tmp == 0) tmp = compptr->MCU_width;
compptr->last_col_width = tmp;
- tmp = (int) (compptr->height_in_blocks % compptr->MCU_height);
+ tmp = (int)(compptr->height_in_blocks % compptr->MCU_height);
if (tmp == 0) tmp = compptr->MCU_height;
compptr->last_row_height = tmp;
/* Prepare array describing MCU composition */
@@ -231,17 +234,17 @@ per_scan_setup (j_decompress_ptr cinfo)
* means that we have to save away the table actually used for each component.
* We do this by copying the table at the start of the first scan containing
* the component.
- * The JPEG spec prohibits the encoder from changing the contents of a Q-table
- * slot between scans of a component using that slot. If the encoder does so
- * anyway, this decoder will simply use the Q-table values that were current
- * at the start of the first scan for the component.
+ * Rec. ITU-T T.81 | ISO/IEC 10918-1 prohibits the encoder from changing the
+ * contents of a Q-table slot between scans of a component using that slot. If
+ * the encoder does so anyway, this decoder will simply use the Q-table values
+ * that were current at the start of the first scan for the component.
*
* The decompressor output side looks only at the saved quant tables,
* not at the current Q-table slots.
*/
LOCAL(void)
-latch_quant_tables (j_decompress_ptr cinfo)
+latch_quant_tables(j_decompress_ptr cinfo)
{
int ci, qtblno;
jpeg_component_info *compptr;
@@ -259,7 +262,7 @@ latch_quant_tables (j_decompress_ptr cinfo)
ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);
/* OK, save away the quantization table */
qtbl = (JQUANT_TBL *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(JQUANT_TBL));
MEMCOPY(qtbl, cinfo->quant_tbl_ptrs[qtblno], sizeof(JQUANT_TBL));
compptr->quant_table = qtbl;
@@ -275,7 +278,7 @@ latch_quant_tables (j_decompress_ptr cinfo)
*/
METHODDEF(void)
-start_input_pass (j_decompress_ptr cinfo)
+start_input_pass(j_decompress_ptr cinfo)
{
per_scan_setup(cinfo);
latch_quant_tables(cinfo);
@@ -292,7 +295,7 @@ start_input_pass (j_decompress_ptr cinfo)
*/
METHODDEF(void)
-finish_input_pass (j_decompress_ptr cinfo)
+finish_input_pass(j_decompress_ptr cinfo)
{
cinfo->inputctl->consume_input = consume_markers;
}
@@ -309,9 +312,9 @@ finish_input_pass (j_decompress_ptr cinfo)
*/
METHODDEF(int)
-consume_markers (j_decompress_ptr cinfo)
+consume_markers(j_decompress_ptr cinfo)
{
- my_inputctl_ptr inputctl = (my_inputctl_ptr) cinfo->inputctl;
+ my_inputctl_ptr inputctl = (my_inputctl_ptr)cinfo->inputctl;
int val;
if (inputctl->pub.eoi_reached) /* After hitting EOI, read no further */
@@ -329,7 +332,7 @@ consume_markers (j_decompress_ptr cinfo)
* responsible for enforcing this sequencing.
*/
} else { /* 2nd or later SOS marker */
- if (! inputctl->pub.has_multiple_scans)
+ if (!inputctl->pub.has_multiple_scans)
ERREXIT(cinfo, JERR_EOI_EXPECTED); /* Oops, I wasn't expecting this! */
start_input_pass(cinfo);
}
@@ -360,16 +363,16 @@ consume_markers (j_decompress_ptr cinfo)
*/
METHODDEF(void)
-reset_input_controller (j_decompress_ptr cinfo)
+reset_input_controller(j_decompress_ptr cinfo)
{
- my_inputctl_ptr inputctl = (my_inputctl_ptr) cinfo->inputctl;
+ my_inputctl_ptr inputctl = (my_inputctl_ptr)cinfo->inputctl;
inputctl->pub.consume_input = consume_markers;
inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
inputctl->pub.eoi_reached = FALSE;
inputctl->inheaders = TRUE;
/* Reset other modules */
- (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
+ (*cinfo->err->reset_error_mgr) ((j_common_ptr)cinfo);
(*cinfo->marker->reset_marker_reader) (cinfo);
/* Reset progression state -- would be cleaner if entropy decoder did this */
cinfo->coef_bits = NULL;
@@ -382,15 +385,15 @@ reset_input_controller (j_decompress_ptr cinfo)
*/
GLOBAL(void)
-jinit_input_controller (j_decompress_ptr cinfo)
+jinit_input_controller(j_decompress_ptr cinfo)
{
my_inputctl_ptr inputctl;
/* Create subobject in permanent pool */
inputctl = (my_inputctl_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
sizeof(my_input_controller));
- cinfo->inputctl = (struct jpeg_input_controller *) inputctl;
+ cinfo->inputctl = (struct jpeg_input_controller *)inputctl;
/* Initialize method pointers */
inputctl->pub.consume_input = consume_markers;
inputctl->pub.reset_input_controller = reset_input_controller;
diff --git a/src/3rdparty/libjpeg/src/jdmainct.c b/src/3rdparty/libjpeg/src/jdmainct.c
index ebb069b0f4..50301d6b50 100644
--- a/src/3rdparty/libjpeg/src/jdmainct.c
+++ b/src/3rdparty/libjpeg/src/jdmainct.c
@@ -112,26 +112,29 @@
/* Forward declarations */
-METHODDEF(void) process_data_simple_main
- (j_decompress_ptr cinfo, JSAMPARRAY output_buf,
- JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail);
-METHODDEF(void) process_data_context_main
- (j_decompress_ptr cinfo, JSAMPARRAY output_buf,
- JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail);
+METHODDEF(void) process_data_simple_main(j_decompress_ptr cinfo,
+ JSAMPARRAY output_buf,
+ JDIMENSION *out_row_ctr,
+ JDIMENSION out_rows_avail);
+METHODDEF(void) process_data_context_main(j_decompress_ptr cinfo,
+ JSAMPARRAY output_buf,
+ JDIMENSION *out_row_ctr,
+ JDIMENSION out_rows_avail);
#ifdef QUANT_2PASS_SUPPORTED
-METHODDEF(void) process_data_crank_post
- (j_decompress_ptr cinfo, JSAMPARRAY output_buf,
- JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail);
+METHODDEF(void) process_data_crank_post(j_decompress_ptr cinfo,
+ JSAMPARRAY output_buf,
+ JDIMENSION *out_row_ctr,
+ JDIMENSION out_rows_avail);
#endif
LOCAL(void)
-alloc_funny_pointers (j_decompress_ptr cinfo)
+alloc_funny_pointers(j_decompress_ptr cinfo)
/* Allocate space for the funny pointer lists.
* This is done only once, not once per pass.
*/
{
- my_main_ptr main_ptr = (my_main_ptr) cinfo->main;
+ my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
int ci, rgroup;
int M = cinfo->_min_DCT_scaled_size;
jpeg_component_info *compptr;
@@ -141,7 +144,7 @@ alloc_funny_pointers (j_decompress_ptr cinfo)
* We alloc both arrays with one call to save a few cycles.
*/
main_ptr->xbuffer[0] = (JSAMPIMAGE)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
cinfo->num_components * 2 * sizeof(JSAMPARRAY));
main_ptr->xbuffer[1] = main_ptr->xbuffer[0] + cinfo->num_components;
@@ -153,7 +156,7 @@ alloc_funny_pointers (j_decompress_ptr cinfo)
* We alloc both pointer lists with one call to save a few cycles.
*/
xbuf = (JSAMPARRAY)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
2 * (rgroup * (M + 4)) * sizeof(JSAMPROW));
xbuf += rgroup; /* want one row group at negative offsets */
main_ptr->xbuffer[0][ci] = xbuf;
@@ -164,7 +167,7 @@ alloc_funny_pointers (j_decompress_ptr cinfo)
LOCAL(void)
-make_funny_pointers (j_decompress_ptr cinfo)
+make_funny_pointers(j_decompress_ptr cinfo)
/* Create the funny pointer lists discussed in the comments above.
* The actual workspace is already allocated (in main_ptr->buffer),
* and the space for the pointer lists is allocated too.
@@ -172,7 +175,7 @@ make_funny_pointers (j_decompress_ptr cinfo)
* This will be repeated at the beginning of each pass.
*/
{
- my_main_ptr main_ptr = (my_main_ptr) cinfo->main;
+ my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
int ci, i, rgroup;
int M = cinfo->_min_DCT_scaled_size;
jpeg_component_info *compptr;
@@ -191,8 +194,8 @@ make_funny_pointers (j_decompress_ptr cinfo)
}
/* In the second list, put the last four row groups in swapped order */
for (i = 0; i < rgroup * 2; i++) {
- xbuf1[rgroup*(M-2) + i] = buf[rgroup*M + i];
- xbuf1[rgroup*M + i] = buf[rgroup*(M-2) + i];
+ xbuf1[rgroup * (M - 2) + i] = buf[rgroup * M + i];
+ xbuf1[rgroup * M + i] = buf[rgroup * (M - 2) + i];
}
/* The wraparound pointers at top and bottom will be filled later
* (see set_wraparound_pointers, below). Initially we want the "above"
@@ -207,13 +210,13 @@ make_funny_pointers (j_decompress_ptr cinfo)
LOCAL(void)
-set_bottom_pointers (j_decompress_ptr cinfo)
+set_bottom_pointers(j_decompress_ptr cinfo)
/* Change the pointer lists to duplicate the last sample row at the bottom
* of the image. whichptr indicates which xbuffer holds the final iMCU row.
* Also sets rowgroups_avail to indicate number of nondummy row groups in row.
*/
{
- my_main_ptr main_ptr = (my_main_ptr) cinfo->main;
+ my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
int ci, i, rgroup, iMCUheight, rows_left;
jpeg_component_info *compptr;
JSAMPARRAY xbuf;
@@ -224,20 +227,20 @@ set_bottom_pointers (j_decompress_ptr cinfo)
iMCUheight = compptr->v_samp_factor * compptr->_DCT_scaled_size;
rgroup = iMCUheight / cinfo->_min_DCT_scaled_size;
/* Count nondummy sample rows remaining for this component */
- rows_left = (int) (compptr->downsampled_height % (JDIMENSION) iMCUheight);
+ rows_left = (int)(compptr->downsampled_height % (JDIMENSION)iMCUheight);
if (rows_left == 0) rows_left = iMCUheight;
/* Count nondummy row groups. Should get same answer for each component,
* so we need only do it once.
*/
if (ci == 0) {
- main_ptr->rowgroups_avail = (JDIMENSION) ((rows_left-1) / rgroup + 1);
+ main_ptr->rowgroups_avail = (JDIMENSION)((rows_left - 1) / rgroup + 1);
}
/* Duplicate the last real sample row rgroup*2 times; this pads out the
* last partial rowgroup and ensures at least one full rowgroup of context.
*/
xbuf = main_ptr->xbuffer[main_ptr->whichptr][ci];
for (i = 0; i < rgroup * 2; i++) {
- xbuf[rows_left + i] = xbuf[rows_left-1];
+ xbuf[rows_left + i] = xbuf[rows_left - 1];
}
}
}
@@ -248,9 +251,9 @@ set_bottom_pointers (j_decompress_ptr cinfo)
*/
METHODDEF(void)
-start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
+start_pass_main(j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
{
- my_main_ptr main_ptr = (my_main_ptr) cinfo->main;
+ my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
switch (pass_mode) {
case JBUF_PASS_THRU:
@@ -286,22 +289,21 @@ start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
*/
METHODDEF(void)
-process_data_simple_main (j_decompress_ptr cinfo,
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
- JDIMENSION out_rows_avail)
+process_data_simple_main(j_decompress_ptr cinfo, JSAMPARRAY output_buf,
+ JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
{
- my_main_ptr main_ptr = (my_main_ptr) cinfo->main;
+ my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
JDIMENSION rowgroups_avail;
/* Read input data if we haven't filled the main buffer yet */
- if (! main_ptr->buffer_full) {
- if (! (*cinfo->coef->decompress_data) (cinfo, main_ptr->buffer))
+ if (!main_ptr->buffer_full) {
+ if (!(*cinfo->coef->decompress_data) (cinfo, main_ptr->buffer))
return; /* suspension forced, can do nothing more */
main_ptr->buffer_full = TRUE; /* OK, we have an iMCU row to work with */
}
/* There are always min_DCT_scaled_size row groups in an iMCU row. */
- rowgroups_avail = (JDIMENSION) cinfo->_min_DCT_scaled_size;
+ rowgroups_avail = (JDIMENSION)cinfo->_min_DCT_scaled_size;
/* Note: at the bottom of the image, we may pass extra garbage row groups
* to the postprocessor. The postprocessor has to check for bottom
* of image anyway (at row resolution), so no point in us doing it too.
@@ -326,16 +328,15 @@ process_data_simple_main (j_decompress_ptr cinfo,
*/
METHODDEF(void)
-process_data_context_main (j_decompress_ptr cinfo,
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
- JDIMENSION out_rows_avail)
+process_data_context_main(j_decompress_ptr cinfo, JSAMPARRAY output_buf,
+ JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
{
- my_main_ptr main_ptr = (my_main_ptr) cinfo->main;
+ my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
/* Read input data if we haven't filled the main buffer yet */
- if (! main_ptr->buffer_full) {
- if (! (*cinfo->coef->decompress_data) (cinfo,
- main_ptr->xbuffer[main_ptr->whichptr]))
+ if (!main_ptr->buffer_full) {
+ if (!(*cinfo->coef->decompress_data) (cinfo,
+ main_ptr->xbuffer[main_ptr->whichptr]))
return; /* suspension forced, can do nothing more */
main_ptr->buffer_full = TRUE; /* OK, we have an iMCU row to work with */
main_ptr->iMCU_row_ctr++; /* count rows received */
@@ -349,9 +350,11 @@ process_data_context_main (j_decompress_ptr cinfo,
switch (main_ptr->context_state) {
case CTX_POSTPONED_ROW:
/* Call postprocessor using previously set pointers for postponed row */
- (*cinfo->post->post_process_data) (cinfo, main_ptr->xbuffer[main_ptr->whichptr],
- &main_ptr->rowgroup_ctr, main_ptr->rowgroups_avail,
- output_buf, out_row_ctr, out_rows_avail);
+ (*cinfo->post->post_process_data) (cinfo,
+ main_ptr->xbuffer[main_ptr->whichptr],
+ &main_ptr->rowgroup_ctr,
+ main_ptr->rowgroups_avail, output_buf,
+ out_row_ctr, out_rows_avail);
if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail)
return; /* Need to suspend */
main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
@@ -361,7 +364,7 @@ process_data_context_main (j_decompress_ptr cinfo,
case CTX_PREPARE_FOR_IMCU:
/* Prepare to process first M-1 row groups of this iMCU row */
main_ptr->rowgroup_ctr = 0;
- main_ptr->rowgroups_avail = (JDIMENSION) (cinfo->_min_DCT_scaled_size - 1);
+ main_ptr->rowgroups_avail = (JDIMENSION)(cinfo->_min_DCT_scaled_size - 1);
/* Check for bottom of image: if so, tweak pointers to "duplicate"
* the last sample row, and adjust rowgroups_avail to ignore padding rows.
*/
@@ -371,9 +374,11 @@ process_data_context_main (j_decompress_ptr cinfo,
/*FALLTHROUGH*/
case CTX_PROCESS_IMCU:
/* Call postprocessor using previously set pointers */
- (*cinfo->post->post_process_data) (cinfo, main_ptr->xbuffer[main_ptr->whichptr],
- &main_ptr->rowgroup_ctr, main_ptr->rowgroups_avail,
- output_buf, out_row_ctr, out_rows_avail);
+ (*cinfo->post->post_process_data) (cinfo,
+ main_ptr->xbuffer[main_ptr->whichptr],
+ &main_ptr->rowgroup_ctr,
+ main_ptr->rowgroups_avail, output_buf,
+ out_row_ctr, out_rows_avail);
if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail)
return; /* Need to suspend */
/* After the first iMCU, change wraparound pointers to normal state */
@@ -384,8 +389,8 @@ process_data_context_main (j_decompress_ptr cinfo,
main_ptr->buffer_full = FALSE;
/* Still need to process last row group of this iMCU row, */
/* which is saved at index M+1 of the other xbuffer */
- main_ptr->rowgroup_ctr = (JDIMENSION) (cinfo->_min_DCT_scaled_size + 1);
- main_ptr->rowgroups_avail = (JDIMENSION) (cinfo->_min_DCT_scaled_size + 2);
+ main_ptr->rowgroup_ctr = (JDIMENSION)(cinfo->_min_DCT_scaled_size + 1);
+ main_ptr->rowgroups_avail = (JDIMENSION)(cinfo->_min_DCT_scaled_size + 2);
main_ptr->context_state = CTX_POSTPONED_ROW;
}
}
@@ -400,12 +405,11 @@ process_data_context_main (j_decompress_ptr cinfo,
#ifdef QUANT_2PASS_SUPPORTED
METHODDEF(void)
-process_data_crank_post (j_decompress_ptr cinfo,
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
- JDIMENSION out_rows_avail)
+process_data_crank_post(j_decompress_ptr cinfo, JSAMPARRAY output_buf,
+ JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
{
- (*cinfo->post->post_process_data) (cinfo, (JSAMPIMAGE) NULL,
- (JDIMENSION *) NULL, (JDIMENSION) 0,
+ (*cinfo->post->post_process_data) (cinfo, (JSAMPIMAGE)NULL,
+ (JDIMENSION *)NULL, (JDIMENSION)0,
output_buf, out_row_ctr, out_rows_avail);
}
@@ -417,16 +421,16 @@ process_data_crank_post (j_decompress_ptr cinfo,
*/
GLOBAL(void)
-jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
+jinit_d_main_controller(j_decompress_ptr cinfo, boolean need_full_buffer)
{
my_main_ptr main_ptr;
int ci, rgroup, ngroups;
jpeg_component_info *compptr;
main_ptr = (my_main_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(my_main_controller));
- cinfo->main = (struct jpeg_d_main_controller *) main_ptr;
+ cinfo->main = (struct jpeg_d_main_controller *)main_ptr;
main_ptr->pub.start_pass = start_pass_main;
if (need_full_buffer) /* shouldn't happen */
@@ -449,8 +453,8 @@ jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
cinfo->_min_DCT_scaled_size; /* height of a row group of component */
main_ptr->buffer[ci] = (*cinfo->mem->alloc_sarray)
- ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ ((j_common_ptr)cinfo, JPOOL_IMAGE,
compptr->width_in_blocks * compptr->_DCT_scaled_size,
- (JDIMENSION) (rgroup * ngroups));
+ (JDIMENSION)(rgroup * ngroups));
}
}
diff --git a/src/3rdparty/libjpeg/src/jdmainct.h b/src/3rdparty/libjpeg/src/jdmainct.h
index 30903019ca..37b201ca88 100644
--- a/src/3rdparty/libjpeg/src/jdmainct.h
+++ b/src/3rdparty/libjpeg/src/jdmainct.h
@@ -44,12 +44,12 @@ typedef my_main_controller *my_main_ptr;
LOCAL(void)
-set_wraparound_pointers (j_decompress_ptr cinfo)
+set_wraparound_pointers(j_decompress_ptr cinfo)
/* Set up the "wraparound" pointers at top and bottom of the pointer lists.
* This changes the pointer list state from top-of-image to the normal state.
*/
{
- my_main_ptr main_ptr = (my_main_ptr) cinfo->main;
+ my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
int ci, i, rgroup;
int M = cinfo->_min_DCT_scaled_size;
jpeg_component_info *compptr;
@@ -62,10 +62,10 @@ set_wraparound_pointers (j_decompress_ptr cinfo)
xbuf0 = main_ptr->xbuffer[0][ci];
xbuf1 = main_ptr->xbuffer[1][ci];
for (i = 0; i < rgroup; i++) {
- xbuf0[i - rgroup] = xbuf0[rgroup*(M+1) + i];
- xbuf1[i - rgroup] = xbuf1[rgroup*(M+1) + i];
- xbuf0[rgroup*(M+2) + i] = xbuf0[i];
- xbuf1[rgroup*(M+2) + i] = xbuf1[i];
+ xbuf0[i - rgroup] = xbuf0[rgroup * (M + 1) + i];
+ xbuf1[i - rgroup] = xbuf1[rgroup * (M + 1) + i];
+ xbuf0[rgroup * (M + 2) + i] = xbuf0[i];
+ xbuf1[rgroup * (M + 2) + i] = xbuf1[i];
}
}
}
diff --git a/src/3rdparty/libjpeg/src/jdmarker.c b/src/3rdparty/libjpeg/src/jdmarker.c
index e3b612c9b9..c9c7ef6399 100644
--- a/src/3rdparty/libjpeg/src/jdmarker.c
+++ b/src/3rdparty/libjpeg/src/jdmarker.c
@@ -119,50 +119,50 @@ typedef my_marker_reader *my_marker_ptr;
*/
/* Declare and initialize local copies of input pointer/count */
-#define INPUT_VARS(cinfo) \
- struct jpeg_source_mgr *datasrc = (cinfo)->src; \
- const JOCTET *next_input_byte = datasrc->next_input_byte; \
- size_t bytes_in_buffer = datasrc->bytes_in_buffer
+#define INPUT_VARS(cinfo) \
+ struct jpeg_source_mgr *datasrc = (cinfo)->src; \
+ const JOCTET *next_input_byte = datasrc->next_input_byte; \
+ size_t bytes_in_buffer = datasrc->bytes_in_buffer
/* Unload the local copies --- do this only at a restart boundary */
-#define INPUT_SYNC(cinfo) \
- ( datasrc->next_input_byte = next_input_byte, \
- datasrc->bytes_in_buffer = bytes_in_buffer )
+#define INPUT_SYNC(cinfo) \
+ ( datasrc->next_input_byte = next_input_byte, \
+ datasrc->bytes_in_buffer = bytes_in_buffer )
/* Reload the local copies --- used only in MAKE_BYTE_AVAIL */
-#define INPUT_RELOAD(cinfo) \
- ( next_input_byte = datasrc->next_input_byte, \
- bytes_in_buffer = datasrc->bytes_in_buffer )
+#define INPUT_RELOAD(cinfo) \
+ ( next_input_byte = datasrc->next_input_byte, \
+ bytes_in_buffer = datasrc->bytes_in_buffer )
/* Internal macro for INPUT_BYTE and INPUT_2BYTES: make a byte available.
* Note we do *not* do INPUT_SYNC before calling fill_input_buffer,
* but we must reload the local copies after a successful fill.
*/
-#define MAKE_BYTE_AVAIL(cinfo,action) \
- if (bytes_in_buffer == 0) { \
- if (! (*datasrc->fill_input_buffer) (cinfo)) \
- { action; } \
- INPUT_RELOAD(cinfo); \
- }
+#define MAKE_BYTE_AVAIL(cinfo, action) \
+ if (bytes_in_buffer == 0) { \
+ if (!(*datasrc->fill_input_buffer) (cinfo)) \
+ { action; } \
+ INPUT_RELOAD(cinfo); \
+ }
/* Read a byte into variable V.
* If must suspend, take the specified action (typically "return FALSE").
*/
-#define INPUT_BYTE(cinfo,V,action) \
- MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \
- bytes_in_buffer--; \
- V = GETJOCTET(*next_input_byte++); )
+#define INPUT_BYTE(cinfo, V, action) \
+ MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
+ bytes_in_buffer--; \
+ V = GETJOCTET(*next_input_byte++); )
/* As above, but read two bytes interpreted as an unsigned 16-bit integer.
* V should be declared unsigned int or perhaps JLONG.
*/
-#define INPUT_2BYTES(cinfo,V,action) \
- MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \
- bytes_in_buffer--; \
- V = ((unsigned int) GETJOCTET(*next_input_byte++)) << 8; \
- MAKE_BYTE_AVAIL(cinfo,action); \
- bytes_in_buffer--; \
- V += GETJOCTET(*next_input_byte++); )
+#define INPUT_2BYTES(cinfo, V, action) \
+ MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
+ bytes_in_buffer--; \
+ V = ((unsigned int)GETJOCTET(*next_input_byte++)) << 8; \
+ MAKE_BYTE_AVAIL(cinfo, action); \
+ bytes_in_buffer--; \
+ V += GETJOCTET(*next_input_byte++); )
/*
@@ -197,7 +197,7 @@ typedef my_marker_reader *my_marker_ptr;
LOCAL(boolean)
-get_soi (j_decompress_ptr cinfo)
+get_soi(j_decompress_ptr cinfo)
/* Process an SOI marker */
{
int i;
@@ -237,7 +237,7 @@ get_soi (j_decompress_ptr cinfo)
LOCAL(boolean)
-get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith)
+get_sof(j_decompress_ptr cinfo, boolean is_prog, boolean is_arith)
/* Process a SOFn marker */
{
JLONG length;
@@ -258,7 +258,7 @@ get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith)
length -= 8;
TRACEMS4(cinfo, 1, JTRC_SOF, cinfo->unread_marker,
- (int) cinfo->image_width, (int) cinfo->image_height,
+ (int)cinfo->image_width, (int)cinfo->image_height,
cinfo->num_components);
if (cinfo->marker->saw_SOF)
@@ -267,16 +267,16 @@ get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith)
/* We don't support files in which the image height is initially specified */
/* as 0 and is later redefined by DNL. As long as we have to check that, */
/* might as well have a general sanity check. */
- if (cinfo->image_height <= 0 || cinfo->image_width <= 0
- || cinfo->num_components <= 0)
+ if (cinfo->image_height <= 0 || cinfo->image_width <= 0 ||
+ cinfo->num_components <= 0)
ERREXIT(cinfo, JERR_EMPTY_IMAGE);
if (length != (cinfo->num_components * 3))
ERREXIT(cinfo, JERR_BAD_LENGTH);
if (cinfo->comp_info == NULL) /* do only once, even if suspend */
- cinfo->comp_info = (jpeg_component_info *) (*cinfo->mem->alloc_small)
- ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ cinfo->comp_info = (jpeg_component_info *)(*cinfo->mem->alloc_small)
+ ((j_common_ptr)cinfo, JPOOL_IMAGE,
cinfo->num_components * sizeof(jpeg_component_info));
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
@@ -301,7 +301,7 @@ get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith)
LOCAL(boolean)
-get_sos (j_decompress_ptr cinfo)
+get_sos(j_decompress_ptr cinfo)
/* Process a SOS marker */
{
JLONG length;
@@ -309,7 +309,7 @@ get_sos (j_decompress_ptr cinfo)
jpeg_component_info *compptr;
INPUT_VARS(cinfo);
- if (! cinfo->marker->saw_SOF)
+ if (!cinfo->marker->saw_SOF)
ERREXIT(cinfo, JERR_SOS_NO_SOF);
INPUT_2BYTES(cinfo, length, return FALSE);
@@ -341,7 +341,7 @@ get_sos (j_decompress_ptr cinfo)
ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);
- id_found:
+id_found:
cinfo->cur_comp_info[i] = compptr;
compptr->dc_tbl_no = (c >> 4) & 15;
@@ -384,7 +384,7 @@ get_sos (j_decompress_ptr cinfo)
#ifdef D_ARITH_CODING_SUPPORTED
LOCAL(boolean)
-get_dac (j_decompress_ptr cinfo)
+get_dac(j_decompress_ptr cinfo)
/* Process a DAC marker */
{
JLONG length;
@@ -402,14 +402,14 @@ get_dac (j_decompress_ptr cinfo)
TRACEMS2(cinfo, 1, JTRC_DAC, index, val);
- if (index < 0 || index >= (2*NUM_ARITH_TBLS))
+ if (index < 0 || index >= (2 * NUM_ARITH_TBLS))
ERREXIT1(cinfo, JERR_DAC_INDEX, index);
if (index >= NUM_ARITH_TBLS) { /* define AC table */
- cinfo->arith_ac_K[index-NUM_ARITH_TBLS] = (UINT8) val;
+ cinfo->arith_ac_K[index - NUM_ARITH_TBLS] = (UINT8)val;
} else { /* define DC table */
- cinfo->arith_dc_L[index] = (UINT8) (val & 0x0F);
- cinfo->arith_dc_U[index] = (UINT8) (val >> 4);
+ cinfo->arith_dc_L[index] = (UINT8)(val & 0x0F);
+ cinfo->arith_dc_U[index] = (UINT8)(val >> 4);
if (cinfo->arith_dc_L[index] > cinfo->arith_dc_U[index])
ERREXIT1(cinfo, JERR_DAC_VALUE, val);
}
@@ -422,7 +422,7 @@ get_dac (j_decompress_ptr cinfo)
return TRUE;
}
-#else /* ! D_ARITH_CODING_SUPPORTED */
+#else /* !D_ARITH_CODING_SUPPORTED */
#define get_dac(cinfo) skip_variable(cinfo)
@@ -430,7 +430,7 @@ get_dac (j_decompress_ptr cinfo)
LOCAL(boolean)
-get_dht (j_decompress_ptr cinfo)
+get_dht(j_decompress_ptr cinfo)
/* Process a DHT marker */
{
JLONG length;
@@ -467,7 +467,7 @@ get_dht (j_decompress_ptr cinfo)
/* Here we just do minimal validation of the counts to avoid walking
* off the end of our table space. jdhuff.c will check more carefully.
*/
- if (count > 256 || ((JLONG) count) > length)
+ if (count > 256 || ((JLONG)count) > length)
ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
for (i = 0; i < count; i++)
@@ -489,7 +489,7 @@ get_dht (j_decompress_ptr cinfo)
}
if (*htblptr == NULL)
- *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
+ *htblptr = jpeg_alloc_huff_table((j_common_ptr)cinfo);
MEMCOPY((*htblptr)->bits, bits, sizeof((*htblptr)->bits));
MEMCOPY((*htblptr)->huffval, huffval, sizeof((*htblptr)->huffval));
@@ -504,7 +504,7 @@ get_dht (j_decompress_ptr cinfo)
LOCAL(boolean)
-get_dqt (j_decompress_ptr cinfo)
+get_dqt(j_decompress_ptr cinfo)
/* Process a DQT marker */
{
JLONG length;
@@ -527,7 +527,7 @@ get_dqt (j_decompress_ptr cinfo)
ERREXIT1(cinfo, JERR_DQT_INDEX, n);
if (cinfo->quant_tbl_ptrs[n] == NULL)
- cinfo->quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr) cinfo);
+ cinfo->quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr)cinfo);
quant_ptr = cinfo->quant_tbl_ptrs[n];
for (i = 0; i < DCTSIZE2; i++) {
@@ -536,20 +536,20 @@ get_dqt (j_decompress_ptr cinfo)
else
INPUT_BYTE(cinfo, tmp, return FALSE);
/* We convert the zigzag-order table to natural array order. */
- quant_ptr->quantval[jpeg_natural_order[i]] = (UINT16) tmp;
+ quant_ptr->quantval[jpeg_natural_order[i]] = (UINT16)tmp;
}
if (cinfo->err->trace_level >= 2) {
for (i = 0; i < DCTSIZE2; i += 8) {
TRACEMS8(cinfo, 2, JTRC_QUANTVALS,
- quant_ptr->quantval[i], quant_ptr->quantval[i+1],
- quant_ptr->quantval[i+2], quant_ptr->quantval[i+3],
- quant_ptr->quantval[i+4], quant_ptr->quantval[i+5],
- quant_ptr->quantval[i+6], quant_ptr->quantval[i+7]);
+ quant_ptr->quantval[i], quant_ptr->quantval[i + 1],
+ quant_ptr->quantval[i + 2], quant_ptr->quantval[i + 3],
+ quant_ptr->quantval[i + 4], quant_ptr->quantval[i + 5],
+ quant_ptr->quantval[i + 6], quant_ptr->quantval[i + 7]);
}
}
- length -= DCTSIZE2+1;
+ length -= DCTSIZE2 + 1;
if (prec) length -= DCTSIZE2;
}
@@ -562,7 +562,7 @@ get_dqt (j_decompress_ptr cinfo)
LOCAL(boolean)
-get_dri (j_decompress_ptr cinfo)
+get_dri(j_decompress_ptr cinfo)
/* Process a DRI marker */
{
JLONG length;
@@ -598,14 +598,14 @@ get_dri (j_decompress_ptr cinfo)
LOCAL(void)
-examine_app0 (j_decompress_ptr cinfo, JOCTET *data,
- unsigned int datalen, JLONG remaining)
+examine_app0(j_decompress_ptr cinfo, JOCTET *data, unsigned int datalen,
+ JLONG remaining)
/* Examine first few bytes from an APP0.
* Take appropriate action if it is a JFIF marker.
* datalen is # of bytes at data[], remaining is length of rest of marker data.
*/
{
- JLONG totallen = (JLONG) datalen + remaining;
+ JLONG totallen = (JLONG)datalen + remaining;
if (datalen >= APP0_DATA_LEN &&
GETJOCTET(data[0]) == 0x4A &&
@@ -639,43 +639,43 @@ examine_app0 (j_decompress_ptr cinfo, JOCTET *data,
GETJOCTET(data[12]), GETJOCTET(data[13]));
totallen -= APP0_DATA_LEN;
if (totallen !=
- ((JLONG)GETJOCTET(data[12]) * (JLONG)GETJOCTET(data[13]) * (JLONG) 3))
- TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int) totallen);
+ ((JLONG)GETJOCTET(data[12]) * (JLONG)GETJOCTET(data[13]) * (JLONG)3))
+ TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int)totallen);
} else if (datalen >= 6 &&
- GETJOCTET(data[0]) == 0x4A &&
- GETJOCTET(data[1]) == 0x46 &&
- GETJOCTET(data[2]) == 0x58 &&
- GETJOCTET(data[3]) == 0x58 &&
- GETJOCTET(data[4]) == 0) {
+ GETJOCTET(data[0]) == 0x4A &&
+ GETJOCTET(data[1]) == 0x46 &&
+ GETJOCTET(data[2]) == 0x58 &&
+ GETJOCTET(data[3]) == 0x58 &&
+ GETJOCTET(data[4]) == 0) {
/* Found JFIF "JFXX" extension APP0 marker */
/* The library doesn't actually do anything with these,
* but we try to produce a helpful trace message.
*/
switch (GETJOCTET(data[5])) {
case 0x10:
- TRACEMS1(cinfo, 1, JTRC_THUMB_JPEG, (int) totallen);
+ TRACEMS1(cinfo, 1, JTRC_THUMB_JPEG, (int)totallen);
break;
case 0x11:
- TRACEMS1(cinfo, 1, JTRC_THUMB_PALETTE, (int) totallen);
+ TRACEMS1(cinfo, 1, JTRC_THUMB_PALETTE, (int)totallen);
break;
case 0x13:
- TRACEMS1(cinfo, 1, JTRC_THUMB_RGB, (int) totallen);
+ TRACEMS1(cinfo, 1, JTRC_THUMB_RGB, (int)totallen);
break;
default:
TRACEMS2(cinfo, 1, JTRC_JFIF_EXTENSION,
- GETJOCTET(data[5]), (int) totallen);
+ GETJOCTET(data[5]), (int)totallen);
break;
}
} else {
/* Start of APP0 does not match "JFIF" or "JFXX", or too short */
- TRACEMS1(cinfo, 1, JTRC_APP0, (int) totallen);
+ TRACEMS1(cinfo, 1, JTRC_APP0, (int)totallen);
}
}
LOCAL(void)
-examine_app14 (j_decompress_ptr cinfo, JOCTET *data,
- unsigned int datalen, JLONG remaining)
+examine_app14(j_decompress_ptr cinfo, JOCTET *data, unsigned int datalen,
+ JLONG remaining)
/* Examine first few bytes from an APP14.
* Take appropriate action if it is an Adobe marker.
* datalen is # of bytes at data[], remaining is length of rest of marker data.
@@ -696,16 +696,16 @@ examine_app14 (j_decompress_ptr cinfo, JOCTET *data,
transform = GETJOCTET(data[11]);
TRACEMS4(cinfo, 1, JTRC_ADOBE, version, flags0, flags1, transform);
cinfo->saw_Adobe_marker = TRUE;
- cinfo->Adobe_transform = (UINT8) transform;
+ cinfo->Adobe_transform = (UINT8)transform;
} else {
/* Start of APP14 does not match "Adobe", or too short */
- TRACEMS1(cinfo, 1, JTRC_APP14, (int) (datalen + remaining));
+ TRACEMS1(cinfo, 1, JTRC_APP14, (int)(datalen + remaining));
}
}
METHODDEF(boolean)
-get_interesting_appn (j_decompress_ptr cinfo)
+get_interesting_appn(j_decompress_ptr cinfo)
/* Process an APP0 or APP14 marker without saving it */
{
JLONG length;
@@ -720,7 +720,7 @@ get_interesting_appn (j_decompress_ptr cinfo)
if (length >= APPN_DATA_LEN)
numtoread = APPN_DATA_LEN;
else if (length > 0)
- numtoread = (unsigned int) length;
+ numtoread = (unsigned int)length;
else
numtoread = 0;
for (i = 0; i < numtoread; i++)
@@ -730,10 +730,10 @@ get_interesting_appn (j_decompress_ptr cinfo)
/* process it */
switch (cinfo->unread_marker) {
case M_APP0:
- examine_app0(cinfo, (JOCTET *) b, numtoread, length);
+ examine_app0(cinfo, (JOCTET *)b, numtoread, length);
break;
case M_APP14:
- examine_app14(cinfo, (JOCTET *) b, numtoread, length);
+ examine_app14(cinfo, (JOCTET *)b, numtoread, length);
break;
default:
/* can't get here unless jpeg_save_markers chooses wrong processor */
@@ -744,7 +744,7 @@ get_interesting_appn (j_decompress_ptr cinfo)
/* skip any remaining data -- could be lots */
INPUT_SYNC(cinfo);
if (length > 0)
- (*cinfo->src->skip_input_data) (cinfo, (long) length);
+ (*cinfo->src->skip_input_data) (cinfo, (long)length);
return TRUE;
}
@@ -753,10 +753,10 @@ get_interesting_appn (j_decompress_ptr cinfo)
#ifdef SAVE_MARKERS_SUPPORTED
METHODDEF(boolean)
-save_marker (j_decompress_ptr cinfo)
+save_marker(j_decompress_ptr cinfo)
/* Save an APPn or COM marker into the marker list */
{
- my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
+ my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
jpeg_saved_marker_ptr cur_marker = marker->cur_marker;
unsigned int bytes_read, data_length;
JOCTET *data;
@@ -770,22 +770,22 @@ save_marker (j_decompress_ptr cinfo)
if (length >= 0) { /* watch out for bogus length word */
/* figure out how much we want to save */
unsigned int limit;
- if (cinfo->unread_marker == (int) M_COM)
+ if (cinfo->unread_marker == (int)M_COM)
limit = marker->length_limit_COM;
else
- limit = marker->length_limit_APPn[cinfo->unread_marker - (int) M_APP0];
- if ((unsigned int) length < limit)
- limit = (unsigned int) length;
+ limit = marker->length_limit_APPn[cinfo->unread_marker - (int)M_APP0];
+ if ((unsigned int)length < limit)
+ limit = (unsigned int)length;
/* allocate and initialize the marker item */
cur_marker = (jpeg_saved_marker_ptr)
- (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(struct jpeg_marker_struct) + limit);
cur_marker->next = NULL;
- cur_marker->marker = (UINT8) cinfo->unread_marker;
- cur_marker->original_length = (unsigned int) length;
+ cur_marker->marker = (UINT8)cinfo->unread_marker;
+ cur_marker->original_length = (unsigned int)length;
cur_marker->data_length = limit;
/* data area is just beyond the jpeg_marker_struct */
- data = cur_marker->data = (JOCTET *) (cur_marker + 1);
+ data = cur_marker->data = (JOCTET *)(cur_marker + 1);
marker->cur_marker = cur_marker;
marker->bytes_read = 0;
bytes_read = 0;
@@ -843,14 +843,14 @@ save_marker (j_decompress_ptr cinfo)
break;
default:
TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker,
- (int) (data_length + length));
+ (int)(data_length + length));
break;
}
/* skip any remaining data -- could be lots */
INPUT_SYNC(cinfo); /* do before skip_input_data */
if (length > 0)
- (*cinfo->src->skip_input_data) (cinfo, (long) length);
+ (*cinfo->src->skip_input_data) (cinfo, (long)length);
return TRUE;
}
@@ -859,7 +859,7 @@ save_marker (j_decompress_ptr cinfo)
METHODDEF(boolean)
-skip_variable (j_decompress_ptr cinfo)
+skip_variable(j_decompress_ptr cinfo)
/* Skip over an unknown or uninteresting variable-length marker */
{
JLONG length;
@@ -868,11 +868,11 @@ skip_variable (j_decompress_ptr cinfo)
INPUT_2BYTES(cinfo, length, return FALSE);
length -= 2;
- TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, (int) length);
+ TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, (int)length);
INPUT_SYNC(cinfo); /* do before skip_input_data */
if (length > 0)
- (*cinfo->src->skip_input_data) (cinfo, (long) length);
+ (*cinfo->src->skip_input_data) (cinfo, (long)length);
return TRUE;
}
@@ -888,7 +888,7 @@ skip_variable (j_decompress_ptr cinfo)
*/
LOCAL(boolean)
-next_marker (j_decompress_ptr cinfo)
+next_marker(j_decompress_ptr cinfo)
{
int c;
INPUT_VARS(cinfo);
@@ -935,7 +935,7 @@ next_marker (j_decompress_ptr cinfo)
LOCAL(boolean)
-first_marker (j_decompress_ptr cinfo)
+first_marker(j_decompress_ptr cinfo)
/* Like next_marker, but used to obtain the initial SOI marker. */
/* For this marker, we do not allow preceding garbage or fill; otherwise,
* we might well scan an entire input file before realizing it ain't JPEG.
@@ -948,7 +948,7 @@ first_marker (j_decompress_ptr cinfo)
INPUT_BYTE(cinfo, c, return FALSE);
INPUT_BYTE(cinfo, c2, return FALSE);
- if (c != 0xFF || c2 != (int) M_SOI)
+ if (c != 0xFF || c2 != (int)M_SOI)
ERREXIT2(cinfo, JERR_NO_SOI, c, c2);
cinfo->unread_marker = c2;
@@ -966,18 +966,18 @@ first_marker (j_decompress_ptr cinfo)
*/
METHODDEF(int)
-read_markers (j_decompress_ptr cinfo)
+read_markers(j_decompress_ptr cinfo)
{
/* Outer loop repeats once for each marker. */
for (;;) {
/* Collect the marker proper, unless we already did. */
/* NB: first_marker() enforces the requirement that SOI appear first. */
if (cinfo->unread_marker == 0) {
- if (! cinfo->marker->saw_SOI) {
- if (! first_marker(cinfo))
+ if (!cinfo->marker->saw_SOI) {
+ if (!first_marker(cinfo))
return JPEG_SUSPENDED;
} else {
- if (! next_marker(cinfo))
+ if (!next_marker(cinfo))
return JPEG_SUSPENDED;
}
}
@@ -987,28 +987,28 @@ read_markers (j_decompress_ptr cinfo)
*/
switch (cinfo->unread_marker) {
case M_SOI:
- if (! get_soi(cinfo))
+ if (!get_soi(cinfo))
return JPEG_SUSPENDED;
break;
case M_SOF0: /* Baseline */
case M_SOF1: /* Extended sequential, Huffman */
- if (! get_sof(cinfo, FALSE, FALSE))
+ if (!get_sof(cinfo, FALSE, FALSE))
return JPEG_SUSPENDED;
break;
case M_SOF2: /* Progressive, Huffman */
- if (! get_sof(cinfo, TRUE, FALSE))
+ if (!get_sof(cinfo, TRUE, FALSE))
return JPEG_SUSPENDED;
break;
case M_SOF9: /* Extended sequential, arithmetic */
- if (! get_sof(cinfo, FALSE, TRUE))
+ if (!get_sof(cinfo, FALSE, TRUE))
return JPEG_SUSPENDED;
break;
case M_SOF10: /* Progressive, arithmetic */
- if (! get_sof(cinfo, TRUE, TRUE))
+ if (!get_sof(cinfo, TRUE, TRUE))
return JPEG_SUSPENDED;
break;
@@ -1026,7 +1026,7 @@ read_markers (j_decompress_ptr cinfo)
break;
case M_SOS:
- if (! get_sos(cinfo))
+ if (!get_sos(cinfo))
return JPEG_SUSPENDED;
cinfo->unread_marker = 0; /* processed the marker */
return JPEG_REACHED_SOS;
@@ -1037,22 +1037,22 @@ read_markers (j_decompress_ptr cinfo)
return JPEG_REACHED_EOI;
case M_DAC:
- if (! get_dac(cinfo))
+ if (!get_dac(cinfo))
return JPEG_SUSPENDED;
break;
case M_DHT:
- if (! get_dht(cinfo))
+ if (!get_dht(cinfo))
return JPEG_SUSPENDED;
break;
case M_DQT:
- if (! get_dqt(cinfo))
+ if (!get_dqt(cinfo))
return JPEG_SUSPENDED;
break;
case M_DRI:
- if (! get_dri(cinfo))
+ if (!get_dri(cinfo))
return JPEG_SUSPENDED;
break;
@@ -1072,13 +1072,13 @@ read_markers (j_decompress_ptr cinfo)
case M_APP13:
case M_APP14:
case M_APP15:
- if (! (*((my_marker_ptr) cinfo->marker)->process_APPn[
- cinfo->unread_marker - (int) M_APP0]) (cinfo))
+ if (!(*((my_marker_ptr)cinfo->marker)->process_APPn[
+ cinfo->unread_marker - (int)M_APP0]) (cinfo))
return JPEG_SUSPENDED;
break;
case M_COM:
- if (! (*((my_marker_ptr) cinfo->marker)->process_COM) (cinfo))
+ if (!(*((my_marker_ptr)cinfo->marker)->process_COM) (cinfo))
return JPEG_SUSPENDED;
break;
@@ -1095,7 +1095,7 @@ read_markers (j_decompress_ptr cinfo)
break;
case M_DNL: /* Ignore DNL ... perhaps the wrong thing */
- if (! skip_variable(cinfo))
+ if (!skip_variable(cinfo))
return JPEG_SUSPENDED;
break;
@@ -1127,25 +1127,25 @@ read_markers (j_decompress_ptr cinfo)
*/
METHODDEF(boolean)
-read_restart_marker (j_decompress_ptr cinfo)
+read_restart_marker(j_decompress_ptr cinfo)
{
/* Obtain a marker unless we already did. */
/* Note that next_marker will complain if it skips any data. */
if (cinfo->unread_marker == 0) {
- if (! next_marker(cinfo))
+ if (!next_marker(cinfo))
return FALSE;
}
if (cinfo->unread_marker ==
- ((int) M_RST0 + cinfo->marker->next_restart_num)) {
+ ((int)M_RST0 + cinfo->marker->next_restart_num)) {
/* Normal case --- swallow the marker and let entropy decoder continue */
TRACEMS1(cinfo, 3, JTRC_RST, cinfo->marker->next_restart_num);
cinfo->unread_marker = 0;
} else {
/* Uh-oh, the restart markers have been messed up. */
/* Let the data source manager determine how to resync. */
- if (! (*cinfo->src->resync_to_restart) (cinfo,
- cinfo->marker->next_restart_num))
+ if (!(*cinfo->src->resync_to_restart) (cinfo,
+ cinfo->marker->next_restart_num))
return FALSE;
}
@@ -1206,7 +1206,7 @@ read_restart_marker (j_decompress_ptr cinfo)
*/
GLOBAL(boolean)
-jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired)
+jpeg_resync_to_restart(j_decompress_ptr cinfo, int desired)
{
int marker = cinfo->unread_marker;
int action = 1;
@@ -1216,16 +1216,16 @@ jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired)
/* Outer loop handles repeated decision after scanning forward. */
for (;;) {
- if (marker < (int) M_SOF0)
+ if (marker < (int)M_SOF0)
action = 2; /* invalid marker */
- else if (marker < (int) M_RST0 || marker > (int) M_RST7)
+ else if (marker < (int)M_RST0 || marker > (int)M_RST7)
action = 3; /* valid non-restart marker */
else {
- if (marker == ((int) M_RST0 + ((desired+1) & 7)) ||
- marker == ((int) M_RST0 + ((desired+2) & 7)))
+ if (marker == ((int)M_RST0 + ((desired + 1) & 7)) ||
+ marker == ((int)M_RST0 + ((desired + 2) & 7)))
action = 3; /* one of the next two expected restarts */
- else if (marker == ((int) M_RST0 + ((desired-1) & 7)) ||
- marker == ((int) M_RST0 + ((desired-2) & 7)))
+ else if (marker == ((int)M_RST0 + ((desired - 1) & 7)) ||
+ marker == ((int)M_RST0 + ((desired - 2) & 7)))
action = 2; /* a prior restart, so advance */
else
action = 1; /* desired restart or too far away */
@@ -1238,7 +1238,7 @@ jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired)
return TRUE;
case 2:
/* Scan to the next marker, and repeat the decision loop. */
- if (! next_marker(cinfo))
+ if (!next_marker(cinfo))
return FALSE;
marker = cinfo->unread_marker;
break;
@@ -1256,9 +1256,9 @@ jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired)
*/
METHODDEF(void)
-reset_marker_reader (j_decompress_ptr cinfo)
+reset_marker_reader(j_decompress_ptr cinfo)
{
- my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
+ my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
cinfo->comp_info = NULL; /* until allocated by get_sof */
cinfo->input_scan_number = 0; /* no SOS seen yet */
@@ -1276,16 +1276,16 @@ reset_marker_reader (j_decompress_ptr cinfo)
*/
GLOBAL(void)
-jinit_marker_reader (j_decompress_ptr cinfo)
+jinit_marker_reader(j_decompress_ptr cinfo)
{
my_marker_ptr marker;
int i;
/* Create subobject in permanent pool */
marker = (my_marker_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
sizeof(my_marker_reader));
- cinfo->marker = (struct jpeg_marker_reader *) marker;
+ cinfo->marker = (struct jpeg_marker_reader *)marker;
/* Initialize public method pointers */
marker->pub.reset_marker_reader = reset_marker_reader;
marker->pub.read_markers = read_markers;
@@ -1314,10 +1314,10 @@ jinit_marker_reader (j_decompress_ptr cinfo)
#ifdef SAVE_MARKERS_SUPPORTED
GLOBAL(void)
-jpeg_save_markers (j_decompress_ptr cinfo, int marker_code,
- unsigned int length_limit)
+jpeg_save_markers(j_decompress_ptr cinfo, int marker_code,
+ unsigned int length_limit)
{
- my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
+ my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
long maxlength;
jpeg_marker_parser_method processor;
@@ -1325,8 +1325,8 @@ jpeg_save_markers (j_decompress_ptr cinfo, int marker_code,
* (should only be a concern in a 16-bit environment).
*/
maxlength = cinfo->mem->max_alloc_chunk - sizeof(struct jpeg_marker_struct);
- if (((long) length_limit) > maxlength)
- length_limit = (unsigned int) maxlength;
+ if (((long)length_limit) > maxlength)
+ length_limit = (unsigned int)maxlength;
/* Choose processor routine to use.
* APP0/APP14 have special requirements.
@@ -1334,23 +1334,23 @@ jpeg_save_markers (j_decompress_ptr cinfo, int marker_code,
if (length_limit) {
processor = save_marker;
/* If saving APP0/APP14, save at least enough for our internal use. */
- if (marker_code == (int) M_APP0 && length_limit < APP0_DATA_LEN)
+ if (marker_code == (int)M_APP0 && length_limit < APP0_DATA_LEN)
length_limit = APP0_DATA_LEN;
- else if (marker_code == (int) M_APP14 && length_limit < APP14_DATA_LEN)
+ else if (marker_code == (int)M_APP14 && length_limit < APP14_DATA_LEN)
length_limit = APP14_DATA_LEN;
} else {
processor = skip_variable;
/* If discarding APP0/APP14, use our regular on-the-fly processor. */
- if (marker_code == (int) M_APP0 || marker_code == (int) M_APP14)
+ if (marker_code == (int)M_APP0 || marker_code == (int)M_APP14)
processor = get_interesting_appn;
}
- if (marker_code == (int) M_COM) {
+ if (marker_code == (int)M_COM) {
marker->process_COM = processor;
marker->length_limit_COM = length_limit;
- } else if (marker_code >= (int) M_APP0 && marker_code <= (int) M_APP15) {
- marker->process_APPn[marker_code - (int) M_APP0] = processor;
- marker->length_limit_APPn[marker_code - (int) M_APP0] = length_limit;
+ } else if (marker_code >= (int)M_APP0 && marker_code <= (int)M_APP15) {
+ marker->process_APPn[marker_code - (int)M_APP0] = processor;
+ marker->length_limit_APPn[marker_code - (int)M_APP0] = length_limit;
} else
ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, marker_code);
}
@@ -1363,15 +1363,15 @@ jpeg_save_markers (j_decompress_ptr cinfo, int marker_code,
*/
GLOBAL(void)
-jpeg_set_marker_processor (j_decompress_ptr cinfo, int marker_code,
- jpeg_marker_parser_method routine)
+jpeg_set_marker_processor(j_decompress_ptr cinfo, int marker_code,
+ jpeg_marker_parser_method routine)
{
- my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
+ my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
- if (marker_code == (int) M_COM)
+ if (marker_code == (int)M_COM)
marker->process_COM = routine;
- else if (marker_code >= (int) M_APP0 && marker_code <= (int) M_APP15)
- marker->process_APPn[marker_code - (int) M_APP0] = routine;
+ else if (marker_code >= (int)M_APP0 && marker_code <= (int)M_APP15)
+ marker->process_APPn[marker_code - (int)M_APP0] = routine;
else
ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, marker_code);
}
diff --git a/src/3rdparty/libjpeg/src/jdmaster.c b/src/3rdparty/libjpeg/src/jdmaster.c
index 9079dda65c..b20906438e 100644
--- a/src/3rdparty/libjpeg/src/jdmaster.c
+++ b/src/3rdparty/libjpeg/src/jdmaster.c
@@ -31,7 +31,7 @@
*/
LOCAL(boolean)
-use_merged_upsample (j_decompress_ptr cinfo)
+use_merged_upsample(j_decompress_ptr cinfo)
{
#ifdef UPSAMPLE_MERGING_SUPPORTED
/* Merging is the equivalent of plain box-filter upsampling */
@@ -40,22 +40,22 @@ use_merged_upsample (j_decompress_ptr cinfo)
/* jdmerge.c only supports YCC=>RGB and YCC=>RGB565 color conversion */
if (cinfo->jpeg_color_space != JCS_YCbCr || cinfo->num_components != 3 ||
(cinfo->out_color_space != JCS_RGB &&
- cinfo->out_color_space != JCS_RGB565 &&
- cinfo->out_color_space != JCS_EXT_RGB &&
- cinfo->out_color_space != JCS_EXT_RGBX &&
- cinfo->out_color_space != JCS_EXT_BGR &&
- cinfo->out_color_space != JCS_EXT_BGRX &&
- cinfo->out_color_space != JCS_EXT_XBGR &&
- cinfo->out_color_space != JCS_EXT_XRGB &&
- cinfo->out_color_space != JCS_EXT_RGBA &&
- cinfo->out_color_space != JCS_EXT_BGRA &&
- cinfo->out_color_space != JCS_EXT_ABGR &&
- cinfo->out_color_space != JCS_EXT_ARGB))
+ cinfo->out_color_space != JCS_RGB565 &&
+ cinfo->out_color_space != JCS_EXT_RGB &&
+ cinfo->out_color_space != JCS_EXT_RGBX &&
+ cinfo->out_color_space != JCS_EXT_BGR &&
+ cinfo->out_color_space != JCS_EXT_BGRX &&
+ cinfo->out_color_space != JCS_EXT_XBGR &&
+ cinfo->out_color_space != JCS_EXT_XRGB &&
+ cinfo->out_color_space != JCS_EXT_RGBA &&
+ cinfo->out_color_space != JCS_EXT_BGRA &&
+ cinfo->out_color_space != JCS_EXT_ABGR &&
+ cinfo->out_color_space != JCS_EXT_ARGB))
return FALSE;
if ((cinfo->out_color_space == JCS_RGB565 &&
- cinfo->out_color_components != 3) ||
+ cinfo->out_color_components != 3) ||
(cinfo->out_color_space != JCS_RGB565 &&
- cinfo->out_color_components != rgb_pixelsize[cinfo->out_color_space]))
+ cinfo->out_color_components != rgb_pixelsize[cinfo->out_color_space]))
return FALSE;
/* and it only handles 2h1v or 2h2v sampling ratios */
if (cinfo->comp_info[0].h_samp_factor != 2 ||
@@ -100,7 +100,7 @@ GLOBAL(void)
#else
LOCAL(void)
#endif
-jpeg_core_output_dimensions (j_decompress_ptr cinfo)
+jpeg_core_output_dimensions(j_decompress_ptr cinfo)
/* Do computations that are needed before master selection phase.
* This function is used for transcoding and full decompression.
*/
@@ -113,129 +113,129 @@ jpeg_core_output_dimensions (j_decompress_ptr cinfo)
if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom) {
/* Provide 1/block_size scaling */
cinfo->output_width = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_width, (long)DCTSIZE);
cinfo->output_height = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_height, (long)DCTSIZE);
cinfo->_min_DCT_h_scaled_size = 1;
cinfo->_min_DCT_v_scaled_size = 1;
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 2) {
/* Provide 2/block_size scaling */
cinfo->output_width = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width * 2L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_width * 2L, (long)DCTSIZE);
cinfo->output_height = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height * 2L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_height * 2L, (long)DCTSIZE);
cinfo->_min_DCT_h_scaled_size = 2;
cinfo->_min_DCT_v_scaled_size = 2;
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 3) {
/* Provide 3/block_size scaling */
cinfo->output_width = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width * 3L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_width * 3L, (long)DCTSIZE);
cinfo->output_height = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height * 3L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_height * 3L, (long)DCTSIZE);
cinfo->_min_DCT_h_scaled_size = 3;
cinfo->_min_DCT_v_scaled_size = 3;
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 4) {
/* Provide 4/block_size scaling */
cinfo->output_width = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width * 4L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_width * 4L, (long)DCTSIZE);
cinfo->output_height = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height * 4L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_height * 4L, (long)DCTSIZE);
cinfo->_min_DCT_h_scaled_size = 4;
cinfo->_min_DCT_v_scaled_size = 4;
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 5) {
/* Provide 5/block_size scaling */
cinfo->output_width = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width * 5L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_width * 5L, (long)DCTSIZE);
cinfo->output_height = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height * 5L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_height * 5L, (long)DCTSIZE);
cinfo->_min_DCT_h_scaled_size = 5;
cinfo->_min_DCT_v_scaled_size = 5;
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 6) {
/* Provide 6/block_size scaling */
cinfo->output_width = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width * 6L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_width * 6L, (long)DCTSIZE);
cinfo->output_height = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height * 6L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_height * 6L, (long)DCTSIZE);
cinfo->_min_DCT_h_scaled_size = 6;
cinfo->_min_DCT_v_scaled_size = 6;
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 7) {
/* Provide 7/block_size scaling */
cinfo->output_width = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width * 7L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_width * 7L, (long)DCTSIZE);
cinfo->output_height = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height * 7L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_height * 7L, (long)DCTSIZE);
cinfo->_min_DCT_h_scaled_size = 7;
cinfo->_min_DCT_v_scaled_size = 7;
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 8) {
/* Provide 8/block_size scaling */
cinfo->output_width = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width * 8L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_width * 8L, (long)DCTSIZE);
cinfo->output_height = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height * 8L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_height * 8L, (long)DCTSIZE);
cinfo->_min_DCT_h_scaled_size = 8;
cinfo->_min_DCT_v_scaled_size = 8;
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 9) {
/* Provide 9/block_size scaling */
cinfo->output_width = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width * 9L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_width * 9L, (long)DCTSIZE);
cinfo->output_height = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height * 9L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_height * 9L, (long)DCTSIZE);
cinfo->_min_DCT_h_scaled_size = 9;
cinfo->_min_DCT_v_scaled_size = 9;
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 10) {
/* Provide 10/block_size scaling */
cinfo->output_width = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width * 10L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_width * 10L, (long)DCTSIZE);
cinfo->output_height = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height * 10L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_height * 10L, (long)DCTSIZE);
cinfo->_min_DCT_h_scaled_size = 10;
cinfo->_min_DCT_v_scaled_size = 10;
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 11) {
/* Provide 11/block_size scaling */
cinfo->output_width = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width * 11L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_width * 11L, (long)DCTSIZE);
cinfo->output_height = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height * 11L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_height * 11L, (long)DCTSIZE);
cinfo->_min_DCT_h_scaled_size = 11;
cinfo->_min_DCT_v_scaled_size = 11;
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 12) {
/* Provide 12/block_size scaling */
cinfo->output_width = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width * 12L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_width * 12L, (long)DCTSIZE);
cinfo->output_height = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height * 12L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_height * 12L, (long)DCTSIZE);
cinfo->_min_DCT_h_scaled_size = 12;
cinfo->_min_DCT_v_scaled_size = 12;
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 13) {
/* Provide 13/block_size scaling */
cinfo->output_width = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width * 13L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_width * 13L, (long)DCTSIZE);
cinfo->output_height = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height * 13L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_height * 13L, (long)DCTSIZE);
cinfo->_min_DCT_h_scaled_size = 13;
cinfo->_min_DCT_v_scaled_size = 13;
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 14) {
/* Provide 14/block_size scaling */
cinfo->output_width = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width * 14L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_width * 14L, (long)DCTSIZE);
cinfo->output_height = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height * 14L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_height * 14L, (long)DCTSIZE);
cinfo->_min_DCT_h_scaled_size = 14;
cinfo->_min_DCT_v_scaled_size = 14;
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 15) {
/* Provide 15/block_size scaling */
cinfo->output_width = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width * 15L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_width * 15L, (long)DCTSIZE);
cinfo->output_height = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height * 15L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_height * 15L, (long)DCTSIZE);
cinfo->_min_DCT_h_scaled_size = 15;
cinfo->_min_DCT_v_scaled_size = 15;
} else {
/* Provide 16/block_size scaling */
cinfo->output_width = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width * 16L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_width * 16L, (long)DCTSIZE);
cinfo->output_height = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height * 16L, (long) DCTSIZE);
+ jdiv_round_up((long)cinfo->image_height * 16L, (long)DCTSIZE);
cinfo->_min_DCT_h_scaled_size = 16;
cinfo->_min_DCT_v_scaled_size = 16;
}
@@ -268,7 +268,7 @@ jpeg_core_output_dimensions (j_decompress_ptr cinfo)
*/
GLOBAL(void)
-jpeg_calc_output_dimensions (j_decompress_ptr cinfo)
+jpeg_calc_output_dimensions(j_decompress_ptr cinfo)
/* Do computations that are needed before master selection phase */
{
#ifdef IDCT_SCALING_SUPPORTED
@@ -314,13 +314,13 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo)
ci++, compptr++) {
/* Size in samples, after IDCT scaling */
compptr->downsampled_width = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width *
- (long) (compptr->h_samp_factor * compptr->_DCT_scaled_size),
- (long) (cinfo->max_h_samp_factor * DCTSIZE));
+ jdiv_round_up((long)cinfo->image_width *
+ (long)(compptr->h_samp_factor * compptr->_DCT_scaled_size),
+ (long)(cinfo->max_h_samp_factor * DCTSIZE));
compptr->downsampled_height = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height *
- (long) (compptr->v_samp_factor * compptr->_DCT_scaled_size),
- (long) (cinfo->max_v_samp_factor * DCTSIZE));
+ jdiv_round_up((long)cinfo->image_height *
+ (long)(compptr->v_samp_factor * compptr->_DCT_scaled_size),
+ (long)(cinfo->max_v_samp_factor * DCTSIZE));
}
#else /* !IDCT_SCALING_SUPPORTED */
@@ -417,30 +417,30 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo)
*/
LOCAL(void)
-prepare_range_limit_table (j_decompress_ptr cinfo)
+prepare_range_limit_table(j_decompress_ptr cinfo)
/* Allocate and fill in the sample_range_limit table */
{
JSAMPLE *table;
int i;
table = (JSAMPLE *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (5 * (MAXJSAMPLE+1) + CENTERJSAMPLE) * sizeof(JSAMPLE));
- table += (MAXJSAMPLE+1); /* allow negative subscripts of simple table */
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
+ (5 * (MAXJSAMPLE + 1) + CENTERJSAMPLE) * sizeof(JSAMPLE));
+ table += (MAXJSAMPLE + 1); /* allow negative subscripts of simple table */
cinfo->sample_range_limit = table;
/* First segment of "simple" table: limit[x] = 0 for x < 0 */
- MEMZERO(table - (MAXJSAMPLE+1), (MAXJSAMPLE+1) * sizeof(JSAMPLE));
+ MEMZERO(table - (MAXJSAMPLE + 1), (MAXJSAMPLE + 1) * sizeof(JSAMPLE));
/* Main part of "simple" table: limit[x] = x */
for (i = 0; i <= MAXJSAMPLE; i++)
- table[i] = (JSAMPLE) i;
+ table[i] = (JSAMPLE)i;
table += CENTERJSAMPLE; /* Point to where post-IDCT table starts */
/* End of simple table, rest of first half of post-IDCT table */
- for (i = CENTERJSAMPLE; i < 2*(MAXJSAMPLE+1); i++)
+ for (i = CENTERJSAMPLE; i < 2 * (MAXJSAMPLE + 1); i++)
table[i] = MAXJSAMPLE;
/* Second half of post-IDCT table */
- MEMZERO(table + (2 * (MAXJSAMPLE+1)),
- (2 * (MAXJSAMPLE+1) - CENTERJSAMPLE) * sizeof(JSAMPLE));
- MEMCOPY(table + (4 * (MAXJSAMPLE+1) - CENTERJSAMPLE),
+ MEMZERO(table + (2 * (MAXJSAMPLE + 1)),
+ (2 * (MAXJSAMPLE + 1) - CENTERJSAMPLE) * sizeof(JSAMPLE));
+ MEMCOPY(table + (4 * (MAXJSAMPLE + 1) - CENTERJSAMPLE),
cinfo->sample_range_limit, CENTERJSAMPLE * sizeof(JSAMPLE));
}
@@ -457,9 +457,9 @@ prepare_range_limit_table (j_decompress_ptr cinfo)
*/
LOCAL(void)
-master_selection (j_decompress_ptr cinfo)
+master_selection(j_decompress_ptr cinfo)
{
- my_master_ptr master = (my_master_ptr) cinfo->master;
+ my_master_ptr master = (my_master_ptr)cinfo->master;
boolean use_c_buffer;
long samplesperrow;
JDIMENSION jd_samplesperrow;
@@ -469,9 +469,10 @@ master_selection (j_decompress_ptr cinfo)
prepare_range_limit_table(cinfo);
/* Width of an output scanline must be representable as JDIMENSION. */
- samplesperrow = (long) cinfo->output_width * (long) cinfo->out_color_components;
- jd_samplesperrow = (JDIMENSION) samplesperrow;
- if ((long) jd_samplesperrow != samplesperrow)
+ samplesperrow = (long)cinfo->output_width *
+ (long)cinfo->out_color_components;
+ jd_samplesperrow = (JDIMENSION)samplesperrow;
+ if ((long)jd_samplesperrow != samplesperrow)
ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
/* Initialize my private state */
@@ -482,7 +483,7 @@ master_selection (j_decompress_ptr cinfo)
master->quantizer_1pass = NULL;
master->quantizer_2pass = NULL;
/* No mode changes if not using buffered-image mode. */
- if (! cinfo->quantize_colors || ! cinfo->buffered_image) {
+ if (!cinfo->quantize_colors || !cinfo->buffered_image) {
cinfo->enable_1pass_quant = FALSE;
cinfo->enable_external_quant = FALSE;
cinfo->enable_2pass_quant = FALSE;
@@ -528,7 +529,7 @@ master_selection (j_decompress_ptr cinfo)
}
/* Post-processing: in particular, color conversion first */
- if (! cinfo->raw_data_out) {
+ if (!cinfo->raw_data_out) {
if (master->using_merged_upsample) {
#ifdef UPSAMPLE_MERGING_SUPPORTED
jinit_merged_upsampler(cinfo); /* does color conversion too */
@@ -565,11 +566,11 @@ master_selection (j_decompress_ptr cinfo)
use_c_buffer = cinfo->inputctl->has_multiple_scans || cinfo->buffered_image;
jinit_d_coef_controller(cinfo, use_c_buffer);
- if (! cinfo->raw_data_out)
+ if (!cinfo->raw_data_out)
jinit_d_main_controller(cinfo, FALSE /* never need full buffer here */);
/* We can now tell the memory manager to allocate virtual arrays. */
- (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
+ (*cinfo->mem->realize_virt_arrays) ((j_common_ptr)cinfo);
/* Initialize input side of decompressor to consume first scan. */
(*cinfo->inputctl->start_input_pass) (cinfo);
@@ -585,7 +586,7 @@ master_selection (j_decompress_ptr cinfo)
* progress monitoring appropriately. The input step is counted
* as one pass.
*/
- if (cinfo->progress != NULL && ! cinfo->buffered_image &&
+ if (cinfo->progress != NULL && !cinfo->buffered_image &&
cinfo->inputctl->has_multiple_scans) {
int nscans;
/* Estimate number of scans to set pass_limit. */
@@ -597,7 +598,7 @@ master_selection (j_decompress_ptr cinfo)
nscans = cinfo->num_components;
}
cinfo->progress->pass_counter = 0L;
- cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows * nscans;
+ cinfo->progress->pass_limit = (long)cinfo->total_iMCU_rows * nscans;
cinfo->progress->completed_passes = 0;
cinfo->progress->total_passes = (cinfo->enable_2pass_quant ? 3 : 2);
/* Count the input pass as done */
@@ -617,9 +618,9 @@ master_selection (j_decompress_ptr cinfo)
*/
METHODDEF(void)
-prepare_for_output_pass (j_decompress_ptr cinfo)
+prepare_for_output_pass(j_decompress_ptr cinfo)
{
- my_master_ptr master = (my_master_ptr) cinfo->master;
+ my_master_ptr master = (my_master_ptr)cinfo->master;
if (master->pub.is_dummy_pass) {
#ifdef QUANT_2PASS_SUPPORTED
@@ -645,8 +646,8 @@ prepare_for_output_pass (j_decompress_ptr cinfo)
}
(*cinfo->idct->start_pass) (cinfo);
(*cinfo->coef->start_output_pass) (cinfo);
- if (! cinfo->raw_data_out) {
- if (! master->using_merged_upsample)
+ if (!cinfo->raw_data_out) {
+ if (!master->using_merged_upsample)
(*cinfo->cconvert->start_pass) (cinfo);
(*cinfo->upsample->start_pass) (cinfo);
if (cinfo->quantize_colors)
@@ -665,7 +666,7 @@ prepare_for_output_pass (j_decompress_ptr cinfo)
/* In buffered-image mode, we assume one more output pass if EOI not
* yet reached, but no more passes if EOI has been reached.
*/
- if (cinfo->buffered_image && ! cinfo->inputctl->eoi_reached) {
+ if (cinfo->buffered_image && !cinfo->inputctl->eoi_reached) {
cinfo->progress->total_passes += (cinfo->enable_2pass_quant ? 2 : 1);
}
}
@@ -677,9 +678,9 @@ prepare_for_output_pass (j_decompress_ptr cinfo)
*/
METHODDEF(void)
-finish_output_pass (j_decompress_ptr cinfo)
+finish_output_pass(j_decompress_ptr cinfo)
{
- my_master_ptr master = (my_master_ptr) cinfo->master;
+ my_master_ptr master = (my_master_ptr)cinfo->master;
if (cinfo->quantize_colors)
(*cinfo->cquantize->finish_pass) (cinfo);
@@ -694,9 +695,9 @@ finish_output_pass (j_decompress_ptr cinfo)
*/
GLOBAL(void)
-jpeg_new_colormap (j_decompress_ptr cinfo)
+jpeg_new_colormap(j_decompress_ptr cinfo)
{
- my_master_ptr master = (my_master_ptr) cinfo->master;
+ my_master_ptr master = (my_master_ptr)cinfo->master;
/* Prevent application from calling me at wrong times */
if (cinfo->global_state != DSTATE_BUFIMAGE)
@@ -722,9 +723,9 @@ jpeg_new_colormap (j_decompress_ptr cinfo)
*/
GLOBAL(void)
-jinit_master_decompress (j_decompress_ptr cinfo)
+jinit_master_decompress(j_decompress_ptr cinfo)
{
- my_master_ptr master = (my_master_ptr) cinfo->master;
+ my_master_ptr master = (my_master_ptr)cinfo->master;
master->pub.prepare_for_output_pass = prepare_for_output_pass;
master->pub.finish_output_pass = finish_output_pass;
diff --git a/src/3rdparty/libjpeg/src/jdmerge.c b/src/3rdparty/libjpeg/src/jdmerge.c
index ca6f16c252..d67faec036 100644
--- a/src/3rdparty/libjpeg/src/jdmerge.c
+++ b/src/3rdparty/libjpeg/src/jdmerge.c
@@ -76,8 +76,8 @@ typedef struct {
typedef my_upsampler *my_upsample_ptr;
#define SCALEBITS 16 /* speediest right-shift on some machines */
-#define ONE_HALF ((JLONG) 1 << (SCALEBITS-1))
-#define FIX(x) ((JLONG) ((x) * (1L<<SCALEBITS) + 0.5))
+#define ONE_HALF ((JLONG)1 << (SCALEBITS - 1))
+#define FIX(x) ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
/* Include inline routines for colorspace extensions */
@@ -88,12 +88,12 @@ typedef my_upsampler *my_upsample_ptr;
#undef RGB_BLUE
#undef RGB_PIXELSIZE
-#define RGB_RED EXT_RGB_RED
-#define RGB_GREEN EXT_RGB_GREEN
-#define RGB_BLUE EXT_RGB_BLUE
-#define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
-#define h2v1_merged_upsample_internal extrgb_h2v1_merged_upsample_internal
-#define h2v2_merged_upsample_internal extrgb_h2v2_merged_upsample_internal
+#define RGB_RED EXT_RGB_RED
+#define RGB_GREEN EXT_RGB_GREEN
+#define RGB_BLUE EXT_RGB_BLUE
+#define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
+#define h2v1_merged_upsample_internal extrgb_h2v1_merged_upsample_internal
+#define h2v2_merged_upsample_internal extrgb_h2v2_merged_upsample_internal
#include "jdmrgext.c"
#undef RGB_RED
#undef RGB_GREEN
@@ -102,13 +102,13 @@ typedef my_upsampler *my_upsample_ptr;
#undef h2v1_merged_upsample_internal
#undef h2v2_merged_upsample_internal
-#define RGB_RED EXT_RGBX_RED
-#define RGB_GREEN EXT_RGBX_GREEN
-#define RGB_BLUE EXT_RGBX_BLUE
-#define RGB_ALPHA 3
-#define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
-#define h2v1_merged_upsample_internal extrgbx_h2v1_merged_upsample_internal
-#define h2v2_merged_upsample_internal extrgbx_h2v2_merged_upsample_internal
+#define RGB_RED EXT_RGBX_RED
+#define RGB_GREEN EXT_RGBX_GREEN
+#define RGB_BLUE EXT_RGBX_BLUE
+#define RGB_ALPHA 3
+#define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
+#define h2v1_merged_upsample_internal extrgbx_h2v1_merged_upsample_internal
+#define h2v2_merged_upsample_internal extrgbx_h2v2_merged_upsample_internal
#include "jdmrgext.c"
#undef RGB_RED
#undef RGB_GREEN
@@ -118,12 +118,12 @@ typedef my_upsampler *my_upsample_ptr;
#undef h2v1_merged_upsample_internal
#undef h2v2_merged_upsample_internal
-#define RGB_RED EXT_BGR_RED
-#define RGB_GREEN EXT_BGR_GREEN
-#define RGB_BLUE EXT_BGR_BLUE
-#define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
-#define h2v1_merged_upsample_internal extbgr_h2v1_merged_upsample_internal
-#define h2v2_merged_upsample_internal extbgr_h2v2_merged_upsample_internal
+#define RGB_RED EXT_BGR_RED
+#define RGB_GREEN EXT_BGR_GREEN
+#define RGB_BLUE EXT_BGR_BLUE
+#define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
+#define h2v1_merged_upsample_internal extbgr_h2v1_merged_upsample_internal
+#define h2v2_merged_upsample_internal extbgr_h2v2_merged_upsample_internal
#include "jdmrgext.c"
#undef RGB_RED
#undef RGB_GREEN
@@ -132,13 +132,13 @@ typedef my_upsampler *my_upsample_ptr;
#undef h2v1_merged_upsample_internal
#undef h2v2_merged_upsample_internal
-#define RGB_RED EXT_BGRX_RED
-#define RGB_GREEN EXT_BGRX_GREEN
-#define RGB_BLUE EXT_BGRX_BLUE
-#define RGB_ALPHA 3
-#define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
-#define h2v1_merged_upsample_internal extbgrx_h2v1_merged_upsample_internal
-#define h2v2_merged_upsample_internal extbgrx_h2v2_merged_upsample_internal
+#define RGB_RED EXT_BGRX_RED
+#define RGB_GREEN EXT_BGRX_GREEN
+#define RGB_BLUE EXT_BGRX_BLUE
+#define RGB_ALPHA 3
+#define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
+#define h2v1_merged_upsample_internal extbgrx_h2v1_merged_upsample_internal
+#define h2v2_merged_upsample_internal extbgrx_h2v2_merged_upsample_internal
#include "jdmrgext.c"
#undef RGB_RED
#undef RGB_GREEN
@@ -148,13 +148,13 @@ typedef my_upsampler *my_upsample_ptr;
#undef h2v1_merged_upsample_internal
#undef h2v2_merged_upsample_internal
-#define RGB_RED EXT_XBGR_RED
-#define RGB_GREEN EXT_XBGR_GREEN
-#define RGB_BLUE EXT_XBGR_BLUE
-#define RGB_ALPHA 0
-#define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
-#define h2v1_merged_upsample_internal extxbgr_h2v1_merged_upsample_internal
-#define h2v2_merged_upsample_internal extxbgr_h2v2_merged_upsample_internal
+#define RGB_RED EXT_XBGR_RED
+#define RGB_GREEN EXT_XBGR_GREEN
+#define RGB_BLUE EXT_XBGR_BLUE
+#define RGB_ALPHA 0
+#define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
+#define h2v1_merged_upsample_internal extxbgr_h2v1_merged_upsample_internal
+#define h2v2_merged_upsample_internal extxbgr_h2v2_merged_upsample_internal
#include "jdmrgext.c"
#undef RGB_RED
#undef RGB_GREEN
@@ -164,13 +164,13 @@ typedef my_upsampler *my_upsample_ptr;
#undef h2v1_merged_upsample_internal
#undef h2v2_merged_upsample_internal
-#define RGB_RED EXT_XRGB_RED
-#define RGB_GREEN EXT_XRGB_GREEN
-#define RGB_BLUE EXT_XRGB_BLUE
-#define RGB_ALPHA 0
-#define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
-#define h2v1_merged_upsample_internal extxrgb_h2v1_merged_upsample_internal
-#define h2v2_merged_upsample_internal extxrgb_h2v2_merged_upsample_internal
+#define RGB_RED EXT_XRGB_RED
+#define RGB_GREEN EXT_XRGB_GREEN
+#define RGB_BLUE EXT_XRGB_BLUE
+#define RGB_ALPHA 0
+#define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
+#define h2v1_merged_upsample_internal extxrgb_h2v1_merged_upsample_internal
+#define h2v2_merged_upsample_internal extxrgb_h2v2_merged_upsample_internal
#include "jdmrgext.c"
#undef RGB_RED
#undef RGB_GREEN
@@ -187,25 +187,25 @@ typedef my_upsampler *my_upsample_ptr;
*/
LOCAL(void)
-build_ycc_rgb_table (j_decompress_ptr cinfo)
+build_ycc_rgb_table(j_decompress_ptr cinfo)
{
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
+ my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
int i;
JLONG x;
SHIFT_TEMPS
upsample->Cr_r_tab = (int *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (MAXJSAMPLE+1) * sizeof(int));
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
+ (MAXJSAMPLE + 1) * sizeof(int));
upsample->Cb_b_tab = (int *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (MAXJSAMPLE+1) * sizeof(int));
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
+ (MAXJSAMPLE + 1) * sizeof(int));
upsample->Cr_g_tab = (JLONG *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (MAXJSAMPLE+1) * sizeof(JLONG));
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
+ (MAXJSAMPLE + 1) * sizeof(JLONG));
upsample->Cb_g_tab = (JLONG *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (MAXJSAMPLE+1) * sizeof(JLONG));
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
+ (MAXJSAMPLE + 1) * sizeof(JLONG));
for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
/* i is the actual input pixel value, in the range 0..MAXJSAMPLE */
@@ -217,10 +217,10 @@ build_ycc_rgb_table (j_decompress_ptr cinfo)
upsample->Cb_b_tab[i] = (int)
RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);
/* Cr=>G value is scaled-up -0.71414 * x */
- upsample->Cr_g_tab[i] = (- FIX(0.71414)) * x;
+ upsample->Cr_g_tab[i] = (-FIX(0.71414)) * x;
/* Cb=>G value is scaled-up -0.34414 * x */
/* We also add in ONE_HALF so that need not do it in inner loop */
- upsample->Cb_g_tab[i] = (- FIX(0.34414)) * x + ONE_HALF;
+ upsample->Cb_g_tab[i] = (-FIX(0.34414)) * x + ONE_HALF;
}
}
@@ -230,9 +230,9 @@ build_ycc_rgb_table (j_decompress_ptr cinfo)
*/
METHODDEF(void)
-start_pass_merged_upsample (j_decompress_ptr cinfo)
+start_pass_merged_upsample(j_decompress_ptr cinfo)
{
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
+ my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
/* Mark the spare buffer empty */
upsample->spare_full = FALSE;
@@ -248,14 +248,13 @@ start_pass_merged_upsample (j_decompress_ptr cinfo)
*/
METHODDEF(void)
-merged_2v_upsample (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
- JDIMENSION in_row_groups_avail,
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
- JDIMENSION out_rows_avail)
+merged_2v_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION *in_row_group_ctr,
+ JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf,
+ JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
/* 2:1 vertical sampling case: may need a spare row. */
{
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
+ my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
JSAMPROW work_ptrs[2];
JDIMENSION num_rows; /* number of rows returned to caller */
@@ -264,8 +263,8 @@ merged_2v_upsample (j_decompress_ptr cinfo,
JDIMENSION size = upsample->out_row_width;
if (cinfo->out_color_space == JCS_RGB565)
size = cinfo->output_width * 2;
- jcopy_sample_rows(& upsample->spare_row, 0, output_buf + *out_row_ctr, 0,
- 1, size);
+ jcopy_sample_rows(&upsample->spare_row, 0, output_buf + *out_row_ctr, 0, 1,
+ size);
num_rows = 1;
upsample->spare_full = FALSE;
} else {
@@ -294,20 +293,19 @@ merged_2v_upsample (j_decompress_ptr cinfo,
*out_row_ctr += num_rows;
upsample->rows_to_go -= num_rows;
/* When the buffer is emptied, declare this input row group consumed */
- if (! upsample->spare_full)
+ if (!upsample->spare_full)
(*in_row_group_ctr)++;
}
METHODDEF(void)
-merged_1v_upsample (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
- JDIMENSION in_row_groups_avail,
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
- JDIMENSION out_rows_avail)
+merged_1v_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION *in_row_group_ctr,
+ JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf,
+ JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
/* 1:1 vertical sampling case: much easier, never need a spare row. */
{
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
+ my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
/* Just do the upsampling. */
(*upsample->upmethod) (cinfo, input_buf, *in_row_group_ctr,
@@ -333,43 +331,42 @@ merged_1v_upsample (j_decompress_ptr cinfo,
*/
METHODDEF(void)
-h2v1_merged_upsample (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr,
- JSAMPARRAY output_buf)
+h2v1_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
{
switch (cinfo->out_color_space) {
- case JCS_EXT_RGB:
- extrgb_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
- output_buf);
- break;
- case JCS_EXT_RGBX:
- case JCS_EXT_RGBA:
- extrgbx_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
- output_buf);
- break;
- case JCS_EXT_BGR:
- extbgr_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
- output_buf);
- break;
- case JCS_EXT_BGRX:
- case JCS_EXT_BGRA:
- extbgrx_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
- output_buf);
- break;
- case JCS_EXT_XBGR:
- case JCS_EXT_ABGR:
- extxbgr_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
- output_buf);
- break;
- case JCS_EXT_XRGB:
- case JCS_EXT_ARGB:
- extxrgb_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
- output_buf);
- break;
- default:
- h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
- output_buf);
- break;
+ case JCS_EXT_RGB:
+ extrgb_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
+ case JCS_EXT_RGBX:
+ case JCS_EXT_RGBA:
+ extrgbx_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
+ case JCS_EXT_BGR:
+ extbgr_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
+ case JCS_EXT_BGRX:
+ case JCS_EXT_BGRA:
+ extbgrx_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
+ case JCS_EXT_XBGR:
+ case JCS_EXT_ABGR:
+ extxbgr_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
+ case JCS_EXT_XRGB:
+ case JCS_EXT_ARGB:
+ extxrgb_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
+ default:
+ h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
}
}
@@ -379,43 +376,42 @@ h2v1_merged_upsample (j_decompress_ptr cinfo,
*/
METHODDEF(void)
-h2v2_merged_upsample (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr,
- JSAMPARRAY output_buf)
+h2v2_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
{
switch (cinfo->out_color_space) {
- case JCS_EXT_RGB:
- extrgb_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
- output_buf);
- break;
- case JCS_EXT_RGBX:
- case JCS_EXT_RGBA:
- extrgbx_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
- output_buf);
- break;
- case JCS_EXT_BGR:
- extbgr_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
- output_buf);
- break;
- case JCS_EXT_BGRX:
- case JCS_EXT_BGRA:
- extbgrx_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
- output_buf);
- break;
- case JCS_EXT_XBGR:
- case JCS_EXT_ABGR:
- extxbgr_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
- output_buf);
- break;
- case JCS_EXT_XRGB:
- case JCS_EXT_ARGB:
- extxrgb_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
- output_buf);
- break;
- default:
- h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
- output_buf);
- break;
+ case JCS_EXT_RGB:
+ extrgb_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
+ case JCS_EXT_RGBX:
+ case JCS_EXT_RGBA:
+ extrgbx_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
+ case JCS_EXT_BGR:
+ extbgr_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
+ case JCS_EXT_BGRX:
+ case JCS_EXT_BGRA:
+ extbgrx_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
+ case JCS_EXT_XBGR:
+ case JCS_EXT_ABGR:
+ extxbgr_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
+ case JCS_EXT_XRGB:
+ case JCS_EXT_ARGB:
+ extxrgb_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
+ default:
+ h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
}
}
@@ -424,24 +420,24 @@ h2v2_merged_upsample (j_decompress_ptr cinfo,
* RGB565 conversion
*/
-#define PACK_SHORT_565_LE(r, g, b) ((((r) << 8) & 0xF800) | \
- (((g) << 3) & 0x7E0) | ((b) >> 3))
-#define PACK_SHORT_565_BE(r, g, b) (((r) & 0xF8) | ((g) >> 5) | \
- (((g) << 11) & 0xE000) | \
- (((b) << 5) & 0x1F00))
+#define PACK_SHORT_565_LE(r, g, b) ((((r) << 8) & 0xF800) | \
+ (((g) << 3) & 0x7E0) | ((b) >> 3))
+#define PACK_SHORT_565_BE(r, g, b) (((r) & 0xF8) | ((g) >> 5) | \
+ (((g) << 11) & 0xE000) | \
+ (((b) << 5) & 0x1F00))
-#define PACK_TWO_PIXELS_LE(l, r) ((r << 16) | l)
-#define PACK_TWO_PIXELS_BE(l, r) ((l << 16) | r)
+#define PACK_TWO_PIXELS_LE(l, r) ((r << 16) | l)
+#define PACK_TWO_PIXELS_BE(l, r) ((l << 16) | r)
-#define PACK_NEED_ALIGNMENT(ptr) (((size_t)(ptr)) & 3)
+#define PACK_NEED_ALIGNMENT(ptr) (((size_t)(ptr)) & 3)
-#define WRITE_TWO_PIXELS_LE(addr, pixels) { \
- ((INT16*)(addr))[0] = (INT16)(pixels); \
- ((INT16*)(addr))[1] = (INT16)((pixels) >> 16); \
+#define WRITE_TWO_PIXELS_LE(addr, pixels) { \
+ ((INT16 *)(addr))[0] = (INT16)(pixels); \
+ ((INT16 *)(addr))[1] = (INT16)((pixels) >> 16); \
}
-#define WRITE_TWO_PIXELS_BE(addr, pixels) { \
- ((INT16*)(addr))[1] = (INT16)(pixels); \
- ((INT16*)(addr))[0] = (INT16)((pixels) >> 16); \
+#define WRITE_TWO_PIXELS_BE(addr, pixels) { \
+ ((INT16 *)(addr))[1] = (INT16)(pixels); \
+ ((INT16 *)(addr))[0] = (INT16)((pixels) >> 16); \
}
#define DITHER_565_R(r, dither) ((r) + ((dither) & 0xFF))
@@ -467,13 +463,13 @@ static const JLONG dither_matrix[4] = {
/* Include inline routines for RGB565 conversion */
-#define PACK_SHORT_565 PACK_SHORT_565_LE
-#define PACK_TWO_PIXELS PACK_TWO_PIXELS_LE
-#define WRITE_TWO_PIXELS WRITE_TWO_PIXELS_LE
-#define h2v1_merged_upsample_565_internal h2v1_merged_upsample_565_le
-#define h2v1_merged_upsample_565D_internal h2v1_merged_upsample_565D_le
-#define h2v2_merged_upsample_565_internal h2v2_merged_upsample_565_le
-#define h2v2_merged_upsample_565D_internal h2v2_merged_upsample_565D_le
+#define PACK_SHORT_565 PACK_SHORT_565_LE
+#define PACK_TWO_PIXELS PACK_TWO_PIXELS_LE
+#define WRITE_TWO_PIXELS WRITE_TWO_PIXELS_LE
+#define h2v1_merged_upsample_565_internal h2v1_merged_upsample_565_le
+#define h2v1_merged_upsample_565D_internal h2v1_merged_upsample_565D_le
+#define h2v2_merged_upsample_565_internal h2v2_merged_upsample_565_le
+#define h2v2_merged_upsample_565D_internal h2v2_merged_upsample_565D_le
#include "jdmrg565.c"
#undef PACK_SHORT_565
#undef PACK_TWO_PIXELS
@@ -483,13 +479,13 @@ static const JLONG dither_matrix[4] = {
#undef h2v2_merged_upsample_565_internal
#undef h2v2_merged_upsample_565D_internal
-#define PACK_SHORT_565 PACK_SHORT_565_BE
-#define PACK_TWO_PIXELS PACK_TWO_PIXELS_BE
-#define WRITE_TWO_PIXELS WRITE_TWO_PIXELS_BE
-#define h2v1_merged_upsample_565_internal h2v1_merged_upsample_565_be
-#define h2v1_merged_upsample_565D_internal h2v1_merged_upsample_565D_be
-#define h2v2_merged_upsample_565_internal h2v2_merged_upsample_565_be
-#define h2v2_merged_upsample_565D_internal h2v2_merged_upsample_565D_be
+#define PACK_SHORT_565 PACK_SHORT_565_BE
+#define PACK_TWO_PIXELS PACK_TWO_PIXELS_BE
+#define WRITE_TWO_PIXELS WRITE_TWO_PIXELS_BE
+#define h2v1_merged_upsample_565_internal h2v1_merged_upsample_565_be
+#define h2v1_merged_upsample_565D_internal h2v1_merged_upsample_565D_be
+#define h2v2_merged_upsample_565_internal h2v2_merged_upsample_565_be
+#define h2v2_merged_upsample_565D_internal h2v2_merged_upsample_565D_be
#include "jdmrg565.c"
#undef PACK_SHORT_565
#undef PACK_TWO_PIXELS
@@ -510,9 +506,8 @@ static INLINE boolean is_big_endian(void)
METHODDEF(void)
-h2v1_merged_upsample_565 (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr,
- JSAMPARRAY output_buf)
+h2v1_merged_upsample_565(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
{
if (is_big_endian())
h2v1_merged_upsample_565_be(cinfo, input_buf, in_row_group_ctr,
@@ -520,13 +515,12 @@ h2v1_merged_upsample_565 (j_decompress_ptr cinfo,
else
h2v1_merged_upsample_565_le(cinfo, input_buf, in_row_group_ctr,
output_buf);
- }
+}
METHODDEF(void)
-h2v1_merged_upsample_565D (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr,
- JSAMPARRAY output_buf)
+h2v1_merged_upsample_565D(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
{
if (is_big_endian())
h2v1_merged_upsample_565D_be(cinfo, input_buf, in_row_group_ctr,
@@ -538,9 +532,8 @@ h2v1_merged_upsample_565D (j_decompress_ptr cinfo,
METHODDEF(void)
-h2v2_merged_upsample_565 (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr,
- JSAMPARRAY output_buf)
+h2v2_merged_upsample_565(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
{
if (is_big_endian())
h2v2_merged_upsample_565_be(cinfo, input_buf, in_row_group_ctr,
@@ -552,9 +545,8 @@ h2v2_merged_upsample_565 (j_decompress_ptr cinfo,
METHODDEF(void)
-h2v2_merged_upsample_565D (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr,
- JSAMPARRAY output_buf)
+h2v2_merged_upsample_565D(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
{
if (is_big_endian())
h2v2_merged_upsample_565D_be(cinfo, input_buf, in_row_group_ctr,
@@ -574,14 +566,14 @@ h2v2_merged_upsample_565D (j_decompress_ptr cinfo,
*/
GLOBAL(void)
-jinit_merged_upsampler (j_decompress_ptr cinfo)
+jinit_merged_upsampler(j_decompress_ptr cinfo)
{
my_upsample_ptr upsample;
upsample = (my_upsample_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(my_upsampler));
- cinfo->upsample = (struct jpeg_upsampler *) upsample;
+ cinfo->upsample = (struct jpeg_upsampler *)upsample;
upsample->pub.start_pass = start_pass_merged_upsample;
upsample->pub.need_context_rows = FALSE;
@@ -602,8 +594,8 @@ jinit_merged_upsampler (j_decompress_ptr cinfo)
}
/* Allocate a spare row buffer */
upsample->spare_row = (JSAMPROW)
- (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (size_t) (upsample->out_row_width * sizeof(JSAMPLE)));
+ (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
+ (size_t)(upsample->out_row_width * sizeof(JSAMPLE)));
} else {
upsample->pub.upsample = merged_1v_upsample;
if (jsimd_can_h2v1_merged_upsample())
diff --git a/src/3rdparty/libjpeg/src/jdmrg565.c b/src/3rdparty/libjpeg/src/jdmrg565.c
index 18287b3735..1b87e3718d 100644
--- a/src/3rdparty/libjpeg/src/jdmrg565.c
+++ b/src/3rdparty/libjpeg/src/jdmrg565.c
@@ -5,7 +5,7 @@
* Copyright (C) 1994-1996, Thomas G. Lane.
* libjpeg-turbo Modifications:
* Copyright (C) 2013, Linaro Limited.
- * Copyright (C) 2014-2015, D. R. Commander.
+ * Copyright (C) 2014-2015, 2018, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@@ -15,23 +15,22 @@
INLINE
LOCAL(void)
-h2v1_merged_upsample_565_internal (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf,
- JDIMENSION in_row_group_ctr,
- JSAMPARRAY output_buf)
+h2v1_merged_upsample_565_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION in_row_group_ctr,
+ JSAMPARRAY output_buf)
{
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
+ my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
register int y, cred, cgreen, cblue;
int cb, cr;
register JSAMPROW outptr;
JSAMPROW inptr0, inptr1, inptr2;
JDIMENSION col;
/* copy these pointers into registers if possible */
- register JSAMPLE * range_limit = cinfo->sample_range_limit;
- int * Crrtab = upsample->Cr_r_tab;
- int * Cbbtab = upsample->Cb_b_tab;
- JLONG * Crgtab = upsample->Cr_g_tab;
- JLONG * Cbgtab = upsample->Cb_g_tab;
+ register JSAMPLE *range_limit = cinfo->sample_range_limit;
+ int *Crrtab = upsample->Cr_r_tab;
+ int *Cbbtab = upsample->Cb_b_tab;
+ JLONG *Crgtab = upsample->Cr_g_tab;
+ JLONG *Cbgtab = upsample->Cb_g_tab;
unsigned int r, g, b;
JLONG rgb;
SHIFT_TEMPS
@@ -47,7 +46,7 @@ h2v1_merged_upsample_565_internal (j_decompress_ptr cinfo,
cb = GETJSAMPLE(*inptr1++);
cr = GETJSAMPLE(*inptr2++);
cred = Crrtab[cr];
- cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
+ cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
/* Fetch 2 Y values and emit 2 pixels */
@@ -72,37 +71,37 @@ h2v1_merged_upsample_565_internal (j_decompress_ptr cinfo,
cb = GETJSAMPLE(*inptr1);
cr = GETJSAMPLE(*inptr2);
cred = Crrtab[cr];
- cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
+ cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
y = GETJSAMPLE(*inptr0);
r = range_limit[y + cred];
g = range_limit[y + cgreen];
b = range_limit[y + cblue];
rgb = PACK_SHORT_565(r, g, b);
- *(INT16*)outptr = (INT16)rgb;
- }
- }
+ *(INT16 *)outptr = (INT16)rgb;
+ }
+}
INLINE
LOCAL(void)
-h2v1_merged_upsample_565D_internal (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf,
- JDIMENSION in_row_group_ctr,
- JSAMPARRAY output_buf)
+h2v1_merged_upsample_565D_internal(j_decompress_ptr cinfo,
+ JSAMPIMAGE input_buf,
+ JDIMENSION in_row_group_ctr,
+ JSAMPARRAY output_buf)
{
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
+ my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
register int y, cred, cgreen, cblue;
int cb, cr;
register JSAMPROW outptr;
JSAMPROW inptr0, inptr1, inptr2;
JDIMENSION col;
/* copy these pointers into registers if possible */
- register JSAMPLE * range_limit = cinfo->sample_range_limit;
- int * Crrtab = upsample->Cr_r_tab;
- int * Cbbtab = upsample->Cb_b_tab;
- JLONG * Crgtab = upsample->Cr_g_tab;
- JLONG * Cbgtab = upsample->Cb_g_tab;
+ register JSAMPLE *range_limit = cinfo->sample_range_limit;
+ int *Crrtab = upsample->Cr_r_tab;
+ int *Cbbtab = upsample->Cb_b_tab;
+ JLONG *Crgtab = upsample->Cr_g_tab;
+ JLONG *Cbgtab = upsample->Cb_g_tab;
JLONG d0 = dither_matrix[cinfo->output_scanline & DITHER_MASK];
unsigned int r, g, b;
JLONG rgb;
@@ -119,7 +118,7 @@ h2v1_merged_upsample_565D_internal (j_decompress_ptr cinfo,
cb = GETJSAMPLE(*inptr1++);
cr = GETJSAMPLE(*inptr2++);
cred = Crrtab[cr];
- cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
+ cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
/* Fetch 2 Y values and emit 2 pixels */
@@ -146,37 +145,36 @@ h2v1_merged_upsample_565D_internal (j_decompress_ptr cinfo,
cb = GETJSAMPLE(*inptr1);
cr = GETJSAMPLE(*inptr2);
cred = Crrtab[cr];
- cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
+ cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
y = GETJSAMPLE(*inptr0);
r = range_limit[DITHER_565_R(y + cred, d0)];
g = range_limit[DITHER_565_G(y + cgreen, d0)];
b = range_limit[DITHER_565_B(y + cblue, d0)];
rgb = PACK_SHORT_565(r, g, b);
- *(INT16*)outptr = (INT16)rgb;
+ *(INT16 *)outptr = (INT16)rgb;
}
}
INLINE
LOCAL(void)
-h2v2_merged_upsample_565_internal (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf,
- JDIMENSION in_row_group_ctr,
- JSAMPARRAY output_buf)
+h2v2_merged_upsample_565_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION in_row_group_ctr,
+ JSAMPARRAY output_buf)
{
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
+ my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
register int y, cred, cgreen, cblue;
int cb, cr;
register JSAMPROW outptr0, outptr1;
JSAMPROW inptr00, inptr01, inptr1, inptr2;
JDIMENSION col;
/* copy these pointers into registers if possible */
- register JSAMPLE * range_limit = cinfo->sample_range_limit;
- int * Crrtab = upsample->Cr_r_tab;
- int * Cbbtab = upsample->Cb_b_tab;
- JLONG * Crgtab = upsample->Cr_g_tab;
- JLONG * Cbgtab = upsample->Cb_g_tab;
+ register JSAMPLE *range_limit = cinfo->sample_range_limit;
+ int *Crrtab = upsample->Cr_r_tab;
+ int *Cbbtab = upsample->Cb_b_tab;
+ JLONG *Crgtab = upsample->Cr_g_tab;
+ JLONG *Cbgtab = upsample->Cb_g_tab;
unsigned int r, g, b;
JLONG rgb;
SHIFT_TEMPS
@@ -194,7 +192,7 @@ h2v2_merged_upsample_565_internal (j_decompress_ptr cinfo,
cb = GETJSAMPLE(*inptr1++);
cr = GETJSAMPLE(*inptr2++);
cred = Crrtab[cr];
- cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
+ cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
/* Fetch 4 Y values and emit 4 pixels */
@@ -234,7 +232,7 @@ h2v2_merged_upsample_565_internal (j_decompress_ptr cinfo,
cb = GETJSAMPLE(*inptr1);
cr = GETJSAMPLE(*inptr2);
cred = Crrtab[cr];
- cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
+ cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
y = GETJSAMPLE(*inptr00);
@@ -242,45 +240,45 @@ h2v2_merged_upsample_565_internal (j_decompress_ptr cinfo,
g = range_limit[y + cgreen];
b = range_limit[y + cblue];
rgb = PACK_SHORT_565(r, g, b);
- *(INT16*)outptr0 = (INT16)rgb;
+ *(INT16 *)outptr0 = (INT16)rgb;
y = GETJSAMPLE(*inptr01);
r = range_limit[y + cred];
g = range_limit[y + cgreen];
b = range_limit[y + cblue];
rgb = PACK_SHORT_565(r, g, b);
- *(INT16*)outptr1 = (INT16)rgb;
+ *(INT16 *)outptr1 = (INT16)rgb;
}
}
INLINE
LOCAL(void)
-h2v2_merged_upsample_565D_internal (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf,
- JDIMENSION in_row_group_ctr,
- JSAMPARRAY output_buf)
+h2v2_merged_upsample_565D_internal(j_decompress_ptr cinfo,
+ JSAMPIMAGE input_buf,
+ JDIMENSION in_row_group_ctr,
+ JSAMPARRAY output_buf)
{
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
+ my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
register int y, cred, cgreen, cblue;
int cb, cr;
register JSAMPROW outptr0, outptr1;
JSAMPROW inptr00, inptr01, inptr1, inptr2;
JDIMENSION col;
/* copy these pointers into registers if possible */
- register JSAMPLE * range_limit = cinfo->sample_range_limit;
- int * Crrtab = upsample->Cr_r_tab;
- int * Cbbtab = upsample->Cb_b_tab;
- JLONG * Crgtab = upsample->Cr_g_tab;
- JLONG * Cbgtab = upsample->Cb_g_tab;
+ register JSAMPLE *range_limit = cinfo->sample_range_limit;
+ int *Crrtab = upsample->Cr_r_tab;
+ int *Cbbtab = upsample->Cb_b_tab;
+ JLONG *Crgtab = upsample->Cr_g_tab;
+ JLONG *Cbgtab = upsample->Cb_g_tab;
JLONG d0 = dither_matrix[cinfo->output_scanline & DITHER_MASK];
- JLONG d1 = dither_matrix[(cinfo->output_scanline+1) & DITHER_MASK];
+ JLONG d1 = dither_matrix[(cinfo->output_scanline + 1) & DITHER_MASK];
unsigned int r, g, b;
JLONG rgb;
SHIFT_TEMPS
- inptr00 = input_buf[0][in_row_group_ctr*2];
- inptr01 = input_buf[0][in_row_group_ctr*2 + 1];
+ inptr00 = input_buf[0][in_row_group_ctr * 2];
+ inptr01 = input_buf[0][in_row_group_ctr * 2 + 1];
inptr1 = input_buf[1][in_row_group_ctr];
inptr2 = input_buf[2][in_row_group_ctr];
outptr0 = output_buf[0];
@@ -292,7 +290,7 @@ h2v2_merged_upsample_565D_internal (j_decompress_ptr cinfo,
cb = GETJSAMPLE(*inptr1++);
cr = GETJSAMPLE(*inptr2++);
cred = Crrtab[cr];
- cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
+ cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
/* Fetch 4 Y values and emit 4 pixels */
@@ -304,20 +302,20 @@ h2v2_merged_upsample_565D_internal (j_decompress_ptr cinfo,
rgb = PACK_SHORT_565(r, g, b);
y = GETJSAMPLE(*inptr00++);
- r = range_limit[DITHER_565_R(y + cred, d1)];
- g = range_limit[DITHER_565_G(y + cgreen, d1)];
- b = range_limit[DITHER_565_B(y + cblue, d1)];
- d1 = DITHER_ROTATE(d1);
+ r = range_limit[DITHER_565_R(y + cred, d0)];
+ g = range_limit[DITHER_565_G(y + cgreen, d0)];
+ b = range_limit[DITHER_565_B(y + cblue, d0)];
+ d0 = DITHER_ROTATE(d0);
rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b));
WRITE_TWO_PIXELS(outptr0, rgb);
outptr0 += 4;
y = GETJSAMPLE(*inptr01++);
- r = range_limit[DITHER_565_R(y + cred, d0)];
- g = range_limit[DITHER_565_G(y + cgreen, d0)];
- b = range_limit[DITHER_565_B(y + cblue, d0)];
- d0 = DITHER_ROTATE(d0);
+ r = range_limit[DITHER_565_R(y + cred, d1)];
+ g = range_limit[DITHER_565_G(y + cgreen, d1)];
+ b = range_limit[DITHER_565_B(y + cblue, d1)];
+ d1 = DITHER_ROTATE(d1);
rgb = PACK_SHORT_565(r, g, b);
y = GETJSAMPLE(*inptr01++);
@@ -336,7 +334,7 @@ h2v2_merged_upsample_565D_internal (j_decompress_ptr cinfo,
cb = GETJSAMPLE(*inptr1);
cr = GETJSAMPLE(*inptr2);
cred = Crrtab[cr];
- cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
+ cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
y = GETJSAMPLE(*inptr00);
@@ -344,13 +342,13 @@ h2v2_merged_upsample_565D_internal (j_decompress_ptr cinfo,
g = range_limit[DITHER_565_G(y + cgreen, d0)];
b = range_limit[DITHER_565_B(y + cblue, d0)];
rgb = PACK_SHORT_565(r, g, b);
- *(INT16*)outptr0 = (INT16)rgb;
+ *(INT16 *)outptr0 = (INT16)rgb;
y = GETJSAMPLE(*inptr01);
r = range_limit[DITHER_565_R(y + cred, d1)];
g = range_limit[DITHER_565_G(y + cgreen, d1)];
b = range_limit[DITHER_565_B(y + cblue, d1)];
rgb = PACK_SHORT_565(r, g, b);
- *(INT16*)outptr1 = (INT16)rgb;
+ *(INT16 *)outptr1 = (INT16)rgb;
}
}
diff --git a/src/3rdparty/libjpeg/src/jdmrgext.c b/src/3rdparty/libjpeg/src/jdmrgext.c
index 9d7d2af2e9..b1c27df56a 100644
--- a/src/3rdparty/libjpeg/src/jdmrgext.c
+++ b/src/3rdparty/libjpeg/src/jdmrgext.c
@@ -21,23 +21,22 @@
INLINE
LOCAL(void)
-h2v1_merged_upsample_internal (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf,
- JDIMENSION in_row_group_ctr,
- JSAMPARRAY output_buf)
+h2v1_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION in_row_group_ctr,
+ JSAMPARRAY output_buf)
{
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
+ my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
register int y, cred, cgreen, cblue;
int cb, cr;
register JSAMPROW outptr;
JSAMPROW inptr0, inptr1, inptr2;
JDIMENSION col;
/* copy these pointers into registers if possible */
- register JSAMPLE * range_limit = cinfo->sample_range_limit;
- int * Crrtab = upsample->Cr_r_tab;
- int * Cbbtab = upsample->Cb_b_tab;
- JLONG * Crgtab = upsample->Cr_g_tab;
- JLONG * Cbgtab = upsample->Cb_g_tab;
+ register JSAMPLE *range_limit = cinfo->sample_range_limit;
+ int *Crrtab = upsample->Cr_r_tab;
+ int *Cbbtab = upsample->Cb_b_tab;
+ JLONG *Crgtab = upsample->Cr_g_tab;
+ JLONG *Cbgtab = upsample->Cb_g_tab;
SHIFT_TEMPS
inptr0 = input_buf[0][in_row_group_ctr];
@@ -50,7 +49,7 @@ h2v1_merged_upsample_internal (j_decompress_ptr cinfo,
cb = GETJSAMPLE(*inptr1++);
cr = GETJSAMPLE(*inptr2++);
cred = Crrtab[cr];
- cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
+ cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
/* Fetch 2 Y values and emit 2 pixels */
y = GETJSAMPLE(*inptr0++);
@@ -75,7 +74,7 @@ h2v1_merged_upsample_internal (j_decompress_ptr cinfo,
cb = GETJSAMPLE(*inptr1);
cr = GETJSAMPLE(*inptr2);
cred = Crrtab[cr];
- cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
+ cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
y = GETJSAMPLE(*inptr0);
outptr[RGB_RED] = range_limit[y + cred];
@@ -94,27 +93,26 @@ h2v1_merged_upsample_internal (j_decompress_ptr cinfo,
INLINE
LOCAL(void)
-h2v2_merged_upsample_internal (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf,
- JDIMENSION in_row_group_ctr,
- JSAMPARRAY output_buf)
+h2v2_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION in_row_group_ctr,
+ JSAMPARRAY output_buf)
{
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
+ my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
register int y, cred, cgreen, cblue;
int cb, cr;
register JSAMPROW outptr0, outptr1;
JSAMPROW inptr00, inptr01, inptr1, inptr2;
JDIMENSION col;
/* copy these pointers into registers if possible */
- register JSAMPLE * range_limit = cinfo->sample_range_limit;
- int * Crrtab = upsample->Cr_r_tab;
- int * Cbbtab = upsample->Cb_b_tab;
- JLONG * Crgtab = upsample->Cr_g_tab;
- JLONG * Cbgtab = upsample->Cb_g_tab;
+ register JSAMPLE *range_limit = cinfo->sample_range_limit;
+ int *Crrtab = upsample->Cr_r_tab;
+ int *Cbbtab = upsample->Cb_b_tab;
+ JLONG *Crgtab = upsample->Cr_g_tab;
+ JLONG *Cbgtab = upsample->Cb_g_tab;
SHIFT_TEMPS
- inptr00 = input_buf[0][in_row_group_ctr*2];
- inptr01 = input_buf[0][in_row_group_ctr*2 + 1];
+ inptr00 = input_buf[0][in_row_group_ctr * 2];
+ inptr01 = input_buf[0][in_row_group_ctr * 2 + 1];
inptr1 = input_buf[1][in_row_group_ctr];
inptr2 = input_buf[2][in_row_group_ctr];
outptr0 = output_buf[0];
@@ -125,7 +123,7 @@ h2v2_merged_upsample_internal (j_decompress_ptr cinfo,
cb = GETJSAMPLE(*inptr1++);
cr = GETJSAMPLE(*inptr2++);
cred = Crrtab[cr];
- cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
+ cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
/* Fetch 4 Y values and emit 4 pixels */
y = GETJSAMPLE(*inptr00++);
@@ -166,7 +164,7 @@ h2v2_merged_upsample_internal (j_decompress_ptr cinfo,
cb = GETJSAMPLE(*inptr1);
cr = GETJSAMPLE(*inptr2);
cred = Crrtab[cr];
- cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
+ cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
y = GETJSAMPLE(*inptr00);
outptr0[RGB_RED] = range_limit[y + cred];
diff --git a/src/3rdparty/libjpeg/src/jdphuff.c b/src/3rdparty/libjpeg/src/jdphuff.c
index c927ffa071..9e82636bbd 100644
--- a/src/3rdparty/libjpeg/src/jdphuff.c
+++ b/src/3rdparty/libjpeg/src/jdphuff.c
@@ -4,7 +4,7 @@
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1995-1997, Thomas G. Lane.
* libjpeg-turbo Modifications:
- * Copyright (C) 2015-2016, D. R. Commander.
+ * Copyright (C) 2015-2016, 2018, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@@ -15,12 +15,16 @@
* up to the start of the current MCU. To do this, we copy state variables
* into local working storage, and update them back to the permanent
* storage only upon successful completion of an MCU.
+ *
+ * NOTE: All referenced figures are from
+ * Recommendation ITU-T T.81 (1992) | ISO/IEC 10918-1:1994.
*/
#define JPEG_INTERNALS
#include "jinclude.h"
#include "jpeglib.h"
#include "jdhuff.h" /* Declarations shared with jdhuff.c */
+#include <limits.h>
#ifdef D_PROGRESSIVE_SUPPORTED
@@ -43,15 +47,15 @@ typedef struct {
*/
#ifndef NO_STRUCT_ASSIGN
-#define ASSIGN_STATE(dest,src) ((dest) = (src))
+#define ASSIGN_STATE(dest, src) ((dest) = (src))
#else
#if MAX_COMPS_IN_SCAN == 4
-#define ASSIGN_STATE(dest,src) \
- ((dest).EOBRUN = (src).EOBRUN, \
- (dest).last_dc_val[0] = (src).last_dc_val[0], \
- (dest).last_dc_val[1] = (src).last_dc_val[1], \
- (dest).last_dc_val[2] = (src).last_dc_val[2], \
- (dest).last_dc_val[3] = (src).last_dc_val[3])
+#define ASSIGN_STATE(dest, src) \
+ ((dest).EOBRUN = (src).EOBRUN, \
+ (dest).last_dc_val[0] = (src).last_dc_val[0], \
+ (dest).last_dc_val[1] = (src).last_dc_val[1], \
+ (dest).last_dc_val[2] = (src).last_dc_val[2], \
+ (dest).last_dc_val[3] = (src).last_dc_val[3])
#endif
#endif
@@ -77,14 +81,14 @@ typedef struct {
typedef phuff_entropy_decoder *phuff_entropy_ptr;
/* Forward declarations */
-METHODDEF(boolean) decode_mcu_DC_first (j_decompress_ptr cinfo,
+METHODDEF(boolean) decode_mcu_DC_first(j_decompress_ptr cinfo,
+ JBLOCKROW *MCU_data);
+METHODDEF(boolean) decode_mcu_AC_first(j_decompress_ptr cinfo,
+ JBLOCKROW *MCU_data);
+METHODDEF(boolean) decode_mcu_DC_refine(j_decompress_ptr cinfo,
JBLOCKROW *MCU_data);
-METHODDEF(boolean) decode_mcu_AC_first (j_decompress_ptr cinfo,
+METHODDEF(boolean) decode_mcu_AC_refine(j_decompress_ptr cinfo,
JBLOCKROW *MCU_data);
-METHODDEF(boolean) decode_mcu_DC_refine (j_decompress_ptr cinfo,
- JBLOCKROW *MCU_data);
-METHODDEF(boolean) decode_mcu_AC_refine (j_decompress_ptr cinfo,
- JBLOCKROW *MCU_data);
/*
@@ -92,9 +96,9 @@ METHODDEF(boolean) decode_mcu_AC_refine (j_decompress_ptr cinfo,
*/
METHODDEF(void)
-start_pass_phuff_decoder (j_decompress_ptr cinfo)
+start_pass_phuff_decoder(j_decompress_ptr cinfo)
{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
+ phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
boolean is_DC_band, bad;
int ci, coefi, tbl;
d_derived_tbl **pdtbl;
@@ -118,7 +122,7 @@ start_pass_phuff_decoder (j_decompress_ptr cinfo)
}
if (cinfo->Ah != 0) {
/* Successive approximation refinement scan: must have Al = Ah-1. */
- if (cinfo->Al != cinfo->Ah-1)
+ if (cinfo->Al != cinfo->Ah - 1)
bad = TRUE;
}
if (cinfo->Al > 13) /* need not check for < 0 */
@@ -138,7 +142,7 @@ start_pass_phuff_decoder (j_decompress_ptr cinfo)
*/
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
int cindex = cinfo->cur_comp_info[ci]->component_index;
- coef_bit_ptr = & cinfo->coef_bits[cindex][0];
+ coef_bit_ptr = &cinfo->coef_bits[cindex][0];
if (!is_DC_band && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
@@ -205,22 +209,26 @@ start_pass_phuff_decoder (j_decompress_ptr cinfo)
#define AVOID_TABLES
#ifdef AVOID_TABLES
-#define NEG_1 ((unsigned)-1)
-#define HUFF_EXTEND(x,s) ((x) < (1<<((s)-1)) ? (x) + (((NEG_1)<<(s)) + 1) : (x))
+#define NEG_1 ((unsigned)-1)
+#define HUFF_EXTEND(x, s) \
+ ((x) < (1 << ((s) - 1)) ? (x) + (((NEG_1) << (s)) + 1) : (x))
#else
-#define HUFF_EXTEND(x,s) ((x) < extend_test[s] ? (x) + extend_offset[s] : (x))
+#define HUFF_EXTEND(x, s) \
+ ((x) < extend_test[s] ? (x) + extend_offset[s] : (x))
-static const int extend_test[16] = /* entry n is 2**(n-1) */
- { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
- 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 };
+static const int extend_test[16] = { /* entry n is 2**(n-1) */
+ 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
+ 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000
+};
-static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */
- { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1,
- ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1,
- ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1,
- ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
+static const int extend_offset[16] = { /* entry n is (-1 << n) + 1 */
+ 0, ((-1) << 1) + 1, ((-1) << 2) + 1, ((-1) << 3) + 1, ((-1) << 4) + 1,
+ ((-1) << 5) + 1, ((-1) << 6) + 1, ((-1) << 7) + 1, ((-1) << 8) + 1,
+ ((-1) << 9) + 1, ((-1) << 10) + 1, ((-1) << 11) + 1, ((-1) << 12) + 1,
+ ((-1) << 13) + 1, ((-1) << 14) + 1, ((-1) << 15) + 1
+};
#endif /* AVOID_TABLES */
@@ -231,9 +239,9 @@ static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */
*/
LOCAL(boolean)
-process_restart (j_decompress_ptr cinfo)
+process_restart(j_decompress_ptr cinfo)
{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
+ phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
int ci;
/* Throw away any unused bits remaining in bit buffer; */
@@ -242,7 +250,7 @@ process_restart (j_decompress_ptr cinfo)
entropy->bitstate.bits_left = 0;
/* Advance past the RSTn marker */
- if (! (*cinfo->marker->read_restart_marker) (cinfo))
+ if (!(*cinfo->marker->read_restart_marker) (cinfo))
return FALSE;
/* Re-initialize DC predictions to 0 */
@@ -289,9 +297,9 @@ process_restart (j_decompress_ptr cinfo)
*/
METHODDEF(boolean)
-decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
+decode_mcu_DC_first(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
+ phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
int Al = cinfo->Al;
register int s, r;
int blkn, ci;
@@ -304,17 +312,17 @@ decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
/* Process restart marker if needed; may have to suspend */
if (cinfo->restart_interval) {
if (entropy->restarts_to_go == 0)
- if (! process_restart(cinfo))
+ if (!process_restart(cinfo))
return FALSE;
}
/* If we've run out of data, just leave the MCU set to zeroes.
* This way, we return uniform gray for the remainder of the segment.
*/
- if (! entropy->pub.insufficient_data) {
+ if (!entropy->pub.insufficient_data) {
/* Load up working state */
- BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
+ BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
ASSIGN_STATE(state, entropy->saved);
/* Outer loop handles each block in the MCU */
@@ -336,14 +344,18 @@ decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
}
/* Convert DC difference to actual value, update last_dc_val */
+ if ((state.last_dc_val[ci] >= 0 &&
+ s > INT_MAX - state.last_dc_val[ci]) ||
+ (state.last_dc_val[ci] < 0 && s < INT_MIN - state.last_dc_val[ci]))
+ ERREXIT(cinfo, JERR_BAD_DCT_COEF);
s += state.last_dc_val[ci];
state.last_dc_val[ci] = s;
/* Scale and output the coefficient (assumes jpeg_natural_order[0]=0) */
- (*block)[0] = (JCOEF) LEFT_SHIFT(s, Al);
+ (*block)[0] = (JCOEF)LEFT_SHIFT(s, Al);
}
/* Completed MCU, so update state */
- BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
+ BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
ASSIGN_STATE(entropy->saved, state);
}
@@ -360,9 +372,9 @@ decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
*/
METHODDEF(boolean)
-decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
+decode_mcu_AC_first(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
+ phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
int Se = cinfo->Se;
int Al = cinfo->Al;
register int s, k, r;
@@ -374,14 +386,14 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
/* Process restart marker if needed; may have to suspend */
if (cinfo->restart_interval) {
if (entropy->restarts_to_go == 0)
- if (! process_restart(cinfo))
+ if (!process_restart(cinfo))
return FALSE;
}
/* If we've run out of data, just leave the MCU set to zeroes.
* This way, we return uniform gray for the remainder of the segment.
*/
- if (! entropy->pub.insufficient_data) {
+ if (!entropy->pub.insufficient_data) {
/* Load up working state.
* We can avoid loading/saving bitread state if in an EOB run.
@@ -393,7 +405,7 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
if (EOBRUN > 0) /* if it's a band of zeroes... */
EOBRUN--; /* ...process it now (we do nothing) */
else {
- BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
+ BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
block = MCU_data[0];
tbl = entropy->ac_derived_tbl;
@@ -407,7 +419,7 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
r = GET_BITS(s);
s = HUFF_EXTEND(r, s);
/* Scale and output coefficient in natural (dezigzagged) order */
- (*block)[jpeg_natural_order[k]] = (JCOEF) LEFT_SHIFT(s, Al);
+ (*block)[jpeg_natural_order[k]] = (JCOEF)LEFT_SHIFT(s, Al);
} else {
if (r == 15) { /* ZRL */
k += 15; /* skip 15 zeroes in band */
@@ -424,7 +436,7 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
}
}
- BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
+ BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
}
/* Completed MCU, so update state */
@@ -445,9 +457,9 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
*/
METHODDEF(boolean)
-decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
+decode_mcu_DC_refine(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
+ phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */
int blkn;
JBLOCKROW block;
@@ -456,7 +468,7 @@ decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
/* Process restart marker if needed; may have to suspend */
if (cinfo->restart_interval) {
if (entropy->restarts_to_go == 0)
- if (! process_restart(cinfo))
+ if (!process_restart(cinfo))
return FALSE;
}
@@ -465,7 +477,7 @@ decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
*/
/* Load up working state */
- BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
+ BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
/* Outer loop handles each block in the MCU */
@@ -480,7 +492,7 @@ decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
}
/* Completed MCU, so update state */
- BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
+ BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
/* Account for restart interval (no-op if not using restarts) */
entropy->restarts_to_go--;
@@ -494,9 +506,9 @@ decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
*/
METHODDEF(boolean)
-decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
+decode_mcu_AC_refine(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
+ phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
int Se = cinfo->Se;
int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */
int m1 = (NEG_1) << cinfo->Al; /* -1 in the bit position being coded */
@@ -512,16 +524,16 @@ decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
/* Process restart marker if needed; may have to suspend */
if (cinfo->restart_interval) {
if (entropy->restarts_to_go == 0)
- if (! process_restart(cinfo))
+ if (!process_restart(cinfo))
return FALSE;
}
/* If we've run out of data, don't modify the MCU.
*/
- if (! entropy->pub.insufficient_data) {
+ if (!entropy->pub.insufficient_data) {
/* Load up working state */
- BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
+ BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
EOBRUN = entropy->saved.EOBRUN; /* only part of saved state we need */
/* There is always only one block per MCU */
@@ -589,7 +601,7 @@ decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
if (s) {
int pos = jpeg_natural_order[k];
/* Output newly nonzero coefficient */
- (*block)[pos] = (JCOEF) s;
+ (*block)[pos] = (JCOEF)s;
/* Remember its position in case we have to suspend */
newnz_pos[num_newnz++] = pos;
}
@@ -621,7 +633,7 @@ decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
}
/* Completed MCU, so update state */
- BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
+ BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
entropy->saved.EOBRUN = EOBRUN; /* only part of saved state we need */
}
@@ -644,16 +656,16 @@ undoit:
*/
GLOBAL(void)
-jinit_phuff_decoder (j_decompress_ptr cinfo)
+jinit_phuff_decoder(j_decompress_ptr cinfo)
{
phuff_entropy_ptr entropy;
int *coef_bit_ptr;
int ci, i;
entropy = (phuff_entropy_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(phuff_entropy_decoder));
- cinfo->entropy = (struct jpeg_entropy_decoder *) entropy;
+ cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
entropy->pub.start_pass = start_pass_phuff_decoder;
/* Mark derived tables unallocated */
@@ -663,9 +675,10 @@ jinit_phuff_decoder (j_decompress_ptr cinfo)
/* Create progression status table */
cinfo->coef_bits = (int (*)[DCTSIZE2])
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- cinfo->num_components*DCTSIZE2*sizeof(int));
- coef_bit_ptr = & cinfo->coef_bits[0][0];
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
+ cinfo->num_components * DCTSIZE2 *
+ sizeof(int));
+ coef_bit_ptr = &cinfo->coef_bits[0][0];
for (ci = 0; ci < cinfo->num_components; ci++)
for (i = 0; i < DCTSIZE2; i++)
*coef_bit_ptr++ = -1;
diff --git a/src/3rdparty/libjpeg/src/jdpostct.c b/src/3rdparty/libjpeg/src/jdpostct.c
index 601fc2a792..6a2cf5c1b3 100644
--- a/src/3rdparty/libjpeg/src/jdpostct.c
+++ b/src/3rdparty/libjpeg/src/jdpostct.c
@@ -46,22 +46,28 @@ typedef my_post_controller *my_post_ptr;
/* Forward declarations */
-METHODDEF(void) post_process_1pass
- (j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
- JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail,
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
- JDIMENSION out_rows_avail);
+METHODDEF(void) post_process_1pass(j_decompress_ptr cinfo,
+ JSAMPIMAGE input_buf,
+ JDIMENSION *in_row_group_ctr,
+ JDIMENSION in_row_groups_avail,
+ JSAMPARRAY output_buf,
+ JDIMENSION *out_row_ctr,
+ JDIMENSION out_rows_avail);
#ifdef QUANT_2PASS_SUPPORTED
-METHODDEF(void) post_process_prepass
- (j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
- JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail,
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
- JDIMENSION out_rows_avail);
-METHODDEF(void) post_process_2pass
- (j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
- JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail,
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
- JDIMENSION out_rows_avail);
+METHODDEF(void) post_process_prepass(j_decompress_ptr cinfo,
+ JSAMPIMAGE input_buf,
+ JDIMENSION *in_row_group_ctr,
+ JDIMENSION in_row_groups_avail,
+ JSAMPARRAY output_buf,
+ JDIMENSION *out_row_ctr,
+ JDIMENSION out_rows_avail);
+METHODDEF(void) post_process_2pass(j_decompress_ptr cinfo,
+ JSAMPIMAGE input_buf,
+ JDIMENSION *in_row_group_ctr,
+ JDIMENSION in_row_groups_avail,
+ JSAMPARRAY output_buf,
+ JDIMENSION *out_row_ctr,
+ JDIMENSION out_rows_avail);
#endif
@@ -70,9 +76,9 @@ METHODDEF(void) post_process_2pass
*/
METHODDEF(void)
-start_pass_dpost (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
+start_pass_dpost(j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
{
- my_post_ptr post = (my_post_ptr) cinfo->post;
+ my_post_ptr post = (my_post_ptr)cinfo->post;
switch (pass_mode) {
case JBUF_PASS_THRU:
@@ -85,8 +91,8 @@ start_pass_dpost (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
*/
if (post->buffer == NULL) {
post->buffer = (*cinfo->mem->access_virt_sarray)
- ((j_common_ptr) cinfo, post->whole_image,
- (JDIMENSION) 0, post->strip_height, TRUE);
+ ((j_common_ptr)cinfo, post->whole_image,
+ (JDIMENSION)0, post->strip_height, TRUE);
}
} else {
/* For single-pass processing without color quantization,
@@ -123,13 +129,12 @@ start_pass_dpost (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
*/
METHODDEF(void)
-post_process_1pass (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
- JDIMENSION in_row_groups_avail,
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
- JDIMENSION out_rows_avail)
+post_process_1pass(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION *in_row_group_ctr,
+ JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf,
+ JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
{
- my_post_ptr post = (my_post_ptr) cinfo->post;
+ my_post_ptr post = (my_post_ptr)cinfo->post;
JDIMENSION num_rows, max_rows;
/* Fill the buffer, but not more than what we can dump out in one go. */
@@ -138,12 +143,13 @@ post_process_1pass (j_decompress_ptr cinfo,
if (max_rows > post->strip_height)
max_rows = post->strip_height;
num_rows = 0;
- (*cinfo->upsample->upsample) (cinfo,
- input_buf, in_row_group_ctr, in_row_groups_avail,
- post->buffer, &num_rows, max_rows);
+ (*cinfo->upsample->upsample) (cinfo, input_buf, in_row_group_ctr,
+ in_row_groups_avail, post->buffer, &num_rows,
+ max_rows);
/* Quantize and emit data. */
- (*cinfo->cquantize->color_quantize) (cinfo,
- post->buffer, output_buf + *out_row_ctr, (int) num_rows);
+ (*cinfo->cquantize->color_quantize) (cinfo, post->buffer,
+ output_buf + *out_row_ctr,
+ (int)num_rows);
*out_row_ctr += num_rows;
}
@@ -155,34 +161,33 @@ post_process_1pass (j_decompress_ptr cinfo,
*/
METHODDEF(void)
-post_process_prepass (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
- JDIMENSION in_row_groups_avail,
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
- JDIMENSION out_rows_avail)
+post_process_prepass(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION *in_row_group_ctr,
+ JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf,
+ JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
{
- my_post_ptr post = (my_post_ptr) cinfo->post;
+ my_post_ptr post = (my_post_ptr)cinfo->post;
JDIMENSION old_next_row, num_rows;
/* Reposition virtual buffer if at start of strip. */
if (post->next_row == 0) {
post->buffer = (*cinfo->mem->access_virt_sarray)
- ((j_common_ptr) cinfo, post->whole_image,
+ ((j_common_ptr)cinfo, post->whole_image,
post->starting_row, post->strip_height, TRUE);
}
/* Upsample some data (up to a strip height's worth). */
old_next_row = post->next_row;
- (*cinfo->upsample->upsample) (cinfo,
- input_buf, in_row_group_ctr, in_row_groups_avail,
- post->buffer, &post->next_row, post->strip_height);
+ (*cinfo->upsample->upsample) (cinfo, input_buf, in_row_group_ctr,
+ in_row_groups_avail, post->buffer,
+ &post->next_row, post->strip_height);
/* Allow quantizer to scan new data. No data is emitted, */
/* but we advance out_row_ctr so outer loop can tell when we're done. */
if (post->next_row > old_next_row) {
num_rows = post->next_row - old_next_row;
(*cinfo->cquantize->color_quantize) (cinfo, post->buffer + old_next_row,
- (JSAMPARRAY) NULL, (int) num_rows);
+ (JSAMPARRAY)NULL, (int)num_rows);
*out_row_ctr += num_rows;
}
@@ -199,19 +204,18 @@ post_process_prepass (j_decompress_ptr cinfo,
*/
METHODDEF(void)
-post_process_2pass (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
- JDIMENSION in_row_groups_avail,
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
- JDIMENSION out_rows_avail)
+post_process_2pass(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION *in_row_group_ctr,
+ JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf,
+ JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
{
- my_post_ptr post = (my_post_ptr) cinfo->post;
+ my_post_ptr post = (my_post_ptr)cinfo->post;
JDIMENSION num_rows, max_rows;
/* Reposition virtual buffer if at start of strip. */
if (post->next_row == 0) {
post->buffer = (*cinfo->mem->access_virt_sarray)
- ((j_common_ptr) cinfo, post->whole_image,
+ ((j_common_ptr)cinfo, post->whole_image,
post->starting_row, post->strip_height, FALSE);
}
@@ -226,9 +230,9 @@ post_process_2pass (j_decompress_ptr cinfo,
num_rows = max_rows;
/* Quantize and emit data. */
- (*cinfo->cquantize->color_quantize) (cinfo,
- post->buffer + post->next_row, output_buf + *out_row_ctr,
- (int) num_rows);
+ (*cinfo->cquantize->color_quantize) (cinfo, post->buffer + post->next_row,
+ output_buf + *out_row_ctr,
+ (int)num_rows);
*out_row_ctr += num_rows;
/* Advance if we filled the strip. */
@@ -247,14 +251,14 @@ post_process_2pass (j_decompress_ptr cinfo,
*/
GLOBAL(void)
-jinit_d_post_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
+jinit_d_post_controller(j_decompress_ptr cinfo, boolean need_full_buffer)
{
my_post_ptr post;
post = (my_post_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(my_post_controller));
- cinfo->post = (struct jpeg_d_post_controller *) post;
+ cinfo->post = (struct jpeg_d_post_controller *)post;
post->pub.start_pass = start_pass_dpost;
post->whole_image = NULL; /* flag for no virtual arrays */
post->buffer = NULL; /* flag for no strip buffer */
@@ -265,16 +269,16 @@ jinit_d_post_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
* an efficient number of rows for upsampling to return.
* (In the presence of output rescaling, we might want to be smarter?)
*/
- post->strip_height = (JDIMENSION) cinfo->max_v_samp_factor;
+ post->strip_height = (JDIMENSION)cinfo->max_v_samp_factor;
if (need_full_buffer) {
/* Two-pass color quantization: need full-image storage. */
/* We round up the number of rows to a multiple of the strip height. */
#ifdef QUANT_2PASS_SUPPORTED
post->whole_image = (*cinfo->mem->request_virt_sarray)
- ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
+ ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
cinfo->output_width * cinfo->out_color_components,
- (JDIMENSION) jround_up((long) cinfo->output_height,
- (long) post->strip_height),
+ (JDIMENSION)jround_up((long)cinfo->output_height,
+ (long)post->strip_height),
post->strip_height);
#else
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
@@ -282,7 +286,7 @@ jinit_d_post_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
} else {
/* One-pass color quantization: just make a strip buffer. */
post->buffer = (*cinfo->mem->alloc_sarray)
- ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ ((j_common_ptr)cinfo, JPOOL_IMAGE,
cinfo->output_width * cinfo->out_color_components,
post->strip_height);
}
diff --git a/src/3rdparty/libjpeg/src/jdsample.c b/src/3rdparty/libjpeg/src/jdsample.c
index b1378e1512..52ee9af49b 100644
--- a/src/3rdparty/libjpeg/src/jdsample.c
+++ b/src/3rdparty/libjpeg/src/jdsample.c
@@ -36,9 +36,9 @@
*/
METHODDEF(void)
-start_pass_upsample (j_decompress_ptr cinfo)
+start_pass_upsample(j_decompress_ptr cinfo)
{
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
+ my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
/* Mark the conversion buffer empty */
upsample->next_row_out = cinfo->max_v_samp_factor;
@@ -56,13 +56,12 @@ start_pass_upsample (j_decompress_ptr cinfo)
*/
METHODDEF(void)
-sep_upsample (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
- JDIMENSION in_row_groups_avail,
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
- JDIMENSION out_rows_avail)
+sep_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail,
+ JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
+ JDIMENSION out_rows_avail)
{
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
+ my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
int ci;
jpeg_component_info *compptr;
JDIMENSION num_rows;
@@ -84,7 +83,7 @@ sep_upsample (j_decompress_ptr cinfo,
/* Color-convert and emit rows */
/* How many we have in the buffer: */
- num_rows = (JDIMENSION) (cinfo->max_v_samp_factor - upsample->next_row_out);
+ num_rows = (JDIMENSION)(cinfo->max_v_samp_factor - upsample->next_row_out);
/* Not more than the distance to the end of the image. Need this test
* in case the image height is not a multiple of max_v_samp_factor:
*/
@@ -96,9 +95,8 @@ sep_upsample (j_decompress_ptr cinfo,
num_rows = out_rows_avail;
(*cinfo->cconvert->color_convert) (cinfo, upsample->color_buf,
- (JDIMENSION) upsample->next_row_out,
- output_buf + *out_row_ctr,
- (int) num_rows);
+ (JDIMENSION)upsample->next_row_out,
+ output_buf + *out_row_ctr, (int)num_rows);
/* Adjust counts */
*out_row_ctr += num_rows;
@@ -124,8 +122,8 @@ sep_upsample (j_decompress_ptr cinfo,
*/
METHODDEF(void)
-fullsize_upsample (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
+fullsize_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
{
*output_data_ptr = input_data;
}
@@ -137,8 +135,8 @@ fullsize_upsample (j_decompress_ptr cinfo, jpeg_component_info *compptr,
*/
METHODDEF(void)
-noop_upsample (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
+noop_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
{
*output_data_ptr = NULL; /* safety check */
}
@@ -156,10 +154,10 @@ noop_upsample (j_decompress_ptr cinfo, jpeg_component_info *compptr,
*/
METHODDEF(void)
-int_upsample (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
+int_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
{
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
+ my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
JSAMPARRAY output_data = *output_data_ptr;
register JSAMPROW inptr, outptr;
register JSAMPLE invalue;
@@ -185,8 +183,8 @@ int_upsample (j_decompress_ptr cinfo, jpeg_component_info *compptr,
}
/* Generate any additional output rows by duplicating the first one */
if (v_expand > 1) {
- jcopy_sample_rows(output_data, outrow, output_data, outrow+1,
- v_expand-1, cinfo->output_width);
+ jcopy_sample_rows(output_data, outrow, output_data, outrow + 1,
+ v_expand - 1, cinfo->output_width);
}
inrow++;
outrow += v_expand;
@@ -200,8 +198,8 @@ int_upsample (j_decompress_ptr cinfo, jpeg_component_info *compptr,
*/
METHODDEF(void)
-h2v1_upsample (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
+h2v1_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
{
JSAMPARRAY output_data = *output_data_ptr;
register JSAMPROW inptr, outptr;
@@ -228,8 +226,8 @@ h2v1_upsample (j_decompress_ptr cinfo, jpeg_component_info *compptr,
*/
METHODDEF(void)
-h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
+h2v2_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
{
JSAMPARRAY output_data = *output_data_ptr;
register JSAMPROW inptr, outptr;
@@ -247,8 +245,8 @@ h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info *compptr,
*outptr++ = invalue;
*outptr++ = invalue;
}
- jcopy_sample_rows(output_data, outrow, output_data, outrow+1,
- 1, cinfo->output_width);
+ jcopy_sample_rows(output_data, outrow, output_data, outrow + 1, 1,
+ cinfo->output_width);
inrow++;
outrow += 2;
}
@@ -271,8 +269,8 @@ h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info *compptr,
*/
METHODDEF(void)
-h2v1_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
+h2v1_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
{
JSAMPARRAY output_data = *output_data_ptr;
register JSAMPROW inptr, outptr;
@@ -285,20 +283,20 @@ h2v1_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info *compptr,
outptr = output_data[inrow];
/* Special case for first column */
invalue = GETJSAMPLE(*inptr++);
- *outptr++ = (JSAMPLE) invalue;
- *outptr++ = (JSAMPLE) ((invalue * 3 + GETJSAMPLE(*inptr) + 2) >> 2);
+ *outptr++ = (JSAMPLE)invalue;
+ *outptr++ = (JSAMPLE)((invalue * 3 + GETJSAMPLE(*inptr) + 2) >> 2);
for (colctr = compptr->downsampled_width - 2; colctr > 0; colctr--) {
/* General case: 3/4 * nearer pixel + 1/4 * further pixel */
invalue = GETJSAMPLE(*inptr++) * 3;
- *outptr++ = (JSAMPLE) ((invalue + GETJSAMPLE(inptr[-2]) + 1) >> 2);
- *outptr++ = (JSAMPLE) ((invalue + GETJSAMPLE(*inptr) + 2) >> 2);
+ *outptr++ = (JSAMPLE)((invalue + GETJSAMPLE(inptr[-2]) + 1) >> 2);
+ *outptr++ = (JSAMPLE)((invalue + GETJSAMPLE(*inptr) + 2) >> 2);
}
/* Special case for last column */
invalue = GETJSAMPLE(*inptr);
- *outptr++ = (JSAMPLE) ((invalue * 3 + GETJSAMPLE(inptr[-1]) + 1) >> 2);
- *outptr++ = (JSAMPLE) invalue;
+ *outptr++ = (JSAMPLE)((invalue * 3 + GETJSAMPLE(inptr[-1]) + 1) >> 2);
+ *outptr++ = (JSAMPLE)invalue;
}
}
@@ -311,8 +309,8 @@ h2v1_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info *compptr,
*/
METHODDEF(void)
-h1v2_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
+h1v2_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
{
JSAMPARRAY output_data = *output_data_ptr;
JSAMPROW inptr0, inptr1, outptr;
@@ -330,14 +328,14 @@ h1v2_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* inptr0 points to nearest input row, inptr1 points to next nearest */
inptr0 = input_data[inrow];
if (v == 0) /* next nearest is row above */
- inptr1 = input_data[inrow-1];
+ inptr1 = input_data[inrow - 1];
else /* next nearest is row below */
- inptr1 = input_data[inrow+1];
+ inptr1 = input_data[inrow + 1];
outptr = output_data[outrow++];
- for(colctr = 0; colctr < compptr->downsampled_width; colctr++) {
+ for (colctr = 0; colctr < compptr->downsampled_width; colctr++) {
thiscolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++);
- *outptr++ = (JSAMPLE) ((thiscolsum + 1) >> 2);
+ *outptr++ = (JSAMPLE)((thiscolsum + 1) >> 2);
}
}
inrow++;
@@ -354,8 +352,8 @@ h1v2_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info *compptr,
*/
METHODDEF(void)
-h2v2_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
+h2v2_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
{
JSAMPARRAY output_data = *output_data_ptr;
register JSAMPROW inptr0, inptr1, outptr;
@@ -373,30 +371,30 @@ h2v2_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* inptr0 points to nearest input row, inptr1 points to next nearest */
inptr0 = input_data[inrow];
if (v == 0) /* next nearest is row above */
- inptr1 = input_data[inrow-1];
+ inptr1 = input_data[inrow - 1];
else /* next nearest is row below */
- inptr1 = input_data[inrow+1];
+ inptr1 = input_data[inrow + 1];
outptr = output_data[outrow++];
/* Special case for first column */
thiscolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++);
nextcolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++);
- *outptr++ = (JSAMPLE) ((thiscolsum * 4 + 8) >> 4);
- *outptr++ = (JSAMPLE) ((thiscolsum * 3 + nextcolsum + 7) >> 4);
- lastcolsum = thiscolsum; thiscolsum = nextcolsum;
+ *outptr++ = (JSAMPLE)((thiscolsum * 4 + 8) >> 4);
+ *outptr++ = (JSAMPLE)((thiscolsum * 3 + nextcolsum + 7) >> 4);
+ lastcolsum = thiscolsum; thiscolsum = nextcolsum;
for (colctr = compptr->downsampled_width - 2; colctr > 0; colctr--) {
/* General case: 3/4 * nearer pixel + 1/4 * further pixel in each */
/* dimension, thus 9/16, 3/16, 3/16, 1/16 overall */
nextcolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++);
- *outptr++ = (JSAMPLE) ((thiscolsum * 3 + lastcolsum + 8) >> 4);
- *outptr++ = (JSAMPLE) ((thiscolsum * 3 + nextcolsum + 7) >> 4);
- lastcolsum = thiscolsum; thiscolsum = nextcolsum;
+ *outptr++ = (JSAMPLE)((thiscolsum * 3 + lastcolsum + 8) >> 4);
+ *outptr++ = (JSAMPLE)((thiscolsum * 3 + nextcolsum + 7) >> 4);
+ lastcolsum = thiscolsum; thiscolsum = nextcolsum;
}
/* Special case for last column */
- *outptr++ = (JSAMPLE) ((thiscolsum * 3 + lastcolsum + 8) >> 4);
- *outptr++ = (JSAMPLE) ((thiscolsum * 4 + 7) >> 4);
+ *outptr++ = (JSAMPLE)((thiscolsum * 3 + lastcolsum + 8) >> 4);
+ *outptr++ = (JSAMPLE)((thiscolsum * 4 + 7) >> 4);
}
inrow++;
}
@@ -408,7 +406,7 @@ h2v2_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info *compptr,
*/
GLOBAL(void)
-jinit_upsampler (j_decompress_ptr cinfo)
+jinit_upsampler(j_decompress_ptr cinfo)
{
my_upsample_ptr upsample;
int ci;
@@ -418,14 +416,14 @@ jinit_upsampler (j_decompress_ptr cinfo)
if (!cinfo->master->jinit_upsampler_no_alloc) {
upsample = (my_upsample_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(my_upsampler));
- cinfo->upsample = (struct jpeg_upsampler *) upsample;
+ cinfo->upsample = (struct jpeg_upsampler *)upsample;
upsample->pub.start_pass = start_pass_upsample;
upsample->pub.upsample = sep_upsample;
upsample->pub.need_context_rows = FALSE; /* until we find out differently */
} else
- upsample = (my_upsample_ptr) cinfo->upsample;
+ upsample = (my_upsample_ptr)cinfo->upsample;
if (cinfo->CCIR601_sampling) /* this isn't supported */
ERREXIT(cinfo, JERR_CCIR601_NOTIMPL);
@@ -451,7 +449,7 @@ jinit_upsampler (j_decompress_ptr cinfo)
v_out_group = cinfo->max_v_samp_factor;
upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
need_buffer = TRUE;
- if (! compptr->component_needed) {
+ if (!compptr->component_needed) {
/* Don't bother to upsample an uninteresting component. */
upsample->methods[ci] = noop_upsample;
need_buffer = FALSE;
@@ -459,8 +457,7 @@ jinit_upsampler (j_decompress_ptr cinfo)
/* Fullsize components can be processed without any work. */
upsample->methods[ci] = fullsize_upsample;
need_buffer = FALSE;
- } else if (h_in_group * 2 == h_out_group &&
- v_in_group == v_out_group) {
+ } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
/* Special cases for 2h1v upsampling */
if (do_fancy && compptr->downsampled_width > 2) {
if (jsimd_can_h2v1_fancy_upsample())
@@ -502,16 +499,16 @@ jinit_upsampler (j_decompress_ptr cinfo)
else
#endif
upsample->methods[ci] = int_upsample;
- upsample->h_expand[ci] = (UINT8) (h_out_group / h_in_group);
- upsample->v_expand[ci] = (UINT8) (v_out_group / v_in_group);
+ upsample->h_expand[ci] = (UINT8)(h_out_group / h_in_group);
+ upsample->v_expand[ci] = (UINT8)(v_out_group / v_in_group);
} else
ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
if (need_buffer && !cinfo->master->jinit_upsampler_no_alloc) {
upsample->color_buf[ci] = (*cinfo->mem->alloc_sarray)
- ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (JDIMENSION) jround_up((long) cinfo->output_width,
- (long) cinfo->max_h_samp_factor),
- (JDIMENSION) cinfo->max_v_samp_factor);
+ ((j_common_ptr)cinfo, JPOOL_IMAGE,
+ (JDIMENSION)jround_up((long)cinfo->output_width,
+ (long)cinfo->max_h_samp_factor),
+ (JDIMENSION)cinfo->max_v_samp_factor);
}
}
}
diff --git a/src/3rdparty/libjpeg/src/jdtrans.c b/src/3rdparty/libjpeg/src/jdtrans.c
index cfc85dd24c..56713efe64 100644
--- a/src/3rdparty/libjpeg/src/jdtrans.c
+++ b/src/3rdparty/libjpeg/src/jdtrans.c
@@ -19,7 +19,7 @@
/* Forward declarations */
-LOCAL(void) transdecode_master_selection (j_decompress_ptr cinfo);
+LOCAL(void) transdecode_master_selection(j_decompress_ptr cinfo);
/*
@@ -45,7 +45,7 @@ LOCAL(void) transdecode_master_selection (j_decompress_ptr cinfo);
*/
GLOBAL(jvirt_barray_ptr *)
-jpeg_read_coefficients (j_decompress_ptr cinfo)
+jpeg_read_coefficients(j_decompress_ptr cinfo)
{
if (cinfo->global_state == DSTATE_READY) {
/* First call: initialize active modules */
@@ -58,7 +58,7 @@ jpeg_read_coefficients (j_decompress_ptr cinfo)
int retcode;
/* Call progress monitor hook if present */
if (cinfo->progress != NULL)
- (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
+ (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
/* Absorb some more input */
retcode = (*cinfo->inputctl->consume_input) (cinfo);
if (retcode == JPEG_SUSPENDED)
@@ -70,7 +70,7 @@ jpeg_read_coefficients (j_decompress_ptr cinfo)
(retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {
/* startup underestimated number of scans; ratchet up one scan */
- cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows;
+ cinfo->progress->pass_limit += (long)cinfo->total_iMCU_rows;
}
}
}
@@ -97,7 +97,7 @@ jpeg_read_coefficients (j_decompress_ptr cinfo)
*/
LOCAL(void)
-transdecode_master_selection (j_decompress_ptr cinfo)
+transdecode_master_selection(j_decompress_ptr cinfo)
{
/* This is effectively a buffered-image operation. */
cinfo->buffered_image = TRUE;
@@ -129,7 +129,7 @@ transdecode_master_selection (j_decompress_ptr cinfo)
jinit_d_coef_controller(cinfo, TRUE);
/* We can now tell the memory manager to allocate virtual arrays. */
- (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
+ (*cinfo->mem->realize_virt_arrays) ((j_common_ptr)cinfo);
/* Initialize input side of decompressor to consume first scan. */
(*cinfo->inputctl->start_input_pass) (cinfo);
@@ -148,7 +148,7 @@ transdecode_master_selection (j_decompress_ptr cinfo)
nscans = 1;
}
cinfo->progress->pass_counter = 0L;
- cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows * nscans;
+ cinfo->progress->pass_limit = (long)cinfo->total_iMCU_rows * nscans;
cinfo->progress->completed_passes = 0;
cinfo->progress->total_passes = 1;
}
diff --git a/src/3rdparty/libjpeg/src/jerror.c b/src/3rdparty/libjpeg/src/jerror.c
index c31acd9ef0..936c4f5d80 100644
--- a/src/3rdparty/libjpeg/src/jerror.c
+++ b/src/3rdparty/libjpeg/src/jerror.c
@@ -44,7 +44,7 @@
* want to refer to it directly.
*/
-#define JMESSAGE(code,string) string ,
+#define JMESSAGE(code, string) string,
const char * const jpeg_std_message_table[] = {
#include "jerror.h"
@@ -66,7 +66,7 @@ const char * const jpeg_std_message_table[] = {
*/
METHODDEF(void)
-error_exit (j_common_ptr cinfo)
+error_exit(j_common_ptr cinfo)
{
/* Always display the message */
(*cinfo->err->output_message) (cinfo);
@@ -94,7 +94,7 @@ error_exit (j_common_ptr cinfo)
*/
METHODDEF(void)
-output_message (j_common_ptr cinfo)
+output_message(j_common_ptr cinfo)
{
char buffer[JMSG_LENGTH_MAX];
@@ -124,7 +124,7 @@ output_message (j_common_ptr cinfo)
*/
METHODDEF(void)
-emit_message (j_common_ptr cinfo, int msg_level)
+emit_message(j_common_ptr cinfo, int msg_level)
{
struct jpeg_error_mgr *err = cinfo->err;
@@ -153,7 +153,7 @@ emit_message (j_common_ptr cinfo, int msg_level)
*/
METHODDEF(void)
-format_message (j_common_ptr cinfo, char *buffer)
+format_message(j_common_ptr cinfo, char *buffer)
{
struct jpeg_error_mgr *err = cinfo->err;
int msg_code = err->msg_code;
@@ -208,7 +208,7 @@ format_message (j_common_ptr cinfo, char *buffer)
*/
METHODDEF(void)
-reset_error_mgr (j_common_ptr cinfo)
+reset_error_mgr(j_common_ptr cinfo)
{
cinfo->err->num_warnings = 0;
/* trace_level is not reset since it is an application-supplied parameter */
@@ -227,7 +227,7 @@ reset_error_mgr (j_common_ptr cinfo)
*/
GLOBAL(struct jpeg_error_mgr *)
-jpeg_std_error (struct jpeg_error_mgr *err)
+jpeg_std_error(struct jpeg_error_mgr *err)
{
err->error_exit = error_exit;
err->emit_message = emit_message;
@@ -241,7 +241,7 @@ jpeg_std_error (struct jpeg_error_mgr *err)
/* Initialize message table pointers */
err->jpeg_message_table = jpeg_std_message_table;
- err->last_jpeg_message = (int) JMSG_LASTMSGCODE - 1;
+ err->last_jpeg_message = (int)JMSG_LASTMSGCODE - 1;
err->addon_message_table = NULL;
err->first_addon_message = 0; /* for safety */
diff --git a/src/3rdparty/libjpeg/src/jerror.h b/src/3rdparty/libjpeg/src/jerror.h
index 11a07cb5d0..933a3690fd 100644
--- a/src/3rdparty/libjpeg/src/jerror.h
+++ b/src/3rdparty/libjpeg/src/jerror.h
@@ -5,7 +5,7 @@
* Copyright (C) 1994-1997, Thomas G. Lane.
* Modified 1997-2009 by Guido Vollbeding.
* libjpeg-turbo Modifications:
- * Copyright (C) 2014, D. R. Commander.
+ * Copyright (C) 2014, 2017, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@@ -28,7 +28,7 @@
#define JMAKE_ENUM_LIST
#else
/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */
-#define JMESSAGE(code,string)
+#define JMESSAGE(code, string)
#endif /* JERROR_H */
#endif /* JMESSAGE */
@@ -36,7 +36,7 @@
typedef enum {
-#define JMESSAGE(code,string) code ,
+#define JMESSAGE(code, string) code,
#endif /* JMAKE_ENUM_LIST */
@@ -44,8 +44,7 @@ JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d") /* Must be first entry! */
/* For maintenance convenience, list is alphabetical by message code name */
#if JPEG_LIB_VERSION < 70
-JMESSAGE(JERR_ARITH_NOTIMPL,
- "Sorry, arithmetic coding is not implemented")
+JMESSAGE(JERR_ARITH_NOTIMPL, "Sorry, arithmetic coding is not implemented")
#endif
JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix")
JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix")
@@ -154,8 +153,7 @@ JMESSAGE(JTRC_HUFFBITS, " %3d %3d %3d %3d %3d %3d %3d %3d")
JMESSAGE(JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d %d")
JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE,
"Warning: thumbnail image size does not match data length %u")
-JMESSAGE(JTRC_JFIF_EXTENSION,
- "JFIF extension marker: type 0x%02x, length %u")
+JMESSAGE(JTRC_JFIF_EXTENSION, "JFIF extension marker: type 0x%02x, length %u")
JMESSAGE(JTRC_JFIF_THUMBNAIL, " with %d x %d thumbnail image")
JMESSAGE(JTRC_MISC_MARKER, "Miscellaneous marker 0x%02x, length %u")
JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x")
@@ -208,6 +206,7 @@ JMESSAGE(JERR_NO_ARITH_TABLE, "Arithmetic table 0x%02x was not defined")
JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code")
#endif
#endif
+JMESSAGE(JWRN_BOGUS_ICC, "Corrupt JPEG data: bad ICC marker")
#ifdef JMAKE_ENUM_LIST
@@ -228,90 +227,90 @@ JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code")
/* The first parameter is either type of cinfo pointer */
/* Fatal errors (print message and exit) */
-#define ERREXIT(cinfo,code) \
+#define ERREXIT(cinfo, code) \
((cinfo)->err->msg_code = (code), \
- (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
-#define ERREXIT1(cinfo,code,p1) \
+ (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
+#define ERREXIT1(cinfo, code, p1) \
((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \
- (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
-#define ERREXIT2(cinfo,code,p1,p2) \
+ (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
+#define ERREXIT2(cinfo, code, p1, p2) \
((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \
(cinfo)->err->msg_parm.i[1] = (p2), \
- (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
-#define ERREXIT3(cinfo,code,p1,p2,p3) \
+ (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
+#define ERREXIT3(cinfo, code, p1, p2, p3) \
((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \
(cinfo)->err->msg_parm.i[1] = (p2), \
(cinfo)->err->msg_parm.i[2] = (p3), \
- (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
-#define ERREXIT4(cinfo,code,p1,p2,p3,p4) \
+ (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
+#define ERREXIT4(cinfo, code, p1, p2, p3, p4) \
((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \
(cinfo)->err->msg_parm.i[1] = (p2), \
(cinfo)->err->msg_parm.i[2] = (p3), \
(cinfo)->err->msg_parm.i[3] = (p4), \
- (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
-#define ERREXITS(cinfo,code,str) \
+ (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
+#define ERREXITS(cinfo, code, str) \
((cinfo)->err->msg_code = (code), \
strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \
- (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
+ (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
#define MAKESTMT(stuff) do { stuff } while (0)
/* Nonfatal errors (we can keep going, but the data is probably corrupt) */
-#define WARNMS(cinfo,code) \
+#define WARNMS(cinfo, code) \
((cinfo)->err->msg_code = (code), \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
-#define WARNMS1(cinfo,code,p1) \
+ (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
+#define WARNMS1(cinfo, code, p1) \
((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
-#define WARNMS2(cinfo,code,p1,p2) \
+ (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
+#define WARNMS2(cinfo, code, p1, p2) \
((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \
(cinfo)->err->msg_parm.i[1] = (p2), \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
+ (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
/* Informational/debugging messages */
-#define TRACEMS(cinfo,lvl,code) \
+#define TRACEMS(cinfo, lvl, code) \
((cinfo)->err->msg_code = (code), \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
-#define TRACEMS1(cinfo,lvl,code,p1) \
+ (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
+#define TRACEMS1(cinfo, lvl, code, p1) \
((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
-#define TRACEMS2(cinfo,lvl,code,p1,p2) \
+ (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
+#define TRACEMS2(cinfo, lvl, code, p1, p2) \
((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \
(cinfo)->err->msg_parm.i[1] = (p2), \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
-#define TRACEMS3(cinfo,lvl,code,p1,p2,p3) \
- MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
- _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); \
+ (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
+#define TRACEMS3(cinfo, lvl, code, p1, p2, p3) \
+ MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
+ _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); \
(cinfo)->err->msg_code = (code); \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
-#define TRACEMS4(cinfo,lvl,code,p1,p2,p3,p4) \
- MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
- _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
+ (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
+#define TRACEMS4(cinfo, lvl, code, p1, p2, p3, p4) \
+ MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
+ _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
(cinfo)->err->msg_code = (code); \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
-#define TRACEMS5(cinfo,lvl,code,p1,p2,p3,p4,p5) \
- MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
- _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
+ (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
+#define TRACEMS5(cinfo, lvl, code, p1, p2, p3, p4, p5) \
+ MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
+ _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
_mp[4] = (p5); \
(cinfo)->err->msg_code = (code); \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
-#define TRACEMS8(cinfo,lvl,code,p1,p2,p3,p4,p5,p6,p7,p8) \
- MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
- _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
- _mp[4] = (p5); _mp[5] = (p6); _mp[6] = (p7); _mp[7] = (p8); \
+ (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
+#define TRACEMS8(cinfo, lvl, code, p1, p2, p3, p4, p5, p6, p7, p8) \
+ MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
+ _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
+ _mp[4] = (p5); _mp[5] = (p6); _mp[6] = (p7); _mp[7] = (p8); \
(cinfo)->err->msg_code = (code); \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
-#define TRACEMSS(cinfo,lvl,code,str) \
+ (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
+#define TRACEMSS(cinfo, lvl, code, str) \
((cinfo)->err->msg_code = (code), \
strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \
- (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
+ (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
#endif /* JERROR_H */
diff --git a/src/3rdparty/libjpeg/src/jfdctflt.c b/src/3rdparty/libjpeg/src/jfdctflt.c
index b3da3ebda8..ab6f6d0825 100644
--- a/src/3rdparty/libjpeg/src/jfdctflt.c
+++ b/src/3rdparty/libjpeg/src/jfdctflt.c
@@ -57,7 +57,7 @@
*/
GLOBAL(void)
-jpeg_fdct_float (FAST_FLOAT *data)
+jpeg_fdct_float(FAST_FLOAT *data)
{
FAST_FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
FAST_FLOAT tmp10, tmp11, tmp12, tmp13;
@@ -68,7 +68,7 @@ jpeg_fdct_float (FAST_FLOAT *data)
/* Pass 1: process rows. */
dataptr = data;
- for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
+ for (ctr = DCTSIZE - 1; ctr >= 0; ctr--) {
tmp0 = dataptr[0] + dataptr[7];
tmp7 = dataptr[0] - dataptr[7];
tmp1 = dataptr[1] + dataptr[6];
@@ -88,7 +88,7 @@ jpeg_fdct_float (FAST_FLOAT *data)
dataptr[0] = tmp10 + tmp11; /* phase 3 */
dataptr[4] = tmp10 - tmp11;
- z1 = (tmp12 + tmp13) * ((FAST_FLOAT) 0.707106781); /* c4 */
+ z1 = (tmp12 + tmp13) * ((FAST_FLOAT)0.707106781); /* c4 */
dataptr[2] = tmp13 + z1; /* phase 5 */
dataptr[6] = tmp13 - z1;
@@ -99,10 +99,10 @@ jpeg_fdct_float (FAST_FLOAT *data)
tmp12 = tmp6 + tmp7;
/* The rotator is modified from fig 4-8 to avoid extra negations. */
- z5 = (tmp10 - tmp12) * ((FAST_FLOAT) 0.382683433); /* c6 */
- z2 = ((FAST_FLOAT) 0.541196100) * tmp10 + z5; /* c2-c6 */
- z4 = ((FAST_FLOAT) 1.306562965) * tmp12 + z5; /* c2+c6 */
- z3 = tmp11 * ((FAST_FLOAT) 0.707106781); /* c4 */
+ z5 = (tmp10 - tmp12) * ((FAST_FLOAT)0.382683433); /* c6 */
+ z2 = ((FAST_FLOAT)0.541196100) * tmp10 + z5; /* c2-c6 */
+ z4 = ((FAST_FLOAT)1.306562965) * tmp12 + z5; /* c2+c6 */
+ z3 = tmp11 * ((FAST_FLOAT)0.707106781); /* c4 */
z11 = tmp7 + z3; /* phase 5 */
z13 = tmp7 - z3;
@@ -118,15 +118,15 @@ jpeg_fdct_float (FAST_FLOAT *data)
/* Pass 2: process columns. */
dataptr = data;
- for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
- tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7];
- tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7];
- tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6];
- tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6];
- tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5];
- tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5];
- tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4];
- tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4];
+ for (ctr = DCTSIZE - 1; ctr >= 0; ctr--) {
+ tmp0 = dataptr[DCTSIZE * 0] + dataptr[DCTSIZE * 7];
+ tmp7 = dataptr[DCTSIZE * 0] - dataptr[DCTSIZE * 7];
+ tmp1 = dataptr[DCTSIZE * 1] + dataptr[DCTSIZE * 6];
+ tmp6 = dataptr[DCTSIZE * 1] - dataptr[DCTSIZE * 6];
+ tmp2 = dataptr[DCTSIZE * 2] + dataptr[DCTSIZE * 5];
+ tmp5 = dataptr[DCTSIZE * 2] - dataptr[DCTSIZE * 5];
+ tmp3 = dataptr[DCTSIZE * 3] + dataptr[DCTSIZE * 4];
+ tmp4 = dataptr[DCTSIZE * 3] - dataptr[DCTSIZE * 4];
/* Even part */
@@ -135,12 +135,12 @@ jpeg_fdct_float (FAST_FLOAT *data)
tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2;
- dataptr[DCTSIZE*0] = tmp10 + tmp11; /* phase 3 */
- dataptr[DCTSIZE*4] = tmp10 - tmp11;
+ dataptr[DCTSIZE * 0] = tmp10 + tmp11; /* phase 3 */
+ dataptr[DCTSIZE * 4] = tmp10 - tmp11;
- z1 = (tmp12 + tmp13) * ((FAST_FLOAT) 0.707106781); /* c4 */
- dataptr[DCTSIZE*2] = tmp13 + z1; /* phase 5 */
- dataptr[DCTSIZE*6] = tmp13 - z1;
+ z1 = (tmp12 + tmp13) * ((FAST_FLOAT)0.707106781); /* c4 */
+ dataptr[DCTSIZE * 2] = tmp13 + z1; /* phase 5 */
+ dataptr[DCTSIZE * 6] = tmp13 - z1;
/* Odd part */
@@ -149,18 +149,18 @@ jpeg_fdct_float (FAST_FLOAT *data)
tmp12 = tmp6 + tmp7;
/* The rotator is modified from fig 4-8 to avoid extra negations. */
- z5 = (tmp10 - tmp12) * ((FAST_FLOAT) 0.382683433); /* c6 */
- z2 = ((FAST_FLOAT) 0.541196100) * tmp10 + z5; /* c2-c6 */
- z4 = ((FAST_FLOAT) 1.306562965) * tmp12 + z5; /* c2+c6 */
- z3 = tmp11 * ((FAST_FLOAT) 0.707106781); /* c4 */
+ z5 = (tmp10 - tmp12) * ((FAST_FLOAT)0.382683433); /* c6 */
+ z2 = ((FAST_FLOAT)0.541196100) * tmp10 + z5; /* c2-c6 */
+ z4 = ((FAST_FLOAT)1.306562965) * tmp12 + z5; /* c2+c6 */
+ z3 = tmp11 * ((FAST_FLOAT)0.707106781); /* c4 */
z11 = tmp7 + z3; /* phase 5 */
z13 = tmp7 - z3;
- dataptr[DCTSIZE*5] = z13 + z2; /* phase 6 */
- dataptr[DCTSIZE*3] = z13 - z2;
- dataptr[DCTSIZE*1] = z11 + z4;
- dataptr[DCTSIZE*7] = z11 - z4;
+ dataptr[DCTSIZE * 5] = z13 + z2; /* phase 6 */
+ dataptr[DCTSIZE * 3] = z13 - z2;
+ dataptr[DCTSIZE * 1] = z11 + z4;
+ dataptr[DCTSIZE * 7] = z11 - z4;
dataptr++; /* advance pointer to next column */
}
diff --git a/src/3rdparty/libjpeg/src/jfdctfst.c b/src/3rdparty/libjpeg/src/jfdctfst.c
index 5cd83a7b8e..4c9ce0de8f 100644
--- a/src/3rdparty/libjpeg/src/jfdctfst.c
+++ b/src/3rdparty/libjpeg/src/jfdctfst.c
@@ -79,10 +79,10 @@
*/
#if CONST_BITS == 8
-#define FIX_0_382683433 ((JLONG) 98) /* FIX(0.382683433) */
-#define FIX_0_541196100 ((JLONG) 139) /* FIX(0.541196100) */
-#define FIX_0_707106781 ((JLONG) 181) /* FIX(0.707106781) */
-#define FIX_1_306562965 ((JLONG) 334) /* FIX(1.306562965) */
+#define FIX_0_382683433 ((JLONG)98) /* FIX(0.382683433) */
+#define FIX_0_541196100 ((JLONG)139) /* FIX(0.541196100) */
+#define FIX_0_707106781 ((JLONG)181) /* FIX(0.707106781) */
+#define FIX_1_306562965 ((JLONG)334) /* FIX(1.306562965) */
#else
#define FIX_0_382683433 FIX(0.382683433)
#define FIX_0_541196100 FIX(0.541196100)
@@ -98,7 +98,7 @@
#ifndef USE_ACCURATE_ROUNDING
#undef DESCALE
-#define DESCALE(x,n) RIGHT_SHIFT(x, n)
+#define DESCALE(x, n) RIGHT_SHIFT(x, n)
#endif
@@ -106,7 +106,7 @@
* descale to yield a DCTELEM result.
*/
-#define MULTIPLY(var,const) ((DCTELEM) DESCALE((var) * (const), CONST_BITS))
+#define MULTIPLY(var, const) ((DCTELEM)DESCALE((var) * (const), CONST_BITS))
/*
@@ -114,7 +114,7 @@
*/
GLOBAL(void)
-jpeg_fdct_ifast (DCTELEM *data)
+jpeg_fdct_ifast(DCTELEM *data)
{
DCTELEM tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
DCTELEM tmp10, tmp11, tmp12, tmp13;
@@ -126,7 +126,7 @@ jpeg_fdct_ifast (DCTELEM *data)
/* Pass 1: process rows. */
dataptr = data;
- for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
+ for (ctr = DCTSIZE - 1; ctr >= 0; ctr--) {
tmp0 = dataptr[0] + dataptr[7];
tmp7 = dataptr[0] - dataptr[7];
tmp1 = dataptr[1] + dataptr[6];
@@ -176,15 +176,15 @@ jpeg_fdct_ifast (DCTELEM *data)
/* Pass 2: process columns. */
dataptr = data;
- for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
- tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7];
- tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7];
- tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6];
- tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6];
- tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5];
- tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5];
- tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4];
- tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4];
+ for (ctr = DCTSIZE - 1; ctr >= 0; ctr--) {
+ tmp0 = dataptr[DCTSIZE * 0] + dataptr[DCTSIZE * 7];
+ tmp7 = dataptr[DCTSIZE * 0] - dataptr[DCTSIZE * 7];
+ tmp1 = dataptr[DCTSIZE * 1] + dataptr[DCTSIZE * 6];
+ tmp6 = dataptr[DCTSIZE * 1] - dataptr[DCTSIZE * 6];
+ tmp2 = dataptr[DCTSIZE * 2] + dataptr[DCTSIZE * 5];
+ tmp5 = dataptr[DCTSIZE * 2] - dataptr[DCTSIZE * 5];
+ tmp3 = dataptr[DCTSIZE * 3] + dataptr[DCTSIZE * 4];
+ tmp4 = dataptr[DCTSIZE * 3] - dataptr[DCTSIZE * 4];
/* Even part */
@@ -193,12 +193,12 @@ jpeg_fdct_ifast (DCTELEM *data)
tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2;
- dataptr[DCTSIZE*0] = tmp10 + tmp11; /* phase 3 */
- dataptr[DCTSIZE*4] = tmp10 - tmp11;
+ dataptr[DCTSIZE * 0] = tmp10 + tmp11; /* phase 3 */
+ dataptr[DCTSIZE * 4] = tmp10 - tmp11;
z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */
- dataptr[DCTSIZE*2] = tmp13 + z1; /* phase 5 */
- dataptr[DCTSIZE*6] = tmp13 - z1;
+ dataptr[DCTSIZE * 2] = tmp13 + z1; /* phase 5 */
+ dataptr[DCTSIZE * 6] = tmp13 - z1;
/* Odd part */
@@ -215,10 +215,10 @@ jpeg_fdct_ifast (DCTELEM *data)
z11 = tmp7 + z3; /* phase 5 */
z13 = tmp7 - z3;
- dataptr[DCTSIZE*5] = z13 + z2; /* phase 6 */
- dataptr[DCTSIZE*3] = z13 - z2;
- dataptr[DCTSIZE*1] = z11 + z4;
- dataptr[DCTSIZE*7] = z11 - z4;
+ dataptr[DCTSIZE * 5] = z13 + z2; /* phase 6 */
+ dataptr[DCTSIZE * 3] = z13 - z2;
+ dataptr[DCTSIZE * 1] = z11 + z4;
+ dataptr[DCTSIZE * 7] = z11 - z4;
dataptr++; /* advance pointer to next column */
}
diff --git a/src/3rdparty/libjpeg/src/jfdctint.c b/src/3rdparty/libjpeg/src/jfdctint.c
index 169bb942ce..c0391a92be 100644
--- a/src/3rdparty/libjpeg/src/jfdctint.c
+++ b/src/3rdparty/libjpeg/src/jfdctint.c
@@ -93,18 +93,18 @@
*/
#if CONST_BITS == 13
-#define FIX_0_298631336 ((JLONG) 2446) /* FIX(0.298631336) */
-#define FIX_0_390180644 ((JLONG) 3196) /* FIX(0.390180644) */
-#define FIX_0_541196100 ((JLONG) 4433) /* FIX(0.541196100) */
-#define FIX_0_765366865 ((JLONG) 6270) /* FIX(0.765366865) */
-#define FIX_0_899976223 ((JLONG) 7373) /* FIX(0.899976223) */
-#define FIX_1_175875602 ((JLONG) 9633) /* FIX(1.175875602) */
-#define FIX_1_501321110 ((JLONG) 12299) /* FIX(1.501321110) */
-#define FIX_1_847759065 ((JLONG) 15137) /* FIX(1.847759065) */
-#define FIX_1_961570560 ((JLONG) 16069) /* FIX(1.961570560) */
-#define FIX_2_053119869 ((JLONG) 16819) /* FIX(2.053119869) */
-#define FIX_2_562915447 ((JLONG) 20995) /* FIX(2.562915447) */
-#define FIX_3_072711026 ((JLONG) 25172) /* FIX(3.072711026) */
+#define FIX_0_298631336 ((JLONG)2446) /* FIX(0.298631336) */
+#define FIX_0_390180644 ((JLONG)3196) /* FIX(0.390180644) */
+#define FIX_0_541196100 ((JLONG)4433) /* FIX(0.541196100) */
+#define FIX_0_765366865 ((JLONG)6270) /* FIX(0.765366865) */
+#define FIX_0_899976223 ((JLONG)7373) /* FIX(0.899976223) */
+#define FIX_1_175875602 ((JLONG)9633) /* FIX(1.175875602) */
+#define FIX_1_501321110 ((JLONG)12299) /* FIX(1.501321110) */
+#define FIX_1_847759065 ((JLONG)15137) /* FIX(1.847759065) */
+#define FIX_1_961570560 ((JLONG)16069) /* FIX(1.961570560) */
+#define FIX_2_053119869 ((JLONG)16819) /* FIX(2.053119869) */
+#define FIX_2_562915447 ((JLONG)20995) /* FIX(2.562915447) */
+#define FIX_3_072711026 ((JLONG)25172) /* FIX(3.072711026) */
#else
#define FIX_0_298631336 FIX(0.298631336)
#define FIX_0_390180644 FIX(0.390180644)
@@ -129,9 +129,9 @@
*/
#if BITS_IN_JSAMPLE == 8
-#define MULTIPLY(var,const) MULTIPLY16C16(var,const)
+#define MULTIPLY(var, const) MULTIPLY16C16(var, const)
#else
-#define MULTIPLY(var,const) ((var) * (const))
+#define MULTIPLY(var, const) ((var) * (const))
#endif
@@ -140,7 +140,7 @@
*/
GLOBAL(void)
-jpeg_fdct_islow (DCTELEM *data)
+jpeg_fdct_islow(DCTELEM *data)
{
JLONG tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
JLONG tmp10, tmp11, tmp12, tmp13;
@@ -154,7 +154,7 @@ jpeg_fdct_islow (DCTELEM *data)
/* furthermore, we scale the results by 2**PASS1_BITS. */
dataptr = data;
- for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
+ for (ctr = DCTSIZE - 1; ctr >= 0; ctr--) {
tmp0 = dataptr[0] + dataptr[7];
tmp7 = dataptr[0] - dataptr[7];
tmp1 = dataptr[1] + dataptr[6];
@@ -173,14 +173,14 @@ jpeg_fdct_islow (DCTELEM *data)
tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2;
- dataptr[0] = (DCTELEM) LEFT_SHIFT(tmp10 + tmp11, PASS1_BITS);
- dataptr[4] = (DCTELEM) LEFT_SHIFT(tmp10 - tmp11, PASS1_BITS);
+ dataptr[0] = (DCTELEM)LEFT_SHIFT(tmp10 + tmp11, PASS1_BITS);
+ dataptr[4] = (DCTELEM)LEFT_SHIFT(tmp10 - tmp11, PASS1_BITS);
z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
- dataptr[2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
- CONST_BITS-PASS1_BITS);
- dataptr[6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065),
- CONST_BITS-PASS1_BITS);
+ dataptr[2] = (DCTELEM)DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
+ CONST_BITS - PASS1_BITS);
+ dataptr[6] = (DCTELEM)DESCALE(z1 + MULTIPLY(tmp12, -FIX_1_847759065),
+ CONST_BITS - PASS1_BITS);
/* Odd part per figure 8 --- note paper omits factor of sqrt(2).
* cK represents cos(K*pi/16).
@@ -197,18 +197,18 @@ jpeg_fdct_islow (DCTELEM *data)
tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
tmp7 = MULTIPLY(tmp7, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
- z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
- z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
- z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
- z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
+ z1 = MULTIPLY(z1, -FIX_0_899976223); /* sqrt(2) * ( c7-c3) */
+ z2 = MULTIPLY(z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
+ z3 = MULTIPLY(z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
+ z4 = MULTIPLY(z4, -FIX_0_390180644); /* sqrt(2) * ( c5-c3) */
z3 += z5;
z4 += z5;
- dataptr[7] = (DCTELEM) DESCALE(tmp4 + z1 + z3, CONST_BITS-PASS1_BITS);
- dataptr[5] = (DCTELEM) DESCALE(tmp5 + z2 + z4, CONST_BITS-PASS1_BITS);
- dataptr[3] = (DCTELEM) DESCALE(tmp6 + z2 + z3, CONST_BITS-PASS1_BITS);
- dataptr[1] = (DCTELEM) DESCALE(tmp7 + z1 + z4, CONST_BITS-PASS1_BITS);
+ dataptr[7] = (DCTELEM)DESCALE(tmp4 + z1 + z3, CONST_BITS - PASS1_BITS);
+ dataptr[5] = (DCTELEM)DESCALE(tmp5 + z2 + z4, CONST_BITS - PASS1_BITS);
+ dataptr[3] = (DCTELEM)DESCALE(tmp6 + z2 + z3, CONST_BITS - PASS1_BITS);
+ dataptr[1] = (DCTELEM)DESCALE(tmp7 + z1 + z4, CONST_BITS - PASS1_BITS);
dataptr += DCTSIZE; /* advance pointer to next row */
}
@@ -219,15 +219,15 @@ jpeg_fdct_islow (DCTELEM *data)
*/
dataptr = data;
- for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
- tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7];
- tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7];
- tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6];
- tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6];
- tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5];
- tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5];
- tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4];
- tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4];
+ for (ctr = DCTSIZE - 1; ctr >= 0; ctr--) {
+ tmp0 = dataptr[DCTSIZE * 0] + dataptr[DCTSIZE * 7];
+ tmp7 = dataptr[DCTSIZE * 0] - dataptr[DCTSIZE * 7];
+ tmp1 = dataptr[DCTSIZE * 1] + dataptr[DCTSIZE * 6];
+ tmp6 = dataptr[DCTSIZE * 1] - dataptr[DCTSIZE * 6];
+ tmp2 = dataptr[DCTSIZE * 2] + dataptr[DCTSIZE * 5];
+ tmp5 = dataptr[DCTSIZE * 2] - dataptr[DCTSIZE * 5];
+ tmp3 = dataptr[DCTSIZE * 3] + dataptr[DCTSIZE * 4];
+ tmp4 = dataptr[DCTSIZE * 3] - dataptr[DCTSIZE * 4];
/* Even part per LL&M figure 1 --- note that published figure is faulty;
* rotator "sqrt(2)*c1" should be "sqrt(2)*c6".
@@ -238,14 +238,16 @@ jpeg_fdct_islow (DCTELEM *data)
tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2;
- dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp11, PASS1_BITS);
- dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp10 - tmp11, PASS1_BITS);
+ dataptr[DCTSIZE * 0] = (DCTELEM)DESCALE(tmp10 + tmp11, PASS1_BITS);
+ dataptr[DCTSIZE * 4] = (DCTELEM)DESCALE(tmp10 - tmp11, PASS1_BITS);
z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
- dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
- CONST_BITS+PASS1_BITS);
- dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065),
- CONST_BITS+PASS1_BITS);
+ dataptr[DCTSIZE * 2] =
+ (DCTELEM)DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
+ CONST_BITS + PASS1_BITS);
+ dataptr[DCTSIZE * 6] =
+ (DCTELEM)DESCALE(z1 + MULTIPLY(tmp12, -FIX_1_847759065),
+ CONST_BITS + PASS1_BITS);
/* Odd part per figure 8 --- note paper omits factor of sqrt(2).
* cK represents cos(K*pi/16).
@@ -262,22 +264,22 @@ jpeg_fdct_islow (DCTELEM *data)
tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
tmp7 = MULTIPLY(tmp7, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
- z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
- z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
- z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
- z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
+ z1 = MULTIPLY(z1, -FIX_0_899976223); /* sqrt(2) * ( c7-c3) */
+ z2 = MULTIPLY(z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
+ z3 = MULTIPLY(z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
+ z4 = MULTIPLY(z4, -FIX_0_390180644); /* sqrt(2) * ( c5-c3) */
z3 += z5;
z4 += z5;
- dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp4 + z1 + z3,
- CONST_BITS+PASS1_BITS);
- dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp5 + z2 + z4,
- CONST_BITS+PASS1_BITS);
- dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp6 + z2 + z3,
- CONST_BITS+PASS1_BITS);
- dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp7 + z1 + z4,
- CONST_BITS+PASS1_BITS);
+ dataptr[DCTSIZE * 7] = (DCTELEM)DESCALE(tmp4 + z1 + z3,
+ CONST_BITS + PASS1_BITS);
+ dataptr[DCTSIZE * 5] = (DCTELEM)DESCALE(tmp5 + z2 + z4,
+ CONST_BITS + PASS1_BITS);
+ dataptr[DCTSIZE * 3] = (DCTELEM)DESCALE(tmp6 + z2 + z3,
+ CONST_BITS + PASS1_BITS);
+ dataptr[DCTSIZE * 1] = (DCTELEM)DESCALE(tmp7 + z1 + z4,
+ CONST_BITS + PASS1_BITS);
dataptr++; /* advance pointer to next column */
}
diff --git a/src/3rdparty/libjpeg/src/jidctflt.c b/src/3rdparty/libjpeg/src/jidctflt.c
index 68c521ed7e..5aee74e232 100644
--- a/src/3rdparty/libjpeg/src/jidctflt.c
+++ b/src/3rdparty/libjpeg/src/jidctflt.c
@@ -61,7 +61,7 @@
* entry; produce a float result.
*/
-#define DEQUANTIZE(coef,quantval) (((FAST_FLOAT) (coef)) * (quantval))
+#define DEQUANTIZE(coef, quantval) (((FAST_FLOAT)(coef)) * (quantval))
/*
@@ -69,9 +69,9 @@
*/
GLOBAL(void)
-jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block,
- JSAMPARRAY output_buf, JDIMENSION output_col)
+jpeg_idct_float(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
{
FAST_FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
FAST_FLOAT tmp10, tmp11, tmp12, tmp13;
@@ -83,12 +83,12 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info *compptr,
JSAMPLE *range_limit = cinfo->sample_range_limit;
int ctr;
FAST_FLOAT workspace[DCTSIZE2]; /* buffers data between passes */
- #define _0_125 ((FLOAT_MULT_TYPE)0.125)
+#define _0_125 ((FLOAT_MULT_TYPE)0.125)
/* Pass 1: process columns from input, store into work array. */
inptr = coef_block;
- quantptr = (FLOAT_MULT_TYPE *) compptr->dct_table;
+ quantptr = (FLOAT_MULT_TYPE *)compptr->dct_table;
wsptr = workspace;
for (ctr = DCTSIZE; ctr > 0; ctr--) {
/* Due to quantization, we will usually find that many of the input
@@ -100,22 +100,22 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info *compptr,
* column DCT calculations can be simplified this way.
*/
- if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 &&
- inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 &&
- inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 &&
- inptr[DCTSIZE*7] == 0) {
+ if (inptr[DCTSIZE * 1] == 0 && inptr[DCTSIZE * 2] == 0 &&
+ inptr[DCTSIZE * 3] == 0 && inptr[DCTSIZE * 4] == 0 &&
+ inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 6] == 0 &&
+ inptr[DCTSIZE * 7] == 0) {
/* AC terms all zero */
- FAST_FLOAT dcval = DEQUANTIZE(inptr[DCTSIZE*0],
- quantptr[DCTSIZE*0] * _0_125);
-
- wsptr[DCTSIZE*0] = dcval;
- wsptr[DCTSIZE*1] = dcval;
- wsptr[DCTSIZE*2] = dcval;
- wsptr[DCTSIZE*3] = dcval;
- wsptr[DCTSIZE*4] = dcval;
- wsptr[DCTSIZE*5] = dcval;
- wsptr[DCTSIZE*6] = dcval;
- wsptr[DCTSIZE*7] = dcval;
+ FAST_FLOAT dcval = DEQUANTIZE(inptr[DCTSIZE * 0],
+ quantptr[DCTSIZE * 0] * _0_125);
+
+ wsptr[DCTSIZE * 0] = dcval;
+ wsptr[DCTSIZE * 1] = dcval;
+ wsptr[DCTSIZE * 2] = dcval;
+ wsptr[DCTSIZE * 3] = dcval;
+ wsptr[DCTSIZE * 4] = dcval;
+ wsptr[DCTSIZE * 5] = dcval;
+ wsptr[DCTSIZE * 6] = dcval;
+ wsptr[DCTSIZE * 7] = dcval;
inptr++; /* advance pointers to next column */
quantptr++;
@@ -125,16 +125,16 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Even part */
- tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0] * _0_125);
- tmp1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2] * _0_125);
- tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4] * _0_125);
- tmp3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6] * _0_125);
+ tmp0 = DEQUANTIZE(inptr[DCTSIZE * 0], quantptr[DCTSIZE * 0] * _0_125);
+ tmp1 = DEQUANTIZE(inptr[DCTSIZE * 2], quantptr[DCTSIZE * 2] * _0_125);
+ tmp2 = DEQUANTIZE(inptr[DCTSIZE * 4], quantptr[DCTSIZE * 4] * _0_125);
+ tmp3 = DEQUANTIZE(inptr[DCTSIZE * 6], quantptr[DCTSIZE * 6] * _0_125);
tmp10 = tmp0 + tmp2; /* phase 3 */
tmp11 = tmp0 - tmp2;
tmp13 = tmp1 + tmp3; /* phases 5-3 */
- tmp12 = (tmp1 - tmp3) * ((FAST_FLOAT) 1.414213562) - tmp13; /* 2*c4 */
+ tmp12 = (tmp1 - tmp3) * ((FAST_FLOAT)1.414213562) - tmp13; /* 2*c4 */
tmp0 = tmp10 + tmp13; /* phase 2 */
tmp3 = tmp10 - tmp13;
@@ -143,10 +143,10 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Odd part */
- tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1] * _0_125);
- tmp5 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3] * _0_125);
- tmp6 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5] * _0_125);
- tmp7 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7] * _0_125);
+ tmp4 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1] * _0_125);
+ tmp5 = DEQUANTIZE(inptr[DCTSIZE * 3], quantptr[DCTSIZE * 3] * _0_125);
+ tmp6 = DEQUANTIZE(inptr[DCTSIZE * 5], quantptr[DCTSIZE * 5] * _0_125);
+ tmp7 = DEQUANTIZE(inptr[DCTSIZE * 7], quantptr[DCTSIZE * 7] * _0_125);
z13 = tmp6 + tmp5; /* phase 6 */
z10 = tmp6 - tmp5;
@@ -154,24 +154,24 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info *compptr,
z12 = tmp4 - tmp7;
tmp7 = z11 + z13; /* phase 5 */
- tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562); /* 2*c4 */
+ tmp11 = (z11 - z13) * ((FAST_FLOAT)1.414213562); /* 2*c4 */
- z5 = (z10 + z12) * ((FAST_FLOAT) 1.847759065); /* 2*c2 */
- tmp10 = z5 - z12 * ((FAST_FLOAT) 1.082392200); /* 2*(c2-c6) */
- tmp12 = z5 - z10 * ((FAST_FLOAT) 2.613125930); /* 2*(c2+c6) */
+ z5 = (z10 + z12) * ((FAST_FLOAT)1.847759065); /* 2*c2 */
+ tmp10 = z5 - z12 * ((FAST_FLOAT)1.082392200); /* 2*(c2-c6) */
+ tmp12 = z5 - z10 * ((FAST_FLOAT)2.613125930); /* 2*(c2+c6) */
tmp6 = tmp12 - tmp7; /* phase 2 */
tmp5 = tmp11 - tmp6;
tmp4 = tmp10 - tmp5;
- wsptr[DCTSIZE*0] = tmp0 + tmp7;
- wsptr[DCTSIZE*7] = tmp0 - tmp7;
- wsptr[DCTSIZE*1] = tmp1 + tmp6;
- wsptr[DCTSIZE*6] = tmp1 - tmp6;
- wsptr[DCTSIZE*2] = tmp2 + tmp5;
- wsptr[DCTSIZE*5] = tmp2 - tmp5;
- wsptr[DCTSIZE*3] = tmp3 + tmp4;
- wsptr[DCTSIZE*4] = tmp3 - tmp4;
+ wsptr[DCTSIZE * 0] = tmp0 + tmp7;
+ wsptr[DCTSIZE * 7] = tmp0 - tmp7;
+ wsptr[DCTSIZE * 1] = tmp1 + tmp6;
+ wsptr[DCTSIZE * 6] = tmp1 - tmp6;
+ wsptr[DCTSIZE * 2] = tmp2 + tmp5;
+ wsptr[DCTSIZE * 5] = tmp2 - tmp5;
+ wsptr[DCTSIZE * 3] = tmp3 + tmp4;
+ wsptr[DCTSIZE * 4] = tmp3 - tmp4;
inptr++; /* advance pointers to next column */
quantptr++;
@@ -192,12 +192,12 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Even part */
/* Apply signed->unsigned and prepare float->int conversion */
- z5 = wsptr[0] + ((FAST_FLOAT) CENTERJSAMPLE + (FAST_FLOAT) 0.5);
+ z5 = wsptr[0] + ((FAST_FLOAT)CENTERJSAMPLE + (FAST_FLOAT)0.5);
tmp10 = z5 + wsptr[4];
tmp11 = z5 - wsptr[4];
tmp13 = wsptr[2] + wsptr[6];
- tmp12 = (wsptr[2] - wsptr[6]) * ((FAST_FLOAT) 1.414213562) - tmp13;
+ tmp12 = (wsptr[2] - wsptr[6]) * ((FAST_FLOAT)1.414213562) - tmp13;
tmp0 = tmp10 + tmp13;
tmp3 = tmp10 - tmp13;
@@ -212,11 +212,11 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info *compptr,
z12 = wsptr[1] - wsptr[7];
tmp7 = z11 + z13;
- tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562);
+ tmp11 = (z11 - z13) * ((FAST_FLOAT)1.414213562);
- z5 = (z10 + z12) * ((FAST_FLOAT) 1.847759065); /* 2*c2 */
- tmp10 = z5 - z12 * ((FAST_FLOAT) 1.082392200); /* 2*(c2-c6) */
- tmp12 = z5 - z10 * ((FAST_FLOAT) 2.613125930); /* 2*(c2+c6) */
+ z5 = (z10 + z12) * ((FAST_FLOAT)1.847759065); /* 2*c2 */
+ tmp10 = z5 - z12 * ((FAST_FLOAT)1.082392200); /* 2*(c2-c6) */
+ tmp12 = z5 - z10 * ((FAST_FLOAT)2.613125930); /* 2*(c2+c6) */
tmp6 = tmp12 - tmp7;
tmp5 = tmp11 - tmp6;
@@ -224,14 +224,14 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage: float->int conversion and range-limit */
- outptr[0] = range_limit[((int) (tmp0 + tmp7)) & RANGE_MASK];
- outptr[7] = range_limit[((int) (tmp0 - tmp7)) & RANGE_MASK];
- outptr[1] = range_limit[((int) (tmp1 + tmp6)) & RANGE_MASK];
- outptr[6] = range_limit[((int) (tmp1 - tmp6)) & RANGE_MASK];
- outptr[2] = range_limit[((int) (tmp2 + tmp5)) & RANGE_MASK];
- outptr[5] = range_limit[((int) (tmp2 - tmp5)) & RANGE_MASK];
- outptr[3] = range_limit[((int) (tmp3 + tmp4)) & RANGE_MASK];
- outptr[4] = range_limit[((int) (tmp3 - tmp4)) & RANGE_MASK];
+ outptr[0] = range_limit[((int)(tmp0 + tmp7)) & RANGE_MASK];
+ outptr[7] = range_limit[((int)(tmp0 - tmp7)) & RANGE_MASK];
+ outptr[1] = range_limit[((int)(tmp1 + tmp6)) & RANGE_MASK];
+ outptr[6] = range_limit[((int)(tmp1 - tmp6)) & RANGE_MASK];
+ outptr[2] = range_limit[((int)(tmp2 + tmp5)) & RANGE_MASK];
+ outptr[5] = range_limit[((int)(tmp2 - tmp5)) & RANGE_MASK];
+ outptr[3] = range_limit[((int)(tmp3 + tmp4)) & RANGE_MASK];
+ outptr[4] = range_limit[((int)(tmp3 - tmp4)) & RANGE_MASK];
wsptr += DCTSIZE; /* advance pointer to next row */
}
diff --git a/src/3rdparty/libjpeg/src/jidctfst.c b/src/3rdparty/libjpeg/src/jidctfst.c
index 10db739b86..89a20c937b 100644
--- a/src/3rdparty/libjpeg/src/jidctfst.c
+++ b/src/3rdparty/libjpeg/src/jidctfst.c
@@ -92,10 +92,10 @@
*/
#if CONST_BITS == 8
-#define FIX_1_082392200 ((JLONG) 277) /* FIX(1.082392200) */
-#define FIX_1_414213562 ((JLONG) 362) /* FIX(1.414213562) */
-#define FIX_1_847759065 ((JLONG) 473) /* FIX(1.847759065) */
-#define FIX_2_613125930 ((JLONG) 669) /* FIX(2.613125930) */
+#define FIX_1_082392200 ((JLONG)277) /* FIX(1.082392200) */
+#define FIX_1_414213562 ((JLONG)362) /* FIX(1.414213562) */
+#define FIX_1_847759065 ((JLONG)473) /* FIX(1.847759065) */
+#define FIX_2_613125930 ((JLONG)669) /* FIX(2.613125930) */
#else
#define FIX_1_082392200 FIX(1.082392200)
#define FIX_1_414213562 FIX(1.414213562)
@@ -111,7 +111,7 @@
#ifndef USE_ACCURATE_ROUNDING
#undef DESCALE
-#define DESCALE(x,n) RIGHT_SHIFT(x, n)
+#define DESCALE(x, n) RIGHT_SHIFT(x, n)
#endif
@@ -119,7 +119,7 @@
* descale to yield a DCTELEM result.
*/
-#define MULTIPLY(var,const) ((DCTELEM) DESCALE((var) * (const), CONST_BITS))
+#define MULTIPLY(var, const) ((DCTELEM)DESCALE((var) * (const), CONST_BITS))
/* Dequantize a coefficient by multiplying it by the multiplier-table
@@ -129,10 +129,10 @@
*/
#if BITS_IN_JSAMPLE == 8
-#define DEQUANTIZE(coef,quantval) (((IFAST_MULT_TYPE) (coef)) * (quantval))
+#define DEQUANTIZE(coef, quantval) (((IFAST_MULT_TYPE)(coef)) * (quantval))
#else
-#define DEQUANTIZE(coef,quantval) \
- DESCALE((coef)*(quantval), IFAST_SCALE_BITS-PASS1_BITS)
+#define DEQUANTIZE(coef, quantval) \
+ DESCALE((coef) * (quantval), IFAST_SCALE_BITS - PASS1_BITS)
#endif
@@ -147,19 +147,19 @@
#else
#define DCTELEMBITS 32 /* DCTELEM must be 32 bits */
#endif
-#define IRIGHT_SHIFT(x,shft) \
- ((ishift_temp = (x)) < 0 ? \
- (ishift_temp >> (shft)) | ((~((DCTELEM) 0)) << (DCTELEMBITS-(shft))) : \
- (ishift_temp >> (shft)))
+#define IRIGHT_SHIFT(x, shft) \
+ ((ishift_temp = (x)) < 0 ? \
+ (ishift_temp >> (shft)) | ((~((DCTELEM)0)) << (DCTELEMBITS - (shft))) : \
+ (ishift_temp >> (shft)))
#else
#define ISHIFT_TEMPS
-#define IRIGHT_SHIFT(x,shft) ((x) >> (shft))
+#define IRIGHT_SHIFT(x, shft) ((x) >> (shft))
#endif
#ifdef USE_ACCURATE_ROUNDING
-#define IDESCALE(x,n) ((int) IRIGHT_SHIFT((x) + (1 << ((n)-1)), n))
+#define IDESCALE(x, n) ((int)IRIGHT_SHIFT((x) + (1 << ((n) - 1)), n))
#else
-#define IDESCALE(x,n) ((int) IRIGHT_SHIFT(x, n))
+#define IDESCALE(x, n) ((int)IRIGHT_SHIFT(x, n))
#endif
@@ -168,9 +168,9 @@
*/
GLOBAL(void)
-jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block,
- JSAMPARRAY output_buf, JDIMENSION output_col)
+jpeg_idct_ifast(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
{
DCTELEM tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
DCTELEM tmp10, tmp11, tmp12, tmp13;
@@ -188,7 +188,7 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Pass 1: process columns from input, store into work array. */
inptr = coef_block;
- quantptr = (IFAST_MULT_TYPE *) compptr->dct_table;
+ quantptr = (IFAST_MULT_TYPE *)compptr->dct_table;
wsptr = workspace;
for (ctr = DCTSIZE; ctr > 0; ctr--) {
/* Due to quantization, we will usually find that many of the input
@@ -200,21 +200,21 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info *compptr,
* column DCT calculations can be simplified this way.
*/
- if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 &&
- inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 &&
- inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 &&
- inptr[DCTSIZE*7] == 0) {
+ if (inptr[DCTSIZE * 1] == 0 && inptr[DCTSIZE * 2] == 0 &&
+ inptr[DCTSIZE * 3] == 0 && inptr[DCTSIZE * 4] == 0 &&
+ inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 6] == 0 &&
+ inptr[DCTSIZE * 7] == 0) {
/* AC terms all zero */
- int dcval = (int) DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
+ int dcval = (int)DEQUANTIZE(inptr[DCTSIZE * 0], quantptr[DCTSIZE * 0]);
- wsptr[DCTSIZE*0] = dcval;
- wsptr[DCTSIZE*1] = dcval;
- wsptr[DCTSIZE*2] = dcval;
- wsptr[DCTSIZE*3] = dcval;
- wsptr[DCTSIZE*4] = dcval;
- wsptr[DCTSIZE*5] = dcval;
- wsptr[DCTSIZE*6] = dcval;
- wsptr[DCTSIZE*7] = dcval;
+ wsptr[DCTSIZE * 0] = dcval;
+ wsptr[DCTSIZE * 1] = dcval;
+ wsptr[DCTSIZE * 2] = dcval;
+ wsptr[DCTSIZE * 3] = dcval;
+ wsptr[DCTSIZE * 4] = dcval;
+ wsptr[DCTSIZE * 5] = dcval;
+ wsptr[DCTSIZE * 6] = dcval;
+ wsptr[DCTSIZE * 7] = dcval;
inptr++; /* advance pointers to next column */
quantptr++;
@@ -224,10 +224,10 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Even part */
- tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
- tmp1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
- tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
- tmp3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
+ tmp0 = DEQUANTIZE(inptr[DCTSIZE * 0], quantptr[DCTSIZE * 0]);
+ tmp1 = DEQUANTIZE(inptr[DCTSIZE * 2], quantptr[DCTSIZE * 2]);
+ tmp2 = DEQUANTIZE(inptr[DCTSIZE * 4], quantptr[DCTSIZE * 4]);
+ tmp3 = DEQUANTIZE(inptr[DCTSIZE * 6], quantptr[DCTSIZE * 6]);
tmp10 = tmp0 + tmp2; /* phase 3 */
tmp11 = tmp0 - tmp2;
@@ -242,10 +242,10 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Odd part */
- tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
- tmp5 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
- tmp6 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
- tmp7 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
+ tmp4 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1]);
+ tmp5 = DEQUANTIZE(inptr[DCTSIZE * 3], quantptr[DCTSIZE * 3]);
+ tmp6 = DEQUANTIZE(inptr[DCTSIZE * 5], quantptr[DCTSIZE * 5]);
+ tmp7 = DEQUANTIZE(inptr[DCTSIZE * 7], quantptr[DCTSIZE * 7]);
z13 = tmp6 + tmp5; /* phase 6 */
z10 = tmp6 - tmp5;
@@ -257,20 +257,20 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info *compptr,
z5 = MULTIPLY(z10 + z12, FIX_1_847759065); /* 2*c2 */
tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5; /* 2*(c2-c6) */
- tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5; /* -2*(c2+c6) */
+ tmp12 = MULTIPLY(z10, -FIX_2_613125930) + z5; /* -2*(c2+c6) */
tmp6 = tmp12 - tmp7; /* phase 2 */
tmp5 = tmp11 - tmp6;
tmp4 = tmp10 + tmp5;
- wsptr[DCTSIZE*0] = (int) (tmp0 + tmp7);
- wsptr[DCTSIZE*7] = (int) (tmp0 - tmp7);
- wsptr[DCTSIZE*1] = (int) (tmp1 + tmp6);
- wsptr[DCTSIZE*6] = (int) (tmp1 - tmp6);
- wsptr[DCTSIZE*2] = (int) (tmp2 + tmp5);
- wsptr[DCTSIZE*5] = (int) (tmp2 - tmp5);
- wsptr[DCTSIZE*4] = (int) (tmp3 + tmp4);
- wsptr[DCTSIZE*3] = (int) (tmp3 - tmp4);
+ wsptr[DCTSIZE * 0] = (int)(tmp0 + tmp7);
+ wsptr[DCTSIZE * 7] = (int)(tmp0 - tmp7);
+ wsptr[DCTSIZE * 1] = (int)(tmp1 + tmp6);
+ wsptr[DCTSIZE * 6] = (int)(tmp1 - tmp6);
+ wsptr[DCTSIZE * 2] = (int)(tmp2 + tmp5);
+ wsptr[DCTSIZE * 5] = (int)(tmp2 - tmp5);
+ wsptr[DCTSIZE * 4] = (int)(tmp3 + tmp4);
+ wsptr[DCTSIZE * 3] = (int)(tmp3 - tmp4);
inptr++; /* advance pointers to next column */
quantptr++;
@@ -296,8 +296,8 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info *compptr,
if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 &&
wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
/* AC terms all zero */
- JSAMPLE dcval = range_limit[IDESCALE(wsptr[0], PASS1_BITS+3)
- & RANGE_MASK];
+ JSAMPLE dcval =
+ range_limit[IDESCALE(wsptr[0], PASS1_BITS + 3) & RANGE_MASK];
outptr[0] = dcval;
outptr[1] = dcval;
@@ -315,12 +315,12 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Even part */
- tmp10 = ((DCTELEM) wsptr[0] + (DCTELEM) wsptr[4]);
- tmp11 = ((DCTELEM) wsptr[0] - (DCTELEM) wsptr[4]);
+ tmp10 = ((DCTELEM)wsptr[0] + (DCTELEM)wsptr[4]);
+ tmp11 = ((DCTELEM)wsptr[0] - (DCTELEM)wsptr[4]);
- tmp13 = ((DCTELEM) wsptr[2] + (DCTELEM) wsptr[6]);
- tmp12 = MULTIPLY((DCTELEM) wsptr[2] - (DCTELEM) wsptr[6], FIX_1_414213562)
- - tmp13;
+ tmp13 = ((DCTELEM)wsptr[2] + (DCTELEM)wsptr[6]);
+ tmp12 =
+ MULTIPLY((DCTELEM)wsptr[2] - (DCTELEM)wsptr[6], FIX_1_414213562) - tmp13;
tmp0 = tmp10 + tmp13;
tmp3 = tmp10 - tmp13;
@@ -329,17 +329,17 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Odd part */
- z13 = (DCTELEM) wsptr[5] + (DCTELEM) wsptr[3];
- z10 = (DCTELEM) wsptr[5] - (DCTELEM) wsptr[3];
- z11 = (DCTELEM) wsptr[1] + (DCTELEM) wsptr[7];
- z12 = (DCTELEM) wsptr[1] - (DCTELEM) wsptr[7];
+ z13 = (DCTELEM)wsptr[5] + (DCTELEM)wsptr[3];
+ z10 = (DCTELEM)wsptr[5] - (DCTELEM)wsptr[3];
+ z11 = (DCTELEM)wsptr[1] + (DCTELEM)wsptr[7];
+ z12 = (DCTELEM)wsptr[1] - (DCTELEM)wsptr[7];
tmp7 = z11 + z13; /* phase 5 */
tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */
z5 = MULTIPLY(z10 + z12, FIX_1_847759065); /* 2*c2 */
tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5; /* 2*(c2-c6) */
- tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5; /* -2*(c2+c6) */
+ tmp12 = MULTIPLY(z10, -FIX_2_613125930) + z5; /* -2*(c2+c6) */
tmp6 = tmp12 - tmp7; /* phase 2 */
tmp5 = tmp11 - tmp6;
@@ -347,22 +347,22 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage: scale down by a factor of 8 and range-limit */
- outptr[0] = range_limit[IDESCALE(tmp0 + tmp7, PASS1_BITS+3)
- & RANGE_MASK];
- outptr[7] = range_limit[IDESCALE(tmp0 - tmp7, PASS1_BITS+3)
- & RANGE_MASK];
- outptr[1] = range_limit[IDESCALE(tmp1 + tmp6, PASS1_BITS+3)
- & RANGE_MASK];
- outptr[6] = range_limit[IDESCALE(tmp1 - tmp6, PASS1_BITS+3)
- & RANGE_MASK];
- outptr[2] = range_limit[IDESCALE(tmp2 + tmp5, PASS1_BITS+3)
- & RANGE_MASK];
- outptr[5] = range_limit[IDESCALE(tmp2 - tmp5, PASS1_BITS+3)
- & RANGE_MASK];
- outptr[4] = range_limit[IDESCALE(tmp3 + tmp4, PASS1_BITS+3)
- & RANGE_MASK];
- outptr[3] = range_limit[IDESCALE(tmp3 - tmp4, PASS1_BITS+3)
- & RANGE_MASK];
+ outptr[0] =
+ range_limit[IDESCALE(tmp0 + tmp7, PASS1_BITS + 3) & RANGE_MASK];
+ outptr[7] =
+ range_limit[IDESCALE(tmp0 - tmp7, PASS1_BITS + 3) & RANGE_MASK];
+ outptr[1] =
+ range_limit[IDESCALE(tmp1 + tmp6, PASS1_BITS + 3) & RANGE_MASK];
+ outptr[6] =
+ range_limit[IDESCALE(tmp1 - tmp6, PASS1_BITS + 3) & RANGE_MASK];
+ outptr[2] =
+ range_limit[IDESCALE(tmp2 + tmp5, PASS1_BITS + 3) & RANGE_MASK];
+ outptr[5] =
+ range_limit[IDESCALE(tmp2 - tmp5, PASS1_BITS + 3) & RANGE_MASK];
+ outptr[4] =
+ range_limit[IDESCALE(tmp3 + tmp4, PASS1_BITS + 3) & RANGE_MASK];
+ outptr[3] =
+ range_limit[IDESCALE(tmp3 - tmp4, PASS1_BITS + 3) & RANGE_MASK];
wsptr += DCTSIZE; /* advance pointer to next row */
}
diff --git a/src/3rdparty/libjpeg/src/jidctint.c b/src/3rdparty/libjpeg/src/jidctint.c
index 3ac6caf692..55573429f1 100644
--- a/src/3rdparty/libjpeg/src/jidctint.c
+++ b/src/3rdparty/libjpeg/src/jidctint.c
@@ -115,18 +115,18 @@
*/
#if CONST_BITS == 13
-#define FIX_0_298631336 ((JLONG) 2446) /* FIX(0.298631336) */
-#define FIX_0_390180644 ((JLONG) 3196) /* FIX(0.390180644) */
-#define FIX_0_541196100 ((JLONG) 4433) /* FIX(0.541196100) */
-#define FIX_0_765366865 ((JLONG) 6270) /* FIX(0.765366865) */
-#define FIX_0_899976223 ((JLONG) 7373) /* FIX(0.899976223) */
-#define FIX_1_175875602 ((JLONG) 9633) /* FIX(1.175875602) */
-#define FIX_1_501321110 ((JLONG) 12299) /* FIX(1.501321110) */
-#define FIX_1_847759065 ((JLONG) 15137) /* FIX(1.847759065) */
-#define FIX_1_961570560 ((JLONG) 16069) /* FIX(1.961570560) */
-#define FIX_2_053119869 ((JLONG) 16819) /* FIX(2.053119869) */
-#define FIX_2_562915447 ((JLONG) 20995) /* FIX(2.562915447) */
-#define FIX_3_072711026 ((JLONG) 25172) /* FIX(3.072711026) */
+#define FIX_0_298631336 ((JLONG)2446) /* FIX(0.298631336) */
+#define FIX_0_390180644 ((JLONG)3196) /* FIX(0.390180644) */
+#define FIX_0_541196100 ((JLONG)4433) /* FIX(0.541196100) */
+#define FIX_0_765366865 ((JLONG)6270) /* FIX(0.765366865) */
+#define FIX_0_899976223 ((JLONG)7373) /* FIX(0.899976223) */
+#define FIX_1_175875602 ((JLONG)9633) /* FIX(1.175875602) */
+#define FIX_1_501321110 ((JLONG)12299) /* FIX(1.501321110) */
+#define FIX_1_847759065 ((JLONG)15137) /* FIX(1.847759065) */
+#define FIX_1_961570560 ((JLONG)16069) /* FIX(1.961570560) */
+#define FIX_2_053119869 ((JLONG)16819) /* FIX(2.053119869) */
+#define FIX_2_562915447 ((JLONG)20995) /* FIX(2.562915447) */
+#define FIX_3_072711026 ((JLONG)25172) /* FIX(3.072711026) */
#else
#define FIX_0_298631336 FIX(0.298631336)
#define FIX_0_390180644 FIX(0.390180644)
@@ -151,9 +151,9 @@
*/
#if BITS_IN_JSAMPLE == 8
-#define MULTIPLY(var,const) MULTIPLY16C16(var,const)
+#define MULTIPLY(var, const) MULTIPLY16C16(var, const)
#else
-#define MULTIPLY(var,const) ((var) * (const))
+#define MULTIPLY(var, const) ((var) * (const))
#endif
@@ -162,7 +162,7 @@
* are 16 bits or less, so either int or short multiply will work.
*/
-#define DEQUANTIZE(coef,quantval) (((ISLOW_MULT_TYPE) (coef)) * (quantval))
+#define DEQUANTIZE(coef, quantval) (((ISLOW_MULT_TYPE)(coef)) * (quantval))
/*
@@ -170,9 +170,9 @@
*/
GLOBAL(void)
-jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block,
- JSAMPARRAY output_buf, JDIMENSION output_col)
+jpeg_idct_islow(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
{
JLONG tmp0, tmp1, tmp2, tmp3;
JLONG tmp10, tmp11, tmp12, tmp13;
@@ -191,7 +191,7 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* furthermore, we scale the results by 2**PASS1_BITS. */
inptr = coef_block;
- quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
+ quantptr = (ISLOW_MULT_TYPE *)compptr->dct_table;
wsptr = workspace;
for (ctr = DCTSIZE; ctr > 0; ctr--) {
/* Due to quantization, we will usually find that many of the input
@@ -203,22 +203,22 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info *compptr,
* column DCT calculations can be simplified this way.
*/
- if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 &&
- inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 &&
- inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 &&
- inptr[DCTSIZE*7] == 0) {
+ if (inptr[DCTSIZE * 1] == 0 && inptr[DCTSIZE * 2] == 0 &&
+ inptr[DCTSIZE * 3] == 0 && inptr[DCTSIZE * 4] == 0 &&
+ inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 6] == 0 &&
+ inptr[DCTSIZE * 7] == 0) {
/* AC terms all zero */
- int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]),
- PASS1_BITS);
-
- wsptr[DCTSIZE*0] = dcval;
- wsptr[DCTSIZE*1] = dcval;
- wsptr[DCTSIZE*2] = dcval;
- wsptr[DCTSIZE*3] = dcval;
- wsptr[DCTSIZE*4] = dcval;
- wsptr[DCTSIZE*5] = dcval;
- wsptr[DCTSIZE*6] = dcval;
- wsptr[DCTSIZE*7] = dcval;
+ int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE * 0],
+ quantptr[DCTSIZE * 0]), PASS1_BITS);
+
+ wsptr[DCTSIZE * 0] = dcval;
+ wsptr[DCTSIZE * 1] = dcval;
+ wsptr[DCTSIZE * 2] = dcval;
+ wsptr[DCTSIZE * 3] = dcval;
+ wsptr[DCTSIZE * 4] = dcval;
+ wsptr[DCTSIZE * 5] = dcval;
+ wsptr[DCTSIZE * 6] = dcval;
+ wsptr[DCTSIZE * 7] = dcval;
inptr++; /* advance pointers to next column */
quantptr++;
@@ -229,15 +229,15 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Even part: reverse the even part of the forward DCT. */
/* The rotator is sqrt(2)*c(-6). */
- z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
- z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
+ z2 = DEQUANTIZE(inptr[DCTSIZE * 2], quantptr[DCTSIZE * 2]);
+ z3 = DEQUANTIZE(inptr[DCTSIZE * 6], quantptr[DCTSIZE * 6]);
z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
- tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065);
+ tmp2 = z1 + MULTIPLY(z3, -FIX_1_847759065);
tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
- z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
- z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
+ z2 = DEQUANTIZE(inptr[DCTSIZE * 0], quantptr[DCTSIZE * 0]);
+ z3 = DEQUANTIZE(inptr[DCTSIZE * 4], quantptr[DCTSIZE * 4]);
tmp0 = LEFT_SHIFT(z2 + z3, CONST_BITS);
tmp1 = LEFT_SHIFT(z2 - z3, CONST_BITS);
@@ -251,10 +251,10 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info *compptr,
* transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
*/
- tmp0 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
- tmp1 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
- tmp2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
- tmp3 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
+ tmp0 = DEQUANTIZE(inptr[DCTSIZE * 7], quantptr[DCTSIZE * 7]);
+ tmp1 = DEQUANTIZE(inptr[DCTSIZE * 5], quantptr[DCTSIZE * 5]);
+ tmp2 = DEQUANTIZE(inptr[DCTSIZE * 3], quantptr[DCTSIZE * 3]);
+ tmp3 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1]);
z1 = tmp0 + tmp3;
z2 = tmp1 + tmp2;
@@ -266,10 +266,10 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info *compptr,
tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
- z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
- z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
- z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
- z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
+ z1 = MULTIPLY(z1, -FIX_0_899976223); /* sqrt(2) * ( c7-c3) */
+ z2 = MULTIPLY(z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
+ z3 = MULTIPLY(z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
+ z4 = MULTIPLY(z4, -FIX_0_390180644); /* sqrt(2) * ( c5-c3) */
z3 += z5;
z4 += z5;
@@ -281,14 +281,14 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
- wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS);
- wsptr[DCTSIZE*7] = (int) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS);
- wsptr[DCTSIZE*1] = (int) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS);
- wsptr[DCTSIZE*6] = (int) DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS);
- wsptr[DCTSIZE*2] = (int) DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS);
- wsptr[DCTSIZE*5] = (int) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS);
- wsptr[DCTSIZE*3] = (int) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS);
- wsptr[DCTSIZE*4] = (int) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS);
+ wsptr[DCTSIZE * 0] = (int)DESCALE(tmp10 + tmp3, CONST_BITS - PASS1_BITS);
+ wsptr[DCTSIZE * 7] = (int)DESCALE(tmp10 - tmp3, CONST_BITS - PASS1_BITS);
+ wsptr[DCTSIZE * 1] = (int)DESCALE(tmp11 + tmp2, CONST_BITS - PASS1_BITS);
+ wsptr[DCTSIZE * 6] = (int)DESCALE(tmp11 - tmp2, CONST_BITS - PASS1_BITS);
+ wsptr[DCTSIZE * 2] = (int)DESCALE(tmp12 + tmp1, CONST_BITS - PASS1_BITS);
+ wsptr[DCTSIZE * 5] = (int)DESCALE(tmp12 - tmp1, CONST_BITS - PASS1_BITS);
+ wsptr[DCTSIZE * 3] = (int)DESCALE(tmp13 + tmp0, CONST_BITS - PASS1_BITS);
+ wsptr[DCTSIZE * 4] = (int)DESCALE(tmp13 - tmp0, CONST_BITS - PASS1_BITS);
inptr++; /* advance pointers to next column */
quantptr++;
@@ -314,8 +314,8 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info *compptr,
if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 &&
wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
/* AC terms all zero */
- JSAMPLE dcval = range_limit[(int) DESCALE((JLONG) wsptr[0], PASS1_BITS+3)
- & RANGE_MASK];
+ JSAMPLE dcval = range_limit[(int)DESCALE((JLONG)wsptr[0],
+ PASS1_BITS + 3) & RANGE_MASK];
outptr[0] = dcval;
outptr[1] = dcval;
@@ -334,15 +334,15 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Even part: reverse the even part of the forward DCT. */
/* The rotator is sqrt(2)*c(-6). */
- z2 = (JLONG) wsptr[2];
- z3 = (JLONG) wsptr[6];
+ z2 = (JLONG)wsptr[2];
+ z3 = (JLONG)wsptr[6];
z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
- tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065);
+ tmp2 = z1 + MULTIPLY(z3, -FIX_1_847759065);
tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
- tmp0 = LEFT_SHIFT((JLONG) wsptr[0] + (JLONG) wsptr[4], CONST_BITS);
- tmp1 = LEFT_SHIFT((JLONG) wsptr[0] - (JLONG) wsptr[4], CONST_BITS);
+ tmp0 = LEFT_SHIFT((JLONG)wsptr[0] + (JLONG)wsptr[4], CONST_BITS);
+ tmp1 = LEFT_SHIFT((JLONG)wsptr[0] - (JLONG)wsptr[4], CONST_BITS);
tmp10 = tmp0 + tmp3;
tmp13 = tmp0 - tmp3;
@@ -353,10 +353,10 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info *compptr,
* transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
*/
- tmp0 = (JLONG) wsptr[7];
- tmp1 = (JLONG) wsptr[5];
- tmp2 = (JLONG) wsptr[3];
- tmp3 = (JLONG) wsptr[1];
+ tmp0 = (JLONG)wsptr[7];
+ tmp1 = (JLONG)wsptr[5];
+ tmp2 = (JLONG)wsptr[3];
+ tmp3 = (JLONG)wsptr[1];
z1 = tmp0 + tmp3;
z2 = tmp1 + tmp2;
@@ -368,10 +368,10 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info *compptr,
tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
- z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
- z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
- z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
- z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
+ z1 = MULTIPLY(z1, -FIX_0_899976223); /* sqrt(2) * ( c7-c3) */
+ z2 = MULTIPLY(z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
+ z3 = MULTIPLY(z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
+ z4 = MULTIPLY(z4, -FIX_0_390180644); /* sqrt(2) * ( c5-c3) */
z3 += z5;
z4 += z5;
@@ -383,30 +383,30 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
- outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp3,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[7] = range_limit[(int) DESCALE(tmp10 - tmp3,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[1] = range_limit[(int) DESCALE(tmp11 + tmp2,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[6] = range_limit[(int) DESCALE(tmp11 - tmp2,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[2] = range_limit[(int) DESCALE(tmp12 + tmp1,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[5] = range_limit[(int) DESCALE(tmp12 - tmp1,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[3] = range_limit[(int) DESCALE(tmp13 + tmp0,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[4] = range_limit[(int) DESCALE(tmp13 - tmp0,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
+ outptr[0] = range_limit[(int)DESCALE(tmp10 + tmp3,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[7] = range_limit[(int)DESCALE(tmp10 - tmp3,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[1] = range_limit[(int)DESCALE(tmp11 + tmp2,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[6] = range_limit[(int)DESCALE(tmp11 - tmp2,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[2] = range_limit[(int)DESCALE(tmp12 + tmp1,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[5] = range_limit[(int)DESCALE(tmp12 - tmp1,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[3] = range_limit[(int)DESCALE(tmp13 + tmp0,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[4] = range_limit[(int)DESCALE(tmp13 - tmp0,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
wsptr += DCTSIZE; /* advance pointer to next row */
}
@@ -424,9 +424,9 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info *compptr,
*/
GLOBAL(void)
-jpeg_idct_7x7 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block,
- JSAMPARRAY output_buf, JDIMENSION output_col)
+jpeg_idct_7x7(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
{
JLONG tmp0, tmp1, tmp2, tmp10, tmp11, tmp12, tmp13;
JLONG z1, z2, z3;
@@ -436,25 +436,25 @@ jpeg_idct_7x7 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
JSAMPROW outptr;
JSAMPLE *range_limit = IDCT_range_limit(cinfo);
int ctr;
- int workspace[7*7]; /* buffers data between passes */
+ int workspace[7 * 7]; /* buffers data between passes */
SHIFT_TEMPS
/* Pass 1: process columns from input, store into work array. */
inptr = coef_block;
- quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
+ quantptr = (ISLOW_MULT_TYPE *)compptr->dct_table;
wsptr = workspace;
for (ctr = 0; ctr < 7; ctr++, inptr++, quantptr++, wsptr++) {
/* Even part */
- tmp13 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
+ tmp13 = DEQUANTIZE(inptr[DCTSIZE * 0], quantptr[DCTSIZE * 0]);
tmp13 = LEFT_SHIFT(tmp13, CONST_BITS);
/* Add fudge factor here for final descale. */
- tmp13 += ONE << (CONST_BITS-PASS1_BITS-1);
+ tmp13 += ONE << (CONST_BITS - PASS1_BITS - 1);
- z1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
- z2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
- z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
+ z1 = DEQUANTIZE(inptr[DCTSIZE * 2], quantptr[DCTSIZE * 2]);
+ z2 = DEQUANTIZE(inptr[DCTSIZE * 4], quantptr[DCTSIZE * 4]);
+ z3 = DEQUANTIZE(inptr[DCTSIZE * 6], quantptr[DCTSIZE * 6]);
tmp10 = MULTIPLY(z2 - z3, FIX(0.881747734)); /* c4 */
tmp12 = MULTIPLY(z1 - z2, FIX(0.314692123)); /* c6 */
@@ -468,15 +468,15 @@ jpeg_idct_7x7 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Odd part */
- z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
- z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
- z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
+ z1 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1]);
+ z2 = DEQUANTIZE(inptr[DCTSIZE * 3], quantptr[DCTSIZE * 3]);
+ z3 = DEQUANTIZE(inptr[DCTSIZE * 5], quantptr[DCTSIZE * 5]);
tmp1 = MULTIPLY(z1 + z2, FIX(0.935414347)); /* (c3+c1-c5)/2 */
tmp2 = MULTIPLY(z1 - z2, FIX(0.170262339)); /* (c3+c5-c1)/2 */
tmp0 = tmp1 - tmp2;
tmp1 += tmp2;
- tmp2 = MULTIPLY(z2 + z3, - FIX(1.378756276)); /* -c1 */
+ tmp2 = MULTIPLY(z2 + z3, -FIX(1.378756276)); /* -c1 */
tmp1 += tmp2;
z2 = MULTIPLY(z1 + z3, FIX(0.613604268)); /* c5 */
tmp0 += z2;
@@ -484,13 +484,13 @@ jpeg_idct_7x7 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */
- wsptr[7*0] = (int) RIGHT_SHIFT(tmp10 + tmp0, CONST_BITS-PASS1_BITS);
- wsptr[7*6] = (int) RIGHT_SHIFT(tmp10 - tmp0, CONST_BITS-PASS1_BITS);
- wsptr[7*1] = (int) RIGHT_SHIFT(tmp11 + tmp1, CONST_BITS-PASS1_BITS);
- wsptr[7*5] = (int) RIGHT_SHIFT(tmp11 - tmp1, CONST_BITS-PASS1_BITS);
- wsptr[7*2] = (int) RIGHT_SHIFT(tmp12 + tmp2, CONST_BITS-PASS1_BITS);
- wsptr[7*4] = (int) RIGHT_SHIFT(tmp12 - tmp2, CONST_BITS-PASS1_BITS);
- wsptr[7*3] = (int) RIGHT_SHIFT(tmp13, CONST_BITS-PASS1_BITS);
+ wsptr[7 * 0] = (int)RIGHT_SHIFT(tmp10 + tmp0, CONST_BITS - PASS1_BITS);
+ wsptr[7 * 6] = (int)RIGHT_SHIFT(tmp10 - tmp0, CONST_BITS - PASS1_BITS);
+ wsptr[7 * 1] = (int)RIGHT_SHIFT(tmp11 + tmp1, CONST_BITS - PASS1_BITS);
+ wsptr[7 * 5] = (int)RIGHT_SHIFT(tmp11 - tmp1, CONST_BITS - PASS1_BITS);
+ wsptr[7 * 2] = (int)RIGHT_SHIFT(tmp12 + tmp2, CONST_BITS - PASS1_BITS);
+ wsptr[7 * 4] = (int)RIGHT_SHIFT(tmp12 - tmp2, CONST_BITS - PASS1_BITS);
+ wsptr[7 * 3] = (int)RIGHT_SHIFT(tmp13, CONST_BITS - PASS1_BITS);
}
/* Pass 2: process 7 rows from work array, store into output array. */
@@ -502,12 +502,12 @@ jpeg_idct_7x7 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Even part */
/* Add fudge factor here for final descale. */
- tmp13 = (JLONG) wsptr[0] + (ONE << (PASS1_BITS+2));
+ tmp13 = (JLONG)wsptr[0] + (ONE << (PASS1_BITS + 2));
tmp13 = LEFT_SHIFT(tmp13, CONST_BITS);
- z1 = (JLONG) wsptr[2];
- z2 = (JLONG) wsptr[4];
- z3 = (JLONG) wsptr[6];
+ z1 = (JLONG)wsptr[2];
+ z2 = (JLONG)wsptr[4];
+ z3 = (JLONG)wsptr[6];
tmp10 = MULTIPLY(z2 - z3, FIX(0.881747734)); /* c4 */
tmp12 = MULTIPLY(z1 - z2, FIX(0.314692123)); /* c6 */
@@ -521,15 +521,15 @@ jpeg_idct_7x7 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Odd part */
- z1 = (JLONG) wsptr[1];
- z2 = (JLONG) wsptr[3];
- z3 = (JLONG) wsptr[5];
+ z1 = (JLONG)wsptr[1];
+ z2 = (JLONG)wsptr[3];
+ z3 = (JLONG)wsptr[5];
tmp1 = MULTIPLY(z1 + z2, FIX(0.935414347)); /* (c3+c1-c5)/2 */
tmp2 = MULTIPLY(z1 - z2, FIX(0.170262339)); /* (c3+c5-c1)/2 */
tmp0 = tmp1 - tmp2;
tmp1 += tmp2;
- tmp2 = MULTIPLY(z2 + z3, - FIX(1.378756276)); /* -c1 */
+ tmp2 = MULTIPLY(z2 + z3, -FIX(1.378756276)); /* -c1 */
tmp1 += tmp2;
z2 = MULTIPLY(z1 + z3, FIX(0.613604268)); /* c5 */
tmp0 += z2;
@@ -537,27 +537,27 @@ jpeg_idct_7x7 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */
- outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp11 + tmp1,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp11 - tmp1,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12 + tmp2,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp12 - tmp2,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp13,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
+ outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp10 + tmp0,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp10 - tmp0,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp11 + tmp1,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp11 - tmp1,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp12 + tmp2,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp12 - tmp2,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp13,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
wsptr += 7; /* advance pointer to next row */
}
@@ -573,9 +573,9 @@ jpeg_idct_7x7 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
*/
GLOBAL(void)
-jpeg_idct_6x6 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block,
- JSAMPARRAY output_buf, JDIMENSION output_col)
+jpeg_idct_6x6(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
{
JLONG tmp0, tmp1, tmp2, tmp10, tmp11, tmp12;
JLONG z1, z2, z3;
@@ -585,35 +585,35 @@ jpeg_idct_6x6 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
JSAMPROW outptr;
JSAMPLE *range_limit = IDCT_range_limit(cinfo);
int ctr;
- int workspace[6*6]; /* buffers data between passes */
+ int workspace[6 * 6]; /* buffers data between passes */
SHIFT_TEMPS
/* Pass 1: process columns from input, store into work array. */
inptr = coef_block;
- quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
+ quantptr = (ISLOW_MULT_TYPE *)compptr->dct_table;
wsptr = workspace;
for (ctr = 0; ctr < 6; ctr++, inptr++, quantptr++, wsptr++) {
/* Even part */
- tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
+ tmp0 = DEQUANTIZE(inptr[DCTSIZE * 0], quantptr[DCTSIZE * 0]);
tmp0 = LEFT_SHIFT(tmp0, CONST_BITS);
/* Add fudge factor here for final descale. */
- tmp0 += ONE << (CONST_BITS-PASS1_BITS-1);
- tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
+ tmp0 += ONE << (CONST_BITS - PASS1_BITS - 1);
+ tmp2 = DEQUANTIZE(inptr[DCTSIZE * 4], quantptr[DCTSIZE * 4]);
tmp10 = MULTIPLY(tmp2, FIX(0.707106781)); /* c4 */
tmp1 = tmp0 + tmp10;
- tmp11 = RIGHT_SHIFT(tmp0 - tmp10 - tmp10, CONST_BITS-PASS1_BITS);
- tmp10 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
+ tmp11 = RIGHT_SHIFT(tmp0 - tmp10 - tmp10, CONST_BITS - PASS1_BITS);
+ tmp10 = DEQUANTIZE(inptr[DCTSIZE * 2], quantptr[DCTSIZE * 2]);
tmp0 = MULTIPLY(tmp10, FIX(1.224744871)); /* c2 */
tmp10 = tmp1 + tmp0;
tmp12 = tmp1 - tmp0;
/* Odd part */
- z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
- z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
- z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
+ z1 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1]);
+ z2 = DEQUANTIZE(inptr[DCTSIZE * 3], quantptr[DCTSIZE * 3]);
+ z3 = DEQUANTIZE(inptr[DCTSIZE * 5], quantptr[DCTSIZE * 5]);
tmp1 = MULTIPLY(z1 + z3, FIX(0.366025404)); /* c5 */
tmp0 = tmp1 + LEFT_SHIFT(z1 + z2, CONST_BITS);
tmp2 = tmp1 + LEFT_SHIFT(z3 - z2, CONST_BITS);
@@ -621,12 +621,12 @@ jpeg_idct_6x6 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */
- wsptr[6*0] = (int) RIGHT_SHIFT(tmp10 + tmp0, CONST_BITS-PASS1_BITS);
- wsptr[6*5] = (int) RIGHT_SHIFT(tmp10 - tmp0, CONST_BITS-PASS1_BITS);
- wsptr[6*1] = (int) (tmp11 + tmp1);
- wsptr[6*4] = (int) (tmp11 - tmp1);
- wsptr[6*2] = (int) RIGHT_SHIFT(tmp12 + tmp2, CONST_BITS-PASS1_BITS);
- wsptr[6*3] = (int) RIGHT_SHIFT(tmp12 - tmp2, CONST_BITS-PASS1_BITS);
+ wsptr[6 * 0] = (int)RIGHT_SHIFT(tmp10 + tmp0, CONST_BITS - PASS1_BITS);
+ wsptr[6 * 5] = (int)RIGHT_SHIFT(tmp10 - tmp0, CONST_BITS - PASS1_BITS);
+ wsptr[6 * 1] = (int)(tmp11 + tmp1);
+ wsptr[6 * 4] = (int)(tmp11 - tmp1);
+ wsptr[6 * 2] = (int)RIGHT_SHIFT(tmp12 + tmp2, CONST_BITS - PASS1_BITS);
+ wsptr[6 * 3] = (int)RIGHT_SHIFT(tmp12 - tmp2, CONST_BITS - PASS1_BITS);
}
/* Pass 2: process 6 rows from work array, store into output array. */
@@ -638,22 +638,22 @@ jpeg_idct_6x6 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Even part */
/* Add fudge factor here for final descale. */
- tmp0 = (JLONG) wsptr[0] + (ONE << (PASS1_BITS+2));
+ tmp0 = (JLONG)wsptr[0] + (ONE << (PASS1_BITS + 2));
tmp0 = LEFT_SHIFT(tmp0, CONST_BITS);
- tmp2 = (JLONG) wsptr[4];
+ tmp2 = (JLONG)wsptr[4];
tmp10 = MULTIPLY(tmp2, FIX(0.707106781)); /* c4 */
tmp1 = tmp0 + tmp10;
tmp11 = tmp0 - tmp10 - tmp10;
- tmp10 = (JLONG) wsptr[2];
+ tmp10 = (JLONG)wsptr[2];
tmp0 = MULTIPLY(tmp10, FIX(1.224744871)); /* c2 */
tmp10 = tmp1 + tmp0;
tmp12 = tmp1 - tmp0;
/* Odd part */
- z1 = (JLONG) wsptr[1];
- z2 = (JLONG) wsptr[3];
- z3 = (JLONG) wsptr[5];
+ z1 = (JLONG)wsptr[1];
+ z2 = (JLONG)wsptr[3];
+ z3 = (JLONG)wsptr[5];
tmp1 = MULTIPLY(z1 + z3, FIX(0.366025404)); /* c5 */
tmp0 = tmp1 + LEFT_SHIFT(z1 + z2, CONST_BITS);
tmp2 = tmp1 + LEFT_SHIFT(z3 - z2, CONST_BITS);
@@ -661,24 +661,24 @@ jpeg_idct_6x6 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */
- outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp11 + tmp1,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp11 - tmp1,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12 + tmp2,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp12 - tmp2,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
+ outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp10 + tmp0,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp10 - tmp0,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp11 + tmp1,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp11 - tmp1,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp12 + tmp2,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp12 - tmp2,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
wsptr += 6; /* advance pointer to next row */
}
@@ -694,9 +694,9 @@ jpeg_idct_6x6 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
*/
GLOBAL(void)
-jpeg_idct_5x5 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block,
- JSAMPARRAY output_buf, JDIMENSION output_col)
+jpeg_idct_5x5(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
{
JLONG tmp0, tmp1, tmp10, tmp11, tmp12;
JLONG z1, z2, z3;
@@ -706,23 +706,23 @@ jpeg_idct_5x5 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
JSAMPROW outptr;
JSAMPLE *range_limit = IDCT_range_limit(cinfo);
int ctr;
- int workspace[5*5]; /* buffers data between passes */
+ int workspace[5 * 5]; /* buffers data between passes */
SHIFT_TEMPS
/* Pass 1: process columns from input, store into work array. */
inptr = coef_block;
- quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
+ quantptr = (ISLOW_MULT_TYPE *)compptr->dct_table;
wsptr = workspace;
for (ctr = 0; ctr < 5; ctr++, inptr++, quantptr++, wsptr++) {
/* Even part */
- tmp12 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
+ tmp12 = DEQUANTIZE(inptr[DCTSIZE * 0], quantptr[DCTSIZE * 0]);
tmp12 = LEFT_SHIFT(tmp12, CONST_BITS);
/* Add fudge factor here for final descale. */
- tmp12 += ONE << (CONST_BITS-PASS1_BITS-1);
- tmp0 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
- tmp1 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
+ tmp12 += ONE << (CONST_BITS - PASS1_BITS - 1);
+ tmp0 = DEQUANTIZE(inptr[DCTSIZE * 2], quantptr[DCTSIZE * 2]);
+ tmp1 = DEQUANTIZE(inptr[DCTSIZE * 4], quantptr[DCTSIZE * 4]);
z1 = MULTIPLY(tmp0 + tmp1, FIX(0.790569415)); /* (c2+c4)/2 */
z2 = MULTIPLY(tmp0 - tmp1, FIX(0.353553391)); /* (c2-c4)/2 */
z3 = tmp12 + z2;
@@ -732,8 +732,8 @@ jpeg_idct_5x5 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Odd part */
- z2 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
- z3 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
+ z2 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1]);
+ z3 = DEQUANTIZE(inptr[DCTSIZE * 3], quantptr[DCTSIZE * 3]);
z1 = MULTIPLY(z2 + z3, FIX(0.831253876)); /* c3 */
tmp0 = z1 + MULTIPLY(z2, FIX(0.513743148)); /* c1-c3 */
@@ -741,11 +741,11 @@ jpeg_idct_5x5 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */
- wsptr[5*0] = (int) RIGHT_SHIFT(tmp10 + tmp0, CONST_BITS-PASS1_BITS);
- wsptr[5*4] = (int) RIGHT_SHIFT(tmp10 - tmp0, CONST_BITS-PASS1_BITS);
- wsptr[5*1] = (int) RIGHT_SHIFT(tmp11 + tmp1, CONST_BITS-PASS1_BITS);
- wsptr[5*3] = (int) RIGHT_SHIFT(tmp11 - tmp1, CONST_BITS-PASS1_BITS);
- wsptr[5*2] = (int) RIGHT_SHIFT(tmp12, CONST_BITS-PASS1_BITS);
+ wsptr[5 * 0] = (int)RIGHT_SHIFT(tmp10 + tmp0, CONST_BITS - PASS1_BITS);
+ wsptr[5 * 4] = (int)RIGHT_SHIFT(tmp10 - tmp0, CONST_BITS - PASS1_BITS);
+ wsptr[5 * 1] = (int)RIGHT_SHIFT(tmp11 + tmp1, CONST_BITS - PASS1_BITS);
+ wsptr[5 * 3] = (int)RIGHT_SHIFT(tmp11 - tmp1, CONST_BITS - PASS1_BITS);
+ wsptr[5 * 2] = (int)RIGHT_SHIFT(tmp12, CONST_BITS - PASS1_BITS);
}
/* Pass 2: process 5 rows from work array, store into output array. */
@@ -757,10 +757,10 @@ jpeg_idct_5x5 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Even part */
/* Add fudge factor here for final descale. */
- tmp12 = (JLONG) wsptr[0] + (ONE << (PASS1_BITS+2));
+ tmp12 = (JLONG)wsptr[0] + (ONE << (PASS1_BITS + 2));
tmp12 = LEFT_SHIFT(tmp12, CONST_BITS);
- tmp0 = (JLONG) wsptr[2];
- tmp1 = (JLONG) wsptr[4];
+ tmp0 = (JLONG)wsptr[2];
+ tmp1 = (JLONG)wsptr[4];
z1 = MULTIPLY(tmp0 + tmp1, FIX(0.790569415)); /* (c2+c4)/2 */
z2 = MULTIPLY(tmp0 - tmp1, FIX(0.353553391)); /* (c2-c4)/2 */
z3 = tmp12 + z2;
@@ -770,8 +770,8 @@ jpeg_idct_5x5 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Odd part */
- z2 = (JLONG) wsptr[1];
- z3 = (JLONG) wsptr[3];
+ z2 = (JLONG)wsptr[1];
+ z3 = (JLONG)wsptr[3];
z1 = MULTIPLY(z2 + z3, FIX(0.831253876)); /* c3 */
tmp0 = z1 + MULTIPLY(z2, FIX(0.513743148)); /* c1-c3 */
@@ -779,21 +779,21 @@ jpeg_idct_5x5 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */
- outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp11 + tmp1,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp11 - tmp1,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
+ outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp10 + tmp0,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp10 - tmp0,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp11 + tmp1,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp11 - tmp1,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp12,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
wsptr += 5; /* advance pointer to next row */
}
@@ -809,9 +809,9 @@ jpeg_idct_5x5 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
*/
GLOBAL(void)
-jpeg_idct_3x3 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block,
- JSAMPARRAY output_buf, JDIMENSION output_col)
+jpeg_idct_3x3(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
{
JLONG tmp0, tmp2, tmp10, tmp12;
JCOEFPTR inptr;
@@ -820,36 +820,36 @@ jpeg_idct_3x3 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
JSAMPROW outptr;
JSAMPLE *range_limit = IDCT_range_limit(cinfo);
int ctr;
- int workspace[3*3]; /* buffers data between passes */
+ int workspace[3 * 3]; /* buffers data between passes */
SHIFT_TEMPS
/* Pass 1: process columns from input, store into work array. */
inptr = coef_block;
- quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
+ quantptr = (ISLOW_MULT_TYPE *)compptr->dct_table;
wsptr = workspace;
for (ctr = 0; ctr < 3; ctr++, inptr++, quantptr++, wsptr++) {
/* Even part */
- tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
+ tmp0 = DEQUANTIZE(inptr[DCTSIZE * 0], quantptr[DCTSIZE * 0]);
tmp0 = LEFT_SHIFT(tmp0, CONST_BITS);
/* Add fudge factor here for final descale. */
- tmp0 += ONE << (CONST_BITS-PASS1_BITS-1);
- tmp2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
+ tmp0 += ONE << (CONST_BITS - PASS1_BITS - 1);
+ tmp2 = DEQUANTIZE(inptr[DCTSIZE * 2], quantptr[DCTSIZE * 2]);
tmp12 = MULTIPLY(tmp2, FIX(0.707106781)); /* c2 */
tmp10 = tmp0 + tmp12;
tmp2 = tmp0 - tmp12 - tmp12;
/* Odd part */
- tmp12 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
+ tmp12 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1]);
tmp0 = MULTIPLY(tmp12, FIX(1.224744871)); /* c1 */
/* Final output stage */
- wsptr[3*0] = (int) RIGHT_SHIFT(tmp10 + tmp0, CONST_BITS-PASS1_BITS);
- wsptr[3*2] = (int) RIGHT_SHIFT(tmp10 - tmp0, CONST_BITS-PASS1_BITS);
- wsptr[3*1] = (int) RIGHT_SHIFT(tmp2, CONST_BITS-PASS1_BITS);
+ wsptr[3 * 0] = (int)RIGHT_SHIFT(tmp10 + tmp0, CONST_BITS - PASS1_BITS);
+ wsptr[3 * 2] = (int)RIGHT_SHIFT(tmp10 - tmp0, CONST_BITS - PASS1_BITS);
+ wsptr[3 * 1] = (int)RIGHT_SHIFT(tmp2, CONST_BITS - PASS1_BITS);
}
/* Pass 2: process 3 rows from work array, store into output array. */
@@ -861,29 +861,29 @@ jpeg_idct_3x3 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Even part */
/* Add fudge factor here for final descale. */
- tmp0 = (JLONG) wsptr[0] + (ONE << (PASS1_BITS+2));
+ tmp0 = (JLONG)wsptr[0] + (ONE << (PASS1_BITS + 2));
tmp0 = LEFT_SHIFT(tmp0, CONST_BITS);
- tmp2 = (JLONG) wsptr[2];
+ tmp2 = (JLONG)wsptr[2];
tmp12 = MULTIPLY(tmp2, FIX(0.707106781)); /* c2 */
tmp10 = tmp0 + tmp12;
tmp2 = tmp0 - tmp12 - tmp12;
/* Odd part */
- tmp12 = (JLONG) wsptr[1];
+ tmp12 = (JLONG)wsptr[1];
tmp0 = MULTIPLY(tmp12, FIX(1.224744871)); /* c1 */
/* Final output stage */
- outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp2,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
+ outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp10 + tmp0,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp10 - tmp0,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp2,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
wsptr += 3; /* advance pointer to next row */
}
@@ -899,9 +899,9 @@ jpeg_idct_3x3 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
*/
GLOBAL(void)
-jpeg_idct_9x9 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block,
- JSAMPARRAY output_buf, JDIMENSION output_col)
+jpeg_idct_9x9(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
{
JLONG tmp0, tmp1, tmp2, tmp3, tmp10, tmp11, tmp12, tmp13, tmp14;
JLONG z1, z2, z3, z4;
@@ -911,25 +911,25 @@ jpeg_idct_9x9 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
JSAMPROW outptr;
JSAMPLE *range_limit = IDCT_range_limit(cinfo);
int ctr;
- int workspace[8*9]; /* buffers data between passes */
+ int workspace[8 * 9]; /* buffers data between passes */
SHIFT_TEMPS
/* Pass 1: process columns from input, store into work array. */
inptr = coef_block;
- quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
+ quantptr = (ISLOW_MULT_TYPE *)compptr->dct_table;
wsptr = workspace;
for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) {
/* Even part */
- tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
+ tmp0 = DEQUANTIZE(inptr[DCTSIZE * 0], quantptr[DCTSIZE * 0]);
tmp0 = LEFT_SHIFT(tmp0, CONST_BITS);
/* Add fudge factor here for final descale. */
- tmp0 += ONE << (CONST_BITS-PASS1_BITS-1);
+ tmp0 += ONE << (CONST_BITS - PASS1_BITS - 1);
- z1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
- z2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
- z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
+ z1 = DEQUANTIZE(inptr[DCTSIZE * 2], quantptr[DCTSIZE * 2]);
+ z2 = DEQUANTIZE(inptr[DCTSIZE * 4], quantptr[DCTSIZE * 4]);
+ z3 = DEQUANTIZE(inptr[DCTSIZE * 6], quantptr[DCTSIZE * 6]);
tmp3 = MULTIPLY(z3, FIX(0.707106781)); /* c6 */
tmp1 = tmp0 + tmp3;
@@ -949,12 +949,12 @@ jpeg_idct_9x9 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Odd part */
- z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
- z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
- z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
- z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
+ z1 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1]);
+ z2 = DEQUANTIZE(inptr[DCTSIZE * 3], quantptr[DCTSIZE * 3]);
+ z3 = DEQUANTIZE(inptr[DCTSIZE * 5], quantptr[DCTSIZE * 5]);
+ z4 = DEQUANTIZE(inptr[DCTSIZE * 7], quantptr[DCTSIZE * 7]);
- z2 = MULTIPLY(z2, - FIX(1.224744871)); /* -c3 */
+ z2 = MULTIPLY(z2, -FIX(1.224744871)); /* -c3 */
tmp2 = MULTIPLY(z1 + z3, FIX(0.909038955)); /* c5 */
tmp3 = MULTIPLY(z1 + z4, FIX(0.483689525)); /* c7 */
@@ -966,15 +966,15 @@ jpeg_idct_9x9 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */
- wsptr[8*0] = (int) RIGHT_SHIFT(tmp10 + tmp0, CONST_BITS-PASS1_BITS);
- wsptr[8*8] = (int) RIGHT_SHIFT(tmp10 - tmp0, CONST_BITS-PASS1_BITS);
- wsptr[8*1] = (int) RIGHT_SHIFT(tmp11 + tmp1, CONST_BITS-PASS1_BITS);
- wsptr[8*7] = (int) RIGHT_SHIFT(tmp11 - tmp1, CONST_BITS-PASS1_BITS);
- wsptr[8*2] = (int) RIGHT_SHIFT(tmp12 + tmp2, CONST_BITS-PASS1_BITS);
- wsptr[8*6] = (int) RIGHT_SHIFT(tmp12 - tmp2, CONST_BITS-PASS1_BITS);
- wsptr[8*3] = (int) RIGHT_SHIFT(tmp13 + tmp3, CONST_BITS-PASS1_BITS);
- wsptr[8*5] = (int) RIGHT_SHIFT(tmp13 - tmp3, CONST_BITS-PASS1_BITS);
- wsptr[8*4] = (int) RIGHT_SHIFT(tmp14, CONST_BITS-PASS1_BITS);
+ wsptr[8 * 0] = (int)RIGHT_SHIFT(tmp10 + tmp0, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 8] = (int)RIGHT_SHIFT(tmp10 - tmp0, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 1] = (int)RIGHT_SHIFT(tmp11 + tmp1, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 7] = (int)RIGHT_SHIFT(tmp11 - tmp1, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 2] = (int)RIGHT_SHIFT(tmp12 + tmp2, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 6] = (int)RIGHT_SHIFT(tmp12 - tmp2, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 3] = (int)RIGHT_SHIFT(tmp13 + tmp3, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 5] = (int)RIGHT_SHIFT(tmp13 - tmp3, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 4] = (int)RIGHT_SHIFT(tmp14, CONST_BITS - PASS1_BITS);
}
/* Pass 2: process 9 rows from work array, store into output array. */
@@ -986,12 +986,12 @@ jpeg_idct_9x9 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Even part */
/* Add fudge factor here for final descale. */
- tmp0 = (JLONG) wsptr[0] + (ONE << (PASS1_BITS+2));
+ tmp0 = (JLONG)wsptr[0] + (ONE << (PASS1_BITS + 2));
tmp0 = LEFT_SHIFT(tmp0, CONST_BITS);
- z1 = (JLONG) wsptr[2];
- z2 = (JLONG) wsptr[4];
- z3 = (JLONG) wsptr[6];
+ z1 = (JLONG)wsptr[2];
+ z2 = (JLONG)wsptr[4];
+ z3 = (JLONG)wsptr[6];
tmp3 = MULTIPLY(z3, FIX(0.707106781)); /* c6 */
tmp1 = tmp0 + tmp3;
@@ -1011,12 +1011,12 @@ jpeg_idct_9x9 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Odd part */
- z1 = (JLONG) wsptr[1];
- z2 = (JLONG) wsptr[3];
- z3 = (JLONG) wsptr[5];
- z4 = (JLONG) wsptr[7];
+ z1 = (JLONG)wsptr[1];
+ z2 = (JLONG)wsptr[3];
+ z3 = (JLONG)wsptr[5];
+ z4 = (JLONG)wsptr[7];
- z2 = MULTIPLY(z2, - FIX(1.224744871)); /* -c3 */
+ z2 = MULTIPLY(z2, -FIX(1.224744871)); /* -c3 */
tmp2 = MULTIPLY(z1 + z3, FIX(0.909038955)); /* c5 */
tmp3 = MULTIPLY(z1 + z4, FIX(0.483689525)); /* c7 */
@@ -1028,33 +1028,33 @@ jpeg_idct_9x9 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */
- outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp11 + tmp1,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp11 - tmp1,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12 + tmp2,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp12 - tmp2,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp13 + tmp3,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp13 - tmp3,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp14,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
+ outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp10 + tmp0,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp10 - tmp0,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp11 + tmp1,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp11 - tmp1,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp12 + tmp2,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp12 - tmp2,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp13 + tmp3,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp13 - tmp3,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp14,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
wsptr += 8; /* advance pointer to next row */
}
@@ -1070,9 +1070,9 @@ jpeg_idct_9x9 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
*/
GLOBAL(void)
-jpeg_idct_10x10 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block,
- JSAMPARRAY output_buf, JDIMENSION output_col)
+jpeg_idct_10x10(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
{
JLONG tmp10, tmp11, tmp12, tmp13, tmp14;
JLONG tmp20, tmp21, tmp22, tmp23, tmp24;
@@ -1083,32 +1083,32 @@ jpeg_idct_10x10 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
JSAMPROW outptr;
JSAMPLE *range_limit = IDCT_range_limit(cinfo);
int ctr;
- int workspace[8*10]; /* buffers data between passes */
+ int workspace[8 * 10]; /* buffers data between passes */
SHIFT_TEMPS
/* Pass 1: process columns from input, store into work array. */
inptr = coef_block;
- quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
+ quantptr = (ISLOW_MULT_TYPE *)compptr->dct_table;
wsptr = workspace;
for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) {
/* Even part */
- z3 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
+ z3 = DEQUANTIZE(inptr[DCTSIZE * 0], quantptr[DCTSIZE * 0]);
z3 = LEFT_SHIFT(z3, CONST_BITS);
/* Add fudge factor here for final descale. */
- z3 += ONE << (CONST_BITS-PASS1_BITS-1);
- z4 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
+ z3 += ONE << (CONST_BITS - PASS1_BITS - 1);
+ z4 = DEQUANTIZE(inptr[DCTSIZE * 4], quantptr[DCTSIZE * 4]);
z1 = MULTIPLY(z4, FIX(1.144122806)); /* c4 */
z2 = MULTIPLY(z4, FIX(0.437016024)); /* c8 */
tmp10 = z3 + z1;
tmp11 = z3 - z2;
tmp22 = RIGHT_SHIFT(z3 - LEFT_SHIFT(z1 - z2, 1),
- CONST_BITS-PASS1_BITS); /* c0 = (c4-c8)*2 */
+ CONST_BITS - PASS1_BITS); /* c0 = (c4-c8)*2 */
- z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
- z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
+ z2 = DEQUANTIZE(inptr[DCTSIZE * 2], quantptr[DCTSIZE * 2]);
+ z3 = DEQUANTIZE(inptr[DCTSIZE * 6], quantptr[DCTSIZE * 6]);
z1 = MULTIPLY(z2 + z3, FIX(0.831253876)); /* c6 */
tmp12 = z1 + MULTIPLY(z2, FIX(0.513743148)); /* c2-c6 */
@@ -1121,10 +1121,10 @@ jpeg_idct_10x10 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Odd part */
- z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
- z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
- z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
- z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
+ z1 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1]);
+ z2 = DEQUANTIZE(inptr[DCTSIZE * 3], quantptr[DCTSIZE * 3]);
+ z3 = DEQUANTIZE(inptr[DCTSIZE * 5], quantptr[DCTSIZE * 5]);
+ z4 = DEQUANTIZE(inptr[DCTSIZE * 7], quantptr[DCTSIZE * 7]);
tmp11 = z2 + z4;
tmp13 = z2 - z4;
@@ -1148,16 +1148,16 @@ jpeg_idct_10x10 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */
- wsptr[8*0] = (int) RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS-PASS1_BITS);
- wsptr[8*9] = (int) RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS-PASS1_BITS);
- wsptr[8*1] = (int) RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS-PASS1_BITS);
- wsptr[8*8] = (int) RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS-PASS1_BITS);
- wsptr[8*2] = (int) (tmp22 + tmp12);
- wsptr[8*7] = (int) (tmp22 - tmp12);
- wsptr[8*3] = (int) RIGHT_SHIFT(tmp23 + tmp13, CONST_BITS-PASS1_BITS);
- wsptr[8*6] = (int) RIGHT_SHIFT(tmp23 - tmp13, CONST_BITS-PASS1_BITS);
- wsptr[8*4] = (int) RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS-PASS1_BITS);
- wsptr[8*5] = (int) RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS-PASS1_BITS);
+ wsptr[8 * 0] = (int)RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 9] = (int)RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 1] = (int)RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 8] = (int)RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 2] = (int)(tmp22 + tmp12);
+ wsptr[8 * 7] = (int)(tmp22 - tmp12);
+ wsptr[8 * 3] = (int)RIGHT_SHIFT(tmp23 + tmp13, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 6] = (int)RIGHT_SHIFT(tmp23 - tmp13, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 4] = (int)RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 5] = (int)RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS - PASS1_BITS);
}
/* Pass 2: process 10 rows from work array, store into output array. */
@@ -1169,9 +1169,9 @@ jpeg_idct_10x10 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Even part */
/* Add fudge factor here for final descale. */
- z3 = (JLONG) wsptr[0] + (ONE << (PASS1_BITS+2));
+ z3 = (JLONG)wsptr[0] + (ONE << (PASS1_BITS + 2));
z3 = LEFT_SHIFT(z3, CONST_BITS);
- z4 = (JLONG) wsptr[4];
+ z4 = (JLONG)wsptr[4];
z1 = MULTIPLY(z4, FIX(1.144122806)); /* c4 */
z2 = MULTIPLY(z4, FIX(0.437016024)); /* c8 */
tmp10 = z3 + z1;
@@ -1179,8 +1179,8 @@ jpeg_idct_10x10 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
tmp22 = z3 - LEFT_SHIFT(z1 - z2, 1); /* c0 = (c4-c8)*2 */
- z2 = (JLONG) wsptr[2];
- z3 = (JLONG) wsptr[6];
+ z2 = (JLONG)wsptr[2];
+ z3 = (JLONG)wsptr[6];
z1 = MULTIPLY(z2 + z3, FIX(0.831253876)); /* c6 */
tmp12 = z1 + MULTIPLY(z2, FIX(0.513743148)); /* c2-c6 */
@@ -1193,11 +1193,11 @@ jpeg_idct_10x10 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Odd part */
- z1 = (JLONG) wsptr[1];
- z2 = (JLONG) wsptr[3];
- z3 = (JLONG) wsptr[5];
+ z1 = (JLONG)wsptr[1];
+ z2 = (JLONG)wsptr[3];
+ z3 = (JLONG)wsptr[5];
z3 = LEFT_SHIFT(z3, CONST_BITS);
- z4 = (JLONG) wsptr[7];
+ z4 = (JLONG)wsptr[7];
tmp11 = z2 + z4;
tmp13 = z2 - z4;
@@ -1220,36 +1220,36 @@ jpeg_idct_10x10 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */
- outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
+ outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
wsptr += 8; /* advance pointer to next row */
}
@@ -1265,9 +1265,9 @@ jpeg_idct_10x10 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
*/
GLOBAL(void)
-jpeg_idct_11x11 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block,
- JSAMPARRAY output_buf, JDIMENSION output_col)
+jpeg_idct_11x11(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
{
JLONG tmp10, tmp11, tmp12, tmp13, tmp14;
JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25;
@@ -1278,30 +1278,30 @@ jpeg_idct_11x11 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
JSAMPROW outptr;
JSAMPLE *range_limit = IDCT_range_limit(cinfo);
int ctr;
- int workspace[8*11]; /* buffers data between passes */
+ int workspace[8 * 11]; /* buffers data between passes */
SHIFT_TEMPS
/* Pass 1: process columns from input, store into work array. */
inptr = coef_block;
- quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
+ quantptr = (ISLOW_MULT_TYPE *)compptr->dct_table;
wsptr = workspace;
for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) {
/* Even part */
- tmp10 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
+ tmp10 = DEQUANTIZE(inptr[DCTSIZE * 0], quantptr[DCTSIZE * 0]);
tmp10 = LEFT_SHIFT(tmp10, CONST_BITS);
/* Add fudge factor here for final descale. */
- tmp10 += ONE << (CONST_BITS-PASS1_BITS-1);
+ tmp10 += ONE << (CONST_BITS - PASS1_BITS - 1);
- z1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
- z2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
- z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
+ z1 = DEQUANTIZE(inptr[DCTSIZE * 2], quantptr[DCTSIZE * 2]);
+ z2 = DEQUANTIZE(inptr[DCTSIZE * 4], quantptr[DCTSIZE * 4]);
+ z3 = DEQUANTIZE(inptr[DCTSIZE * 6], quantptr[DCTSIZE * 6]);
tmp20 = MULTIPLY(z2 - z3, FIX(2.546640132)); /* c2+c4 */
tmp23 = MULTIPLY(z2 - z1, FIX(0.430815045)); /* c2-c6 */
z4 = z1 + z3;
- tmp24 = MULTIPLY(z4, - FIX(1.155664402)); /* -(c2-c10) */
+ tmp24 = MULTIPLY(z4, -FIX(1.155664402)); /* -(c2-c10) */
z4 -= z2;
tmp25 = tmp10 + MULTIPLY(z4, FIX(1.356927976)); /* c2 */
tmp21 = tmp20 + tmp23 + tmp25 -
@@ -1316,10 +1316,10 @@ jpeg_idct_11x11 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Odd part */
- z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
- z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
- z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
- z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
+ z1 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1]);
+ z2 = DEQUANTIZE(inptr[DCTSIZE * 3], quantptr[DCTSIZE * 3]);
+ z3 = DEQUANTIZE(inptr[DCTSIZE * 5], quantptr[DCTSIZE * 5]);
+ z4 = DEQUANTIZE(inptr[DCTSIZE * 7], quantptr[DCTSIZE * 7]);
tmp11 = z1 + z2;
tmp14 = MULTIPLY(tmp11 + z3 + z4, FIX(0.398430003)); /* c9 */
@@ -1331,26 +1331,26 @@ jpeg_idct_11x11 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
z1 = tmp14 - MULTIPLY(z2 + z3, FIX(1.163011579)); /* c7+c9 */
tmp11 += z1 + MULTIPLY(z2, FIX(2.073276588)); /* c1+c7+3*c9-c3 */
tmp12 += z1 - MULTIPLY(z3, FIX(1.192193623)); /* c3+c5-c7-c9 */
- z1 = MULTIPLY(z2 + z4, - FIX(1.798248910)); /* -(c1+c9) */
+ z1 = MULTIPLY(z2 + z4, -FIX(1.798248910)); /* -(c1+c9) */
tmp11 += z1;
tmp13 += z1 + MULTIPLY(z4, FIX(2.102458632)); /* c1+c5+c9-c7 */
- tmp14 += MULTIPLY(z2, - FIX(1.467221301)) + /* -(c5+c9) */
+ tmp14 += MULTIPLY(z2, -FIX(1.467221301)) + /* -(c5+c9) */
MULTIPLY(z3, FIX(1.001388905)) - /* c1-c9 */
MULTIPLY(z4, FIX(1.684843907)); /* c3+c9 */
/* Final output stage */
- wsptr[8*0] = (int) RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS-PASS1_BITS);
- wsptr[8*10] = (int) RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS-PASS1_BITS);
- wsptr[8*1] = (int) RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS-PASS1_BITS);
- wsptr[8*9] = (int) RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS-PASS1_BITS);
- wsptr[8*2] = (int) RIGHT_SHIFT(tmp22 + tmp12, CONST_BITS-PASS1_BITS);
- wsptr[8*8] = (int) RIGHT_SHIFT(tmp22 - tmp12, CONST_BITS-PASS1_BITS);
- wsptr[8*3] = (int) RIGHT_SHIFT(tmp23 + tmp13, CONST_BITS-PASS1_BITS);
- wsptr[8*7] = (int) RIGHT_SHIFT(tmp23 - tmp13, CONST_BITS-PASS1_BITS);
- wsptr[8*4] = (int) RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS-PASS1_BITS);
- wsptr[8*6] = (int) RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS-PASS1_BITS);
- wsptr[8*5] = (int) RIGHT_SHIFT(tmp25, CONST_BITS-PASS1_BITS);
+ wsptr[8 * 0] = (int)RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 10] = (int)RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 1] = (int)RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 9] = (int)RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 2] = (int)RIGHT_SHIFT(tmp22 + tmp12, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 8] = (int)RIGHT_SHIFT(tmp22 - tmp12, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 3] = (int)RIGHT_SHIFT(tmp23 + tmp13, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 7] = (int)RIGHT_SHIFT(tmp23 - tmp13, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 4] = (int)RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 6] = (int)RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 5] = (int)RIGHT_SHIFT(tmp25, CONST_BITS - PASS1_BITS);
}
/* Pass 2: process 11 rows from work array, store into output array. */
@@ -1362,17 +1362,17 @@ jpeg_idct_11x11 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Even part */
/* Add fudge factor here for final descale. */
- tmp10 = (JLONG) wsptr[0] + (ONE << (PASS1_BITS+2));
+ tmp10 = (JLONG)wsptr[0] + (ONE << (PASS1_BITS + 2));
tmp10 = LEFT_SHIFT(tmp10, CONST_BITS);
- z1 = (JLONG) wsptr[2];
- z2 = (JLONG) wsptr[4];
- z3 = (JLONG) wsptr[6];
+ z1 = (JLONG)wsptr[2];
+ z2 = (JLONG)wsptr[4];
+ z3 = (JLONG)wsptr[6];
tmp20 = MULTIPLY(z2 - z3, FIX(2.546640132)); /* c2+c4 */
tmp23 = MULTIPLY(z2 - z1, FIX(0.430815045)); /* c2-c6 */
z4 = z1 + z3;
- tmp24 = MULTIPLY(z4, - FIX(1.155664402)); /* -(c2-c10) */
+ tmp24 = MULTIPLY(z4, -FIX(1.155664402)); /* -(c2-c10) */
z4 -= z2;
tmp25 = tmp10 + MULTIPLY(z4, FIX(1.356927976)); /* c2 */
tmp21 = tmp20 + tmp23 + tmp25 -
@@ -1387,10 +1387,10 @@ jpeg_idct_11x11 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Odd part */
- z1 = (JLONG) wsptr[1];
- z2 = (JLONG) wsptr[3];
- z3 = (JLONG) wsptr[5];
- z4 = (JLONG) wsptr[7];
+ z1 = (JLONG)wsptr[1];
+ z2 = (JLONG)wsptr[3];
+ z3 = (JLONG)wsptr[5];
+ z4 = (JLONG)wsptr[7];
tmp11 = z1 + z2;
tmp14 = MULTIPLY(tmp11 + z3 + z4, FIX(0.398430003)); /* c9 */
@@ -1402,48 +1402,48 @@ jpeg_idct_11x11 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
z1 = tmp14 - MULTIPLY(z2 + z3, FIX(1.163011579)); /* c7+c9 */
tmp11 += z1 + MULTIPLY(z2, FIX(2.073276588)); /* c1+c7+3*c9-c3 */
tmp12 += z1 - MULTIPLY(z3, FIX(1.192193623)); /* c3+c5-c7-c9 */
- z1 = MULTIPLY(z2 + z4, - FIX(1.798248910)); /* -(c1+c9) */
+ z1 = MULTIPLY(z2 + z4, -FIX(1.798248910)); /* -(c1+c9) */
tmp11 += z1;
tmp13 += z1 + MULTIPLY(z4, FIX(2.102458632)); /* c1+c5+c9-c7 */
- tmp14 += MULTIPLY(z2, - FIX(1.467221301)) + /* -(c5+c9) */
+ tmp14 += MULTIPLY(z2, -FIX(1.467221301)) + /* -(c5+c9) */
MULTIPLY(z3, FIX(1.001388905)) - /* c1-c9 */
MULTIPLY(z4, FIX(1.684843907)); /* c3+c9 */
/* Final output stage */
- outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
+ outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
wsptr += 8; /* advance pointer to next row */
}
@@ -1459,9 +1459,9 @@ jpeg_idct_11x11 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
*/
GLOBAL(void)
-jpeg_idct_12x12 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block,
- JSAMPARRAY output_buf, JDIMENSION output_col)
+jpeg_idct_12x12(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
{
JLONG tmp10, tmp11, tmp12, tmp13, tmp14, tmp15;
JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25;
@@ -1472,32 +1472,32 @@ jpeg_idct_12x12 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
JSAMPROW outptr;
JSAMPLE *range_limit = IDCT_range_limit(cinfo);
int ctr;
- int workspace[8*12]; /* buffers data between passes */
+ int workspace[8 * 12]; /* buffers data between passes */
SHIFT_TEMPS
/* Pass 1: process columns from input, store into work array. */
inptr = coef_block;
- quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
+ quantptr = (ISLOW_MULT_TYPE *)compptr->dct_table;
wsptr = workspace;
for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) {
/* Even part */
- z3 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
+ z3 = DEQUANTIZE(inptr[DCTSIZE * 0], quantptr[DCTSIZE * 0]);
z3 = LEFT_SHIFT(z3, CONST_BITS);
/* Add fudge factor here for final descale. */
- z3 += ONE << (CONST_BITS-PASS1_BITS-1);
+ z3 += ONE << (CONST_BITS - PASS1_BITS - 1);
- z4 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
+ z4 = DEQUANTIZE(inptr[DCTSIZE * 4], quantptr[DCTSIZE * 4]);
z4 = MULTIPLY(z4, FIX(1.224744871)); /* c4 */
tmp10 = z3 + z4;
tmp11 = z3 - z4;
- z1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
+ z1 = DEQUANTIZE(inptr[DCTSIZE * 2], quantptr[DCTSIZE * 2]);
z4 = MULTIPLY(z1, FIX(1.366025404)); /* c2 */
z1 = LEFT_SHIFT(z1, CONST_BITS);
- z2 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
+ z2 = DEQUANTIZE(inptr[DCTSIZE * 6], quantptr[DCTSIZE * 6]);
z2 = LEFT_SHIFT(z2, CONST_BITS);
tmp12 = z1 - z2;
@@ -1517,19 +1517,19 @@ jpeg_idct_12x12 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Odd part */
- z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
- z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
- z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
- z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
+ z1 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1]);
+ z2 = DEQUANTIZE(inptr[DCTSIZE * 3], quantptr[DCTSIZE * 3]);
+ z3 = DEQUANTIZE(inptr[DCTSIZE * 5], quantptr[DCTSIZE * 5]);
+ z4 = DEQUANTIZE(inptr[DCTSIZE * 7], quantptr[DCTSIZE * 7]);
tmp11 = MULTIPLY(z2, FIX(1.306562965)); /* c3 */
- tmp14 = MULTIPLY(z2, - FIX_0_541196100); /* -c9 */
+ tmp14 = MULTIPLY(z2, -FIX_0_541196100); /* -c9 */
tmp10 = z1 + z3;
tmp15 = MULTIPLY(tmp10 + z4, FIX(0.860918669)); /* c7 */
tmp12 = tmp15 + MULTIPLY(tmp10, FIX(0.261052384)); /* c5-c7 */
tmp10 = tmp12 + tmp11 + MULTIPLY(z1, FIX(0.280143716)); /* c1-c5 */
- tmp13 = MULTIPLY(z3 + z4, - FIX(1.045510580)); /* -(c7+c11) */
+ tmp13 = MULTIPLY(z3 + z4, -FIX(1.045510580)); /* -(c7+c11) */
tmp12 += tmp13 + tmp14 - MULTIPLY(z3, FIX(1.478575242)); /* c1+c5-c7-c11 */
tmp13 += tmp15 - tmp11 + MULTIPLY(z4, FIX(1.586706681)); /* c1+c11 */
tmp15 += tmp14 - MULTIPLY(z1, FIX(0.676326758)) - /* c7-c11 */
@@ -1543,18 +1543,18 @@ jpeg_idct_12x12 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */
- wsptr[8*0] = (int) RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS-PASS1_BITS);
- wsptr[8*11] = (int) RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS-PASS1_BITS);
- wsptr[8*1] = (int) RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS-PASS1_BITS);
- wsptr[8*10] = (int) RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS-PASS1_BITS);
- wsptr[8*2] = (int) RIGHT_SHIFT(tmp22 + tmp12, CONST_BITS-PASS1_BITS);
- wsptr[8*9] = (int) RIGHT_SHIFT(tmp22 - tmp12, CONST_BITS-PASS1_BITS);
- wsptr[8*3] = (int) RIGHT_SHIFT(tmp23 + tmp13, CONST_BITS-PASS1_BITS);
- wsptr[8*8] = (int) RIGHT_SHIFT(tmp23 - tmp13, CONST_BITS-PASS1_BITS);
- wsptr[8*4] = (int) RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS-PASS1_BITS);
- wsptr[8*7] = (int) RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS-PASS1_BITS);
- wsptr[8*5] = (int) RIGHT_SHIFT(tmp25 + tmp15, CONST_BITS-PASS1_BITS);
- wsptr[8*6] = (int) RIGHT_SHIFT(tmp25 - tmp15, CONST_BITS-PASS1_BITS);
+ wsptr[8 * 0] = (int)RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 11] = (int)RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 1] = (int)RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 10] = (int)RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 2] = (int)RIGHT_SHIFT(tmp22 + tmp12, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 9] = (int)RIGHT_SHIFT(tmp22 - tmp12, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 3] = (int)RIGHT_SHIFT(tmp23 + tmp13, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 8] = (int)RIGHT_SHIFT(tmp23 - tmp13, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 4] = (int)RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 7] = (int)RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 5] = (int)RIGHT_SHIFT(tmp25 + tmp15, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 6] = (int)RIGHT_SHIFT(tmp25 - tmp15, CONST_BITS - PASS1_BITS);
}
/* Pass 2: process 12 rows from work array, store into output array. */
@@ -1566,19 +1566,19 @@ jpeg_idct_12x12 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Even part */
/* Add fudge factor here for final descale. */
- z3 = (JLONG) wsptr[0] + (ONE << (PASS1_BITS+2));
+ z3 = (JLONG)wsptr[0] + (ONE << (PASS1_BITS + 2));
z3 = LEFT_SHIFT(z3, CONST_BITS);
- z4 = (JLONG) wsptr[4];
+ z4 = (JLONG)wsptr[4];
z4 = MULTIPLY(z4, FIX(1.224744871)); /* c4 */
tmp10 = z3 + z4;
tmp11 = z3 - z4;
- z1 = (JLONG) wsptr[2];
+ z1 = (JLONG)wsptr[2];
z4 = MULTIPLY(z1, FIX(1.366025404)); /* c2 */
z1 = LEFT_SHIFT(z1, CONST_BITS);
- z2 = (JLONG) wsptr[6];
+ z2 = (JLONG)wsptr[6];
z2 = LEFT_SHIFT(z2, CONST_BITS);
tmp12 = z1 - z2;
@@ -1598,19 +1598,19 @@ jpeg_idct_12x12 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Odd part */
- z1 = (JLONG) wsptr[1];
- z2 = (JLONG) wsptr[3];
- z3 = (JLONG) wsptr[5];
- z4 = (JLONG) wsptr[7];
+ z1 = (JLONG)wsptr[1];
+ z2 = (JLONG)wsptr[3];
+ z3 = (JLONG)wsptr[5];
+ z4 = (JLONG)wsptr[7];
tmp11 = MULTIPLY(z2, FIX(1.306562965)); /* c3 */
- tmp14 = MULTIPLY(z2, - FIX_0_541196100); /* -c9 */
+ tmp14 = MULTIPLY(z2, -FIX_0_541196100); /* -c9 */
tmp10 = z1 + z3;
tmp15 = MULTIPLY(tmp10 + z4, FIX(0.860918669)); /* c7 */
tmp12 = tmp15 + MULTIPLY(tmp10, FIX(0.261052384)); /* c5-c7 */
tmp10 = tmp12 + tmp11 + MULTIPLY(z1, FIX(0.280143716)); /* c1-c5 */
- tmp13 = MULTIPLY(z3 + z4, - FIX(1.045510580)); /* -(c7+c11) */
+ tmp13 = MULTIPLY(z3 + z4, -FIX(1.045510580)); /* -(c7+c11) */
tmp12 += tmp13 + tmp14 - MULTIPLY(z3, FIX(1.478575242)); /* c1+c5-c7-c11 */
tmp13 += tmp15 - tmp11 + MULTIPLY(z4, FIX(1.586706681)); /* c1+c11 */
tmp15 += tmp14 - MULTIPLY(z1, FIX(0.676326758)) - /* c7-c11 */
@@ -1624,42 +1624,42 @@ jpeg_idct_12x12 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */
- outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp15,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp15,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
+ outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[11] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25 + tmp15,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp25 - tmp15,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
wsptr += 8; /* advance pointer to next row */
}
@@ -1675,9 +1675,9 @@ jpeg_idct_12x12 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
*/
GLOBAL(void)
-jpeg_idct_13x13 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block,
- JSAMPARRAY output_buf, JDIMENSION output_col)
+jpeg_idct_13x13(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
{
JLONG tmp10, tmp11, tmp12, tmp13, tmp14, tmp15;
JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26;
@@ -1688,25 +1688,25 @@ jpeg_idct_13x13 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
JSAMPROW outptr;
JSAMPLE *range_limit = IDCT_range_limit(cinfo);
int ctr;
- int workspace[8*13]; /* buffers data between passes */
+ int workspace[8 * 13]; /* buffers data between passes */
SHIFT_TEMPS
/* Pass 1: process columns from input, store into work array. */
inptr = coef_block;
- quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
+ quantptr = (ISLOW_MULT_TYPE *)compptr->dct_table;
wsptr = workspace;
for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) {
/* Even part */
- z1 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
+ z1 = DEQUANTIZE(inptr[DCTSIZE * 0], quantptr[DCTSIZE * 0]);
z1 = LEFT_SHIFT(z1, CONST_BITS);
/* Add fudge factor here for final descale. */
- z1 += ONE << (CONST_BITS-PASS1_BITS-1);
+ z1 += ONE << (CONST_BITS - PASS1_BITS - 1);
- z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
- z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
- z4 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
+ z2 = DEQUANTIZE(inptr[DCTSIZE * 2], quantptr[DCTSIZE * 2]);
+ z3 = DEQUANTIZE(inptr[DCTSIZE * 4], quantptr[DCTSIZE * 4]);
+ z4 = DEQUANTIZE(inptr[DCTSIZE * 6], quantptr[DCTSIZE * 6]);
tmp10 = z3 + z4;
tmp11 = z3 - z4;
@@ -1721,22 +1721,22 @@ jpeg_idct_13x13 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
tmp13 = MULTIPLY(tmp11, FIX(0.486914739)) + z1; /* (c8+c12)/2 */
tmp21 = MULTIPLY(z2, FIX(1.058554052)) - tmp12 + tmp13; /* c6 */
- tmp25 = MULTIPLY(z2, - FIX(1.252223920)) + tmp12 + tmp13; /* c4 */
+ tmp25 = MULTIPLY(z2, -FIX(1.252223920)) + tmp12 + tmp13; /* c4 */
tmp12 = MULTIPLY(tmp10, FIX(0.435816023)); /* (c2-c10)/2 */
tmp13 = MULTIPLY(tmp11, FIX(0.937303064)) - z1; /* (c2+c10)/2 */
- tmp23 = MULTIPLY(z2, - FIX(0.170464608)) - tmp12 - tmp13; /* c12 */
- tmp24 = MULTIPLY(z2, - FIX(0.803364869)) + tmp12 - tmp13; /* c8 */
+ tmp23 = MULTIPLY(z2, -FIX(0.170464608)) - tmp12 - tmp13; /* c12 */
+ tmp24 = MULTIPLY(z2, -FIX(0.803364869)) + tmp12 - tmp13; /* c8 */
tmp26 = MULTIPLY(tmp11 - z2, FIX(1.414213562)) + z1; /* c0 */
/* Odd part */
- z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
- z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
- z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
- z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
+ z1 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1]);
+ z2 = DEQUANTIZE(inptr[DCTSIZE * 3], quantptr[DCTSIZE * 3]);
+ z3 = DEQUANTIZE(inptr[DCTSIZE * 5], quantptr[DCTSIZE * 5]);
+ z4 = DEQUANTIZE(inptr[DCTSIZE * 7], quantptr[DCTSIZE * 7]);
tmp11 = MULTIPLY(z1 + z2, FIX(1.322312651)); /* c3 */
tmp12 = MULTIPLY(z1 + z3, FIX(1.163874945)); /* c5 */
@@ -1744,13 +1744,13 @@ jpeg_idct_13x13 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
tmp13 = MULTIPLY(tmp15, FIX(0.937797057)); /* c7 */
tmp10 = tmp11 + tmp12 + tmp13 -
MULTIPLY(z1, FIX(2.020082300)); /* c7+c5+c3-c1 */
- tmp14 = MULTIPLY(z2 + z3, - FIX(0.338443458)); /* -c11 */
+ tmp14 = MULTIPLY(z2 + z3, -FIX(0.338443458)); /* -c11 */
tmp11 += tmp14 + MULTIPLY(z2, FIX(0.837223564)); /* c5+c9+c11-c3 */
tmp12 += tmp14 - MULTIPLY(z3, FIX(1.572116027)); /* c1+c5-c9-c11 */
- tmp14 = MULTIPLY(z2 + z4, - FIX(1.163874945)); /* -c5 */
+ tmp14 = MULTIPLY(z2 + z4, -FIX(1.163874945)); /* -c5 */
tmp11 += tmp14;
tmp13 += tmp14 + MULTIPLY(z4, FIX(2.205608352)); /* c3+c5+c9-c7 */
- tmp14 = MULTIPLY(z3 + z4, - FIX(0.657217813)); /* -c9 */
+ tmp14 = MULTIPLY(z3 + z4, -FIX(0.657217813)); /* -c9 */
tmp12 += tmp14;
tmp13 += tmp14;
tmp15 = MULTIPLY(tmp15, FIX(0.338443458)); /* c11 */
@@ -1763,19 +1763,19 @@ jpeg_idct_13x13 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */
- wsptr[8*0] = (int) RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS-PASS1_BITS);
- wsptr[8*12] = (int) RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS-PASS1_BITS);
- wsptr[8*1] = (int) RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS-PASS1_BITS);
- wsptr[8*11] = (int) RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS-PASS1_BITS);
- wsptr[8*2] = (int) RIGHT_SHIFT(tmp22 + tmp12, CONST_BITS-PASS1_BITS);
- wsptr[8*10] = (int) RIGHT_SHIFT(tmp22 - tmp12, CONST_BITS-PASS1_BITS);
- wsptr[8*3] = (int) RIGHT_SHIFT(tmp23 + tmp13, CONST_BITS-PASS1_BITS);
- wsptr[8*9] = (int) RIGHT_SHIFT(tmp23 - tmp13, CONST_BITS-PASS1_BITS);
- wsptr[8*4] = (int) RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS-PASS1_BITS);
- wsptr[8*8] = (int) RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS-PASS1_BITS);
- wsptr[8*5] = (int) RIGHT_SHIFT(tmp25 + tmp15, CONST_BITS-PASS1_BITS);
- wsptr[8*7] = (int) RIGHT_SHIFT(tmp25 - tmp15, CONST_BITS-PASS1_BITS);
- wsptr[8*6] = (int) RIGHT_SHIFT(tmp26, CONST_BITS-PASS1_BITS);
+ wsptr[8 * 0] = (int)RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 12] = (int)RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 1] = (int)RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 11] = (int)RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 2] = (int)RIGHT_SHIFT(tmp22 + tmp12, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 10] = (int)RIGHT_SHIFT(tmp22 - tmp12, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 3] = (int)RIGHT_SHIFT(tmp23 + tmp13, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 9] = (int)RIGHT_SHIFT(tmp23 - tmp13, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 4] = (int)RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 8] = (int)RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 5] = (int)RIGHT_SHIFT(tmp25 + tmp15, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 7] = (int)RIGHT_SHIFT(tmp25 - tmp15, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 6] = (int)RIGHT_SHIFT(tmp26, CONST_BITS - PASS1_BITS);
}
/* Pass 2: process 13 rows from work array, store into output array. */
@@ -1787,12 +1787,12 @@ jpeg_idct_13x13 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Even part */
/* Add fudge factor here for final descale. */
- z1 = (JLONG) wsptr[0] + (ONE << (PASS1_BITS+2));
+ z1 = (JLONG)wsptr[0] + (ONE << (PASS1_BITS + 2));
z1 = LEFT_SHIFT(z1, CONST_BITS);
- z2 = (JLONG) wsptr[2];
- z3 = (JLONG) wsptr[4];
- z4 = (JLONG) wsptr[6];
+ z2 = (JLONG)wsptr[2];
+ z3 = (JLONG)wsptr[4];
+ z4 = (JLONG)wsptr[6];
tmp10 = z3 + z4;
tmp11 = z3 - z4;
@@ -1807,22 +1807,22 @@ jpeg_idct_13x13 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
tmp13 = MULTIPLY(tmp11, FIX(0.486914739)) + z1; /* (c8+c12)/2 */
tmp21 = MULTIPLY(z2, FIX(1.058554052)) - tmp12 + tmp13; /* c6 */
- tmp25 = MULTIPLY(z2, - FIX(1.252223920)) + tmp12 + tmp13; /* c4 */
+ tmp25 = MULTIPLY(z2, -FIX(1.252223920)) + tmp12 + tmp13; /* c4 */
tmp12 = MULTIPLY(tmp10, FIX(0.435816023)); /* (c2-c10)/2 */
tmp13 = MULTIPLY(tmp11, FIX(0.937303064)) - z1; /* (c2+c10)/2 */
- tmp23 = MULTIPLY(z2, - FIX(0.170464608)) - tmp12 - tmp13; /* c12 */
- tmp24 = MULTIPLY(z2, - FIX(0.803364869)) + tmp12 - tmp13; /* c8 */
+ tmp23 = MULTIPLY(z2, -FIX(0.170464608)) - tmp12 - tmp13; /* c12 */
+ tmp24 = MULTIPLY(z2, -FIX(0.803364869)) + tmp12 - tmp13; /* c8 */
tmp26 = MULTIPLY(tmp11 - z2, FIX(1.414213562)) + z1; /* c0 */
/* Odd part */
- z1 = (JLONG) wsptr[1];
- z2 = (JLONG) wsptr[3];
- z3 = (JLONG) wsptr[5];
- z4 = (JLONG) wsptr[7];
+ z1 = (JLONG)wsptr[1];
+ z2 = (JLONG)wsptr[3];
+ z3 = (JLONG)wsptr[5];
+ z4 = (JLONG)wsptr[7];
tmp11 = MULTIPLY(z1 + z2, FIX(1.322312651)); /* c3 */
tmp12 = MULTIPLY(z1 + z3, FIX(1.163874945)); /* c5 */
@@ -1830,13 +1830,13 @@ jpeg_idct_13x13 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
tmp13 = MULTIPLY(tmp15, FIX(0.937797057)); /* c7 */
tmp10 = tmp11 + tmp12 + tmp13 -
MULTIPLY(z1, FIX(2.020082300)); /* c7+c5+c3-c1 */
- tmp14 = MULTIPLY(z2 + z3, - FIX(0.338443458)); /* -c11 */
+ tmp14 = MULTIPLY(z2 + z3, -FIX(0.338443458)); /* -c11 */
tmp11 += tmp14 + MULTIPLY(z2, FIX(0.837223564)); /* c5+c9+c11-c3 */
tmp12 += tmp14 - MULTIPLY(z3, FIX(1.572116027)); /* c1+c5-c9-c11 */
- tmp14 = MULTIPLY(z2 + z4, - FIX(1.163874945)); /* -c5 */
+ tmp14 = MULTIPLY(z2 + z4, -FIX(1.163874945)); /* -c5 */
tmp11 += tmp14;
tmp13 += tmp14 + MULTIPLY(z4, FIX(2.205608352)); /* c3+c5+c9-c7 */
- tmp14 = MULTIPLY(z3 + z4, - FIX(0.657217813)); /* -c9 */
+ tmp14 = MULTIPLY(z3 + z4, -FIX(0.657217813)); /* -c9 */
tmp12 += tmp14;
tmp13 += tmp14;
tmp15 = MULTIPLY(tmp15, FIX(0.338443458)); /* c11 */
@@ -1849,45 +1849,45 @@ jpeg_idct_13x13 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */
- outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[12] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp15,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp15,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp26,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
+ outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[12] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[11] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25 + tmp15,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp25 - tmp15,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp26,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
wsptr += 8; /* advance pointer to next row */
}
@@ -1903,9 +1903,9 @@ jpeg_idct_13x13 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
*/
GLOBAL(void)
-jpeg_idct_14x14 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block,
- JSAMPARRAY output_buf, JDIMENSION output_col)
+jpeg_idct_14x14(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
{
JLONG tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16;
JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26;
@@ -1916,22 +1916,22 @@ jpeg_idct_14x14 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
JSAMPROW outptr;
JSAMPLE *range_limit = IDCT_range_limit(cinfo);
int ctr;
- int workspace[8*14]; /* buffers data between passes */
+ int workspace[8 * 14]; /* buffers data between passes */
SHIFT_TEMPS
/* Pass 1: process columns from input, store into work array. */
inptr = coef_block;
- quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
+ quantptr = (ISLOW_MULT_TYPE *)compptr->dct_table;
wsptr = workspace;
for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) {
/* Even part */
- z1 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
+ z1 = DEQUANTIZE(inptr[DCTSIZE * 0], quantptr[DCTSIZE * 0]);
z1 = LEFT_SHIFT(z1, CONST_BITS);
/* Add fudge factor here for final descale. */
- z1 += ONE << (CONST_BITS-PASS1_BITS-1);
- z4 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
+ z1 += ONE << (CONST_BITS - PASS1_BITS - 1);
+ z4 = DEQUANTIZE(inptr[DCTSIZE * 4], quantptr[DCTSIZE * 4]);
z2 = MULTIPLY(z4, FIX(1.274162392)); /* c4 */
z3 = MULTIPLY(z4, FIX(0.314692123)); /* c12 */
z4 = MULTIPLY(z4, FIX(0.881747734)); /* c8 */
@@ -1941,10 +1941,10 @@ jpeg_idct_14x14 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
tmp12 = z1 - z4;
tmp23 = RIGHT_SHIFT(z1 - LEFT_SHIFT(z2 + z3 - z4, 1),
- CONST_BITS-PASS1_BITS); /* c0 = (c4+c12-c8)*2 */
+ CONST_BITS - PASS1_BITS); /* c0 = (c4+c12-c8)*2 */
- z1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
- z2 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
+ z1 = DEQUANTIZE(inptr[DCTSIZE * 2], quantptr[DCTSIZE * 2]);
+ z2 = DEQUANTIZE(inptr[DCTSIZE * 6], quantptr[DCTSIZE * 6]);
z3 = MULTIPLY(z1 + z2, FIX(1.105676686)); /* c6 */
@@ -1962,10 +1962,10 @@ jpeg_idct_14x14 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Odd part */
- z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
- z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
- z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
- z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
+ z1 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1]);
+ z2 = DEQUANTIZE(inptr[DCTSIZE * 3], quantptr[DCTSIZE * 3]);
+ z3 = DEQUANTIZE(inptr[DCTSIZE * 5], quantptr[DCTSIZE * 5]);
+ z4 = DEQUANTIZE(inptr[DCTSIZE * 7], quantptr[DCTSIZE * 7]);
tmp13 = LEFT_SHIFT(z4, CONST_BITS);
tmp14 = z1 + z3;
@@ -1978,7 +1978,7 @@ jpeg_idct_14x14 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
tmp15 = MULTIPLY(z1, FIX(0.467085129)) - tmp13; /* c11 */
tmp16 += tmp15;
z1 += z4;
- z4 = MULTIPLY(z2 + z3, - FIX(0.158341681)) - tmp13; /* -c13 */
+ z4 = MULTIPLY(z2 + z3, -FIX(0.158341681)) - tmp13; /* -c13 */
tmp11 += z4 - MULTIPLY(z2, FIX(0.424103948)); /* c3-c9-c13 */
tmp12 += z4 - MULTIPLY(z3, FIX(2.373959773)); /* c3+c5-c13 */
z4 = MULTIPLY(z3 - z2, FIX(1.405321284)); /* c1 */
@@ -1989,20 +1989,20 @@ jpeg_idct_14x14 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */
- wsptr[8*0] = (int) RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS-PASS1_BITS);
- wsptr[8*13] = (int) RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS-PASS1_BITS);
- wsptr[8*1] = (int) RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS-PASS1_BITS);
- wsptr[8*12] = (int) RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS-PASS1_BITS);
- wsptr[8*2] = (int) RIGHT_SHIFT(tmp22 + tmp12, CONST_BITS-PASS1_BITS);
- wsptr[8*11] = (int) RIGHT_SHIFT(tmp22 - tmp12, CONST_BITS-PASS1_BITS);
- wsptr[8*3] = (int) (tmp23 + tmp13);
- wsptr[8*10] = (int) (tmp23 - tmp13);
- wsptr[8*4] = (int) RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS-PASS1_BITS);
- wsptr[8*9] = (int) RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS-PASS1_BITS);
- wsptr[8*5] = (int) RIGHT_SHIFT(tmp25 + tmp15, CONST_BITS-PASS1_BITS);
- wsptr[8*8] = (int) RIGHT_SHIFT(tmp25 - tmp15, CONST_BITS-PASS1_BITS);
- wsptr[8*6] = (int) RIGHT_SHIFT(tmp26 + tmp16, CONST_BITS-PASS1_BITS);
- wsptr[8*7] = (int) RIGHT_SHIFT(tmp26 - tmp16, CONST_BITS-PASS1_BITS);
+ wsptr[8 * 0] = (int)RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 13] = (int)RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 1] = (int)RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 12] = (int)RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 2] = (int)RIGHT_SHIFT(tmp22 + tmp12, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 11] = (int)RIGHT_SHIFT(tmp22 - tmp12, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 3] = (int)(tmp23 + tmp13);
+ wsptr[8 * 10] = (int)(tmp23 - tmp13);
+ wsptr[8 * 4] = (int)RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 9] = (int)RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 5] = (int)RIGHT_SHIFT(tmp25 + tmp15, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 8] = (int)RIGHT_SHIFT(tmp25 - tmp15, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 6] = (int)RIGHT_SHIFT(tmp26 + tmp16, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 7] = (int)RIGHT_SHIFT(tmp26 - tmp16, CONST_BITS - PASS1_BITS);
}
/* Pass 2: process 14 rows from work array, store into output array. */
@@ -2014,9 +2014,9 @@ jpeg_idct_14x14 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Even part */
/* Add fudge factor here for final descale. */
- z1 = (JLONG) wsptr[0] + (ONE << (PASS1_BITS+2));
+ z1 = (JLONG)wsptr[0] + (ONE << (PASS1_BITS + 2));
z1 = LEFT_SHIFT(z1, CONST_BITS);
- z4 = (JLONG) wsptr[4];
+ z4 = (JLONG)wsptr[4];
z2 = MULTIPLY(z4, FIX(1.274162392)); /* c4 */
z3 = MULTIPLY(z4, FIX(0.314692123)); /* c12 */
z4 = MULTIPLY(z4, FIX(0.881747734)); /* c8 */
@@ -2027,8 +2027,8 @@ jpeg_idct_14x14 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
tmp23 = z1 - LEFT_SHIFT(z2 + z3 - z4, 1); /* c0 = (c4+c12-c8)*2 */
- z1 = (JLONG) wsptr[2];
- z2 = (JLONG) wsptr[6];
+ z1 = (JLONG)wsptr[2];
+ z2 = (JLONG)wsptr[6];
z3 = MULTIPLY(z1 + z2, FIX(1.105676686)); /* c6 */
@@ -2046,10 +2046,10 @@ jpeg_idct_14x14 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Odd part */
- z1 = (JLONG) wsptr[1];
- z2 = (JLONG) wsptr[3];
- z3 = (JLONG) wsptr[5];
- z4 = (JLONG) wsptr[7];
+ z1 = (JLONG)wsptr[1];
+ z2 = (JLONG)wsptr[3];
+ z3 = (JLONG)wsptr[5];
+ z4 = (JLONG)wsptr[7];
z4 = LEFT_SHIFT(z4, CONST_BITS);
tmp14 = z1 + z3;
@@ -2061,7 +2061,7 @@ jpeg_idct_14x14 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
z1 -= z2;
tmp15 = MULTIPLY(z1, FIX(0.467085129)) - z4; /* c11 */
tmp16 += tmp15;
- tmp13 = MULTIPLY(z2 + z3, - FIX(0.158341681)) - z4; /* -c13 */
+ tmp13 = MULTIPLY(z2 + z3, -FIX(0.158341681)) - z4; /* -c13 */
tmp11 += tmp13 - MULTIPLY(z2, FIX(0.424103948)); /* c3-c9-c13 */
tmp12 += tmp13 - MULTIPLY(z3, FIX(2.373959773)); /* c3+c5-c13 */
tmp13 = MULTIPLY(z3 - z2, FIX(1.405321284)); /* c1 */
@@ -2072,48 +2072,48 @@ jpeg_idct_14x14 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */
- outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[13] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[12] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp15,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp15,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp26 + tmp16,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp26 - tmp16,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
+ outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[13] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[12] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[11] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25 + tmp15,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp25 - tmp15,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp26 + tmp16,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp26 - tmp16,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
wsptr += 8; /* advance pointer to next row */
}
@@ -2129,9 +2129,9 @@ jpeg_idct_14x14 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
*/
GLOBAL(void)
-jpeg_idct_15x15 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block,
- JSAMPARRAY output_buf, JDIMENSION output_col)
+jpeg_idct_15x15(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
{
JLONG tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16;
JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26, tmp27;
@@ -2142,25 +2142,25 @@ jpeg_idct_15x15 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
JSAMPROW outptr;
JSAMPLE *range_limit = IDCT_range_limit(cinfo);
int ctr;
- int workspace[8*15]; /* buffers data between passes */
+ int workspace[8 * 15]; /* buffers data between passes */
SHIFT_TEMPS
/* Pass 1: process columns from input, store into work array. */
inptr = coef_block;
- quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
+ quantptr = (ISLOW_MULT_TYPE *)compptr->dct_table;
wsptr = workspace;
for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) {
/* Even part */
- z1 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
+ z1 = DEQUANTIZE(inptr[DCTSIZE * 0], quantptr[DCTSIZE * 0]);
z1 = LEFT_SHIFT(z1, CONST_BITS);
/* Add fudge factor here for final descale. */
- z1 += ONE << (CONST_BITS-PASS1_BITS-1);
+ z1 += ONE << (CONST_BITS - PASS1_BITS - 1);
- z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
- z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
- z4 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
+ z2 = DEQUANTIZE(inptr[DCTSIZE * 2], quantptr[DCTSIZE * 2]);
+ z3 = DEQUANTIZE(inptr[DCTSIZE * 4], quantptr[DCTSIZE * 4]);
+ z4 = DEQUANTIZE(inptr[DCTSIZE * 6], quantptr[DCTSIZE * 6]);
tmp10 = MULTIPLY(z4, FIX(0.437016024)); /* c12 */
tmp11 = MULTIPLY(z4, FIX(1.144122806)); /* c6 */
@@ -2195,19 +2195,19 @@ jpeg_idct_15x15 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Odd part */
- z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
- z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
- z4 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
+ z1 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1]);
+ z2 = DEQUANTIZE(inptr[DCTSIZE * 3], quantptr[DCTSIZE * 3]);
+ z4 = DEQUANTIZE(inptr[DCTSIZE * 5], quantptr[DCTSIZE * 5]);
z3 = MULTIPLY(z4, FIX(1.224744871)); /* c5 */
- z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
+ z4 = DEQUANTIZE(inptr[DCTSIZE * 7], quantptr[DCTSIZE * 7]);
tmp13 = z2 - z4;
tmp15 = MULTIPLY(z1 + tmp13, FIX(0.831253876)); /* c9 */
tmp11 = tmp15 + MULTIPLY(z1, FIX(0.513743148)); /* c3-c9 */
tmp14 = tmp15 - MULTIPLY(tmp13, FIX(2.176250899)); /* c3+c9 */
- tmp13 = MULTIPLY(z2, - FIX(0.831253876)); /* -c9 */
- tmp15 = MULTIPLY(z2, - FIX(1.344997024)); /* -c3 */
+ tmp13 = MULTIPLY(z2, -FIX(0.831253876)); /* -c9 */
+ tmp15 = MULTIPLY(z2, -FIX(1.344997024)); /* -c3 */
z2 = z1 - z4;
tmp12 = z3 + MULTIPLY(z2, FIX(1.406466353)); /* c1 */
@@ -2220,21 +2220,21 @@ jpeg_idct_15x15 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */
- wsptr[8*0] = (int) RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS-PASS1_BITS);
- wsptr[8*14] = (int) RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS-PASS1_BITS);
- wsptr[8*1] = (int) RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS-PASS1_BITS);
- wsptr[8*13] = (int) RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS-PASS1_BITS);
- wsptr[8*2] = (int) RIGHT_SHIFT(tmp22 + tmp12, CONST_BITS-PASS1_BITS);
- wsptr[8*12] = (int) RIGHT_SHIFT(tmp22 - tmp12, CONST_BITS-PASS1_BITS);
- wsptr[8*3] = (int) RIGHT_SHIFT(tmp23 + tmp13, CONST_BITS-PASS1_BITS);
- wsptr[8*11] = (int) RIGHT_SHIFT(tmp23 - tmp13, CONST_BITS-PASS1_BITS);
- wsptr[8*4] = (int) RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS-PASS1_BITS);
- wsptr[8*10] = (int) RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS-PASS1_BITS);
- wsptr[8*5] = (int) RIGHT_SHIFT(tmp25 + tmp15, CONST_BITS-PASS1_BITS);
- wsptr[8*9] = (int) RIGHT_SHIFT(tmp25 - tmp15, CONST_BITS-PASS1_BITS);
- wsptr[8*6] = (int) RIGHT_SHIFT(tmp26 + tmp16, CONST_BITS-PASS1_BITS);
- wsptr[8*8] = (int) RIGHT_SHIFT(tmp26 - tmp16, CONST_BITS-PASS1_BITS);
- wsptr[8*7] = (int) RIGHT_SHIFT(tmp27, CONST_BITS-PASS1_BITS);
+ wsptr[8 * 0] = (int)RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 14] = (int)RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 1] = (int)RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 13] = (int)RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 2] = (int)RIGHT_SHIFT(tmp22 + tmp12, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 12] = (int)RIGHT_SHIFT(tmp22 - tmp12, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 3] = (int)RIGHT_SHIFT(tmp23 + tmp13, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 11] = (int)RIGHT_SHIFT(tmp23 - tmp13, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 4] = (int)RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 10] = (int)RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 5] = (int)RIGHT_SHIFT(tmp25 + tmp15, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 9] = (int)RIGHT_SHIFT(tmp25 - tmp15, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 6] = (int)RIGHT_SHIFT(tmp26 + tmp16, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 8] = (int)RIGHT_SHIFT(tmp26 - tmp16, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 7] = (int)RIGHT_SHIFT(tmp27, CONST_BITS - PASS1_BITS);
}
/* Pass 2: process 15 rows from work array, store into output array. */
@@ -2246,12 +2246,12 @@ jpeg_idct_15x15 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Even part */
/* Add fudge factor here for final descale. */
- z1 = (JLONG) wsptr[0] + (ONE << (PASS1_BITS+2));
+ z1 = (JLONG)wsptr[0] + (ONE << (PASS1_BITS + 2));
z1 = LEFT_SHIFT(z1, CONST_BITS);
- z2 = (JLONG) wsptr[2];
- z3 = (JLONG) wsptr[4];
- z4 = (JLONG) wsptr[6];
+ z2 = (JLONG)wsptr[2];
+ z3 = (JLONG)wsptr[4];
+ z4 = (JLONG)wsptr[6];
tmp10 = MULTIPLY(z4, FIX(0.437016024)); /* c12 */
tmp11 = MULTIPLY(z4, FIX(1.144122806)); /* c6 */
@@ -2286,19 +2286,19 @@ jpeg_idct_15x15 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Odd part */
- z1 = (JLONG) wsptr[1];
- z2 = (JLONG) wsptr[3];
- z4 = (JLONG) wsptr[5];
+ z1 = (JLONG)wsptr[1];
+ z2 = (JLONG)wsptr[3];
+ z4 = (JLONG)wsptr[5];
z3 = MULTIPLY(z4, FIX(1.224744871)); /* c5 */
- z4 = (JLONG) wsptr[7];
+ z4 = (JLONG)wsptr[7];
tmp13 = z2 - z4;
tmp15 = MULTIPLY(z1 + tmp13, FIX(0.831253876)); /* c9 */
tmp11 = tmp15 + MULTIPLY(z1, FIX(0.513743148)); /* c3-c9 */
tmp14 = tmp15 - MULTIPLY(tmp13, FIX(2.176250899)); /* c3+c9 */
- tmp13 = MULTIPLY(z2, - FIX(0.831253876)); /* -c9 */
- tmp15 = MULTIPLY(z2, - FIX(1.344997024)); /* -c3 */
+ tmp13 = MULTIPLY(z2, -FIX(0.831253876)); /* -c9 */
+ tmp15 = MULTIPLY(z2, -FIX(1.344997024)); /* -c3 */
z2 = z1 - z4;
tmp12 = z3 + MULTIPLY(z2, FIX(1.406466353)); /* c1 */
@@ -2311,51 +2311,51 @@ jpeg_idct_15x15 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */
- outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[14] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[13] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[12] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp15,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp15,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp26 + tmp16,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp26 - tmp16,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp27,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
+ outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[14] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[13] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[12] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[11] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25 + tmp15,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp25 - tmp15,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp26 + tmp16,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp26 - tmp16,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp27,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
wsptr += 8; /* advance pointer to next row */
}
@@ -2371,9 +2371,9 @@ jpeg_idct_15x15 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
*/
GLOBAL(void)
-jpeg_idct_16x16 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block,
- JSAMPARRAY output_buf, JDIMENSION output_col)
+jpeg_idct_16x16(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
{
JLONG tmp0, tmp1, tmp2, tmp3, tmp10, tmp11, tmp12, tmp13;
JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26, tmp27;
@@ -2384,23 +2384,23 @@ jpeg_idct_16x16 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
JSAMPROW outptr;
JSAMPLE *range_limit = IDCT_range_limit(cinfo);
int ctr;
- int workspace[8*16]; /* buffers data between passes */
+ int workspace[8 * 16]; /* buffers data between passes */
SHIFT_TEMPS
/* Pass 1: process columns from input, store into work array. */
inptr = coef_block;
- quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
+ quantptr = (ISLOW_MULT_TYPE *)compptr->dct_table;
wsptr = workspace;
for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) {
/* Even part */
- tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
+ tmp0 = DEQUANTIZE(inptr[DCTSIZE * 0], quantptr[DCTSIZE * 0]);
tmp0 = LEFT_SHIFT(tmp0, CONST_BITS);
/* Add fudge factor here for final descale. */
- tmp0 += 1 << (CONST_BITS-PASS1_BITS-1);
+ tmp0 += 1 << (CONST_BITS - PASS1_BITS - 1);
- z1 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
+ z1 = DEQUANTIZE(inptr[DCTSIZE * 4], quantptr[DCTSIZE * 4]);
tmp1 = MULTIPLY(z1, FIX(1.306562965)); /* c4[16] = c2[8] */
tmp2 = MULTIPLY(z1, FIX_0_541196100); /* c12[16] = c6[8] */
@@ -2409,8 +2409,8 @@ jpeg_idct_16x16 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
tmp12 = tmp0 + tmp2;
tmp13 = tmp0 - tmp2;
- z1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
- z2 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
+ z1 = DEQUANTIZE(inptr[DCTSIZE * 2], quantptr[DCTSIZE * 2]);
+ z2 = DEQUANTIZE(inptr[DCTSIZE * 6], quantptr[DCTSIZE * 6]);
z3 = z1 - z2;
z4 = MULTIPLY(z3, FIX(0.275899379)); /* c14[16] = c7[8] */
z3 = MULTIPLY(z3, FIX(1.387039845)); /* c2[16] = c1[8] */
@@ -2431,10 +2431,10 @@ jpeg_idct_16x16 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Odd part */
- z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
- z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
- z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
- z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
+ z1 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1]);
+ z2 = DEQUANTIZE(inptr[DCTSIZE * 3], quantptr[DCTSIZE * 3]);
+ z3 = DEQUANTIZE(inptr[DCTSIZE * 5], quantptr[DCTSIZE * 5]);
+ z4 = DEQUANTIZE(inptr[DCTSIZE * 7], quantptr[DCTSIZE * 7]);
tmp11 = z1 + z3;
@@ -2455,13 +2455,13 @@ jpeg_idct_16x16 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
tmp11 += z1 - MULTIPLY(z3, FIX(0.766367282)); /* c1+c11-c9-c13 */
tmp12 += z1 + MULTIPLY(z2, FIX(1.971951411)); /* c1+c5+c13-c7 */
z2 += z4;
- z1 = MULTIPLY(z2, - FIX(0.666655658)); /* -c11 */
+ z1 = MULTIPLY(z2, -FIX(0.666655658)); /* -c11 */
tmp1 += z1;
tmp3 += z1 + MULTIPLY(z4, FIX(1.065388962)); /* c3+c11+c15-c7 */
- z2 = MULTIPLY(z2, - FIX(1.247225013)); /* -c5 */
+ z2 = MULTIPLY(z2, -FIX(1.247225013)); /* -c5 */
tmp10 += z2 + MULTIPLY(z4, FIX(3.141271809)); /* c1+c5+c9-c13 */
tmp12 += z2;
- z2 = MULTIPLY(z3 + z4, - FIX(1.353318001)); /* -c3 */
+ z2 = MULTIPLY(z3 + z4, -FIX(1.353318001)); /* -c3 */
tmp2 += z2;
tmp3 += z2;
z2 = MULTIPLY(z4 - z3, FIX(0.410524528)); /* c13 */
@@ -2470,22 +2470,22 @@ jpeg_idct_16x16 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */
- wsptr[8*0] = (int) RIGHT_SHIFT(tmp20 + tmp0, CONST_BITS-PASS1_BITS);
- wsptr[8*15] = (int) RIGHT_SHIFT(tmp20 - tmp0, CONST_BITS-PASS1_BITS);
- wsptr[8*1] = (int) RIGHT_SHIFT(tmp21 + tmp1, CONST_BITS-PASS1_BITS);
- wsptr[8*14] = (int) RIGHT_SHIFT(tmp21 - tmp1, CONST_BITS-PASS1_BITS);
- wsptr[8*2] = (int) RIGHT_SHIFT(tmp22 + tmp2, CONST_BITS-PASS1_BITS);
- wsptr[8*13] = (int) RIGHT_SHIFT(tmp22 - tmp2, CONST_BITS-PASS1_BITS);
- wsptr[8*3] = (int) RIGHT_SHIFT(tmp23 + tmp3, CONST_BITS-PASS1_BITS);
- wsptr[8*12] = (int) RIGHT_SHIFT(tmp23 - tmp3, CONST_BITS-PASS1_BITS);
- wsptr[8*4] = (int) RIGHT_SHIFT(tmp24 + tmp10, CONST_BITS-PASS1_BITS);
- wsptr[8*11] = (int) RIGHT_SHIFT(tmp24 - tmp10, CONST_BITS-PASS1_BITS);
- wsptr[8*5] = (int) RIGHT_SHIFT(tmp25 + tmp11, CONST_BITS-PASS1_BITS);
- wsptr[8*10] = (int) RIGHT_SHIFT(tmp25 - tmp11, CONST_BITS-PASS1_BITS);
- wsptr[8*6] = (int) RIGHT_SHIFT(tmp26 + tmp12, CONST_BITS-PASS1_BITS);
- wsptr[8*9] = (int) RIGHT_SHIFT(tmp26 - tmp12, CONST_BITS-PASS1_BITS);
- wsptr[8*7] = (int) RIGHT_SHIFT(tmp27 + tmp13, CONST_BITS-PASS1_BITS);
- wsptr[8*8] = (int) RIGHT_SHIFT(tmp27 - tmp13, CONST_BITS-PASS1_BITS);
+ wsptr[8 * 0] = (int)RIGHT_SHIFT(tmp20 + tmp0, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 15] = (int)RIGHT_SHIFT(tmp20 - tmp0, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 1] = (int)RIGHT_SHIFT(tmp21 + tmp1, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 14] = (int)RIGHT_SHIFT(tmp21 - tmp1, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 2] = (int)RIGHT_SHIFT(tmp22 + tmp2, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 13] = (int)RIGHT_SHIFT(tmp22 - tmp2, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 3] = (int)RIGHT_SHIFT(tmp23 + tmp3, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 12] = (int)RIGHT_SHIFT(tmp23 - tmp3, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 4] = (int)RIGHT_SHIFT(tmp24 + tmp10, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 11] = (int)RIGHT_SHIFT(tmp24 - tmp10, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 5] = (int)RIGHT_SHIFT(tmp25 + tmp11, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 10] = (int)RIGHT_SHIFT(tmp25 - tmp11, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 6] = (int)RIGHT_SHIFT(tmp26 + tmp12, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 9] = (int)RIGHT_SHIFT(tmp26 - tmp12, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 7] = (int)RIGHT_SHIFT(tmp27 + tmp13, CONST_BITS - PASS1_BITS);
+ wsptr[8 * 8] = (int)RIGHT_SHIFT(tmp27 - tmp13, CONST_BITS - PASS1_BITS);
}
/* Pass 2: process 16 rows from work array, store into output array. */
@@ -2497,10 +2497,10 @@ jpeg_idct_16x16 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Even part */
/* Add fudge factor here for final descale. */
- tmp0 = (JLONG) wsptr[0] + (ONE << (PASS1_BITS+2));
+ tmp0 = (JLONG)wsptr[0] + (ONE << (PASS1_BITS + 2));
tmp0 = LEFT_SHIFT(tmp0, CONST_BITS);
- z1 = (JLONG) wsptr[4];
+ z1 = (JLONG)wsptr[4];
tmp1 = MULTIPLY(z1, FIX(1.306562965)); /* c4[16] = c2[8] */
tmp2 = MULTIPLY(z1, FIX_0_541196100); /* c12[16] = c6[8] */
@@ -2509,8 +2509,8 @@ jpeg_idct_16x16 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
tmp12 = tmp0 + tmp2;
tmp13 = tmp0 - tmp2;
- z1 = (JLONG) wsptr[2];
- z2 = (JLONG) wsptr[6];
+ z1 = (JLONG)wsptr[2];
+ z2 = (JLONG)wsptr[6];
z3 = z1 - z2;
z4 = MULTIPLY(z3, FIX(0.275899379)); /* c14[16] = c7[8] */
z3 = MULTIPLY(z3, FIX(1.387039845)); /* c2[16] = c1[8] */
@@ -2531,10 +2531,10 @@ jpeg_idct_16x16 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Odd part */
- z1 = (JLONG) wsptr[1];
- z2 = (JLONG) wsptr[3];
- z3 = (JLONG) wsptr[5];
- z4 = (JLONG) wsptr[7];
+ z1 = (JLONG)wsptr[1];
+ z2 = (JLONG)wsptr[3];
+ z3 = (JLONG)wsptr[5];
+ z4 = (JLONG)wsptr[7];
tmp11 = z1 + z3;
@@ -2555,13 +2555,13 @@ jpeg_idct_16x16 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
tmp11 += z1 - MULTIPLY(z3, FIX(0.766367282)); /* c1+c11-c9-c13 */
tmp12 += z1 + MULTIPLY(z2, FIX(1.971951411)); /* c1+c5+c13-c7 */
z2 += z4;
- z1 = MULTIPLY(z2, - FIX(0.666655658)); /* -c11 */
+ z1 = MULTIPLY(z2, -FIX(0.666655658)); /* -c11 */
tmp1 += z1;
tmp3 += z1 + MULTIPLY(z4, FIX(1.065388962)); /* c3+c11+c15-c7 */
- z2 = MULTIPLY(z2, - FIX(1.247225013)); /* -c5 */
+ z2 = MULTIPLY(z2, -FIX(1.247225013)); /* -c5 */
tmp10 += z2 + MULTIPLY(z4, FIX(3.141271809)); /* c1+c5+c9-c13 */
tmp12 += z2;
- z2 = MULTIPLY(z3 + z4, - FIX(1.353318001)); /* -c3 */
+ z2 = MULTIPLY(z3 + z4, -FIX(1.353318001)); /* -c3 */
tmp2 += z2;
tmp3 += z2;
z2 = MULTIPLY(z4 - z3, FIX(0.410524528)); /* c13 */
@@ -2570,54 +2570,54 @@ jpeg_idct_16x16 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */
- outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp0,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[15] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp0,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp1,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[14] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp1,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp2,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[13] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp2,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp3,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[12] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp3,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp10,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp10,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp11,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp11,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp26 + tmp12,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp26 - tmp12,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp27 + tmp13,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
- outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp27 - tmp13,
- CONST_BITS+PASS1_BITS+3)
- & RANGE_MASK];
+ outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp0,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[15] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp0,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp1,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[14] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp1,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp2,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[13] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp2,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp3,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[12] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp3,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp10,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[11] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp10,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25 + tmp11,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp25 - tmp11,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp26 + tmp12,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp26 - tmp12,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp27 + tmp13,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
+ outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp27 - tmp13,
+ CONST_BITS + PASS1_BITS + 3) &
+ RANGE_MASK];
wsptr += 8; /* advance pointer to next row */
}
diff --git a/src/3rdparty/libjpeg/src/jidctred.c b/src/3rdparty/libjpeg/src/jidctred.c
index 7a81803b8d..1ff352f875 100644
--- a/src/3rdparty/libjpeg/src/jidctred.c
+++ b/src/3rdparty/libjpeg/src/jidctred.c
@@ -58,20 +58,20 @@
*/
#if CONST_BITS == 13
-#define FIX_0_211164243 ((JLONG) 1730) /* FIX(0.211164243) */
-#define FIX_0_509795579 ((JLONG) 4176) /* FIX(0.509795579) */
-#define FIX_0_601344887 ((JLONG) 4926) /* FIX(0.601344887) */
-#define FIX_0_720959822 ((JLONG) 5906) /* FIX(0.720959822) */
-#define FIX_0_765366865 ((JLONG) 6270) /* FIX(0.765366865) */
-#define FIX_0_850430095 ((JLONG) 6967) /* FIX(0.850430095) */
-#define FIX_0_899976223 ((JLONG) 7373) /* FIX(0.899976223) */
-#define FIX_1_061594337 ((JLONG) 8697) /* FIX(1.061594337) */
-#define FIX_1_272758580 ((JLONG) 10426) /* FIX(1.272758580) */
-#define FIX_1_451774981 ((JLONG) 11893) /* FIX(1.451774981) */
-#define FIX_1_847759065 ((JLONG) 15137) /* FIX(1.847759065) */
-#define FIX_2_172734803 ((JLONG) 17799) /* FIX(2.172734803) */
-#define FIX_2_562915447 ((JLONG) 20995) /* FIX(2.562915447) */
-#define FIX_3_624509785 ((JLONG) 29692) /* FIX(3.624509785) */
+#define FIX_0_211164243 ((JLONG)1730) /* FIX(0.211164243) */
+#define FIX_0_509795579 ((JLONG)4176) /* FIX(0.509795579) */
+#define FIX_0_601344887 ((JLONG)4926) /* FIX(0.601344887) */
+#define FIX_0_720959822 ((JLONG)5906) /* FIX(0.720959822) */
+#define FIX_0_765366865 ((JLONG)6270) /* FIX(0.765366865) */
+#define FIX_0_850430095 ((JLONG)6967) /* FIX(0.850430095) */
+#define FIX_0_899976223 ((JLONG)7373) /* FIX(0.899976223) */
+#define FIX_1_061594337 ((JLONG)8697) /* FIX(1.061594337) */
+#define FIX_1_272758580 ((JLONG)10426) /* FIX(1.272758580) */
+#define FIX_1_451774981 ((JLONG)11893) /* FIX(1.451774981) */
+#define FIX_1_847759065 ((JLONG)15137) /* FIX(1.847759065) */
+#define FIX_2_172734803 ((JLONG)17799) /* FIX(2.172734803) */
+#define FIX_2_562915447 ((JLONG)20995) /* FIX(2.562915447) */
+#define FIX_3_624509785 ((JLONG)29692) /* FIX(3.624509785) */
#else
#define FIX_0_211164243 FIX(0.211164243)
#define FIX_0_509795579 FIX(0.509795579)
@@ -98,9 +98,9 @@
*/
#if BITS_IN_JSAMPLE == 8
-#define MULTIPLY(var,const) MULTIPLY16C16(var,const)
+#define MULTIPLY(var, const) MULTIPLY16C16(var, const)
#else
-#define MULTIPLY(var,const) ((var) * (const))
+#define MULTIPLY(var, const) ((var) * (const))
#endif
@@ -109,7 +109,7 @@
* are 16 bits or less, so either int or short multiply will work.
*/
-#define DEQUANTIZE(coef,quantval) (((ISLOW_MULT_TYPE) (coef)) * (quantval))
+#define DEQUANTIZE(coef, quantval) (((ISLOW_MULT_TYPE)(coef)) * (quantval))
/*
@@ -118,9 +118,9 @@
*/
GLOBAL(void)
-jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block,
- JSAMPARRAY output_buf, JDIMENSION output_col)
+jpeg_idct_4x4(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
{
JLONG tmp0, tmp2, tmp10, tmp12;
JLONG z1, z2, z3, z4;
@@ -130,69 +130,73 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
JSAMPROW outptr;
JSAMPLE *range_limit = IDCT_range_limit(cinfo);
int ctr;
- int workspace[DCTSIZE*4]; /* buffers data between passes */
+ int workspace[DCTSIZE * 4]; /* buffers data between passes */
SHIFT_TEMPS
/* Pass 1: process columns from input, store into work array. */
inptr = coef_block;
- quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
+ quantptr = (ISLOW_MULT_TYPE *)compptr->dct_table;
wsptr = workspace;
for (ctr = DCTSIZE; ctr > 0; inptr++, quantptr++, wsptr++, ctr--) {
/* Don't bother to process column 4, because second pass won't use it */
- if (ctr == DCTSIZE-4)
+ if (ctr == DCTSIZE - 4)
continue;
- if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 &&
- inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*5] == 0 &&
- inptr[DCTSIZE*6] == 0 && inptr[DCTSIZE*7] == 0) {
+ if (inptr[DCTSIZE * 1] == 0 && inptr[DCTSIZE * 2] == 0 &&
+ inptr[DCTSIZE * 3] == 0 && inptr[DCTSIZE * 5] == 0 &&
+ inptr[DCTSIZE * 6] == 0 && inptr[DCTSIZE * 7] == 0) {
/* AC terms all zero; we need not examine term 4 for 4x4 output */
- int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]),
- PASS1_BITS);
+ int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE * 0],
+ quantptr[DCTSIZE * 0]), PASS1_BITS);
- wsptr[DCTSIZE*0] = dcval;
- wsptr[DCTSIZE*1] = dcval;
- wsptr[DCTSIZE*2] = dcval;
- wsptr[DCTSIZE*3] = dcval;
+ wsptr[DCTSIZE * 0] = dcval;
+ wsptr[DCTSIZE * 1] = dcval;
+ wsptr[DCTSIZE * 2] = dcval;
+ wsptr[DCTSIZE * 3] = dcval;
continue;
}
/* Even part */
- tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
- tmp0 = LEFT_SHIFT(tmp0, CONST_BITS+1);
+ tmp0 = DEQUANTIZE(inptr[DCTSIZE * 0], quantptr[DCTSIZE * 0]);
+ tmp0 = LEFT_SHIFT(tmp0, CONST_BITS + 1);
- z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
- z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
+ z2 = DEQUANTIZE(inptr[DCTSIZE * 2], quantptr[DCTSIZE * 2]);
+ z3 = DEQUANTIZE(inptr[DCTSIZE * 6], quantptr[DCTSIZE * 6]);
- tmp2 = MULTIPLY(z2, FIX_1_847759065) + MULTIPLY(z3, - FIX_0_765366865);
+ tmp2 = MULTIPLY(z2, FIX_1_847759065) + MULTIPLY(z3, -FIX_0_765366865);
tmp10 = tmp0 + tmp2;
tmp12 = tmp0 - tmp2;
/* Odd part */
- z1 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
- z2 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
- z3 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
- z4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
+ z1 = DEQUANTIZE(inptr[DCTSIZE * 7], quantptr[DCTSIZE * 7]);
+ z2 = DEQUANTIZE(inptr[DCTSIZE * 5], quantptr[DCTSIZE * 5]);
+ z3 = DEQUANTIZE(inptr[DCTSIZE * 3], quantptr[DCTSIZE * 3]);
+ z4 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1]);
- tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */
- + MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */
- + MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */
- + MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */
+ tmp0 = MULTIPLY(z1, -FIX_0_211164243) + /* sqrt(2) * ( c3-c1) */
+ MULTIPLY(z2, FIX_1_451774981) + /* sqrt(2) * ( c3+c7) */
+ MULTIPLY(z3, -FIX_2_172734803) + /* sqrt(2) * (-c1-c5) */
+ MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * ( c5+c7) */
- tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */
- + MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */
- + MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */
- + MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */
+ tmp2 = MULTIPLY(z1, -FIX_0_509795579) + /* sqrt(2) * (c7-c5) */
+ MULTIPLY(z2, -FIX_0_601344887) + /* sqrt(2) * (c5-c1) */
+ MULTIPLY(z3, FIX_0_899976223) + /* sqrt(2) * (c3-c7) */
+ MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */
/* Final output stage */
- wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp2, CONST_BITS-PASS1_BITS+1);
- wsptr[DCTSIZE*3] = (int) DESCALE(tmp10 - tmp2, CONST_BITS-PASS1_BITS+1);
- wsptr[DCTSIZE*1] = (int) DESCALE(tmp12 + tmp0, CONST_BITS-PASS1_BITS+1);
- wsptr[DCTSIZE*2] = (int) DESCALE(tmp12 - tmp0, CONST_BITS-PASS1_BITS+1);
+ wsptr[DCTSIZE * 0] =
+ (int)DESCALE(tmp10 + tmp2, CONST_BITS - PASS1_BITS + 1);
+ wsptr[DCTSIZE * 3] =
+ (int)DESCALE(tmp10 - tmp2, CONST_BITS - PASS1_BITS + 1);
+ wsptr[DCTSIZE * 1] =
+ (int)DESCALE(tmp12 + tmp0, CONST_BITS - PASS1_BITS + 1);
+ wsptr[DCTSIZE * 2] =
+ (int)DESCALE(tmp12 - tmp0, CONST_BITS - PASS1_BITS + 1);
}
/* Pass 2: process 4 rows from work array, store into output array. */
@@ -206,8 +210,8 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 &&
wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
/* AC terms all zero */
- JSAMPLE dcval = range_limit[(int) DESCALE((JLONG) wsptr[0], PASS1_BITS+3)
- & RANGE_MASK];
+ JSAMPLE dcval = range_limit[(int)DESCALE((JLONG)wsptr[0],
+ PASS1_BITS + 3) & RANGE_MASK];
outptr[0] = dcval;
outptr[1] = dcval;
@@ -221,45 +225,45 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Even part */
- tmp0 = LEFT_SHIFT((JLONG) wsptr[0], CONST_BITS+1);
+ tmp0 = LEFT_SHIFT((JLONG)wsptr[0], CONST_BITS + 1);
- tmp2 = MULTIPLY((JLONG) wsptr[2], FIX_1_847759065)
- + MULTIPLY((JLONG) wsptr[6], - FIX_0_765366865);
+ tmp2 = MULTIPLY((JLONG)wsptr[2], FIX_1_847759065) +
+ MULTIPLY((JLONG)wsptr[6], -FIX_0_765366865);
tmp10 = tmp0 + tmp2;
tmp12 = tmp0 - tmp2;
/* Odd part */
- z1 = (JLONG) wsptr[7];
- z2 = (JLONG) wsptr[5];
- z3 = (JLONG) wsptr[3];
- z4 = (JLONG) wsptr[1];
+ z1 = (JLONG)wsptr[7];
+ z2 = (JLONG)wsptr[5];
+ z3 = (JLONG)wsptr[3];
+ z4 = (JLONG)wsptr[1];
- tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */
- + MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */
- + MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */
- + MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */
+ tmp0 = MULTIPLY(z1, -FIX_0_211164243) + /* sqrt(2) * ( c3-c1) */
+ MULTIPLY(z2, FIX_1_451774981) + /* sqrt(2) * ( c3+c7) */
+ MULTIPLY(z3, -FIX_2_172734803) + /* sqrt(2) * (-c1-c5) */
+ MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * ( c5+c7) */
- tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */
- + MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */
- + MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */
- + MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */
+ tmp2 = MULTIPLY(z1, -FIX_0_509795579) + /* sqrt(2) * (c7-c5) */
+ MULTIPLY(z2, -FIX_0_601344887) + /* sqrt(2) * (c5-c1) */
+ MULTIPLY(z3, FIX_0_899976223) + /* sqrt(2) * (c3-c7) */
+ MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */
/* Final output stage */
- outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp2,
- CONST_BITS+PASS1_BITS+3+1)
- & RANGE_MASK];
- outptr[3] = range_limit[(int) DESCALE(tmp10 - tmp2,
- CONST_BITS+PASS1_BITS+3+1)
- & RANGE_MASK];
- outptr[1] = range_limit[(int) DESCALE(tmp12 + tmp0,
- CONST_BITS+PASS1_BITS+3+1)
- & RANGE_MASK];
- outptr[2] = range_limit[(int) DESCALE(tmp12 - tmp0,
- CONST_BITS+PASS1_BITS+3+1)
- & RANGE_MASK];
+ outptr[0] = range_limit[(int)DESCALE(tmp10 + tmp2,
+ CONST_BITS + PASS1_BITS + 3 + 1) &
+ RANGE_MASK];
+ outptr[3] = range_limit[(int)DESCALE(tmp10 - tmp2,
+ CONST_BITS + PASS1_BITS + 3 + 1) &
+ RANGE_MASK];
+ outptr[1] = range_limit[(int)DESCALE(tmp12 + tmp0,
+ CONST_BITS + PASS1_BITS + 3 + 1) &
+ RANGE_MASK];
+ outptr[2] = range_limit[(int)DESCALE(tmp12 - tmp0,
+ CONST_BITS + PASS1_BITS + 3 + 1) &
+ RANGE_MASK];
wsptr += DCTSIZE; /* advance pointer to next row */
}
@@ -272,9 +276,9 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
*/
GLOBAL(void)
-jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block,
- JSAMPARRAY output_buf, JDIMENSION output_col)
+jpeg_idct_2x2(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
{
JLONG tmp0, tmp10, z1;
JCOEFPTR inptr;
@@ -283,50 +287,52 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
JSAMPROW outptr;
JSAMPLE *range_limit = IDCT_range_limit(cinfo);
int ctr;
- int workspace[DCTSIZE*2]; /* buffers data between passes */
+ int workspace[DCTSIZE * 2]; /* buffers data between passes */
SHIFT_TEMPS
/* Pass 1: process columns from input, store into work array. */
inptr = coef_block;
- quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
+ quantptr = (ISLOW_MULT_TYPE *)compptr->dct_table;
wsptr = workspace;
for (ctr = DCTSIZE; ctr > 0; inptr++, quantptr++, wsptr++, ctr--) {
/* Don't bother to process columns 2,4,6 */
- if (ctr == DCTSIZE-2 || ctr == DCTSIZE-4 || ctr == DCTSIZE-6)
+ if (ctr == DCTSIZE - 2 || ctr == DCTSIZE - 4 || ctr == DCTSIZE - 6)
continue;
- if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*3] == 0 &&
- inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*7] == 0) {
+ if (inptr[DCTSIZE * 1] == 0 && inptr[DCTSIZE * 3] == 0 &&
+ inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 7] == 0) {
/* AC terms all zero; we need not examine terms 2,4,6 for 2x2 output */
- int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]),
- PASS1_BITS);
+ int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE * 0],
+ quantptr[DCTSIZE * 0]), PASS1_BITS);
- wsptr[DCTSIZE*0] = dcval;
- wsptr[DCTSIZE*1] = dcval;
+ wsptr[DCTSIZE * 0] = dcval;
+ wsptr[DCTSIZE * 1] = dcval;
continue;
}
/* Even part */
- z1 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
- tmp10 = LEFT_SHIFT(z1, CONST_BITS+2);
+ z1 = DEQUANTIZE(inptr[DCTSIZE * 0], quantptr[DCTSIZE * 0]);
+ tmp10 = LEFT_SHIFT(z1, CONST_BITS + 2);
/* Odd part */
- z1 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
- tmp0 = MULTIPLY(z1, - FIX_0_720959822); /* sqrt(2) * (c7-c5+c3-c1) */
- z1 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
- tmp0 += MULTIPLY(z1, FIX_0_850430095); /* sqrt(2) * (-c1+c3+c5+c7) */
- z1 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
- tmp0 += MULTIPLY(z1, - FIX_1_272758580); /* sqrt(2) * (-c1+c3-c5-c7) */
- z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
- tmp0 += MULTIPLY(z1, FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */
+ z1 = DEQUANTIZE(inptr[DCTSIZE * 7], quantptr[DCTSIZE * 7]);
+ tmp0 = MULTIPLY(z1, -FIX_0_720959822); /* sqrt(2) * ( c7-c5+c3-c1) */
+ z1 = DEQUANTIZE(inptr[DCTSIZE * 5], quantptr[DCTSIZE * 5]);
+ tmp0 += MULTIPLY(z1, FIX_0_850430095); /* sqrt(2) * (-c1+c3+c5+c7) */
+ z1 = DEQUANTIZE(inptr[DCTSIZE * 3], quantptr[DCTSIZE * 3]);
+ tmp0 += MULTIPLY(z1, -FIX_1_272758580); /* sqrt(2) * (-c1+c3-c5-c7) */
+ z1 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1]);
+ tmp0 += MULTIPLY(z1, FIX_3_624509785); /* sqrt(2) * ( c1+c3+c5+c7) */
/* Final output stage */
- wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp0, CONST_BITS-PASS1_BITS+2);
- wsptr[DCTSIZE*1] = (int) DESCALE(tmp10 - tmp0, CONST_BITS-PASS1_BITS+2);
+ wsptr[DCTSIZE * 0] =
+ (int)DESCALE(tmp10 + tmp0, CONST_BITS - PASS1_BITS + 2);
+ wsptr[DCTSIZE * 1] =
+ (int)DESCALE(tmp10 - tmp0, CONST_BITS - PASS1_BITS + 2);
}
/* Pass 2: process 2 rows from work array, store into output array. */
@@ -339,8 +345,8 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
#ifndef NO_ZERO_ROW_TEST
if (wsptr[1] == 0 && wsptr[3] == 0 && wsptr[5] == 0 && wsptr[7] == 0) {
/* AC terms all zero */
- JSAMPLE dcval = range_limit[(int) DESCALE((JLONG) wsptr[0], PASS1_BITS+3)
- & RANGE_MASK];
+ JSAMPLE dcval = range_limit[(int)DESCALE((JLONG)wsptr[0],
+ PASS1_BITS + 3) & RANGE_MASK];
outptr[0] = dcval;
outptr[1] = dcval;
@@ -352,23 +358,23 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Even part */
- tmp10 = LEFT_SHIFT((JLONG) wsptr[0], CONST_BITS+2);
+ tmp10 = LEFT_SHIFT((JLONG)wsptr[0], CONST_BITS + 2);
/* Odd part */
- tmp0 = MULTIPLY((JLONG) wsptr[7], - FIX_0_720959822) /* sqrt(2) * (c7-c5+c3-c1) */
- + MULTIPLY((JLONG) wsptr[5], FIX_0_850430095) /* sqrt(2) * (-c1+c3+c5+c7) */
- + MULTIPLY((JLONG) wsptr[3], - FIX_1_272758580) /* sqrt(2) * (-c1+c3-c5-c7) */
- + MULTIPLY((JLONG) wsptr[1], FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */
+ tmp0 = MULTIPLY((JLONG)wsptr[7], -FIX_0_720959822) + /* sqrt(2) * ( c7-c5+c3-c1) */
+ MULTIPLY((JLONG)wsptr[5], FIX_0_850430095) + /* sqrt(2) * (-c1+c3+c5+c7) */
+ MULTIPLY((JLONG)wsptr[3], -FIX_1_272758580) + /* sqrt(2) * (-c1+c3-c5-c7) */
+ MULTIPLY((JLONG)wsptr[1], FIX_3_624509785); /* sqrt(2) * ( c1+c3+c5+c7) */
/* Final output stage */
- outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp0,
- CONST_BITS+PASS1_BITS+3+2)
- & RANGE_MASK];
- outptr[1] = range_limit[(int) DESCALE(tmp10 - tmp0,
- CONST_BITS+PASS1_BITS+3+2)
- & RANGE_MASK];
+ outptr[0] = range_limit[(int)DESCALE(tmp10 + tmp0,
+ CONST_BITS + PASS1_BITS + 3 + 2) &
+ RANGE_MASK];
+ outptr[1] = range_limit[(int)DESCALE(tmp10 - tmp0,
+ CONST_BITS + PASS1_BITS + 3 + 2) &
+ RANGE_MASK];
wsptr += DCTSIZE; /* advance pointer to next row */
}
@@ -381,9 +387,9 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
*/
GLOBAL(void)
-jpeg_idct_1x1 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block,
- JSAMPARRAY output_buf, JDIMENSION output_col)
+jpeg_idct_1x1(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
{
int dcval;
ISLOW_MULT_TYPE *quantptr;
@@ -393,9 +399,9 @@ jpeg_idct_1x1 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* We hardly need an inverse DCT routine for this: just take the
* average pixel value, which is one-eighth of the DC coefficient.
*/
- quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
+ quantptr = (ISLOW_MULT_TYPE *)compptr->dct_table;
dcval = DEQUANTIZE(coef_block[0], quantptr[0]);
- dcval = (int) DESCALE((JLONG) dcval, 3);
+ dcval = (int)DESCALE((JLONG)dcval, 3);
output_buf[0][output_col] = range_limit[dcval & RANGE_MASK];
}
diff --git a/src/3rdparty/libjpeg/src/jinclude.h b/src/3rdparty/libjpeg/src/jinclude.h
index d461a1aa16..c1bcf7d9da 100644
--- a/src/3rdparty/libjpeg/src/jinclude.h
+++ b/src/3rdparty/libjpeg/src/jinclude.h
@@ -61,14 +61,18 @@
#ifdef NEED_BSD_STRINGS
#include <strings.h>
-#define MEMZERO(target,size) bzero((void *)(target), (size_t)(size))
-#define MEMCOPY(dest,src,size) bcopy((const void *)(src), (void *)(dest), (size_t)(size))
+#define MEMZERO(target, size) \
+ bzero((void *)(target), (size_t)(size))
+#define MEMCOPY(dest, src, size) \
+ bcopy((const void *)(src), (void *)(dest), (size_t)(size))
#else /* not BSD, assume ANSI/SysV string lib */
#include <string.h>
-#define MEMZERO(target,size) memset((void *)(target), 0, (size_t)(size))
-#define MEMCOPY(dest,src,size) memcpy((void *)(dest), (const void *)(src), (size_t)(size))
+#define MEMZERO(target, size) \
+ memset((void *)(target), 0, (size_t)(size))
+#define MEMCOPY(dest, src, size) \
+ memcpy((void *)(dest), (const void *)(src), (size_t)(size))
#endif
@@ -78,7 +82,7 @@
* CAUTION: argument order is different from underlying functions!
*/
-#define JFREAD(file,buf,sizeofbuf) \
- ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
-#define JFWRITE(file,buf,sizeofbuf) \
- ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
+#define JFREAD(file, buf, sizeofbuf) \
+ ((size_t)fread((void *)(buf), (size_t)1, (size_t)(sizeofbuf), (file)))
+#define JFWRITE(file, buf, sizeofbuf) \
+ ((size_t)fwrite((const void *)(buf), (size_t)1, (size_t)(sizeofbuf), (file)))
diff --git a/src/3rdparty/libjpeg/src/jmemmgr.c b/src/3rdparty/libjpeg/src/jmemmgr.c
index 8dfb633dae..508ca7429c 100644
--- a/src/3rdparty/libjpeg/src/jmemmgr.c
+++ b/src/3rdparty/libjpeg/src/jmemmgr.c
@@ -32,20 +32,20 @@
#include "jinclude.h"
#include "jpeglib.h"
#include "jmemsys.h" /* import the system-dependent declarations */
-#ifndef _WIN32
+#if !defined(_MSC_VER) || _MSC_VER > 1600
#include <stdint.h>
#endif
#include <limits.h>
#ifndef NO_GETENV
#ifndef HAVE_STDLIB_H /* <stdlib.h> should declare getenv() */
-extern char *getenv (const char *name);
+extern char *getenv(const char *name);
#endif
#endif
LOCAL(size_t)
-round_up_pow2 (size_t a, size_t b)
+round_up_pow2(size_t a, size_t b)
/* a rounded up to the next multiple of b, i.e. ceil(a/b)*b */
/* Assumes a >= 0, b > 0, and b is a power of 2 */
{
@@ -89,7 +89,9 @@ round_up_pow2 (size_t a, size_t b)
#ifndef WITH_SIMD
#define ALIGN_SIZE sizeof(double)
#else
-#define ALIGN_SIZE 16 /* Most SIMD implementations require this */
+#define ALIGN_SIZE 32 /* Most of the SIMD instructions we support require
+ 16-byte (128-bit) alignment, but AVX2 requires
+ 32-byte alignment. */
#endif
#endif
@@ -104,7 +106,7 @@ round_up_pow2 (size_t a, size_t b)
typedef struct small_pool_struct *small_pool_ptr;
typedef struct small_pool_struct {
- small_pool_ptr next; /* next in list of pools */
+ small_pool_ptr next; /* next in list of pools */
size_t bytes_used; /* how many bytes already used within pool */
size_t bytes_left; /* bytes still available in this pool */
} small_pool_hdr;
@@ -112,7 +114,7 @@ typedef struct small_pool_struct {
typedef struct large_pool_struct *large_pool_ptr;
typedef struct large_pool_struct {
- large_pool_ptr next; /* next in list of pools */
+ large_pool_ptr next; /* next in list of pools */
size_t bytes_used; /* how many bytes already used within pool */
size_t bytes_left; /* bytes still available in this pool */
} large_pool_hdr;
@@ -191,9 +193,9 @@ struct jvirt_barray_control {
#ifdef MEM_STATS /* optional extra stuff for statistics */
LOCAL(void)
-print_mem_stats (j_common_ptr cinfo, int pool_id)
+print_mem_stats(j_common_ptr cinfo, int pool_id)
{
- my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
+ my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
small_pool_ptr shdr_ptr;
large_pool_ptr lhdr_ptr;
@@ -206,15 +208,13 @@ print_mem_stats (j_common_ptr cinfo, int pool_id)
for (lhdr_ptr = mem->large_list[pool_id]; lhdr_ptr != NULL;
lhdr_ptr = lhdr_ptr->next) {
- fprintf(stderr, " Large chunk used %ld\n",
- (long) lhdr_ptr->bytes_used);
+ fprintf(stderr, " Large chunk used %ld\n", (long)lhdr_ptr->bytes_used);
}
for (shdr_ptr = mem->small_list[pool_id]; shdr_ptr != NULL;
shdr_ptr = shdr_ptr->next) {
fprintf(stderr, " Small chunk used %ld free %ld\n",
- (long) shdr_ptr->bytes_used,
- (long) shdr_ptr->bytes_left);
+ (long)shdr_ptr->bytes_used, (long)shdr_ptr->bytes_left);
}
}
@@ -222,7 +222,7 @@ print_mem_stats (j_common_ptr cinfo, int pool_id)
LOCAL(void)
-out_of_memory (j_common_ptr cinfo, int which)
+out_of_memory(j_common_ptr cinfo, int which)
/* Report an out-of-memory error and stop execution */
/* If we compiled MEM_STATS support, report alloc requests before dying */
{
@@ -250,26 +250,24 @@ out_of_memory (j_common_ptr cinfo, int which)
* adjustment.
*/
-static const size_t first_pool_slop[JPOOL_NUMPOOLS] =
-{
- 1600, /* first PERMANENT pool */
- 16000 /* first IMAGE pool */
+static const size_t first_pool_slop[JPOOL_NUMPOOLS] = {
+ 1600, /* first PERMANENT pool */
+ 16000 /* first IMAGE pool */
};
-static const size_t extra_pool_slop[JPOOL_NUMPOOLS] =
-{
- 0, /* additional PERMANENT pools */
- 5000 /* additional IMAGE pools */
+static const size_t extra_pool_slop[JPOOL_NUMPOOLS] = {
+ 0, /* additional PERMANENT pools */
+ 5000 /* additional IMAGE pools */
};
#define MIN_SLOP 50 /* greater than 0 to avoid futile looping */
METHODDEF(void *)
-alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
+alloc_small(j_common_ptr cinfo, int pool_id, size_t sizeofobject)
/* Allocate a "small" object */
{
- my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
+ my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
small_pool_ptr hdr_ptr, prev_hdr_ptr;
char *data_ptr;
size_t min_request, slop;
@@ -313,11 +311,11 @@ alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
else
slop = extra_pool_slop[pool_id];
/* Don't ask for more than MAX_ALLOC_CHUNK */
- if (slop > (size_t) (MAX_ALLOC_CHUNK-min_request))
- slop = (size_t) (MAX_ALLOC_CHUNK-min_request);
+ if (slop > (size_t)(MAX_ALLOC_CHUNK - min_request))
+ slop = (size_t)(MAX_ALLOC_CHUNK - min_request);
/* Try to get space, if fail reduce slop and try again */
for (;;) {
- hdr_ptr = (small_pool_ptr) jpeg_get_small(cinfo, min_request + slop);
+ hdr_ptr = (small_pool_ptr)jpeg_get_small(cinfo, min_request + slop);
if (hdr_ptr != NULL)
break;
slop /= 2;
@@ -336,7 +334,7 @@ alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
}
/* OK, allocate the object from the current pool */
- data_ptr = (char *) hdr_ptr; /* point to first data byte in pool... */
+ data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
@@ -344,7 +342,7 @@ alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
hdr_ptr->bytes_used += sizeofobject;
hdr_ptr->bytes_left -= sizeofobject;
- return (void *) data_ptr;
+ return (void *)data_ptr;
}
@@ -362,10 +360,10 @@ alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
*/
METHODDEF(void *)
-alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
+alloc_large(j_common_ptr cinfo, int pool_id, size_t sizeofobject)
/* Allocate a "large" object */
{
- my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
+ my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
large_pool_ptr hdr_ptr;
char *data_ptr;
@@ -390,9 +388,9 @@ alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
- hdr_ptr = (large_pool_ptr) jpeg_get_large(cinfo, sizeofobject +
- sizeof(large_pool_hdr) +
- ALIGN_SIZE - 1);
+ hdr_ptr = (large_pool_ptr)jpeg_get_large(cinfo, sizeofobject +
+ sizeof(large_pool_hdr) +
+ ALIGN_SIZE - 1);
if (hdr_ptr == NULL)
out_of_memory(cinfo, 4); /* jpeg_get_large failed */
mem->total_space_allocated += sizeofobject + sizeof(large_pool_hdr) +
@@ -407,12 +405,12 @@ alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
hdr_ptr->bytes_left = 0;
mem->large_list[pool_id] = hdr_ptr;
- data_ptr = (char *) hdr_ptr; /* point to first data byte in pool... */
+ data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
- return (void *) data_ptr;
+ return (void *)data_ptr;
}
@@ -433,11 +431,11 @@ alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
*/
METHODDEF(JSAMPARRAY)
-alloc_sarray (j_common_ptr cinfo, int pool_id,
- JDIMENSION samplesperrow, JDIMENSION numrows)
+alloc_sarray(j_common_ptr cinfo, int pool_id, JDIMENSION samplesperrow,
+ JDIMENSION numrows)
/* Allocate a 2-D sample array */
{
- my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
+ my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
JSAMPARRAY result;
JSAMPROW workspace;
JDIMENSION rowsperchunk, currow, i;
@@ -456,27 +454,27 @@ alloc_sarray (j_common_ptr cinfo, int pool_id,
sizeof(JSAMPLE));
/* Calculate max # of rows allowed in one allocation chunk */
- ltemp = (MAX_ALLOC_CHUNK-sizeof(large_pool_hdr)) /
- ((long) samplesperrow * sizeof(JSAMPLE));
+ ltemp = (MAX_ALLOC_CHUNK - sizeof(large_pool_hdr)) /
+ ((long)samplesperrow * sizeof(JSAMPLE));
if (ltemp <= 0)
ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
- if (ltemp < (long) numrows)
- rowsperchunk = (JDIMENSION) ltemp;
+ if (ltemp < (long)numrows)
+ rowsperchunk = (JDIMENSION)ltemp;
else
rowsperchunk = numrows;
mem->last_rowsperchunk = rowsperchunk;
/* Get space for row pointers (small object) */
- result = (JSAMPARRAY) alloc_small(cinfo, pool_id,
- (size_t) (numrows * sizeof(JSAMPROW)));
+ result = (JSAMPARRAY)alloc_small(cinfo, pool_id,
+ (size_t)(numrows * sizeof(JSAMPROW)));
/* Get the rows themselves (large objects) */
currow = 0;
while (currow < numrows) {
rowsperchunk = MIN(rowsperchunk, numrows - currow);
- workspace = (JSAMPROW) alloc_large(cinfo, pool_id,
- (size_t) ((size_t) rowsperchunk * (size_t) samplesperrow
- * sizeof(JSAMPLE)));
+ workspace = (JSAMPROW)alloc_large(cinfo, pool_id,
+ (size_t)((size_t)rowsperchunk * (size_t)samplesperrow *
+ sizeof(JSAMPLE)));
for (i = rowsperchunk; i > 0; i--) {
result[currow++] = workspace;
workspace += samplesperrow;
@@ -493,11 +491,11 @@ alloc_sarray (j_common_ptr cinfo, int pool_id,
*/
METHODDEF(JBLOCKARRAY)
-alloc_barray (j_common_ptr cinfo, int pool_id,
- JDIMENSION blocksperrow, JDIMENSION numrows)
+alloc_barray(j_common_ptr cinfo, int pool_id, JDIMENSION blocksperrow,
+ JDIMENSION numrows)
/* Allocate a 2-D coefficient-block array */
{
- my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
+ my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
JBLOCKARRAY result;
JBLOCKROW workspace;
JDIMENSION rowsperchunk, currow, i;
@@ -508,27 +506,27 @@ alloc_barray (j_common_ptr cinfo, int pool_id,
out_of_memory(cinfo, 6); /* safety check */
/* Calculate max # of rows allowed in one allocation chunk */
- ltemp = (MAX_ALLOC_CHUNK-sizeof(large_pool_hdr)) /
- ((long) blocksperrow * sizeof(JBLOCK));
+ ltemp = (MAX_ALLOC_CHUNK - sizeof(large_pool_hdr)) /
+ ((long)blocksperrow * sizeof(JBLOCK));
if (ltemp <= 0)
ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
- if (ltemp < (long) numrows)
- rowsperchunk = (JDIMENSION) ltemp;
+ if (ltemp < (long)numrows)
+ rowsperchunk = (JDIMENSION)ltemp;
else
rowsperchunk = numrows;
mem->last_rowsperchunk = rowsperchunk;
/* Get space for row pointers (small object) */
- result = (JBLOCKARRAY) alloc_small(cinfo, pool_id,
- (size_t) (numrows * sizeof(JBLOCKROW)));
+ result = (JBLOCKARRAY)alloc_small(cinfo, pool_id,
+ (size_t)(numrows * sizeof(JBLOCKROW)));
/* Get the rows themselves (large objects) */
currow = 0;
while (currow < numrows) {
rowsperchunk = MIN(rowsperchunk, numrows - currow);
- workspace = (JBLOCKROW) alloc_large(cinfo, pool_id,
- (size_t) ((size_t) rowsperchunk * (size_t) blocksperrow
- * sizeof(JBLOCK)));
+ workspace = (JBLOCKROW)alloc_large(cinfo, pool_id,
+ (size_t)((size_t)rowsperchunk * (size_t)blocksperrow *
+ sizeof(JBLOCK)));
for (i = rowsperchunk; i > 0; i--) {
result[currow++] = workspace;
workspace += blocksperrow;
@@ -577,12 +575,12 @@ alloc_barray (j_common_ptr cinfo, int pool_id,
METHODDEF(jvirt_sarray_ptr)
-request_virt_sarray (j_common_ptr cinfo, int pool_id, boolean pre_zero,
- JDIMENSION samplesperrow, JDIMENSION numrows,
- JDIMENSION maxaccess)
+request_virt_sarray(j_common_ptr cinfo, int pool_id, boolean pre_zero,
+ JDIMENSION samplesperrow, JDIMENSION numrows,
+ JDIMENSION maxaccess)
/* Request a virtual 2-D sample array */
{
- my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
+ my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
jvirt_sarray_ptr result;
/* Only IMAGE-lifetime virtual arrays are currently supported */
@@ -590,8 +588,8 @@ request_virt_sarray (j_common_ptr cinfo, int pool_id, boolean pre_zero,
ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
/* get control block */
- result = (jvirt_sarray_ptr) alloc_small(cinfo, pool_id,
- sizeof(struct jvirt_sarray_control));
+ result = (jvirt_sarray_ptr)alloc_small(cinfo, pool_id,
+ sizeof(struct jvirt_sarray_control));
result->mem_buffer = NULL; /* marks array not yet realized */
result->rows_in_array = numrows;
@@ -607,12 +605,12 @@ request_virt_sarray (j_common_ptr cinfo, int pool_id, boolean pre_zero,
METHODDEF(jvirt_barray_ptr)
-request_virt_barray (j_common_ptr cinfo, int pool_id, boolean pre_zero,
- JDIMENSION blocksperrow, JDIMENSION numrows,
- JDIMENSION maxaccess)
+request_virt_barray(j_common_ptr cinfo, int pool_id, boolean pre_zero,
+ JDIMENSION blocksperrow, JDIMENSION numrows,
+ JDIMENSION maxaccess)
/* Request a virtual 2-D coefficient-block array */
{
- my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
+ my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
jvirt_barray_ptr result;
/* Only IMAGE-lifetime virtual arrays are currently supported */
@@ -620,8 +618,8 @@ request_virt_barray (j_common_ptr cinfo, int pool_id, boolean pre_zero,
ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
/* get control block */
- result = (jvirt_barray_ptr) alloc_small(cinfo, pool_id,
- sizeof(struct jvirt_barray_control));
+ result = (jvirt_barray_ptr)alloc_small(cinfo, pool_id,
+ sizeof(struct jvirt_barray_control));
result->mem_buffer = NULL; /* marks array not yet realized */
result->rows_in_array = numrows;
@@ -637,10 +635,10 @@ request_virt_barray (j_common_ptr cinfo, int pool_id, boolean pre_zero,
METHODDEF(void)
-realize_virt_arrays (j_common_ptr cinfo)
+realize_virt_arrays(j_common_ptr cinfo)
/* Allocate the in-memory buffers for any unrealized virtual arrays */
{
- my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
+ my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
size_t space_per_minheight, maximum_space, avail_mem;
size_t minheights, max_minheights;
jvirt_sarray_ptr sptr;
@@ -654,11 +652,11 @@ realize_virt_arrays (j_common_ptr cinfo)
maximum_space = 0;
for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
if (sptr->mem_buffer == NULL) { /* if not realized yet */
- size_t new_space = (long) sptr->rows_in_array *
- (long) sptr->samplesperrow * sizeof(JSAMPLE);
+ size_t new_space = (long)sptr->rows_in_array *
+ (long)sptr->samplesperrow * sizeof(JSAMPLE);
- space_per_minheight += (long) sptr->maxaccess *
- (long) sptr->samplesperrow * sizeof(JSAMPLE);
+ space_per_minheight += (long)sptr->maxaccess *
+ (long)sptr->samplesperrow * sizeof(JSAMPLE);
if (SIZE_MAX - maximum_space < new_space)
out_of_memory(cinfo, 10);
maximum_space += new_space;
@@ -666,11 +664,11 @@ realize_virt_arrays (j_common_ptr cinfo)
}
for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
if (bptr->mem_buffer == NULL) { /* if not realized yet */
- size_t new_space = (long) bptr->rows_in_array *
- (long) bptr->blocksperrow * sizeof(JBLOCK);
+ size_t new_space = (long)bptr->rows_in_array *
+ (long)bptr->blocksperrow * sizeof(JBLOCK);
- space_per_minheight += (long) bptr->maxaccess *
- (long) bptr->blocksperrow * sizeof(JBLOCK);
+ space_per_minheight += (long)bptr->maxaccess *
+ (long)bptr->blocksperrow * sizeof(JBLOCK);
if (SIZE_MAX - maximum_space < new_space)
out_of_memory(cinfo, 11);
maximum_space += new_space;
@@ -703,17 +701,17 @@ realize_virt_arrays (j_common_ptr cinfo)
for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
if (sptr->mem_buffer == NULL) { /* if not realized yet */
- minheights = ((long) sptr->rows_in_array - 1L) / sptr->maxaccess + 1L;
+ minheights = ((long)sptr->rows_in_array - 1L) / sptr->maxaccess + 1L;
if (minheights <= max_minheights) {
/* This buffer fits in memory */
sptr->rows_in_mem = sptr->rows_in_array;
} else {
/* It doesn't fit in memory, create backing store. */
- sptr->rows_in_mem = (JDIMENSION) (max_minheights * sptr->maxaccess);
- jpeg_open_backing_store(cinfo, & sptr->b_s_info,
- (long) sptr->rows_in_array *
- (long) sptr->samplesperrow *
- (long) sizeof(JSAMPLE));
+ sptr->rows_in_mem = (JDIMENSION)(max_minheights * sptr->maxaccess);
+ jpeg_open_backing_store(cinfo, &sptr->b_s_info,
+ (long)sptr->rows_in_array *
+ (long)sptr->samplesperrow *
+ (long)sizeof(JSAMPLE));
sptr->b_s_open = TRUE;
}
sptr->mem_buffer = alloc_sarray(cinfo, JPOOL_IMAGE,
@@ -727,17 +725,17 @@ realize_virt_arrays (j_common_ptr cinfo)
for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
if (bptr->mem_buffer == NULL) { /* if not realized yet */
- minheights = ((long) bptr->rows_in_array - 1L) / bptr->maxaccess + 1L;
+ minheights = ((long)bptr->rows_in_array - 1L) / bptr->maxaccess + 1L;
if (minheights <= max_minheights) {
/* This buffer fits in memory */
bptr->rows_in_mem = bptr->rows_in_array;
} else {
/* It doesn't fit in memory, create backing store. */
- bptr->rows_in_mem = (JDIMENSION) (max_minheights * bptr->maxaccess);
- jpeg_open_backing_store(cinfo, & bptr->b_s_info,
- (long) bptr->rows_in_array *
- (long) bptr->blocksperrow *
- (long) sizeof(JBLOCK));
+ bptr->rows_in_mem = (JDIMENSION)(max_minheights * bptr->maxaccess);
+ jpeg_open_backing_store(cinfo, &bptr->b_s_info,
+ (long)bptr->rows_in_array *
+ (long)bptr->blocksperrow *
+ (long)sizeof(JBLOCK));
bptr->b_s_open = TRUE;
}
bptr->mem_buffer = alloc_barray(cinfo, JPOOL_IMAGE,
@@ -752,32 +750,32 @@ realize_virt_arrays (j_common_ptr cinfo)
LOCAL(void)
-do_sarray_io (j_common_ptr cinfo, jvirt_sarray_ptr ptr, boolean writing)
+do_sarray_io(j_common_ptr cinfo, jvirt_sarray_ptr ptr, boolean writing)
/* Do backing store read or write of a virtual sample array */
{
long bytesperrow, file_offset, byte_count, rows, thisrow, i;
- bytesperrow = (long) ptr->samplesperrow * sizeof(JSAMPLE);
+ bytesperrow = (long)ptr->samplesperrow * sizeof(JSAMPLE);
file_offset = ptr->cur_start_row * bytesperrow;
/* Loop to read or write each allocation chunk in mem_buffer */
- for (i = 0; i < (long) ptr->rows_in_mem; i += ptr->rowsperchunk) {
+ for (i = 0; i < (long)ptr->rows_in_mem; i += ptr->rowsperchunk) {
/* One chunk, but check for short chunk at end of buffer */
- rows = MIN((long) ptr->rowsperchunk, (long) ptr->rows_in_mem - i);
+ rows = MIN((long)ptr->rowsperchunk, (long)ptr->rows_in_mem - i);
/* Transfer no more than is currently defined */
- thisrow = (long) ptr->cur_start_row + i;
- rows = MIN(rows, (long) ptr->first_undef_row - thisrow);
+ thisrow = (long)ptr->cur_start_row + i;
+ rows = MIN(rows, (long)ptr->first_undef_row - thisrow);
/* Transfer no more than fits in file */
- rows = MIN(rows, (long) ptr->rows_in_array - thisrow);
+ rows = MIN(rows, (long)ptr->rows_in_array - thisrow);
if (rows <= 0) /* this chunk might be past end of file! */
break;
byte_count = rows * bytesperrow;
if (writing)
- (*ptr->b_s_info.write_backing_store) (cinfo, & ptr->b_s_info,
- (void *) ptr->mem_buffer[i],
+ (*ptr->b_s_info.write_backing_store) (cinfo, &ptr->b_s_info,
+ (void *)ptr->mem_buffer[i],
file_offset, byte_count);
else
- (*ptr->b_s_info.read_backing_store) (cinfo, & ptr->b_s_info,
- (void *) ptr->mem_buffer[i],
+ (*ptr->b_s_info.read_backing_store) (cinfo, &ptr->b_s_info,
+ (void *)ptr->mem_buffer[i],
file_offset, byte_count);
file_offset += byte_count;
}
@@ -785,32 +783,32 @@ do_sarray_io (j_common_ptr cinfo, jvirt_sarray_ptr ptr, boolean writing)
LOCAL(void)
-do_barray_io (j_common_ptr cinfo, jvirt_barray_ptr ptr, boolean writing)
+do_barray_io(j_common_ptr cinfo, jvirt_barray_ptr ptr, boolean writing)
/* Do backing store read or write of a virtual coefficient-block array */
{
long bytesperrow, file_offset, byte_count, rows, thisrow, i;
- bytesperrow = (long) ptr->blocksperrow * sizeof(JBLOCK);
+ bytesperrow = (long)ptr->blocksperrow * sizeof(JBLOCK);
file_offset = ptr->cur_start_row * bytesperrow;
/* Loop to read or write each allocation chunk in mem_buffer */
- for (i = 0; i < (long) ptr->rows_in_mem; i += ptr->rowsperchunk) {
+ for (i = 0; i < (long)ptr->rows_in_mem; i += ptr->rowsperchunk) {
/* One chunk, but check for short chunk at end of buffer */
- rows = MIN((long) ptr->rowsperchunk, (long) ptr->rows_in_mem - i);
+ rows = MIN((long)ptr->rowsperchunk, (long)ptr->rows_in_mem - i);
/* Transfer no more than is currently defined */
- thisrow = (long) ptr->cur_start_row + i;
- rows = MIN(rows, (long) ptr->first_undef_row - thisrow);
+ thisrow = (long)ptr->cur_start_row + i;
+ rows = MIN(rows, (long)ptr->first_undef_row - thisrow);
/* Transfer no more than fits in file */
- rows = MIN(rows, (long) ptr->rows_in_array - thisrow);
+ rows = MIN(rows, (long)ptr->rows_in_array - thisrow);
if (rows <= 0) /* this chunk might be past end of file! */
break;
byte_count = rows * bytesperrow;
if (writing)
- (*ptr->b_s_info.write_backing_store) (cinfo, & ptr->b_s_info,
- (void *) ptr->mem_buffer[i],
+ (*ptr->b_s_info.write_backing_store) (cinfo, &ptr->b_s_info,
+ (void *)ptr->mem_buffer[i],
file_offset, byte_count);
else
- (*ptr->b_s_info.read_backing_store) (cinfo, & ptr->b_s_info,
- (void *) ptr->mem_buffer[i],
+ (*ptr->b_s_info.read_backing_store) (cinfo, &ptr->b_s_info,
+ (void *)ptr->mem_buffer[i],
file_offset, byte_count);
file_offset += byte_count;
}
@@ -818,9 +816,8 @@ do_barray_io (j_common_ptr cinfo, jvirt_barray_ptr ptr, boolean writing)
METHODDEF(JSAMPARRAY)
-access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr,
- JDIMENSION start_row, JDIMENSION num_rows,
- boolean writable)
+access_virt_sarray(j_common_ptr cinfo, jvirt_sarray_ptr ptr,
+ JDIMENSION start_row, JDIMENSION num_rows, boolean writable)
/* Access the part of a virtual sample array starting at start_row */
/* and extending for num_rows rows. writable is true if */
/* caller intends to modify the accessed area. */
@@ -835,8 +832,8 @@ access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr,
/* Make the desired part of the virtual array accessible */
if (start_row < ptr->cur_start_row ||
- end_row > ptr->cur_start_row+ptr->rows_in_mem) {
- if (! ptr->b_s_open)
+ end_row > ptr->cur_start_row + ptr->rows_in_mem) {
+ if (!ptr->b_s_open)
ERREXIT(cinfo, JERR_VIRTUAL_BUG);
/* Flush old buffer contents if necessary */
if (ptr->dirty) {
@@ -856,10 +853,10 @@ access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr,
/* use long arithmetic here to avoid overflow & unsigned problems */
long ltemp;
- ltemp = (long) end_row - (long) ptr->rows_in_mem;
+ ltemp = (long)end_row - (long)ptr->rows_in_mem;
if (ltemp < 0)
ltemp = 0; /* don't fall off front end of file */
- ptr->cur_start_row = (JDIMENSION) ltemp;
+ ptr->cur_start_row = (JDIMENSION)ltemp;
}
/* Read in the selected part of the array.
* During the initial write pass, we will do no actual read
@@ -882,15 +879,15 @@ access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr,
if (writable)
ptr->first_undef_row = end_row;
if (ptr->pre_zero) {
- size_t bytesperrow = (size_t) ptr->samplesperrow * sizeof(JSAMPLE);
+ size_t bytesperrow = (size_t)ptr->samplesperrow * sizeof(JSAMPLE);
undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */
end_row -= ptr->cur_start_row;
while (undef_row < end_row) {
- jzero_far((void *) ptr->mem_buffer[undef_row], bytesperrow);
+ jzero_far((void *)ptr->mem_buffer[undef_row], bytesperrow);
undef_row++;
}
} else {
- if (! writable) /* reader looking at undefined data */
+ if (!writable) /* reader looking at undefined data */
ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
}
}
@@ -903,9 +900,8 @@ access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr,
METHODDEF(JBLOCKARRAY)
-access_virt_barray (j_common_ptr cinfo, jvirt_barray_ptr ptr,
- JDIMENSION start_row, JDIMENSION num_rows,
- boolean writable)
+access_virt_barray(j_common_ptr cinfo, jvirt_barray_ptr ptr,
+ JDIMENSION start_row, JDIMENSION num_rows, boolean writable)
/* Access the part of a virtual block array starting at start_row */
/* and extending for num_rows rows. writable is true if */
/* caller intends to modify the accessed area. */
@@ -920,8 +916,8 @@ access_virt_barray (j_common_ptr cinfo, jvirt_barray_ptr ptr,
/* Make the desired part of the virtual array accessible */
if (start_row < ptr->cur_start_row ||
- end_row > ptr->cur_start_row+ptr->rows_in_mem) {
- if (! ptr->b_s_open)
+ end_row > ptr->cur_start_row + ptr->rows_in_mem) {
+ if (!ptr->b_s_open)
ERREXIT(cinfo, JERR_VIRTUAL_BUG);
/* Flush old buffer contents if necessary */
if (ptr->dirty) {
@@ -941,10 +937,10 @@ access_virt_barray (j_common_ptr cinfo, jvirt_barray_ptr ptr,
/* use long arithmetic here to avoid overflow & unsigned problems */
long ltemp;
- ltemp = (long) end_row - (long) ptr->rows_in_mem;
+ ltemp = (long)end_row - (long)ptr->rows_in_mem;
if (ltemp < 0)
ltemp = 0; /* don't fall off front end of file */
- ptr->cur_start_row = (JDIMENSION) ltemp;
+ ptr->cur_start_row = (JDIMENSION)ltemp;
}
/* Read in the selected part of the array.
* During the initial write pass, we will do no actual read
@@ -967,15 +963,15 @@ access_virt_barray (j_common_ptr cinfo, jvirt_barray_ptr ptr,
if (writable)
ptr->first_undef_row = end_row;
if (ptr->pre_zero) {
- size_t bytesperrow = (size_t) ptr->blocksperrow * sizeof(JBLOCK);
+ size_t bytesperrow = (size_t)ptr->blocksperrow * sizeof(JBLOCK);
undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */
end_row -= ptr->cur_start_row;
while (undef_row < end_row) {
- jzero_far((void *) ptr->mem_buffer[undef_row], bytesperrow);
+ jzero_far((void *)ptr->mem_buffer[undef_row], bytesperrow);
undef_row++;
}
} else {
- if (! writable) /* reader looking at undefined data */
+ if (!writable) /* reader looking at undefined data */
ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
}
}
@@ -992,9 +988,9 @@ access_virt_barray (j_common_ptr cinfo, jvirt_barray_ptr ptr,
*/
METHODDEF(void)
-free_pool (j_common_ptr cinfo, int pool_id)
+free_pool(j_common_ptr cinfo, int pool_id)
{
- my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
+ my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
small_pool_ptr shdr_ptr;
large_pool_ptr lhdr_ptr;
size_t space_freed;
@@ -1015,14 +1011,14 @@ free_pool (j_common_ptr cinfo, int pool_id)
for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
if (sptr->b_s_open) { /* there may be no backing store */
sptr->b_s_open = FALSE; /* prevent recursive close if error */
- (*sptr->b_s_info.close_backing_store) (cinfo, & sptr->b_s_info);
+ (*sptr->b_s_info.close_backing_store) (cinfo, &sptr->b_s_info);
}
}
mem->virt_sarray_list = NULL;
for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
if (bptr->b_s_open) { /* there may be no backing store */
bptr->b_s_open = FALSE; /* prevent recursive close if error */
- (*bptr->b_s_info.close_backing_store) (cinfo, & bptr->b_s_info);
+ (*bptr->b_s_info.close_backing_store) (cinfo, &bptr->b_s_info);
}
}
mem->virt_barray_list = NULL;
@@ -1037,7 +1033,7 @@ free_pool (j_common_ptr cinfo, int pool_id)
space_freed = lhdr_ptr->bytes_used +
lhdr_ptr->bytes_left +
sizeof(large_pool_hdr);
- jpeg_free_large(cinfo, (void *) lhdr_ptr, space_freed);
+ jpeg_free_large(cinfo, (void *)lhdr_ptr, space_freed);
mem->total_space_allocated -= space_freed;
lhdr_ptr = next_lhdr_ptr;
}
@@ -1048,10 +1044,9 @@ free_pool (j_common_ptr cinfo, int pool_id)
while (shdr_ptr != NULL) {
small_pool_ptr next_shdr_ptr = shdr_ptr->next;
- space_freed = shdr_ptr->bytes_used +
- shdr_ptr->bytes_left +
+ space_freed = shdr_ptr->bytes_used + shdr_ptr->bytes_left +
sizeof(small_pool_hdr);
- jpeg_free_small(cinfo, (void *) shdr_ptr, space_freed);
+ jpeg_free_small(cinfo, (void *)shdr_ptr, space_freed);
mem->total_space_allocated -= space_freed;
shdr_ptr = next_shdr_ptr;
}
@@ -1064,7 +1059,7 @@ free_pool (j_common_ptr cinfo, int pool_id)
*/
METHODDEF(void)
-self_destruct (j_common_ptr cinfo)
+self_destruct(j_common_ptr cinfo)
{
int pool;
@@ -1072,12 +1067,12 @@ self_destruct (j_common_ptr cinfo)
* Releasing pools in reverse order might help avoid fragmentation
* with some (brain-damaged) malloc libraries.
*/
- for (pool = JPOOL_NUMPOOLS-1; pool >= JPOOL_PERMANENT; pool--) {
+ for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
free_pool(cinfo, pool);
}
/* Release the memory manager control block too. */
- jpeg_free_small(cinfo, (void *) cinfo->mem, sizeof(my_memory_mgr));
+ jpeg_free_small(cinfo, (void *)cinfo->mem, sizeof(my_memory_mgr));
cinfo->mem = NULL; /* ensures I will be called only once */
jpeg_mem_term(cinfo); /* system-dependent cleanup */
@@ -1090,7 +1085,7 @@ self_destruct (j_common_ptr cinfo)
*/
GLOBAL(void)
-jinit_memory_mgr (j_common_ptr cinfo)
+jinit_memory_mgr(j_common_ptr cinfo)
{
my_mem_ptr mem;
long max_to_use;
@@ -1106,22 +1101,22 @@ jinit_memory_mgr (j_common_ptr cinfo)
* in common if and only if X is a power of 2, ie has only one one-bit.
* Some compilers may give an "unreachable code" warning here; ignore it.
*/
- if ((ALIGN_SIZE & (ALIGN_SIZE-1)) != 0)
+ if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
ERREXIT(cinfo, JERR_BAD_ALIGN_TYPE);
/* MAX_ALLOC_CHUNK must be representable as type size_t, and must be
* a multiple of ALIGN_SIZE.
* Again, an "unreachable code" warning may be ignored here.
* But a "constant too large" warning means you need to fix MAX_ALLOC_CHUNK.
*/
- test_mac = (size_t) MAX_ALLOC_CHUNK;
- if ((long) test_mac != MAX_ALLOC_CHUNK ||
+ test_mac = (size_t)MAX_ALLOC_CHUNK;
+ if ((long)test_mac != MAX_ALLOC_CHUNK ||
(MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
ERREXIT(cinfo, JERR_BAD_ALLOC_CHUNK);
max_to_use = jpeg_mem_init(cinfo); /* system-dependent initialization */
/* Attempt to allocate memory manager's control block */
- mem = (my_mem_ptr) jpeg_get_small(cinfo, sizeof(my_memory_mgr));
+ mem = (my_mem_ptr)jpeg_get_small(cinfo, sizeof(my_memory_mgr));
if (mem == NULL) {
jpeg_mem_term(cinfo); /* system-dependent cleanup */
@@ -1147,7 +1142,7 @@ jinit_memory_mgr (j_common_ptr cinfo)
/* Initialize working state */
mem->pub.max_memory_to_use = max_to_use;
- for (pool = JPOOL_NUMPOOLS-1; pool >= JPOOL_PERMANENT; pool--) {
+ for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
mem->small_list[pool] = NULL;
mem->large_list[pool] = NULL;
}
@@ -1157,7 +1152,7 @@ jinit_memory_mgr (j_common_ptr cinfo)
mem->total_space_allocated = sizeof(my_memory_mgr);
/* Declare ourselves open for business */
- cinfo->mem = & mem->pub;
+ cinfo->mem = &mem->pub;
/* Check for an environment variable JPEGMEM; if found, override the
* default max_memory setting from jpeg_mem_init. Note that the
@@ -1166,7 +1161,8 @@ jinit_memory_mgr (j_common_ptr cinfo)
* this feature.
*/
#ifndef NO_GETENV
- { char *memenv;
+ {
+ char *memenv;
if ((memenv = getenv("JPEGMEM")) != NULL) {
char ch = 'x';
diff --git a/src/3rdparty/libjpeg/src/jmemnobs.c b/src/3rdparty/libjpeg/src/jmemnobs.c
index ac12afa51b..089be8f500 100644
--- a/src/3rdparty/libjpeg/src/jmemnobs.c
+++ b/src/3rdparty/libjpeg/src/jmemnobs.c
@@ -4,7 +4,7 @@
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1992-1996, Thomas G. Lane.
* libjpeg-turbo Modifications:
- * Copyright (C) 2017, D. R. Commander.
+ * Copyright (C) 2017-2018, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@@ -23,8 +23,8 @@
#include "jmemsys.h" /* import the system-dependent declarations */
#ifndef HAVE_STDLIB_H /* <stdlib.h> should declare malloc(),free() */
-extern void *malloc (size_t size);
-extern void free (void *ptr);
+extern void *malloc(size_t size);
+extern void free(void *ptr);
#endif
@@ -34,13 +34,13 @@ extern void free (void *ptr);
*/
GLOBAL(void *)
-jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject)
+jpeg_get_small(j_common_ptr cinfo, size_t sizeofobject)
{
- return (void *) malloc(sizeofobject);
+ return (void *)malloc(sizeofobject);
}
GLOBAL(void)
-jpeg_free_small (j_common_ptr cinfo, void *object, size_t sizeofobject)
+jpeg_free_small(j_common_ptr cinfo, void *object, size_t sizeofobject)
{
free(object);
}
@@ -51,13 +51,13 @@ jpeg_free_small (j_common_ptr cinfo, void *object, size_t sizeofobject)
*/
GLOBAL(void *)
-jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject)
+jpeg_get_large(j_common_ptr cinfo, size_t sizeofobject)
{
- return (void *) malloc(sizeofobject);
+ return (void *)malloc(sizeofobject);
}
GLOBAL(void)
-jpeg_free_large (j_common_ptr cinfo, void *object, size_t sizeofobject)
+jpeg_free_large(j_common_ptr cinfo, void *object, size_t sizeofobject)
{
free(object);
}
@@ -68,11 +68,11 @@ jpeg_free_large (j_common_ptr cinfo, void *object, size_t sizeofobject)
*/
GLOBAL(size_t)
-jpeg_mem_available (j_common_ptr cinfo, size_t min_bytes_needed,
- size_t max_bytes_needed, size_t already_allocated)
+jpeg_mem_available(j_common_ptr cinfo, size_t min_bytes_needed,
+ size_t max_bytes_needed, size_t already_allocated)
{
if (cinfo->mem->max_memory_to_use) {
- if (cinfo->mem->max_memory_to_use > already_allocated)
+ if ((size_t)cinfo->mem->max_memory_to_use > already_allocated)
return cinfo->mem->max_memory_to_use - already_allocated;
else
return 0;
@@ -90,8 +90,8 @@ jpeg_mem_available (j_common_ptr cinfo, size_t min_bytes_needed,
*/
GLOBAL(void)
-jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info,
- long total_bytes_needed)
+jpeg_open_backing_store(j_common_ptr cinfo, backing_store_ptr info,
+ long total_bytes_needed)
{
ERREXIT(cinfo, JERR_NO_BACKING_STORE);
}
@@ -103,13 +103,13 @@ jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info,
*/
GLOBAL(long)
-jpeg_mem_init (j_common_ptr cinfo)
+jpeg_mem_init(j_common_ptr cinfo)
{
return 0; /* just set max_memory_to_use to 0 */
}
GLOBAL(void)
-jpeg_mem_term (j_common_ptr cinfo)
+jpeg_mem_term(j_common_ptr cinfo)
{
/* no work */
}
diff --git a/src/3rdparty/libjpeg/src/jmemsys.h b/src/3rdparty/libjpeg/src/jmemsys.h
index f7dfe87a83..9229550afd 100644
--- a/src/3rdparty/libjpeg/src/jmemsys.h
+++ b/src/3rdparty/libjpeg/src/jmemsys.h
@@ -31,9 +31,9 @@
* size of the object being freed, just in case it's needed.
*/
-EXTERN(void *) jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject);
-EXTERN(void) jpeg_free_small (j_common_ptr cinfo, void *object,
- size_t sizeofobject);
+EXTERN(void *) jpeg_get_small(j_common_ptr cinfo, size_t sizeofobject);
+EXTERN(void) jpeg_free_small(j_common_ptr cinfo, void *object,
+ size_t sizeofobject);
/*
* These two functions are used to allocate and release large chunks of
@@ -43,9 +43,9 @@ EXTERN(void) jpeg_free_small (j_common_ptr cinfo, void *object,
* large chunks.
*/
-EXTERN(void *) jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject);
-EXTERN(void) jpeg_free_large (j_common_ptr cinfo, void *object,
- size_t sizeofobject);
+EXTERN(void *) jpeg_get_large(j_common_ptr cinfo, size_t sizeofobject);
+EXTERN(void) jpeg_free_large(j_common_ptr cinfo, void *object,
+ size_t sizeofobject);
/*
* The macro MAX_ALLOC_CHUNK designates the maximum number of bytes that may
@@ -84,9 +84,9 @@ EXTERN(void) jpeg_free_large (j_common_ptr cinfo, void *object,
* Conversely, zero may be returned to always use the minimum amount of memory.
*/
-EXTERN(size_t) jpeg_mem_available (j_common_ptr cinfo, size_t min_bytes_needed,
- size_t max_bytes_needed,
- size_t already_allocated);
+EXTERN(size_t) jpeg_mem_available(j_common_ptr cinfo, size_t min_bytes_needed,
+ size_t max_bytes_needed,
+ size_t already_allocated);
/*
@@ -157,9 +157,9 @@ typedef struct backing_store_struct {
* just take an error exit.)
*/
-EXTERN(void) jpeg_open_backing_store (j_common_ptr cinfo,
- backing_store_ptr info,
- long total_bytes_needed);
+EXTERN(void) jpeg_open_backing_store(j_common_ptr cinfo,
+ backing_store_ptr info,
+ long total_bytes_needed);
/*
@@ -174,5 +174,5 @@ EXTERN(void) jpeg_open_backing_store (j_common_ptr cinfo,
* all opened backing-store objects have been closed.
*/
-EXTERN(long) jpeg_mem_init (j_common_ptr cinfo);
-EXTERN(void) jpeg_mem_term (j_common_ptr cinfo);
+EXTERN(long) jpeg_mem_init(j_common_ptr cinfo);
+EXTERN(void) jpeg_mem_term(j_common_ptr cinfo);
diff --git a/src/3rdparty/libjpeg/src/jmorecfg.h b/src/3rdparty/libjpeg/src/jmorecfg.h
index 1d967863cd..d0b930079a 100644
--- a/src/3rdparty/libjpeg/src/jmorecfg.h
+++ b/src/3rdparty/libjpeg/src/jmorecfg.h
@@ -5,7 +5,7 @@
* Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 1997-2009 by Guido Vollbeding.
* libjpeg-turbo Modifications:
- * Copyright (C) 2009, 2011, 2014-2015, D. R. Commander.
+ * Copyright (C) 2009, 2011, 2014-2015, 2018, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@@ -17,9 +17,9 @@
/*
* Maximum number of components (color channels) allowed in JPEG image.
- * To meet the letter of the JPEG spec, set this to 255. However, darn
- * few applications need more than 4 channels (maybe 5 for CMYK + alpha
- * mask). We recommend 10 as a reasonable compromise; use 4 if you are
+ * To meet the letter of Rec. ITU-T T.81 | ISO/IEC 10918-1, set this to 255.
+ * However, darn few applications need more than 4 channels (maybe 5 for CMYK +
+ * alpha mask). We recommend 10 as a reasonable compromise; use 4 if you are
* really short on memory. (Each allowed component costs a hundred or so
* bytes of storage, whether actually used in an image or not.)
*/
@@ -49,15 +49,15 @@
#ifdef HAVE_UNSIGNED_CHAR
typedef unsigned char JSAMPLE;
-#define GETJSAMPLE(value) ((int) (value))
+#define GETJSAMPLE(value) ((int)(value))
#else /* not HAVE_UNSIGNED_CHAR */
typedef char JSAMPLE;
#ifdef __CHAR_UNSIGNED__
-#define GETJSAMPLE(value) ((int) (value))
+#define GETJSAMPLE(value) ((int)(value))
#else
-#define GETJSAMPLE(value) ((int) (value) & 0xFF)
+#define GETJSAMPLE(value) ((int)(value) & 0xFF)
#endif /* __CHAR_UNSIGNED__ */
#endif /* HAVE_UNSIGNED_CHAR */
@@ -74,7 +74,7 @@ typedef char JSAMPLE;
*/
typedef short JSAMPLE;
-#define GETJSAMPLE(value) ((int) (value))
+#define GETJSAMPLE(value) ((int)(value))
#define MAXJSAMPLE 4095
#define CENTERJSAMPLE 2048
@@ -173,9 +173,9 @@ typedef short INT16;
*/
#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
-#ifndef _BASETSD_H_ /* Microsoft defines it in basetsd.h */
-#ifndef _BASETSD_H /* MinGW is slightly different */
-#ifndef QGLOBAL_H /* Qt defines it in qglobal.h */
+#ifndef _BASETSD_H_ /* Microsoft defines it in basetsd.h */
+#ifndef _BASETSD_H /* MinGW is slightly different */
+#ifndef QGLOBAL_H /* Qt defines it in qglobal.h */
typedef long INT32;
#endif
#endif
@@ -220,7 +220,7 @@ typedef unsigned int JDIMENSION;
* software out there that uses it.
*/
-#define JMETHOD(type,methodname,arglist) type (*methodname) arglist
+#define JMETHOD(type, methodname, arglist) type (*methodname) arglist
/* libjpeg-turbo no longer supports platforms that have far symbols (MS-DOS),
@@ -315,10 +315,10 @@ typedef int boolean;
* with it. In reality, few people ever did this, because there were some
* severe restrictions involved (cjpeg and djpeg no longer worked properly,
* compressing/decompressing RGB JPEGs no longer worked properly, and the color
- * quantizer wouldn't work with pixel sizes other than 3.) Further, since all
- * of the O/S-supplied versions of libjpeg were built with the default values
- * of RGB_RED, RGB_GREEN, RGB_BLUE, and RGB_PIXELSIZE, many applications have
- * come to regard these values as immutable.
+ * quantizer wouldn't work with pixel sizes other than 3.) Furthermore, since
+ * all of the O/S-supplied versions of libjpeg were built with the default
+ * values of RGB_RED, RGB_GREEN, RGB_BLUE, and RGB_PIXELSIZE, many applications
+ * have come to regard these values as immutable.
*
* The libjpeg-turbo colorspace extensions provide a much cleaner way of
* compressing from/decompressing to buffers with arbitrary component orders
@@ -333,37 +333,37 @@ typedef int boolean;
#define RGB_BLUE 2 /* Offset of Blue */
#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */
-#define JPEG_NUMCS 17
+#define JPEG_NUMCS 17
-#define EXT_RGB_RED 0
-#define EXT_RGB_GREEN 1
-#define EXT_RGB_BLUE 2
-#define EXT_RGB_PIXELSIZE 3
+#define EXT_RGB_RED 0
+#define EXT_RGB_GREEN 1
+#define EXT_RGB_BLUE 2
+#define EXT_RGB_PIXELSIZE 3
-#define EXT_RGBX_RED 0
-#define EXT_RGBX_GREEN 1
-#define EXT_RGBX_BLUE 2
-#define EXT_RGBX_PIXELSIZE 4
+#define EXT_RGBX_RED 0
+#define EXT_RGBX_GREEN 1
+#define EXT_RGBX_BLUE 2
+#define EXT_RGBX_PIXELSIZE 4
-#define EXT_BGR_RED 2
-#define EXT_BGR_GREEN 1
-#define EXT_BGR_BLUE 0
-#define EXT_BGR_PIXELSIZE 3
+#define EXT_BGR_RED 2
+#define EXT_BGR_GREEN 1
+#define EXT_BGR_BLUE 0
+#define EXT_BGR_PIXELSIZE 3
-#define EXT_BGRX_RED 2
-#define EXT_BGRX_GREEN 1
-#define EXT_BGRX_BLUE 0
-#define EXT_BGRX_PIXELSIZE 4
+#define EXT_BGRX_RED 2
+#define EXT_BGRX_GREEN 1
+#define EXT_BGRX_BLUE 0
+#define EXT_BGRX_PIXELSIZE 4
-#define EXT_XBGR_RED 3
-#define EXT_XBGR_GREEN 2
-#define EXT_XBGR_BLUE 1
-#define EXT_XBGR_PIXELSIZE 4
+#define EXT_XBGR_RED 3
+#define EXT_XBGR_GREEN 2
+#define EXT_XBGR_BLUE 1
+#define EXT_XBGR_PIXELSIZE 4
-#define EXT_XRGB_RED 1
-#define EXT_XRGB_GREEN 2
-#define EXT_XRGB_BLUE 3
-#define EXT_XRGB_PIXELSIZE 4
+#define EXT_XRGB_RED 1
+#define EXT_XRGB_GREEN 2
+#define EXT_XRGB_BLUE 3
+#define EXT_XRGB_PIXELSIZE 4
static const int rgb_red[JPEG_NUMCS] = {
-1, -1, RGB_RED, -1, -1, -1, EXT_RGB_RED, EXT_RGBX_RED,
@@ -404,7 +404,7 @@ static const int rgb_pixelsize[JPEG_NUMCS] = {
#ifndef WITH_SIMD
#define MULTIPLIER int /* type for fastest integer multiply */
#else
-#define MULTIPLIER short /* prefer 16-bit with SIMD for parellelism */
+#define MULTIPLIER short /* prefer 16-bit with SIMD for parellelism */
#endif
#endif
diff --git a/src/3rdparty/libjpeg/src/jpegcomp.h b/src/3rdparty/libjpeg/src/jpegcomp.h
index ade0d1edcd..b32d544bf1 100644
--- a/src/3rdparty/libjpeg/src/jpegcomp.h
+++ b/src/3rdparty/libjpeg/src/jpegcomp.h
@@ -11,21 +11,21 @@
*/
#if JPEG_LIB_VERSION >= 70
-#define _DCT_scaled_size DCT_h_scaled_size
-#define _DCT_h_scaled_size DCT_h_scaled_size
-#define _DCT_v_scaled_size DCT_v_scaled_size
-#define _min_DCT_scaled_size min_DCT_h_scaled_size
-#define _min_DCT_h_scaled_size min_DCT_h_scaled_size
-#define _min_DCT_v_scaled_size min_DCT_v_scaled_size
-#define _jpeg_width jpeg_width
-#define _jpeg_height jpeg_height
+#define _DCT_scaled_size DCT_h_scaled_size
+#define _DCT_h_scaled_size DCT_h_scaled_size
+#define _DCT_v_scaled_size DCT_v_scaled_size
+#define _min_DCT_scaled_size min_DCT_h_scaled_size
+#define _min_DCT_h_scaled_size min_DCT_h_scaled_size
+#define _min_DCT_v_scaled_size min_DCT_v_scaled_size
+#define _jpeg_width jpeg_width
+#define _jpeg_height jpeg_height
#else
-#define _DCT_scaled_size DCT_scaled_size
-#define _DCT_h_scaled_size DCT_scaled_size
-#define _DCT_v_scaled_size DCT_scaled_size
-#define _min_DCT_scaled_size min_DCT_scaled_size
-#define _min_DCT_h_scaled_size min_DCT_scaled_size
-#define _min_DCT_v_scaled_size min_DCT_scaled_size
-#define _jpeg_width image_width
-#define _jpeg_height image_height
+#define _DCT_scaled_size DCT_scaled_size
+#define _DCT_h_scaled_size DCT_scaled_size
+#define _DCT_v_scaled_size DCT_scaled_size
+#define _min_DCT_scaled_size min_DCT_scaled_size
+#define _min_DCT_h_scaled_size min_DCT_scaled_size
+#define _min_DCT_v_scaled_size min_DCT_scaled_size
+#define _jpeg_width image_width
+#define _jpeg_height image_height
#endif
diff --git a/src/3rdparty/libjpeg/src/jpegint.h b/src/3rdparty/libjpeg/src/jpegint.h
index 9979a912d9..ad36ca8b56 100644
--- a/src/3rdparty/libjpeg/src/jpegint.h
+++ b/src/3rdparty/libjpeg/src/jpegint.h
@@ -27,21 +27,21 @@ typedef enum { /* Operating modes for buffer controllers */
} J_BUF_MODE;
/* Values of global_state field (jdapi.c has some dependencies on ordering!) */
-#define CSTATE_START 100 /* after create_compress */
-#define CSTATE_SCANNING 101 /* start_compress done, write_scanlines OK */
-#define CSTATE_RAW_OK 102 /* start_compress done, write_raw_data OK */
-#define CSTATE_WRCOEFS 103 /* jpeg_write_coefficients done */
-#define DSTATE_START 200 /* after create_decompress */
-#define DSTATE_INHEADER 201 /* reading header markers, no SOS yet */
-#define DSTATE_READY 202 /* found SOS, ready for start_decompress */
-#define DSTATE_PRELOAD 203 /* reading multiscan file in start_decompress*/
-#define DSTATE_PRESCAN 204 /* performing dummy pass for 2-pass quant */
-#define DSTATE_SCANNING 205 /* start_decompress done, read_scanlines OK */
-#define DSTATE_RAW_OK 206 /* start_decompress done, read_raw_data OK */
-#define DSTATE_BUFIMAGE 207 /* expecting jpeg_start_output */
-#define DSTATE_BUFPOST 208 /* looking for SOS/EOI in jpeg_finish_output */
-#define DSTATE_RDCOEFS 209 /* reading file in jpeg_read_coefficients */
-#define DSTATE_STOPPING 210 /* looking for EOI in jpeg_finish_decompress */
+#define CSTATE_START 100 /* after create_compress */
+#define CSTATE_SCANNING 101 /* start_compress done, write_scanlines OK */
+#define CSTATE_RAW_OK 102 /* start_compress done, write_raw_data OK */
+#define CSTATE_WRCOEFS 103 /* jpeg_write_coefficients done */
+#define DSTATE_START 200 /* after create_decompress */
+#define DSTATE_INHEADER 201 /* reading header markers, no SOS yet */
+#define DSTATE_READY 202 /* found SOS, ready for start_decompress */
+#define DSTATE_PRELOAD 203 /* reading multiscan file in start_decompress*/
+#define DSTATE_PRESCAN 204 /* performing dummy pass for 2-pass quant */
+#define DSTATE_SCANNING 205 /* start_decompress done, read_scanlines OK */
+#define DSTATE_RAW_OK 206 /* start_decompress done, read_raw_data OK */
+#define DSTATE_BUFIMAGE 207 /* expecting jpeg_start_output */
+#define DSTATE_BUFPOST 208 /* looking for SOS/EOI in jpeg_finish_output */
+#define DSTATE_RDCOEFS 209 /* reading file in jpeg_read_coefficients */
+#define DSTATE_STOPPING 210 /* looking for EOI in jpeg_finish_decompress */
/* JLONG must hold at least signed 32-bit values. */
@@ -53,7 +53,7 @@ typedef long JLONG;
* sanitizer warnings
*/
-#define LEFT_SHIFT(a, b) ((JLONG)((unsigned long)(a) << (b)))
+#define LEFT_SHIFT(a, b) ((JLONG)((unsigned long)(a) << (b)))
/* Declarations for compression modules */
@@ -274,9 +274,9 @@ struct jpeg_color_quantizer {
/* Miscellaneous useful macros */
#undef MAX
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
#undef MIN
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
/* We assume that right shift corresponds to signed division by 2 with
@@ -291,64 +291,64 @@ struct jpeg_color_quantizer {
#ifdef RIGHT_SHIFT_IS_UNSIGNED
#define SHIFT_TEMPS JLONG shift_temp;
-#define RIGHT_SHIFT(x,shft) \
- ((shift_temp = (x)) < 0 ? \
- (shift_temp >> (shft)) | ((~((JLONG) 0)) << (32-(shft))) : \
- (shift_temp >> (shft)))
+#define RIGHT_SHIFT(x, shft) \
+ ((shift_temp = (x)) < 0 ? \
+ (shift_temp >> (shft)) | ((~((JLONG)0)) << (32 - (shft))) : \
+ (shift_temp >> (shft)))
#else
#define SHIFT_TEMPS
-#define RIGHT_SHIFT(x,shft) ((x) >> (shft))
+#define RIGHT_SHIFT(x, shft) ((x) >> (shft))
#endif
/* Compression module initialization routines */
-EXTERN(void) jinit_compress_master (j_compress_ptr cinfo);
-EXTERN(void) jinit_c_master_control (j_compress_ptr cinfo,
- boolean transcode_only);
-EXTERN(void) jinit_c_main_controller (j_compress_ptr cinfo,
- boolean need_full_buffer);
-EXTERN(void) jinit_c_prep_controller (j_compress_ptr cinfo,
- boolean need_full_buffer);
-EXTERN(void) jinit_c_coef_controller (j_compress_ptr cinfo,
- boolean need_full_buffer);
-EXTERN(void) jinit_color_converter (j_compress_ptr cinfo);
-EXTERN(void) jinit_downsampler (j_compress_ptr cinfo);
-EXTERN(void) jinit_forward_dct (j_compress_ptr cinfo);
-EXTERN(void) jinit_huff_encoder (j_compress_ptr cinfo);
-EXTERN(void) jinit_phuff_encoder (j_compress_ptr cinfo);
-EXTERN(void) jinit_arith_encoder (j_compress_ptr cinfo);
-EXTERN(void) jinit_marker_writer (j_compress_ptr cinfo);
+EXTERN(void) jinit_compress_master(j_compress_ptr cinfo);
+EXTERN(void) jinit_c_master_control(j_compress_ptr cinfo,
+ boolean transcode_only);
+EXTERN(void) jinit_c_main_controller(j_compress_ptr cinfo,
+ boolean need_full_buffer);
+EXTERN(void) jinit_c_prep_controller(j_compress_ptr cinfo,
+ boolean need_full_buffer);
+EXTERN(void) jinit_c_coef_controller(j_compress_ptr cinfo,
+ boolean need_full_buffer);
+EXTERN(void) jinit_color_converter(j_compress_ptr cinfo);
+EXTERN(void) jinit_downsampler(j_compress_ptr cinfo);
+EXTERN(void) jinit_forward_dct(j_compress_ptr cinfo);
+EXTERN(void) jinit_huff_encoder(j_compress_ptr cinfo);
+EXTERN(void) jinit_phuff_encoder(j_compress_ptr cinfo);
+EXTERN(void) jinit_arith_encoder(j_compress_ptr cinfo);
+EXTERN(void) jinit_marker_writer(j_compress_ptr cinfo);
/* Decompression module initialization routines */
-EXTERN(void) jinit_master_decompress (j_decompress_ptr cinfo);
-EXTERN(void) jinit_d_main_controller (j_decompress_ptr cinfo,
- boolean need_full_buffer);
-EXTERN(void) jinit_d_coef_controller (j_decompress_ptr cinfo,
- boolean need_full_buffer);
-EXTERN(void) jinit_d_post_controller (j_decompress_ptr cinfo,
- boolean need_full_buffer);
-EXTERN(void) jinit_input_controller (j_decompress_ptr cinfo);
-EXTERN(void) jinit_marker_reader (j_decompress_ptr cinfo);
-EXTERN(void) jinit_huff_decoder (j_decompress_ptr cinfo);
-EXTERN(void) jinit_phuff_decoder (j_decompress_ptr cinfo);
-EXTERN(void) jinit_arith_decoder (j_decompress_ptr cinfo);
-EXTERN(void) jinit_inverse_dct (j_decompress_ptr cinfo);
-EXTERN(void) jinit_upsampler (j_decompress_ptr cinfo);
-EXTERN(void) jinit_color_deconverter (j_decompress_ptr cinfo);
-EXTERN(void) jinit_1pass_quantizer (j_decompress_ptr cinfo);
-EXTERN(void) jinit_2pass_quantizer (j_decompress_ptr cinfo);
-EXTERN(void) jinit_merged_upsampler (j_decompress_ptr cinfo);
+EXTERN(void) jinit_master_decompress(j_decompress_ptr cinfo);
+EXTERN(void) jinit_d_main_controller(j_decompress_ptr cinfo,
+ boolean need_full_buffer);
+EXTERN(void) jinit_d_coef_controller(j_decompress_ptr cinfo,
+ boolean need_full_buffer);
+EXTERN(void) jinit_d_post_controller(j_decompress_ptr cinfo,
+ boolean need_full_buffer);
+EXTERN(void) jinit_input_controller(j_decompress_ptr cinfo);
+EXTERN(void) jinit_marker_reader(j_decompress_ptr cinfo);
+EXTERN(void) jinit_huff_decoder(j_decompress_ptr cinfo);
+EXTERN(void) jinit_phuff_decoder(j_decompress_ptr cinfo);
+EXTERN(void) jinit_arith_decoder(j_decompress_ptr cinfo);
+EXTERN(void) jinit_inverse_dct(j_decompress_ptr cinfo);
+EXTERN(void) jinit_upsampler(j_decompress_ptr cinfo);
+EXTERN(void) jinit_color_deconverter(j_decompress_ptr cinfo);
+EXTERN(void) jinit_1pass_quantizer(j_decompress_ptr cinfo);
+EXTERN(void) jinit_2pass_quantizer(j_decompress_ptr cinfo);
+EXTERN(void) jinit_merged_upsampler(j_decompress_ptr cinfo);
/* Memory manager initialization */
-EXTERN(void) jinit_memory_mgr (j_common_ptr cinfo);
+EXTERN(void) jinit_memory_mgr(j_common_ptr cinfo);
/* Utility routines in jutils.c */
-EXTERN(long) jdiv_round_up (long a, long b);
-EXTERN(long) jround_up (long a, long b);
-EXTERN(void) jcopy_sample_rows (JSAMPARRAY input_array, int source_row,
- JSAMPARRAY output_array, int dest_row,
- int num_rows, JDIMENSION num_cols);
-EXTERN(void) jcopy_block_row (JBLOCKROW input_row, JBLOCKROW output_row,
- JDIMENSION num_blocks);
-EXTERN(void) jzero_far (void *target, size_t bytestozero);
+EXTERN(long) jdiv_round_up(long a, long b);
+EXTERN(long) jround_up(long a, long b);
+EXTERN(void) jcopy_sample_rows(JSAMPARRAY input_array, int source_row,
+ JSAMPARRAY output_array, int dest_row,
+ int num_rows, JDIMENSION num_cols);
+EXTERN(void) jcopy_block_row(JBLOCKROW input_row, JBLOCKROW output_row,
+ JDIMENSION num_blocks);
+EXTERN(void) jzero_far(void *target, size_t bytestozero);
/* Constant tables in jutils.c */
#if 0 /* This table is not actually needed in v6a */
extern const int jpeg_zigzag_order[]; /* natural coef order to zigzag order */
diff --git a/src/3rdparty/libjpeg/src/jpeglib.h b/src/3rdparty/libjpeg/src/jpeglib.h
index 6c63f58222..33f8ad2791 100644
--- a/src/3rdparty/libjpeg/src/jpeglib.h
+++ b/src/3rdparty/libjpeg/src/jpeglib.h
@@ -5,7 +5,7 @@
* Copyright (C) 1991-1998, Thomas G. Lane.
* Modified 2002-2009 by Guido Vollbeding.
* libjpeg-turbo Modifications:
- * Copyright (C) 2009-2011, 2013-2014, 2016, D. R. Commander.
+ * Copyright (C) 2009-2011, 2013-2014, 2016-2017, D. R. Commander.
* Copyright (C) 2015, Google, Inc.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
@@ -211,8 +211,8 @@ struct jpeg_marker_struct {
/* Known color spaces. */
-#define JCS_EXTENSIONS 1
-#define JCS_ALPHA_EXTENSIONS 1
+#define JCS_EXTENSIONS 1
+#define JCS_ALPHA_EXTENSIONS 1
typedef enum {
JCS_UNKNOWN, /* error/unspecified */
@@ -268,11 +268,11 @@ typedef enum {
/* Common fields between JPEG compression and decompression master structs. */
#define jpeg_common_fields \
- struct jpeg_error_mgr *err; /* Error handler module */\
- struct jpeg_memory_mgr *mem; /* Memory manager module */\
- struct jpeg_progress_mgr *progress; /* Progress monitor, or NULL if none */\
- void *client_data; /* Available for use by application */\
- boolean is_decompressor; /* So common code can tell which is which */\
+ struct jpeg_error_mgr *err; /* Error handler module */ \
+ struct jpeg_memory_mgr *mem; /* Memory manager module */ \
+ struct jpeg_progress_mgr *progress; /* Progress monitor, or NULL if none */ \
+ void *client_data; /* Available for use by application */ \
+ boolean is_decompressor; /* So common code can tell which is which */ \
int global_state /* For checking call sequence validity */
/* Routines that are to be used by both halves of the library are declared
@@ -822,9 +822,9 @@ struct jpeg_source_mgr {
* successful.
*/
-#define JPOOL_PERMANENT 0 /* lasts until master record is destroyed */
-#define JPOOL_IMAGE 1 /* lasts until done with image/datastream */
-#define JPOOL_NUMPOOLS 2
+#define JPOOL_PERMANENT 0 /* lasts until master record is destroyed */
+#define JPOOL_IMAGE 1 /* lasts until done with image/datastream */
+#define JPOOL_NUMPOOLS 2
typedef struct jvirt_sarray_control *jvirt_sarray_ptr;
typedef struct jvirt_barray_control *jvirt_barray_ptr;
@@ -888,7 +888,7 @@ typedef boolean (*jpeg_marker_parser_method) (j_decompress_ptr cinfo);
/* Default error-management setup */
-EXTERN(struct jpeg_error_mgr *) jpeg_std_error (struct jpeg_error_mgr *err);
+EXTERN(struct jpeg_error_mgr *) jpeg_std_error(struct jpeg_error_mgr *err);
/* Initialization of JPEG compression objects.
* jpeg_create_compress() and jpeg_create_decompress() are the exported
@@ -898,90 +898,95 @@ EXTERN(struct jpeg_error_mgr *) jpeg_std_error (struct jpeg_error_mgr *err);
* NB: you must set up the error-manager BEFORE calling jpeg_create_xxx.
*/
#define jpeg_create_compress(cinfo) \
- jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \
- (size_t) sizeof(struct jpeg_compress_struct))
+ jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \
+ (size_t)sizeof(struct jpeg_compress_struct))
#define jpeg_create_decompress(cinfo) \
- jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \
- (size_t) sizeof(struct jpeg_decompress_struct))
-EXTERN(void) jpeg_CreateCompress (j_compress_ptr cinfo, int version,
- size_t structsize);
-EXTERN(void) jpeg_CreateDecompress (j_decompress_ptr cinfo, int version,
- size_t structsize);
+ jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \
+ (size_t)sizeof(struct jpeg_decompress_struct))
+EXTERN(void) jpeg_CreateCompress(j_compress_ptr cinfo, int version,
+ size_t structsize);
+EXTERN(void) jpeg_CreateDecompress(j_decompress_ptr cinfo, int version,
+ size_t structsize);
/* Destruction of JPEG compression objects */
-EXTERN(void) jpeg_destroy_compress (j_compress_ptr cinfo);
-EXTERN(void) jpeg_destroy_decompress (j_decompress_ptr cinfo);
+EXTERN(void) jpeg_destroy_compress(j_compress_ptr cinfo);
+EXTERN(void) jpeg_destroy_decompress(j_decompress_ptr cinfo);
/* Standard data source and destination managers: stdio streams. */
/* Caller is responsible for opening the file before and closing after. */
-EXTERN(void) jpeg_stdio_dest (j_compress_ptr cinfo, FILE *outfile);
-EXTERN(void) jpeg_stdio_src (j_decompress_ptr cinfo, FILE *infile);
+EXTERN(void) jpeg_stdio_dest(j_compress_ptr cinfo, FILE *outfile);
+EXTERN(void) jpeg_stdio_src(j_decompress_ptr cinfo, FILE *infile);
#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED)
/* Data source and destination managers: memory buffers. */
-EXTERN(void) jpeg_mem_dest (j_compress_ptr cinfo, unsigned char **outbuffer,
- unsigned long *outsize);
-EXTERN(void) jpeg_mem_src (j_decompress_ptr cinfo,
- const unsigned char *inbuffer,
- unsigned long insize);
+EXTERN(void) jpeg_mem_dest(j_compress_ptr cinfo, unsigned char **outbuffer,
+ unsigned long *outsize);
+EXTERN(void) jpeg_mem_src(j_decompress_ptr cinfo,
+ const unsigned char *inbuffer, unsigned long insize);
#endif
/* Default parameter setup for compression */
-EXTERN(void) jpeg_set_defaults (j_compress_ptr cinfo);
+EXTERN(void) jpeg_set_defaults(j_compress_ptr cinfo);
/* Compression parameter setup aids */
-EXTERN(void) jpeg_set_colorspace (j_compress_ptr cinfo,
- J_COLOR_SPACE colorspace);
-EXTERN(void) jpeg_default_colorspace (j_compress_ptr cinfo);
-EXTERN(void) jpeg_set_quality (j_compress_ptr cinfo, int quality,
- boolean force_baseline);
-EXTERN(void) jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor,
- boolean force_baseline);
+EXTERN(void) jpeg_set_colorspace(j_compress_ptr cinfo,
+ J_COLOR_SPACE colorspace);
+EXTERN(void) jpeg_default_colorspace(j_compress_ptr cinfo);
+EXTERN(void) jpeg_set_quality(j_compress_ptr cinfo, int quality,
+ boolean force_baseline);
+EXTERN(void) jpeg_set_linear_quality(j_compress_ptr cinfo, int scale_factor,
+ boolean force_baseline);
#if JPEG_LIB_VERSION >= 70
-EXTERN(void) jpeg_default_qtables (j_compress_ptr cinfo,
- boolean force_baseline);
+EXTERN(void) jpeg_default_qtables(j_compress_ptr cinfo,
+ boolean force_baseline);
#endif
-EXTERN(void) jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl,
- const unsigned int *basic_table,
- int scale_factor, boolean force_baseline);
-EXTERN(int) jpeg_quality_scaling (int quality);
-EXTERN(void) jpeg_simple_progression (j_compress_ptr cinfo);
-EXTERN(void) jpeg_suppress_tables (j_compress_ptr cinfo, boolean suppress);
-EXTERN(JQUANT_TBL *) jpeg_alloc_quant_table (j_common_ptr cinfo);
-EXTERN(JHUFF_TBL *) jpeg_alloc_huff_table (j_common_ptr cinfo);
+EXTERN(void) jpeg_add_quant_table(j_compress_ptr cinfo, int which_tbl,
+ const unsigned int *basic_table,
+ int scale_factor, boolean force_baseline);
+EXTERN(int) jpeg_quality_scaling(int quality);
+EXTERN(void) jpeg_simple_progression(j_compress_ptr cinfo);
+EXTERN(void) jpeg_suppress_tables(j_compress_ptr cinfo, boolean suppress);
+EXTERN(JQUANT_TBL *) jpeg_alloc_quant_table(j_common_ptr cinfo);
+EXTERN(JHUFF_TBL *) jpeg_alloc_huff_table(j_common_ptr cinfo);
/* Main entry points for compression */
-EXTERN(void) jpeg_start_compress (j_compress_ptr cinfo,
- boolean write_all_tables);
-EXTERN(JDIMENSION) jpeg_write_scanlines (j_compress_ptr cinfo,
- JSAMPARRAY scanlines,
- JDIMENSION num_lines);
-EXTERN(void) jpeg_finish_compress (j_compress_ptr cinfo);
+EXTERN(void) jpeg_start_compress(j_compress_ptr cinfo,
+ boolean write_all_tables);
+EXTERN(JDIMENSION) jpeg_write_scanlines(j_compress_ptr cinfo,
+ JSAMPARRAY scanlines,
+ JDIMENSION num_lines);
+EXTERN(void) jpeg_finish_compress(j_compress_ptr cinfo);
#if JPEG_LIB_VERSION >= 70
/* Precalculate JPEG dimensions for current compression parameters. */
-EXTERN(void) jpeg_calc_jpeg_dimensions (j_compress_ptr cinfo);
+EXTERN(void) jpeg_calc_jpeg_dimensions(j_compress_ptr cinfo);
#endif
/* Replaces jpeg_write_scanlines when writing raw downsampled data. */
-EXTERN(JDIMENSION) jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data,
- JDIMENSION num_lines);
+EXTERN(JDIMENSION) jpeg_write_raw_data(j_compress_ptr cinfo, JSAMPIMAGE data,
+ JDIMENSION num_lines);
/* Write a special marker. See libjpeg.txt concerning safe usage. */
-EXTERN(void) jpeg_write_marker (j_compress_ptr cinfo, int marker,
- const JOCTET *dataptr, unsigned int datalen);
+EXTERN(void) jpeg_write_marker(j_compress_ptr cinfo, int marker,
+ const JOCTET *dataptr, unsigned int datalen);
/* Same, but piecemeal. */
-EXTERN(void) jpeg_write_m_header (j_compress_ptr cinfo, int marker,
- unsigned int datalen);
-EXTERN(void) jpeg_write_m_byte (j_compress_ptr cinfo, int val);
+EXTERN(void) jpeg_write_m_header(j_compress_ptr cinfo, int marker,
+ unsigned int datalen);
+EXTERN(void) jpeg_write_m_byte(j_compress_ptr cinfo, int val);
/* Alternate compression function: just write an abbreviated table file */
-EXTERN(void) jpeg_write_tables (j_compress_ptr cinfo);
+EXTERN(void) jpeg_write_tables(j_compress_ptr cinfo);
+
+/* Write ICC profile. See libjpeg.txt for usage information. */
+EXTERN(void) jpeg_write_icc_profile(j_compress_ptr cinfo,
+ const JOCTET *icc_data_ptr,
+ unsigned int icc_data_len);
+
/* Decompression startup: read start of JPEG datastream to see what's there */
-EXTERN(int) jpeg_read_header (j_decompress_ptr cinfo, boolean require_image);
+EXTERN(int) jpeg_read_header(j_decompress_ptr cinfo, boolean require_image);
/* Return value is one of: */
-#define JPEG_SUSPENDED 0 /* Suspended due to lack of input data */
-#define JPEG_HEADER_OK 1 /* Found valid image datastream */
-#define JPEG_HEADER_TABLES_ONLY 2 /* Found valid table-specs-only datastream */
+#define JPEG_SUSPENDED 0 /* Suspended due to lack of input data */
+#define JPEG_HEADER_OK 1 /* Found valid image datastream */
+#define JPEG_HEADER_TABLES_ONLY 2 /* Found valid table-specs-only datastream */
/* If you pass require_image = TRUE (normal case), you need not check for
* a TABLES_ONLY return code; an abbreviated file will cause an error exit.
* JPEG_SUSPENDED is only possible if you use a data source module that can
@@ -989,27 +994,27 @@ EXTERN(int) jpeg_read_header (j_decompress_ptr cinfo, boolean require_image);
*/
/* Main entry points for decompression */
-EXTERN(boolean) jpeg_start_decompress (j_decompress_ptr cinfo);
-EXTERN(JDIMENSION) jpeg_read_scanlines (j_decompress_ptr cinfo,
- JSAMPARRAY scanlines,
- JDIMENSION max_lines);
-EXTERN(JDIMENSION) jpeg_skip_scanlines (j_decompress_ptr cinfo,
- JDIMENSION num_lines);
-EXTERN(void) jpeg_crop_scanline (j_decompress_ptr cinfo, JDIMENSION *xoffset,
- JDIMENSION *width);
-EXTERN(boolean) jpeg_finish_decompress (j_decompress_ptr cinfo);
+EXTERN(boolean) jpeg_start_decompress(j_decompress_ptr cinfo);
+EXTERN(JDIMENSION) jpeg_read_scanlines(j_decompress_ptr cinfo,
+ JSAMPARRAY scanlines,
+ JDIMENSION max_lines);
+EXTERN(JDIMENSION) jpeg_skip_scanlines(j_decompress_ptr cinfo,
+ JDIMENSION num_lines);
+EXTERN(void) jpeg_crop_scanline(j_decompress_ptr cinfo, JDIMENSION *xoffset,
+ JDIMENSION *width);
+EXTERN(boolean) jpeg_finish_decompress(j_decompress_ptr cinfo);
/* Replaces jpeg_read_scanlines when reading raw downsampled data. */
-EXTERN(JDIMENSION) jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data,
- JDIMENSION max_lines);
+EXTERN(JDIMENSION) jpeg_read_raw_data(j_decompress_ptr cinfo, JSAMPIMAGE data,
+ JDIMENSION max_lines);
/* Additional entry points for buffered-image mode. */
-EXTERN(boolean) jpeg_has_multiple_scans (j_decompress_ptr cinfo);
-EXTERN(boolean) jpeg_start_output (j_decompress_ptr cinfo, int scan_number);
-EXTERN(boolean) jpeg_finish_output (j_decompress_ptr cinfo);
-EXTERN(boolean) jpeg_input_complete (j_decompress_ptr cinfo);
-EXTERN(void) jpeg_new_colormap (j_decompress_ptr cinfo);
-EXTERN(int) jpeg_consume_input (j_decompress_ptr cinfo);
+EXTERN(boolean) jpeg_has_multiple_scans(j_decompress_ptr cinfo);
+EXTERN(boolean) jpeg_start_output(j_decompress_ptr cinfo, int scan_number);
+EXTERN(boolean) jpeg_finish_output(j_decompress_ptr cinfo);
+EXTERN(boolean) jpeg_input_complete(j_decompress_ptr cinfo);
+EXTERN(void) jpeg_new_colormap(j_decompress_ptr cinfo);
+EXTERN(int) jpeg_consume_input(j_decompress_ptr cinfo);
/* Return value is one of: */
/* #define JPEG_SUSPENDED 0 Suspended due to lack of input data */
#define JPEG_REACHED_SOS 1 /* Reached start of new scan */
@@ -1019,25 +1024,25 @@ EXTERN(int) jpeg_consume_input (j_decompress_ptr cinfo);
/* Precalculate output dimensions for current decompression parameters. */
#if JPEG_LIB_VERSION >= 80
-EXTERN(void) jpeg_core_output_dimensions (j_decompress_ptr cinfo);
+EXTERN(void) jpeg_core_output_dimensions(j_decompress_ptr cinfo);
#endif
-EXTERN(void) jpeg_calc_output_dimensions (j_decompress_ptr cinfo);
+EXTERN(void) jpeg_calc_output_dimensions(j_decompress_ptr cinfo);
/* Control saving of COM and APPn markers into marker_list. */
-EXTERN(void) jpeg_save_markers (j_decompress_ptr cinfo, int marker_code,
- unsigned int length_limit);
+EXTERN(void) jpeg_save_markers(j_decompress_ptr cinfo, int marker_code,
+ unsigned int length_limit);
/* Install a special processing method for COM or APPn markers. */
-EXTERN(void) jpeg_set_marker_processor (j_decompress_ptr cinfo,
- int marker_code,
- jpeg_marker_parser_method routine);
+EXTERN(void) jpeg_set_marker_processor(j_decompress_ptr cinfo,
+ int marker_code,
+ jpeg_marker_parser_method routine);
/* Read or write raw DCT coefficients --- useful for lossless transcoding. */
-EXTERN(jvirt_barray_ptr *) jpeg_read_coefficients (j_decompress_ptr cinfo);
-EXTERN(void) jpeg_write_coefficients (j_compress_ptr cinfo,
- jvirt_barray_ptr *coef_arrays);
-EXTERN(void) jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
- j_compress_ptr dstinfo);
+EXTERN(jvirt_barray_ptr *) jpeg_read_coefficients(j_decompress_ptr cinfo);
+EXTERN(void) jpeg_write_coefficients(j_compress_ptr cinfo,
+ jvirt_barray_ptr *coef_arrays);
+EXTERN(void) jpeg_copy_critical_parameters(j_decompress_ptr srcinfo,
+ j_compress_ptr dstinfo);
/* If you choose to abort compression or decompression before completing
* jpeg_finish_(de)compress, then you need to clean up to release memory,
@@ -1045,17 +1050,22 @@ EXTERN(void) jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
* if you're done with the JPEG object, but if you want to clean it up and
* reuse it, call this:
*/
-EXTERN(void) jpeg_abort_compress (j_compress_ptr cinfo);
-EXTERN(void) jpeg_abort_decompress (j_decompress_ptr cinfo);
+EXTERN(void) jpeg_abort_compress(j_compress_ptr cinfo);
+EXTERN(void) jpeg_abort_decompress(j_decompress_ptr cinfo);
/* Generic versions of jpeg_abort and jpeg_destroy that work on either
* flavor of JPEG object. These may be more convenient in some places.
*/
-EXTERN(void) jpeg_abort (j_common_ptr cinfo);
-EXTERN(void) jpeg_destroy (j_common_ptr cinfo);
+EXTERN(void) jpeg_abort(j_common_ptr cinfo);
+EXTERN(void) jpeg_destroy(j_common_ptr cinfo);
/* Default restart-marker-resync procedure for use by data source modules */
-EXTERN(boolean) jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired);
+EXTERN(boolean) jpeg_resync_to_restart(j_decompress_ptr cinfo, int desired);
+
+/* Read ICC profile. See libjpeg.txt for usage information. */
+EXTERN(boolean) jpeg_read_icc_profile(j_decompress_ptr cinfo,
+ JOCTET **icc_data_ptr,
+ unsigned int *icc_data_len);
/* These marker codes are exported since applications and data source modules
diff --git a/src/3rdparty/libjpeg/src/jquant1.c b/src/3rdparty/libjpeg/src/jquant1.c
index e7814815ef..a336abdbbb 100644
--- a/src/3rdparty/libjpeg/src/jquant1.c
+++ b/src/3rdparty/libjpeg/src/jquant1.c
@@ -73,8 +73,9 @@
#define ODITHER_SIZE 16 /* dimension of dither matrix */
/* NB: if ODITHER_SIZE is not a power of 2, ODITHER_MASK uses will break */
-#define ODITHER_CELLS (ODITHER_SIZE*ODITHER_SIZE) /* # cells in matrix */
-#define ODITHER_MASK (ODITHER_SIZE-1) /* mask for wrapping around counters */
+#define ODITHER_CELLS (ODITHER_SIZE * ODITHER_SIZE) /* # cells in matrix */
+#define ODITHER_MASK (ODITHER_SIZE - 1) /* mask for wrapping around
+ counters */
typedef int ODITHER_MATRIX[ODITHER_SIZE][ODITHER_SIZE];
typedef int (*ODITHER_MATRIX_PTR)[ODITHER_SIZE];
@@ -132,12 +133,12 @@ typedef JLONG FSERROR; /* may need more than 16 bits */
typedef JLONG LOCFSERROR; /* be sure calculation temps are big enough */
#endif
-typedef FSERROR *FSERRPTR; /* pointer to error array */
+typedef FSERROR *FSERRPTR; /* pointer to error array */
/* Private subobject */
-#define MAX_Q_COMPS 4 /* max components I can handle */
+#define MAX_Q_COMPS 4 /* max components I can handle */
typedef struct {
struct jpeg_color_quantizer pub; /* public fields */
@@ -183,7 +184,7 @@ typedef my_cquantizer *my_cquantize_ptr;
LOCAL(int)
-select_ncolors (j_decompress_ptr cinfo, int Ncolors[])
+select_ncolors(j_decompress_ptr cinfo, int Ncolors[])
/* Determine allocation of desired colors to components, */
/* and fill in Ncolors[] array to indicate choice. */
/* Return value is total number of colors (product of Ncolors[] values). */
@@ -206,12 +207,12 @@ select_ncolors (j_decompress_ptr cinfo, int Ncolors[])
temp = iroot; /* set temp = iroot ** nc */
for (i = 1; i < nc; i++)
temp *= iroot;
- } while (temp <= (long) max_colors); /* repeat till iroot exceeds root */
+ } while (temp <= (long)max_colors); /* repeat till iroot exceeds root */
iroot--; /* now iroot = floor(root) */
/* Must have at least 2 color values per component */
if (iroot < 2)
- ERREXIT1(cinfo, JERR_QUANT_FEW_COLORS, (int) temp);
+ ERREXIT1(cinfo, JERR_QUANT_FEW_COLORS, (int)temp);
/* Initialize to iroot color values for each component */
total_colors = 1;
@@ -231,11 +232,11 @@ select_ncolors (j_decompress_ptr cinfo, int Ncolors[])
j = (cinfo->out_color_space == JCS_RGB ? RGB_order[i] : i);
/* calculate new total_colors if Ncolors[j] is incremented */
temp = total_colors / Ncolors[j];
- temp *= Ncolors[j]+1; /* done in long arith to avoid oflo */
- if (temp > (long) max_colors)
+ temp *= Ncolors[j] + 1; /* done in long arith to avoid oflo */
+ if (temp > (long)max_colors)
break; /* won't fit, done with this pass */
Ncolors[j]++; /* OK, apply the increment */
- total_colors = (int) temp;
+ total_colors = (int)temp;
changed = TRUE;
}
} while (changed);
@@ -245,7 +246,7 @@ select_ncolors (j_decompress_ptr cinfo, int Ncolors[])
LOCAL(int)
-output_value (j_decompress_ptr cinfo, int ci, int j, int maxj)
+output_value(j_decompress_ptr cinfo, int ci, int j, int maxj)
/* Return j'th output value, where j will range from 0 to maxj */
/* The output values must fall in 0..MAXJSAMPLE in increasing order */
{
@@ -254,17 +255,17 @@ output_value (j_decompress_ptr cinfo, int ci, int j, int maxj)
* (Forcing the upper and lower values to the limits ensures that
* dithering can't produce a color outside the selected gamut.)
*/
- return (int) (((JLONG) j * MAXJSAMPLE + maxj/2) / maxj);
+ return (int)(((JLONG)j * MAXJSAMPLE + maxj / 2) / maxj);
}
LOCAL(int)
-largest_input_value (j_decompress_ptr cinfo, int ci, int j, int maxj)
+largest_input_value(j_decompress_ptr cinfo, int ci, int j, int maxj)
/* Return largest input value that should map to j'th output value */
/* Must have largest(j=0) >= 0, and largest(j=maxj) >= MAXJSAMPLE */
{
/* Breakpoints are halfway between values returned by output_value */
- return (int) (((JLONG) (2*j + 1) * MAXJSAMPLE + maxj) / (2*maxj));
+ return (int)(((JLONG)(2 * j + 1) * MAXJSAMPLE + maxj) / (2 * maxj));
}
@@ -273,21 +274,21 @@ largest_input_value (j_decompress_ptr cinfo, int ci, int j, int maxj)
*/
LOCAL(void)
-create_colormap (j_decompress_ptr cinfo)
+create_colormap(j_decompress_ptr cinfo)
{
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+ my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
JSAMPARRAY colormap; /* Created colormap */
int total_colors; /* Number of distinct output colors */
- int i,j,k, nci, blksize, blkdist, ptr, val;
+ int i, j, k, nci, blksize, blkdist, ptr, val;
/* Select number of colors for each component */
total_colors = select_ncolors(cinfo, cquantize->Ncolors);
/* Report selected color counts */
if (cinfo->out_color_components == 3)
- TRACEMS4(cinfo, 1, JTRC_QUANT_3_NCOLORS,
- total_colors, cquantize->Ncolors[0],
- cquantize->Ncolors[1], cquantize->Ncolors[2]);
+ TRACEMS4(cinfo, 1, JTRC_QUANT_3_NCOLORS, total_colors,
+ cquantize->Ncolors[0], cquantize->Ncolors[1],
+ cquantize->Ncolors[2]);
else
TRACEMS1(cinfo, 1, JTRC_QUANT_NCOLORS, total_colors);
@@ -296,8 +297,8 @@ create_colormap (j_decompress_ptr cinfo)
/* i.e. rightmost (highest-indexed) color changes most rapidly. */
colormap = (*cinfo->mem->alloc_sarray)
- ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (JDIMENSION) total_colors, (JDIMENSION) cinfo->out_color_components);
+ ((j_common_ptr)cinfo, JPOOL_IMAGE,
+ (JDIMENSION)total_colors, (JDIMENSION)cinfo->out_color_components);
/* blksize is number of adjacent repeated entries for a component */
/* blkdist is distance between groups of identical entries for a component */
@@ -309,12 +310,12 @@ create_colormap (j_decompress_ptr cinfo)
blksize = blkdist / nci;
for (j = 0; j < nci; j++) {
/* Compute j'th output value (out of nci) for component */
- val = output_value(cinfo, i, j, nci-1);
+ val = output_value(cinfo, i, j, nci - 1);
/* Fill in all colormap entries that have this value of this component */
for (ptr = j * blksize; ptr < total_colors; ptr += blkdist) {
/* fill in blksize entries beginning at ptr */
for (k = 0; k < blksize; k++)
- colormap[i][ptr+k] = (JSAMPLE) val;
+ colormap[i][ptr + k] = (JSAMPLE)val;
}
}
blkdist = blksize; /* blksize of this color is blkdist of next */
@@ -333,11 +334,11 @@ create_colormap (j_decompress_ptr cinfo)
*/
LOCAL(void)
-create_colorindex (j_decompress_ptr cinfo)
+create_colorindex(j_decompress_ptr cinfo)
{
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+ my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
JSAMPROW indexptr;
- int i,j,k, nci, blksize, val, pad;
+ int i, j, k, nci, blksize, val, pad;
/* For ordered dither, we pad the color index tables by MAXJSAMPLE in
* each direction (input index values can be -MAXJSAMPLE .. 2*MAXJSAMPLE).
@@ -345,7 +346,7 @@ create_colorindex (j_decompress_ptr cinfo)
* flag whether it was done in case user changes dithering mode.
*/
if (cinfo->dither_mode == JDITHER_ORDERED) {
- pad = MAXJSAMPLE*2;
+ pad = MAXJSAMPLE * 2;
cquantize->is_padded = TRUE;
} else {
pad = 0;
@@ -353,9 +354,9 @@ create_colorindex (j_decompress_ptr cinfo)
}
cquantize->colorindex = (*cinfo->mem->alloc_sarray)
- ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (JDIMENSION) (MAXJSAMPLE+1 + pad),
- (JDIMENSION) cinfo->out_color_components);
+ ((j_common_ptr)cinfo, JPOOL_IMAGE,
+ (JDIMENSION)(MAXJSAMPLE + 1 + pad),
+ (JDIMENSION)cinfo->out_color_components);
/* blksize is number of adjacent repeated entries for a component */
blksize = cquantize->sv_actual;
@@ -373,18 +374,18 @@ create_colorindex (j_decompress_ptr cinfo)
/* and k = largest j that maps to current val */
indexptr = cquantize->colorindex[i];
val = 0;
- k = largest_input_value(cinfo, i, 0, nci-1);
+ k = largest_input_value(cinfo, i, 0, nci - 1);
for (j = 0; j <= MAXJSAMPLE; j++) {
while (j > k) /* advance val if past boundary */
- k = largest_input_value(cinfo, i, ++val, nci-1);
+ k = largest_input_value(cinfo, i, ++val, nci - 1);
/* premultiply so that no multiplication needed in main processing */
- indexptr[j] = (JSAMPLE) (val * blksize);
+ indexptr[j] = (JSAMPLE)(val * blksize);
}
/* Pad at both ends if necessary */
if (pad)
for (j = 1; j <= MAXJSAMPLE; j++) {
indexptr[-j] = indexptr[0];
- indexptr[MAXJSAMPLE+j] = indexptr[MAXJSAMPLE];
+ indexptr[MAXJSAMPLE + j] = indexptr[MAXJSAMPLE];
}
}
}
@@ -396,29 +397,29 @@ create_colorindex (j_decompress_ptr cinfo)
*/
LOCAL(ODITHER_MATRIX_PTR)
-make_odither_array (j_decompress_ptr cinfo, int ncolors)
+make_odither_array(j_decompress_ptr cinfo, int ncolors)
{
ODITHER_MATRIX_PTR odither;
- int j,k;
- JLONG num,den;
+ int j, k;
+ JLONG num, den;
odither = (ODITHER_MATRIX_PTR)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(ODITHER_MATRIX));
/* The inter-value distance for this color is MAXJSAMPLE/(ncolors-1).
* Hence the dither value for the matrix cell with fill order f
* (f=0..N-1) should be (N-1-2*f)/(2*N) * MAXJSAMPLE/(ncolors-1).
* On 16-bit-int machine, be careful to avoid overflow.
*/
- den = 2 * ODITHER_CELLS * ((JLONG) (ncolors - 1));
+ den = 2 * ODITHER_CELLS * ((JLONG)(ncolors - 1));
for (j = 0; j < ODITHER_SIZE; j++) {
for (k = 0; k < ODITHER_SIZE; k++) {
- num = ((JLONG) (ODITHER_CELLS-1 - 2*((int)base_dither_matrix[j][k])))
- * MAXJSAMPLE;
+ num = ((JLONG)(ODITHER_CELLS - 1 -
+ 2 * ((int)base_dither_matrix[j][k]))) * MAXJSAMPLE;
/* Ensure round towards zero despite C's lack of consistency
* about rounding negative values in integer division...
*/
- odither[j][k] = (int) (num<0 ? -((-num)/den) : num/den);
+ odither[j][k] = (int)(num < 0 ? -((-num) / den) : num / den);
}
}
return odither;
@@ -432,9 +433,9 @@ make_odither_array (j_decompress_ptr cinfo, int ncolors)
*/
LOCAL(void)
-create_odither_tables (j_decompress_ptr cinfo)
+create_odither_tables(j_decompress_ptr cinfo)
{
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+ my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
ODITHER_MATRIX_PTR odither;
int i, j, nci;
@@ -459,11 +460,11 @@ create_odither_tables (j_decompress_ptr cinfo)
*/
METHODDEF(void)
-color_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
- JSAMPARRAY output_buf, int num_rows)
+color_quantize(j_decompress_ptr cinfo, JSAMPARRAY input_buf,
+ JSAMPARRAY output_buf, int num_rows)
/* General case, no dithering */
{
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+ my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
JSAMPARRAY colorindex = cquantize->colorindex;
register int pixcode, ci;
register JSAMPROW ptrin, ptrout;
@@ -480,18 +481,18 @@ color_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
for (ci = 0; ci < nc; ci++) {
pixcode += GETJSAMPLE(colorindex[ci][GETJSAMPLE(*ptrin++)]);
}
- *ptrout++ = (JSAMPLE) pixcode;
+ *ptrout++ = (JSAMPLE)pixcode;
}
}
}
METHODDEF(void)
-color_quantize3 (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
- JSAMPARRAY output_buf, int num_rows)
+color_quantize3(j_decompress_ptr cinfo, JSAMPARRAY input_buf,
+ JSAMPARRAY output_buf, int num_rows)
/* Fast path for out_color_components==3, no dithering */
{
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+ my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
register int pixcode;
register JSAMPROW ptrin, ptrout;
JSAMPROW colorindex0 = cquantize->colorindex[0];
@@ -508,18 +509,18 @@ color_quantize3 (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
pixcode = GETJSAMPLE(colorindex0[GETJSAMPLE(*ptrin++)]);
pixcode += GETJSAMPLE(colorindex1[GETJSAMPLE(*ptrin++)]);
pixcode += GETJSAMPLE(colorindex2[GETJSAMPLE(*ptrin++)]);
- *ptrout++ = (JSAMPLE) pixcode;
+ *ptrout++ = (JSAMPLE)pixcode;
}
}
}
METHODDEF(void)
-quantize_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
- JSAMPARRAY output_buf, int num_rows)
+quantize_ord_dither(j_decompress_ptr cinfo, JSAMPARRAY input_buf,
+ JSAMPARRAY output_buf, int num_rows)
/* General case, with ordered dithering */
{
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+ my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
register JSAMPROW input_ptr;
register JSAMPROW output_ptr;
JSAMPROW colorindex_ci;
@@ -533,7 +534,7 @@ quantize_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
for (row = 0; row < num_rows; row++) {
/* Initialize output values to 0 so can process components separately */
- jzero_far((void *) output_buf[row], (size_t) (width * sizeof(JSAMPLE)));
+ jzero_far((void *)output_buf[row], (size_t)(width * sizeof(JSAMPLE)));
row_index = cquantize->row_index;
for (ci = 0; ci < nc; ci++) {
input_ptr = input_buf[row] + ci;
@@ -550,7 +551,8 @@ quantize_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
* inputs. The maximum dither is +- MAXJSAMPLE; this sets the
* required amount of padding.
*/
- *output_ptr += colorindex_ci[GETJSAMPLE(*input_ptr)+dither[col_index]];
+ *output_ptr +=
+ colorindex_ci[GETJSAMPLE(*input_ptr) + dither[col_index]];
input_ptr += nc;
output_ptr++;
col_index = (col_index + 1) & ODITHER_MASK;
@@ -564,11 +566,11 @@ quantize_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
METHODDEF(void)
-quantize3_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
- JSAMPARRAY output_buf, int num_rows)
+quantize3_ord_dither(j_decompress_ptr cinfo, JSAMPARRAY input_buf,
+ JSAMPARRAY output_buf, int num_rows)
/* Fast path for out_color_components==3, with ordered dithering */
{
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+ my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
register int pixcode;
register JSAMPROW input_ptr;
register JSAMPROW output_ptr;
@@ -593,13 +595,13 @@ quantize3_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
col_index = 0;
for (col = width; col > 0; col--) {
- pixcode = GETJSAMPLE(colorindex0[GETJSAMPLE(*input_ptr++) +
- dither0[col_index]]);
- pixcode += GETJSAMPLE(colorindex1[GETJSAMPLE(*input_ptr++) +
- dither1[col_index]]);
- pixcode += GETJSAMPLE(colorindex2[GETJSAMPLE(*input_ptr++) +
- dither2[col_index]]);
- *output_ptr++ = (JSAMPLE) pixcode;
+ pixcode =
+ GETJSAMPLE(colorindex0[GETJSAMPLE(*input_ptr++) + dither0[col_index]]);
+ pixcode +=
+ GETJSAMPLE(colorindex1[GETJSAMPLE(*input_ptr++) + dither1[col_index]]);
+ pixcode +=
+ GETJSAMPLE(colorindex2[GETJSAMPLE(*input_ptr++) + dither2[col_index]]);
+ *output_ptr++ = (JSAMPLE)pixcode;
col_index = (col_index + 1) & ODITHER_MASK;
}
row_index = (row_index + 1) & ODITHER_MASK;
@@ -609,11 +611,11 @@ quantize3_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
METHODDEF(void)
-quantize_fs_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
- JSAMPARRAY output_buf, int num_rows)
+quantize_fs_dither(j_decompress_ptr cinfo, JSAMPARRAY input_buf,
+ JSAMPARRAY output_buf, int num_rows)
/* General case, with Floyd-Steinberg dithering */
{
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+ my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
register LOCFSERROR cur; /* current error or pixel value */
LOCFSERROR belowerr; /* error for pixel below cur */
LOCFSERROR bpreverr; /* error for below/prev col */
@@ -637,17 +639,17 @@ quantize_fs_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
for (row = 0; row < num_rows; row++) {
/* Initialize output values to 0 so can process components separately */
- jzero_far((void *) output_buf[row], (size_t) (width * sizeof(JSAMPLE)));
+ jzero_far((void *)output_buf[row], (size_t)(width * sizeof(JSAMPLE)));
for (ci = 0; ci < nc; ci++) {
input_ptr = input_buf[row] + ci;
output_ptr = output_buf[row];
if (cquantize->on_odd_row) {
/* work right to left in this row */
- input_ptr += (width-1) * nc; /* so point to rightmost pixel */
- output_ptr += width-1;
+ input_ptr += (width - 1) * nc; /* so point to rightmost pixel */
+ output_ptr += width - 1;
dir = -1;
dirnc = -nc;
- errorptr = cquantize->fserrors[ci] + (width+1); /* => entry after last column */
+ errorptr = cquantize->fserrors[ci] + (width + 1); /* => entry after last column */
} else {
/* work left to right in this row */
dir = 1;
@@ -679,7 +681,7 @@ quantize_fs_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
cur = GETJSAMPLE(range_limit[cur]);
/* Select output value, accumulate into output code for this pixel */
pixcode = GETJSAMPLE(colorindex_ci[cur]);
- *output_ptr += (JSAMPLE) pixcode;
+ *output_ptr += (JSAMPLE)pixcode;
/* Compute actual representation error at this pixel */
/* Note: we can do this even though we don't have the final */
/* pixel code, because the colormap is orthogonal. */
@@ -691,7 +693,7 @@ quantize_fs_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
bnexterr = cur;
delta = cur * 2;
cur += delta; /* form error * 3 */
- errorptr[0] = (FSERROR) (bpreverr + cur);
+ errorptr[0] = (FSERROR)(bpreverr + cur);
cur += delta; /* form error * 5 */
bpreverr = belowerr + cur;
belowerr = bnexterr;
@@ -708,7 +710,7 @@ quantize_fs_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
* final fserrors[] entry. Note we need not unload belowerr because
* it is for the dummy column before or after the actual array.
*/
- errorptr[0] = (FSERROR) bpreverr; /* unload prev err into array */
+ errorptr[0] = (FSERROR)bpreverr; /* unload prev err into array */
}
cquantize->on_odd_row = (cquantize->on_odd_row ? FALSE : TRUE);
}
@@ -720,16 +722,16 @@ quantize_fs_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
*/
LOCAL(void)
-alloc_fs_workspace (j_decompress_ptr cinfo)
+alloc_fs_workspace(j_decompress_ptr cinfo)
{
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+ my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
size_t arraysize;
int i;
- arraysize = (size_t) ((cinfo->output_width + 2) * sizeof(FSERROR));
+ arraysize = (size_t)((cinfo->output_width + 2) * sizeof(FSERROR));
for (i = 0; i < cinfo->out_color_components; i++) {
cquantize->fserrors[i] = (FSERRPTR)
- (*cinfo->mem->alloc_large)((j_common_ptr) cinfo, JPOOL_IMAGE, arraysize);
+ (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE, arraysize);
}
}
@@ -739,9 +741,9 @@ alloc_fs_workspace (j_decompress_ptr cinfo)
*/
METHODDEF(void)
-start_pass_1_quant (j_decompress_ptr cinfo, boolean is_pre_scan)
+start_pass_1_quant(j_decompress_ptr cinfo, boolean is_pre_scan)
{
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+ my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
size_t arraysize;
int i;
@@ -767,7 +769,7 @@ start_pass_1_quant (j_decompress_ptr cinfo, boolean is_pre_scan)
* we must recreate the color index table with padding.
* This will cost extra space, but probably isn't very likely.
*/
- if (! cquantize->is_padded)
+ if (!cquantize->is_padded)
create_colorindex(cinfo);
/* Create ordered-dither tables if we didn't already. */
if (cquantize->odither[0] == NULL)
@@ -780,9 +782,9 @@ start_pass_1_quant (j_decompress_ptr cinfo, boolean is_pre_scan)
if (cquantize->fserrors[0] == NULL)
alloc_fs_workspace(cinfo);
/* Initialize the propagated errors to zero. */
- arraysize = (size_t) ((cinfo->output_width + 2) * sizeof(FSERROR));
+ arraysize = (size_t)((cinfo->output_width + 2) * sizeof(FSERROR));
for (i = 0; i < cinfo->out_color_components; i++)
- jzero_far((void *) cquantize->fserrors[i], arraysize);
+ jzero_far((void *)cquantize->fserrors[i], arraysize);
break;
default:
ERREXIT(cinfo, JERR_NOT_COMPILED);
@@ -796,7 +798,7 @@ start_pass_1_quant (j_decompress_ptr cinfo, boolean is_pre_scan)
*/
METHODDEF(void)
-finish_pass_1_quant (j_decompress_ptr cinfo)
+finish_pass_1_quant(j_decompress_ptr cinfo)
{
/* no work in 1-pass case */
}
@@ -808,7 +810,7 @@ finish_pass_1_quant (j_decompress_ptr cinfo)
*/
METHODDEF(void)
-new_color_map_1_quant (j_decompress_ptr cinfo)
+new_color_map_1_quant(j_decompress_ptr cinfo)
{
ERREXIT(cinfo, JERR_MODE_CHANGE);
}
@@ -819,14 +821,14 @@ new_color_map_1_quant (j_decompress_ptr cinfo)
*/
GLOBAL(void)
-jinit_1pass_quantizer (j_decompress_ptr cinfo)
+jinit_1pass_quantizer(j_decompress_ptr cinfo)
{
my_cquantize_ptr cquantize;
cquantize = (my_cquantize_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(my_cquantizer));
- cinfo->cquantize = (struct jpeg_color_quantizer *) cquantize;
+ cinfo->cquantize = (struct jpeg_color_quantizer *)cquantize;
cquantize->pub.start_pass = start_pass_1_quant;
cquantize->pub.finish_pass = finish_pass_1_quant;
cquantize->pub.new_color_map = new_color_map_1_quant;
@@ -837,8 +839,8 @@ jinit_1pass_quantizer (j_decompress_ptr cinfo)
if (cinfo->out_color_components > MAX_Q_COMPS)
ERREXIT1(cinfo, JERR_QUANT_COMPONENTS, MAX_Q_COMPS);
/* Make sure colormap indexes can be represented by JSAMPLEs */
- if (cinfo->desired_number_of_colors > (MAXJSAMPLE+1))
- ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXJSAMPLE+1);
+ if (cinfo->desired_number_of_colors > (MAXJSAMPLE + 1))
+ ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXJSAMPLE + 1);
/* Create the colormap and color index table. */
create_colormap(cinfo);
diff --git a/src/3rdparty/libjpeg/src/jquant2.c b/src/3rdparty/libjpeg/src/jquant2.c
index cfbd0f1526..0ce0ca5472 100644
--- a/src/3rdparty/libjpeg/src/jquant2.c
+++ b/src/3rdparty/libjpeg/src/jquant2.c
@@ -73,14 +73,14 @@
* probably need to change these scale factors.
*/
-#define R_SCALE 2 /* scale R distances by this much */
-#define G_SCALE 3 /* scale G distances by this much */
-#define B_SCALE 1 /* and B by this much */
+#define R_SCALE 2 /* scale R distances by this much */
+#define G_SCALE 3 /* scale G distances by this much */
+#define B_SCALE 1 /* and B by this much */
-static const int c_scales[3]={R_SCALE, G_SCALE, B_SCALE};
-#define C0_SCALE c_scales[rgb_red[cinfo->out_color_space]]
-#define C1_SCALE c_scales[rgb_green[cinfo->out_color_space]]
-#define C2_SCALE c_scales[rgb_blue[cinfo->out_color_space]]
+static const int c_scales[3] = { R_SCALE, G_SCALE, B_SCALE };
+#define C0_SCALE c_scales[rgb_red[cinfo->out_color_space]]
+#define C1_SCALE c_scales[rgb_green[cinfo->out_color_space]]
+#define C2_SCALE c_scales[rgb_blue[cinfo->out_color_space]]
/*
* First we have the histogram data structure and routines for creating it.
@@ -106,7 +106,7 @@ static const int c_scales[3]={R_SCALE, G_SCALE, B_SCALE};
* each 2-D array has 2^6*2^5 = 2048 or 2^6*2^6 = 4096 entries.
*/
-#define MAXNUMCOLORS (MAXJSAMPLE+1) /* maximum size of colormap */
+#define MAXNUMCOLORS (MAXJSAMPLE + 1) /* maximum size of colormap */
/* These will do the right thing for either R,G,B or B,G,R color order,
* but you may not like the results for other color orders.
@@ -116,19 +116,19 @@ static const int c_scales[3]={R_SCALE, G_SCALE, B_SCALE};
#define HIST_C2_BITS 5 /* bits of precision in B/R histogram */
/* Number of elements along histogram axes. */
-#define HIST_C0_ELEMS (1<<HIST_C0_BITS)
-#define HIST_C1_ELEMS (1<<HIST_C1_BITS)
-#define HIST_C2_ELEMS (1<<HIST_C2_BITS)
+#define HIST_C0_ELEMS (1 << HIST_C0_BITS)
+#define HIST_C1_ELEMS (1 << HIST_C1_BITS)
+#define HIST_C2_ELEMS (1 << HIST_C2_BITS)
/* These are the amounts to shift an input value to get a histogram index. */
-#define C0_SHIFT (BITS_IN_JSAMPLE-HIST_C0_BITS)
-#define C1_SHIFT (BITS_IN_JSAMPLE-HIST_C1_BITS)
-#define C2_SHIFT (BITS_IN_JSAMPLE-HIST_C2_BITS)
+#define C0_SHIFT (BITS_IN_JSAMPLE - HIST_C0_BITS)
+#define C1_SHIFT (BITS_IN_JSAMPLE - HIST_C1_BITS)
+#define C2_SHIFT (BITS_IN_JSAMPLE - HIST_C2_BITS)
typedef UINT16 histcell; /* histogram cell; prefer an unsigned type */
-typedef histcell *histptr; /* for pointers to histogram cells */
+typedef histcell *histptr; /* for pointers to histogram cells */
typedef histcell hist1d[HIST_C2_ELEMS]; /* typedefs for the array */
typedef hist1d *hist2d; /* type for the 2nd-level pointers */
@@ -200,10 +200,10 @@ typedef my_cquantizer *my_cquantize_ptr;
*/
METHODDEF(void)
-prescan_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
- JSAMPARRAY output_buf, int num_rows)
+prescan_quantize(j_decompress_ptr cinfo, JSAMPARRAY input_buf,
+ JSAMPARRAY output_buf, int num_rows)
{
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+ my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
register JSAMPROW ptr;
register histptr histp;
register hist3d histogram = cquantize->histogram;
@@ -215,9 +215,9 @@ prescan_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
ptr = input_buf[row];
for (col = width; col > 0; col--) {
/* get pixel value and index into the histogram */
- histp = & histogram[GETJSAMPLE(ptr[0]) >> C0_SHIFT]
- [GETJSAMPLE(ptr[1]) >> C1_SHIFT]
- [GETJSAMPLE(ptr[2]) >> C2_SHIFT];
+ histp = &histogram[GETJSAMPLE(ptr[0]) >> C0_SHIFT]
+ [GETJSAMPLE(ptr[1]) >> C1_SHIFT]
+ [GETJSAMPLE(ptr[2]) >> C2_SHIFT];
/* increment, check for overflow and undo increment if so. */
if (++(*histp) <= 0)
(*histp)--;
@@ -249,7 +249,7 @@ typedef box *boxptr;
LOCAL(boxptr)
-find_biggest_color_pop (boxptr boxlist, int numboxes)
+find_biggest_color_pop(boxptr boxlist, int numboxes)
/* Find the splittable box with the largest color population */
/* Returns NULL if no splittable boxes remain */
{
@@ -269,7 +269,7 @@ find_biggest_color_pop (boxptr boxlist, int numboxes)
LOCAL(boxptr)
-find_biggest_volume (boxptr boxlist, int numboxes)
+find_biggest_volume(boxptr boxlist, int numboxes)
/* Find the splittable box with the largest (scaled) volume */
/* Returns NULL if no splittable boxes remain */
{
@@ -289,16 +289,16 @@ find_biggest_volume (boxptr boxlist, int numboxes)
LOCAL(void)
-update_box (j_decompress_ptr cinfo, boxptr boxp)
+update_box(j_decompress_ptr cinfo, boxptr boxp)
/* Shrink the min/max bounds of a box to enclose only nonzero elements, */
/* and recompute its volume and population */
{
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+ my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
hist3d histogram = cquantize->histogram;
histptr histp;
- int c0,c1,c2;
- int c0min,c0max,c1min,c1max,c2min,c2max;
- JLONG dist0,dist1,dist2;
+ int c0, c1, c2;
+ int c0min, c0max, c1min, c1max, c2min, c2max;
+ JLONG dist0, dist1, dist2;
long ccount;
c0min = boxp->c0min; c0max = boxp->c0max;
@@ -308,69 +308,69 @@ update_box (j_decompress_ptr cinfo, boxptr boxp)
if (c0max > c0min)
for (c0 = c0min; c0 <= c0max; c0++)
for (c1 = c1min; c1 <= c1max; c1++) {
- histp = & histogram[c0][c1][c2min];
+ histp = &histogram[c0][c1][c2min];
for (c2 = c2min; c2 <= c2max; c2++)
if (*histp++ != 0) {
boxp->c0min = c0min = c0;
goto have_c0min;
}
}
- have_c0min:
+have_c0min:
if (c0max > c0min)
for (c0 = c0max; c0 >= c0min; c0--)
for (c1 = c1min; c1 <= c1max; c1++) {
- histp = & histogram[c0][c1][c2min];
+ histp = &histogram[c0][c1][c2min];
for (c2 = c2min; c2 <= c2max; c2++)
if (*histp++ != 0) {
boxp->c0max = c0max = c0;
goto have_c0max;
}
}
- have_c0max:
+have_c0max:
if (c1max > c1min)
for (c1 = c1min; c1 <= c1max; c1++)
for (c0 = c0min; c0 <= c0max; c0++) {
- histp = & histogram[c0][c1][c2min];
+ histp = &histogram[c0][c1][c2min];
for (c2 = c2min; c2 <= c2max; c2++)
if (*histp++ != 0) {
boxp->c1min = c1min = c1;
goto have_c1min;
}
}
- have_c1min:
+have_c1min:
if (c1max > c1min)
for (c1 = c1max; c1 >= c1min; c1--)
for (c0 = c0min; c0 <= c0max; c0++) {
- histp = & histogram[c0][c1][c2min];
+ histp = &histogram[c0][c1][c2min];
for (c2 = c2min; c2 <= c2max; c2++)
if (*histp++ != 0) {
boxp->c1max = c1max = c1;
goto have_c1max;
}
}
- have_c1max:
+have_c1max:
if (c2max > c2min)
for (c2 = c2min; c2 <= c2max; c2++)
for (c0 = c0min; c0 <= c0max; c0++) {
- histp = & histogram[c0][c1min][c2];
+ histp = &histogram[c0][c1min][c2];
for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS)
if (*histp != 0) {
boxp->c2min = c2min = c2;
goto have_c2min;
}
}
- have_c2min:
+have_c2min:
if (c2max > c2min)
for (c2 = c2max; c2 >= c2min; c2--)
for (c0 = c0min; c0 <= c0max; c0++) {
- histp = & histogram[c0][c1min][c2];
+ histp = &histogram[c0][c1min][c2];
for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS)
if (*histp != 0) {
boxp->c2max = c2max = c2;
goto have_c2max;
}
}
- have_c2max:
+have_c2max:
/* Update box volume.
* We use 2-norm rather than real volume here; this biases the method
@@ -383,13 +383,13 @@ update_box (j_decompress_ptr cinfo, boxptr boxp)
dist0 = ((c0max - c0min) << C0_SHIFT) * C0_SCALE;
dist1 = ((c1max - c1min) << C1_SHIFT) * C1_SCALE;
dist2 = ((c2max - c2min) << C2_SHIFT) * C2_SCALE;
- boxp->volume = dist0*dist0 + dist1*dist1 + dist2*dist2;
+ boxp->volume = dist0 * dist0 + dist1 * dist1 + dist2 * dist2;
/* Now scan remaining volume of box and compute population */
ccount = 0;
for (c0 = c0min; c0 <= c0max; c0++)
for (c1 = c1min; c1 <= c1max; c1++) {
- histp = & histogram[c0][c1][c2min];
+ histp = &histogram[c0][c1][c2min];
for (c2 = c2min; c2 <= c2max; c2++, histp++)
if (*histp != 0) {
ccount++;
@@ -400,19 +400,19 @@ update_box (j_decompress_ptr cinfo, boxptr boxp)
LOCAL(int)
-median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes,
- int desired_colors)
+median_cut(j_decompress_ptr cinfo, boxptr boxlist, int numboxes,
+ int desired_colors)
/* Repeatedly select and split the largest box until we have enough boxes */
{
- int n,lb;
- int c0,c1,c2,cmax;
- register boxptr b1,b2;
+ int n, lb;
+ int c0, c1, c2, cmax;
+ register boxptr b1, b2;
while (numboxes < desired_colors) {
/* Select box to split.
* Current algorithm: by population for first half, then by volume.
*/
- if (numboxes*2 <= desired_colors) {
+ if (numboxes * 2 <= desired_colors) {
b1 = find_biggest_color_pop(boxlist, numboxes);
} else {
b1 = find_biggest_volume(boxlist, numboxes);
@@ -421,8 +421,8 @@ median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes,
break;
b2 = &boxlist[numboxes]; /* where new box will go */
/* Copy the color bounds to the new box. */
- b2->c0max = b1->c0max; b2->c1max = b1->c1max; b2->c2max = b1->c2max;
- b2->c0min = b1->c0min; b2->c1min = b1->c1min; b2->c2min = b1->c2min;
+ b2->c0max = b1->c0max; b2->c1max = b1->c1max; b2->c2max = b1->c2max;
+ b2->c0min = b1->c0min; b2->c1min = b1->c1min; b2->c2min = b1->c2min;
/* Choose which axis to split the box on.
* Current algorithm: longest scaled axis.
* See notes in update_box about scaling distances.
@@ -434,13 +434,12 @@ median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes,
* This code does the right thing for R,G,B or B,G,R color orders only.
*/
if (rgb_red[cinfo->out_color_space] == 0) {
- cmax = c1; n = 1;
- if (c0 > cmax) { cmax = c0; n = 0; }
+ cmax = c1; n = 1;
+ if (c0 > cmax) { cmax = c0; n = 0; }
if (c2 > cmax) { n = 2; }
- }
- else {
- cmax = c1; n = 1;
- if (c2 > cmax) { cmax = c2; n = 2; }
+ } else {
+ cmax = c1; n = 1;
+ if (c2 > cmax) { cmax = c2; n = 2; }
if (c0 > cmax) { n = 0; }
}
/* Choose split point along selected axis, and update box bounds.
@@ -453,17 +452,17 @@ median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes,
case 0:
lb = (b1->c0max + b1->c0min) / 2;
b1->c0max = lb;
- b2->c0min = lb+1;
+ b2->c0min = lb + 1;
break;
case 1:
lb = (b1->c1max + b1->c1min) / 2;
b1->c1max = lb;
- b2->c1min = lb+1;
+ b2->c1min = lb + 1;
break;
case 2:
lb = (b1->c2max + b1->c2min) / 2;
b1->c2max = lb;
- b2->c2min = lb+1;
+ b2->c2min = lb + 1;
break;
}
/* Update stats for boxes */
@@ -476,16 +475,16 @@ median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes,
LOCAL(void)
-compute_color (j_decompress_ptr cinfo, boxptr boxp, int icolor)
+compute_color(j_decompress_ptr cinfo, boxptr boxp, int icolor)
/* Compute representative color for a box, put it in colormap[icolor] */
{
/* Current algorithm: mean weighted by pixels (not colors) */
/* Note it is important to get the rounding correct! */
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+ my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
hist3d histogram = cquantize->histogram;
histptr histp;
- int c0,c1,c2;
- int c0min,c0max,c1min,c1max,c2min,c2max;
+ int c0, c1, c2;
+ int c0min, c0max, c1min, c1max, c2min, c2max;
long count;
long total = 0;
long c0total = 0;
@@ -498,25 +497,25 @@ compute_color (j_decompress_ptr cinfo, boxptr boxp, int icolor)
for (c0 = c0min; c0 <= c0max; c0++)
for (c1 = c1min; c1 <= c1max; c1++) {
- histp = & histogram[c0][c1][c2min];
+ histp = &histogram[c0][c1][c2min];
for (c2 = c2min; c2 <= c2max; c2++) {
if ((count = *histp++) != 0) {
total += count;
- c0total += ((c0 << C0_SHIFT) + ((1<<C0_SHIFT)>>1)) * count;
- c1total += ((c1 << C1_SHIFT) + ((1<<C1_SHIFT)>>1)) * count;
- c2total += ((c2 << C2_SHIFT) + ((1<<C2_SHIFT)>>1)) * count;
+ c0total += ((c0 << C0_SHIFT) + ((1 << C0_SHIFT) >> 1)) * count;
+ c1total += ((c1 << C1_SHIFT) + ((1 << C1_SHIFT) >> 1)) * count;
+ c2total += ((c2 << C2_SHIFT) + ((1 << C2_SHIFT) >> 1)) * count;
}
}
}
- cinfo->colormap[0][icolor] = (JSAMPLE) ((c0total + (total>>1)) / total);
- cinfo->colormap[1][icolor] = (JSAMPLE) ((c1total + (total>>1)) / total);
- cinfo->colormap[2][icolor] = (JSAMPLE) ((c2total + (total>>1)) / total);
+ cinfo->colormap[0][icolor] = (JSAMPLE)((c0total + (total >> 1)) / total);
+ cinfo->colormap[1][icolor] = (JSAMPLE)((c1total + (total >> 1)) / total);
+ cinfo->colormap[2][icolor] = (JSAMPLE)((c2total + (total >> 1)) / total);
}
LOCAL(void)
-select_colors (j_decompress_ptr cinfo, int desired_colors)
+select_colors(j_decompress_ptr cinfo, int desired_colors)
/* Master routine for color selection */
{
boxptr boxlist;
@@ -524,8 +523,8 @@ select_colors (j_decompress_ptr cinfo, int desired_colors)
int i;
/* Allocate workspace for box list */
- boxlist = (boxptr) (*cinfo->mem->alloc_small)
- ((j_common_ptr) cinfo, JPOOL_IMAGE, desired_colors * sizeof(box));
+ boxlist = (boxptr)(*cinfo->mem->alloc_small)
+ ((j_common_ptr)cinfo, JPOOL_IMAGE, desired_colors * sizeof(box));
/* Initialize one box containing whole space */
numboxes = 1;
boxlist[0].c0min = 0;
@@ -535,12 +534,12 @@ select_colors (j_decompress_ptr cinfo, int desired_colors)
boxlist[0].c2min = 0;
boxlist[0].c2max = MAXJSAMPLE >> C2_SHIFT;
/* Shrink it to actually-used volume and set its statistics */
- update_box(cinfo, & boxlist[0]);
+ update_box(cinfo, &boxlist[0]);
/* Perform median-cut to produce final box list */
numboxes = median_cut(cinfo, boxlist, numboxes, desired_colors);
/* Compute the representative color for each box, fill colormap */
for (i = 0; i < numboxes; i++)
- compute_color(cinfo, & boxlist[i], i);
+ compute_color(cinfo, &boxlist[i], i);
cinfo->actual_number_of_colors = numboxes;
TRACEMS1(cinfo, 1, JTRC_QUANT_SELECTED, numboxes);
}
@@ -601,13 +600,13 @@ select_colors (j_decompress_ptr cinfo, int desired_colors)
/* log2(histogram cells in update box) for each axis; this can be adjusted */
-#define BOX_C0_LOG (HIST_C0_BITS-3)
-#define BOX_C1_LOG (HIST_C1_BITS-3)
-#define BOX_C2_LOG (HIST_C2_BITS-3)
+#define BOX_C0_LOG (HIST_C0_BITS - 3)
+#define BOX_C1_LOG (HIST_C1_BITS - 3)
+#define BOX_C2_LOG (HIST_C2_BITS - 3)
-#define BOX_C0_ELEMS (1<<BOX_C0_LOG) /* # of hist cells in update box */
-#define BOX_C1_ELEMS (1<<BOX_C1_LOG)
-#define BOX_C2_ELEMS (1<<BOX_C2_LOG)
+#define BOX_C0_ELEMS (1 << BOX_C0_LOG) /* # of hist cells in update box */
+#define BOX_C1_ELEMS (1 << BOX_C1_LOG)
+#define BOX_C2_ELEMS (1 << BOX_C2_LOG)
#define BOX_C0_SHIFT (C0_SHIFT + BOX_C0_LOG)
#define BOX_C1_SHIFT (C1_SHIFT + BOX_C1_LOG)
@@ -623,8 +622,8 @@ select_colors (j_decompress_ptr cinfo, int desired_colors)
*/
LOCAL(int)
-find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
- JSAMPLE colorlist[])
+find_nearby_colors(j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
+ JSAMPLE colorlist[])
/* Locate the colormap entries close enough to an update box to be candidates
* for the nearest entry to some cell(s) in the update box. The update box
* is specified by the center coordinates of its first cell. The number of
@@ -669,67 +668,67 @@ find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
x = GETJSAMPLE(cinfo->colormap[0][i]);
if (x < minc0) {
tdist = (x - minc0) * C0_SCALE;
- min_dist = tdist*tdist;
+ min_dist = tdist * tdist;
tdist = (x - maxc0) * C0_SCALE;
- max_dist = tdist*tdist;
+ max_dist = tdist * tdist;
} else if (x > maxc0) {
tdist = (x - maxc0) * C0_SCALE;
- min_dist = tdist*tdist;
+ min_dist = tdist * tdist;
tdist = (x - minc0) * C0_SCALE;
- max_dist = tdist*tdist;
+ max_dist = tdist * tdist;
} else {
/* within cell range so no contribution to min_dist */
min_dist = 0;
if (x <= centerc0) {
tdist = (x - maxc0) * C0_SCALE;
- max_dist = tdist*tdist;
+ max_dist = tdist * tdist;
} else {
tdist = (x - minc0) * C0_SCALE;
- max_dist = tdist*tdist;
+ max_dist = tdist * tdist;
}
}
x = GETJSAMPLE(cinfo->colormap[1][i]);
if (x < minc1) {
tdist = (x - minc1) * C1_SCALE;
- min_dist += tdist*tdist;
+ min_dist += tdist * tdist;
tdist = (x - maxc1) * C1_SCALE;
- max_dist += tdist*tdist;
+ max_dist += tdist * tdist;
} else if (x > maxc1) {
tdist = (x - maxc1) * C1_SCALE;
- min_dist += tdist*tdist;
+ min_dist += tdist * tdist;
tdist = (x - minc1) * C1_SCALE;
- max_dist += tdist*tdist;
+ max_dist += tdist * tdist;
} else {
/* within cell range so no contribution to min_dist */
if (x <= centerc1) {
tdist = (x - maxc1) * C1_SCALE;
- max_dist += tdist*tdist;
+ max_dist += tdist * tdist;
} else {
tdist = (x - minc1) * C1_SCALE;
- max_dist += tdist*tdist;
+ max_dist += tdist * tdist;
}
}
x = GETJSAMPLE(cinfo->colormap[2][i]);
if (x < minc2) {
tdist = (x - minc2) * C2_SCALE;
- min_dist += tdist*tdist;
+ min_dist += tdist * tdist;
tdist = (x - maxc2) * C2_SCALE;
- max_dist += tdist*tdist;
+ max_dist += tdist * tdist;
} else if (x > maxc2) {
tdist = (x - maxc2) * C2_SCALE;
- min_dist += tdist*tdist;
+ min_dist += tdist * tdist;
tdist = (x - minc2) * C2_SCALE;
- max_dist += tdist*tdist;
+ max_dist += tdist * tdist;
} else {
/* within cell range so no contribution to min_dist */
if (x <= centerc2) {
tdist = (x - maxc2) * C2_SCALE;
- max_dist += tdist*tdist;
+ max_dist += tdist * tdist;
} else {
tdist = (x - minc2) * C2_SCALE;
- max_dist += tdist*tdist;
+ max_dist += tdist * tdist;
}
}
@@ -745,15 +744,15 @@ find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
ncolors = 0;
for (i = 0; i < numcolors; i++) {
if (mindist[i] <= minmaxdist)
- colorlist[ncolors++] = (JSAMPLE) i;
+ colorlist[ncolors++] = (JSAMPLE)i;
}
return ncolors;
}
LOCAL(void)
-find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
- int numcolors, JSAMPLE colorlist[], JSAMPLE bestcolor[])
+find_best_colors(j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
+ int numcolors, JSAMPLE colorlist[], JSAMPLE bestcolor[])
/* Find the closest colormap entry for each cell in the update box,
* given the list of candidate colors prepared by find_nearby_colors.
* Return the indexes of the closest entries in the bestcolor[] array.
@@ -775,7 +774,7 @@ find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
/* Initialize best-distance for each cell of the update box */
bptr = bestdist;
- for (i = BOX_C0_ELEMS*BOX_C1_ELEMS*BOX_C2_ELEMS-1; i >= 0; i--)
+ for (i = BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS - 1; i >= 0; i--)
*bptr++ = 0x7FFFFFFFL;
/* For each color selected by find_nearby_colors,
@@ -792,11 +791,11 @@ find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
icolor = GETJSAMPLE(colorlist[i]);
/* Compute (square of) distance from minc0/c1/c2 to this color */
inc0 = (minc0 - GETJSAMPLE(cinfo->colormap[0][icolor])) * C0_SCALE;
- dist0 = inc0*inc0;
+ dist0 = inc0 * inc0;
inc1 = (minc1 - GETJSAMPLE(cinfo->colormap[1][icolor])) * C1_SCALE;
- dist0 += inc1*inc1;
+ dist0 += inc1 * inc1;
inc2 = (minc2 - GETJSAMPLE(cinfo->colormap[2][icolor])) * C2_SCALE;
- dist0 += inc2*inc2;
+ dist0 += inc2 * inc2;
/* Form the initial difference increments */
inc0 = inc0 * (2 * STEP_C0) + STEP_C0 * STEP_C0;
inc1 = inc1 * (2 * STEP_C1) + STEP_C1 * STEP_C1;
@@ -805,16 +804,16 @@ find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
bptr = bestdist;
cptr = bestcolor;
xx0 = inc0;
- for (ic0 = BOX_C0_ELEMS-1; ic0 >= 0; ic0--) {
+ for (ic0 = BOX_C0_ELEMS - 1; ic0 >= 0; ic0--) {
dist1 = dist0;
xx1 = inc1;
- for (ic1 = BOX_C1_ELEMS-1; ic1 >= 0; ic1--) {
+ for (ic1 = BOX_C1_ELEMS - 1; ic1 >= 0; ic1--) {
dist2 = dist1;
xx2 = inc2;
- for (ic2 = BOX_C2_ELEMS-1; ic2 >= 0; ic2--) {
+ for (ic2 = BOX_C2_ELEMS - 1; ic2 >= 0; ic2--) {
if (dist2 < *bptr) {
*bptr = dist2;
- *cptr = (JSAMPLE) icolor;
+ *cptr = (JSAMPLE)icolor;
}
dist2 += xx2;
xx2 += 2 * STEP_C2 * STEP_C2;
@@ -832,12 +831,12 @@ find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
LOCAL(void)
-fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2)
+fill_inverse_cmap(j_decompress_ptr cinfo, int c0, int c1, int c2)
/* Fill the inverse-colormap entries in the update box that contains */
/* histogram cell c0/c1/c2. (Only that one cell MUST be filled, but */
/* we can fill as many others as we wish.) */
{
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+ my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
hist3d histogram = cquantize->histogram;
int minc0, minc1, minc2; /* lower left corner of update box */
int ic0, ic1, ic2;
@@ -878,9 +877,9 @@ fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2)
cptr = bestcolor;
for (ic0 = 0; ic0 < BOX_C0_ELEMS; ic0++) {
for (ic1 = 0; ic1 < BOX_C1_ELEMS; ic1++) {
- cachep = & histogram[c0+ic0][c1+ic1][c2];
+ cachep = &histogram[c0 + ic0][c1 + ic1][c2];
for (ic2 = 0; ic2 < BOX_C2_ELEMS; ic2++) {
- *cachep++ = (histcell) (GETJSAMPLE(*cptr++) + 1);
+ *cachep++ = (histcell)(GETJSAMPLE(*cptr++) + 1);
}
}
}
@@ -892,11 +891,11 @@ fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2)
*/
METHODDEF(void)
-pass2_no_dither (j_decompress_ptr cinfo,
- JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows)
+pass2_no_dither(j_decompress_ptr cinfo, JSAMPARRAY input_buf,
+ JSAMPARRAY output_buf, int num_rows)
/* This version performs no dithering */
{
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+ my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
hist3d histogram = cquantize->histogram;
register JSAMPROW inptr, outptr;
register histptr cachep;
@@ -913,24 +912,24 @@ pass2_no_dither (j_decompress_ptr cinfo,
c0 = GETJSAMPLE(*inptr++) >> C0_SHIFT;
c1 = GETJSAMPLE(*inptr++) >> C1_SHIFT;
c2 = GETJSAMPLE(*inptr++) >> C2_SHIFT;
- cachep = & histogram[c0][c1][c2];
+ cachep = &histogram[c0][c1][c2];
/* If we have not seen this color before, find nearest colormap entry */
/* and update the cache */
if (*cachep == 0)
- fill_inverse_cmap(cinfo, c0,c1,c2);
+ fill_inverse_cmap(cinfo, c0, c1, c2);
/* Now emit the colormap index for this cell */
- *outptr++ = (JSAMPLE) (*cachep - 1);
+ *outptr++ = (JSAMPLE)(*cachep - 1);
}
}
}
METHODDEF(void)
-pass2_fs_dither (j_decompress_ptr cinfo,
- JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows)
+pass2_fs_dither(j_decompress_ptr cinfo, JSAMPARRAY input_buf,
+ JSAMPARRAY output_buf, int num_rows)
/* This version performs Floyd-Steinberg dithering */
{
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+ my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
hist3d histogram = cquantize->histogram;
register LOCFSERROR cur0, cur1, cur2; /* current error or pixel value */
LOCFSERROR belowerr0, belowerr1, belowerr2; /* error for pixel below cur */
@@ -956,11 +955,11 @@ pass2_fs_dither (j_decompress_ptr cinfo,
outptr = output_buf[row];
if (cquantize->on_odd_row) {
/* work right to left in this row */
- inptr += (width-1) * 3; /* so point to rightmost pixel */
- outptr += width-1;
+ inptr += (width - 1) * 3; /* so point to rightmost pixel */
+ outptr += width - 1;
dir = -1;
dir3 = -3;
- errorptr = cquantize->fserrors + (width+1)*3; /* => entry after last column */
+ errorptr = cquantize->fserrors + (width + 1) * 3; /* => entry after last column */
cquantize->on_odd_row = FALSE; /* flip for next time */
} else {
/* work left to right in this row */
@@ -984,9 +983,9 @@ pass2_fs_dither (j_decompress_ptr cinfo,
* for either sign of the error value.
* Note: errorptr points to *previous* column's array entry.
*/
- cur0 = RIGHT_SHIFT(cur0 + errorptr[dir3+0] + 8, 4);
- cur1 = RIGHT_SHIFT(cur1 + errorptr[dir3+1] + 8, 4);
- cur2 = RIGHT_SHIFT(cur2 + errorptr[dir3+2] + 8, 4);
+ cur0 = RIGHT_SHIFT(cur0 + errorptr[dir3 + 0] + 8, 4);
+ cur1 = RIGHT_SHIFT(cur1 + errorptr[dir3 + 1] + 8, 4);
+ cur2 = RIGHT_SHIFT(cur2 + errorptr[dir3 + 2] + 8, 4);
/* Limit the error using transfer function set by init_error_limit.
* See comments with init_error_limit for rationale.
*/
@@ -1004,14 +1003,17 @@ pass2_fs_dither (j_decompress_ptr cinfo,
cur1 = GETJSAMPLE(range_limit[cur1]);
cur2 = GETJSAMPLE(range_limit[cur2]);
/* Index into the cache with adjusted pixel value */
- cachep = & histogram[cur0>>C0_SHIFT][cur1>>C1_SHIFT][cur2>>C2_SHIFT];
+ cachep =
+ &histogram[cur0 >> C0_SHIFT][cur1 >> C1_SHIFT][cur2 >> C2_SHIFT];
/* If we have not seen this color before, find nearest colormap */
/* entry and update the cache */
if (*cachep == 0)
- fill_inverse_cmap(cinfo, cur0>>C0_SHIFT,cur1>>C1_SHIFT,cur2>>C2_SHIFT);
+ fill_inverse_cmap(cinfo, cur0 >> C0_SHIFT, cur1 >> C1_SHIFT,
+ cur2 >> C2_SHIFT);
/* Now emit the colormap index for this cell */
- { register int pixcode = *cachep - 1;
- *outptr = (JSAMPLE) pixcode;
+ {
+ register int pixcode = *cachep - 1;
+ *outptr = (JSAMPLE)pixcode;
/* Compute representation error for this pixel */
cur0 -= GETJSAMPLE(colormap0[pixcode]);
cur1 -= GETJSAMPLE(colormap1[pixcode]);
@@ -1021,20 +1023,21 @@ pass2_fs_dither (j_decompress_ptr cinfo,
* Add these into the running sums, and simultaneously shift the
* next-line error sums left by 1 column.
*/
- { register LOCFSERROR bnexterr;
+ {
+ register LOCFSERROR bnexterr;
bnexterr = cur0; /* Process component 0 */
- errorptr[0] = (FSERROR) (bpreverr0 + cur0 * 3);
+ errorptr[0] = (FSERROR)(bpreverr0 + cur0 * 3);
bpreverr0 = belowerr0 + cur0 * 5;
belowerr0 = bnexterr;
cur0 *= 7;
bnexterr = cur1; /* Process component 1 */
- errorptr[1] = (FSERROR) (bpreverr1 + cur1 * 3);
+ errorptr[1] = (FSERROR)(bpreverr1 + cur1 * 3);
bpreverr1 = belowerr1 + cur1 * 5;
belowerr1 = bnexterr;
cur1 *= 7;
bnexterr = cur2; /* Process component 2 */
- errorptr[2] = (FSERROR) (bpreverr2 + cur2 * 3);
+ errorptr[2] = (FSERROR)(bpreverr2 + cur2 * 3);
bpreverr2 = belowerr2 + cur2 * 5;
belowerr2 = bnexterr;
cur2 *= 7;
@@ -1051,9 +1054,9 @@ pass2_fs_dither (j_decompress_ptr cinfo,
* final fserrors[] entry. Note we need not unload belowerrN because
* it is for the dummy column before or after the actual array.
*/
- errorptr[0] = (FSERROR) bpreverr0; /* unload prev errs into array */
- errorptr[1] = (FSERROR) bpreverr1;
- errorptr[2] = (FSERROR) bpreverr2;
+ errorptr[0] = (FSERROR)bpreverr0; /* unload prev errs into array */
+ errorptr[1] = (FSERROR)bpreverr1;
+ errorptr[2] = (FSERROR)bpreverr2;
}
}
@@ -1076,31 +1079,31 @@ pass2_fs_dither (j_decompress_ptr cinfo,
*/
LOCAL(void)
-init_error_limit (j_decompress_ptr cinfo)
+init_error_limit(j_decompress_ptr cinfo)
/* Allocate and fill in the error_limiter table */
{
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+ my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
int *table;
int in, out;
- table = (int *) (*cinfo->mem->alloc_small)
- ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE*2+1) * sizeof(int));
+ table = (int *)(*cinfo->mem->alloc_small)
+ ((j_common_ptr)cinfo, JPOOL_IMAGE, (MAXJSAMPLE * 2 + 1) * sizeof(int));
table += MAXJSAMPLE; /* so can index -MAXJSAMPLE .. +MAXJSAMPLE */
cquantize->error_limiter = table;
-#define STEPSIZE ((MAXJSAMPLE+1)/16)
+#define STEPSIZE ((MAXJSAMPLE + 1) / 16)
/* Map errors 1:1 up to +- MAXJSAMPLE/16 */
out = 0;
for (in = 0; in < STEPSIZE; in++, out++) {
- table[in] = out; table[-in] = -out;
+ table[in] = out; table[-in] = -out;
}
/* Map errors 1:2 up to +- 3*MAXJSAMPLE/16 */
- for (; in < STEPSIZE*3; in++, out += (in&1) ? 0 : 1) {
- table[in] = out; table[-in] = -out;
+ for (; in < STEPSIZE * 3; in++, out += (in & 1) ? 0 : 1) {
+ table[in] = out; table[-in] = -out;
}
/* Clamp the rest to final out value (which is (MAXJSAMPLE+1)/8) */
for (; in <= MAXJSAMPLE; in++) {
- table[in] = out; table[-in] = -out;
+ table[in] = out; table[-in] = -out;
}
#undef STEPSIZE
}
@@ -1111,9 +1114,9 @@ init_error_limit (j_decompress_ptr cinfo)
*/
METHODDEF(void)
-finish_pass1 (j_decompress_ptr cinfo)
+finish_pass1(j_decompress_ptr cinfo)
{
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+ my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
/* Select the representative colors and fill in cinfo->colormap */
cinfo->colormap = cquantize->sv_colormap;
@@ -1124,7 +1127,7 @@ finish_pass1 (j_decompress_ptr cinfo)
METHODDEF(void)
-finish_pass2 (j_decompress_ptr cinfo)
+finish_pass2(j_decompress_ptr cinfo)
{
/* no work */
}
@@ -1135,9 +1138,9 @@ finish_pass2 (j_decompress_ptr cinfo)
*/
METHODDEF(void)
-start_pass_2_quant (j_decompress_ptr cinfo, boolean is_pre_scan)
+start_pass_2_quant(j_decompress_ptr cinfo, boolean is_pre_scan)
{
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+ my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
hist3d histogram = cquantize->histogram;
int i;
@@ -1167,14 +1170,14 @@ start_pass_2_quant (j_decompress_ptr cinfo, boolean is_pre_scan)
ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXNUMCOLORS);
if (cinfo->dither_mode == JDITHER_FS) {
- size_t arraysize = (size_t) ((cinfo->output_width + 2) *
- (3 * sizeof(FSERROR)));
+ size_t arraysize =
+ (size_t)((cinfo->output_width + 2) * (3 * sizeof(FSERROR)));
/* Allocate Floyd-Steinberg workspace if we didn't already. */
if (cquantize->fserrors == NULL)
- cquantize->fserrors = (FSERRPTR) (*cinfo->mem->alloc_large)
- ((j_common_ptr) cinfo, JPOOL_IMAGE, arraysize);
+ cquantize->fserrors = (FSERRPTR)(*cinfo->mem->alloc_large)
+ ((j_common_ptr)cinfo, JPOOL_IMAGE, arraysize);
/* Initialize the propagated errors to zero. */
- jzero_far((void *) cquantize->fserrors, arraysize);
+ jzero_far((void *)cquantize->fserrors, arraysize);
/* Make the error-limit table if we didn't already. */
if (cquantize->error_limiter == NULL)
init_error_limit(cinfo);
@@ -1185,8 +1188,8 @@ start_pass_2_quant (j_decompress_ptr cinfo, boolean is_pre_scan)
/* Zero the histogram or inverse color map, if necessary */
if (cquantize->needs_zeroed) {
for (i = 0; i < HIST_C0_ELEMS; i++) {
- jzero_far((void *) histogram[i],
- HIST_C1_ELEMS*HIST_C2_ELEMS * sizeof(histcell));
+ jzero_far((void *)histogram[i],
+ HIST_C1_ELEMS * HIST_C2_ELEMS * sizeof(histcell));
}
cquantize->needs_zeroed = FALSE;
}
@@ -1198,9 +1201,9 @@ start_pass_2_quant (j_decompress_ptr cinfo, boolean is_pre_scan)
*/
METHODDEF(void)
-new_color_map_2_quant (j_decompress_ptr cinfo)
+new_color_map_2_quant(j_decompress_ptr cinfo)
{
- my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
+ my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
/* Reset the inverse color map */
cquantize->needs_zeroed = TRUE;
@@ -1212,15 +1215,15 @@ new_color_map_2_quant (j_decompress_ptr cinfo)
*/
GLOBAL(void)
-jinit_2pass_quantizer (j_decompress_ptr cinfo)
+jinit_2pass_quantizer(j_decompress_ptr cinfo)
{
my_cquantize_ptr cquantize;
int i;
cquantize = (my_cquantize_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(my_cquantizer));
- cinfo->cquantize = (struct jpeg_color_quantizer *) cquantize;
+ cinfo->cquantize = (struct jpeg_color_quantizer *)cquantize;
cquantize->pub.start_pass = start_pass_2_quant;
cquantize->pub.new_color_map = new_color_map_2_quant;
cquantize->fserrors = NULL; /* flag optional arrays not allocated */
@@ -1231,12 +1234,12 @@ jinit_2pass_quantizer (j_decompress_ptr cinfo)
ERREXIT(cinfo, JERR_NOTIMPL);
/* Allocate the histogram/inverse colormap storage */
- cquantize->histogram = (hist3d) (*cinfo->mem->alloc_small)
- ((j_common_ptr) cinfo, JPOOL_IMAGE, HIST_C0_ELEMS * sizeof(hist2d));
+ cquantize->histogram = (hist3d)(*cinfo->mem->alloc_small)
+ ((j_common_ptr)cinfo, JPOOL_IMAGE, HIST_C0_ELEMS * sizeof(hist2d));
for (i = 0; i < HIST_C0_ELEMS; i++) {
- cquantize->histogram[i] = (hist2d) (*cinfo->mem->alloc_large)
- ((j_common_ptr) cinfo, JPOOL_IMAGE,
- HIST_C1_ELEMS*HIST_C2_ELEMS * sizeof(histcell));
+ cquantize->histogram[i] = (hist2d)(*cinfo->mem->alloc_large)
+ ((j_common_ptr)cinfo, JPOOL_IMAGE,
+ HIST_C1_ELEMS * HIST_C2_ELEMS * sizeof(histcell));
}
cquantize->needs_zeroed = TRUE; /* histogram is garbage now */
@@ -1254,7 +1257,7 @@ jinit_2pass_quantizer (j_decompress_ptr cinfo)
if (desired > MAXNUMCOLORS)
ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXNUMCOLORS);
cquantize->sv_colormap = (*cinfo->mem->alloc_sarray)
- ((j_common_ptr) cinfo,JPOOL_IMAGE, (JDIMENSION) desired, (JDIMENSION) 3);
+ ((j_common_ptr)cinfo, JPOOL_IMAGE, (JDIMENSION)desired, (JDIMENSION)3);
cquantize->desired = desired;
} else
cquantize->sv_colormap = NULL;
@@ -1271,9 +1274,9 @@ jinit_2pass_quantizer (j_decompress_ptr cinfo)
* dither_mode changes.
*/
if (cinfo->dither_mode == JDITHER_FS) {
- cquantize->fserrors = (FSERRPTR) (*cinfo->mem->alloc_large)
- ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (size_t) ((cinfo->output_width + 2) * (3 * sizeof(FSERROR))));
+ cquantize->fserrors = (FSERRPTR)(*cinfo->mem->alloc_large)
+ ((j_common_ptr)cinfo, JPOOL_IMAGE,
+ (size_t)((cinfo->output_width + 2) * (3 * sizeof(FSERROR))));
/* Might as well create the error-limiting table too. */
init_error_limit(cinfo);
}
diff --git a/src/3rdparty/libjpeg/src/jsimd.h b/src/3rdparty/libjpeg/src/jsimd.h
index 3aa0779b8a..51e2b8c89d 100644
--- a/src/3rdparty/libjpeg/src/jsimd.h
+++ b/src/3rdparty/libjpeg/src/jsimd.h
@@ -3,7 +3,7 @@
*
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
* Copyright (C) 2011, 2014, D. R. Commander.
- * Copyright (C) 2015, Matthieu Darbois.
+ * Copyright (C) 2015-2016, 2018, Matthieu Darbois.
*
* Based on the x86 SIMD extension for IJG JPEG library,
* Copyright (C) 1999-2006, MIYASAKA Masaru.
@@ -13,81 +13,105 @@
#include "jchuff.h" /* Declarations shared with jcphuff.c */
-EXTERN(int) jsimd_can_rgb_ycc (void);
-EXTERN(int) jsimd_can_rgb_gray (void);
-EXTERN(int) jsimd_can_ycc_rgb (void);
-EXTERN(int) jsimd_can_ycc_rgb565 (void);
-EXTERN(int) jsimd_c_can_null_convert (void);
-
-EXTERN(void) jsimd_rgb_ycc_convert
- (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
- JDIMENSION output_row, int num_rows);
-EXTERN(void) jsimd_rgb_gray_convert
- (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
- JDIMENSION output_row, int num_rows);
-EXTERN(void) jsimd_ycc_rgb_convert
- (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows);
-EXTERN(void) jsimd_ycc_rgb565_convert
- (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows);
-EXTERN(void) jsimd_c_null_convert
- (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
- JDIMENSION output_row, int num_rows);
-
-EXTERN(int) jsimd_can_h2v2_downsample (void);
-EXTERN(int) jsimd_can_h2v1_downsample (void);
-
-EXTERN(void) jsimd_h2v2_downsample
- (j_compress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY output_data);
-
-EXTERN(int) jsimd_can_h2v2_smooth_downsample (void);
-
-EXTERN(void) jsimd_h2v2_smooth_downsample
- (j_compress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY output_data);
-
-EXTERN(void) jsimd_h2v1_downsample
- (j_compress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY output_data);
-
-EXTERN(int) jsimd_can_h2v2_upsample (void);
-EXTERN(int) jsimd_can_h2v1_upsample (void);
-EXTERN(int) jsimd_can_int_upsample (void);
-
-EXTERN(void) jsimd_h2v2_upsample
- (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr);
-EXTERN(void) jsimd_h2v1_upsample
- (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr);
-EXTERN(void) jsimd_int_upsample
- (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr);
-
-EXTERN(int) jsimd_can_h2v2_fancy_upsample (void);
-EXTERN(int) jsimd_can_h2v1_fancy_upsample (void);
-
-EXTERN(void) jsimd_h2v2_fancy_upsample
- (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr);
-EXTERN(void) jsimd_h2v1_fancy_upsample
- (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr);
-
-EXTERN(int) jsimd_can_h2v2_merged_upsample (void);
-EXTERN(int) jsimd_can_h2v1_merged_upsample (void);
-
-EXTERN(void) jsimd_h2v2_merged_upsample
- (j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
- JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf);
-EXTERN(void) jsimd_h2v1_merged_upsample
- (j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
- JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf);
-
-EXTERN(int) jsimd_can_huff_encode_one_block (void);
-
-EXTERN(JOCTET*) jsimd_huff_encode_one_block
- (void *state, JOCTET *buffer, JCOEFPTR block, int last_dc_val,
- c_derived_tbl *dctbl, c_derived_tbl *actbl);
+EXTERN(int) jsimd_can_rgb_ycc(void);
+EXTERN(int) jsimd_can_rgb_gray(void);
+EXTERN(int) jsimd_can_ycc_rgb(void);
+EXTERN(int) jsimd_can_ycc_rgb565(void);
+EXTERN(int) jsimd_c_can_null_convert(void);
+
+EXTERN(void) jsimd_rgb_ycc_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
+ JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows);
+EXTERN(void) jsimd_rgb_gray_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
+ JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows);
+EXTERN(void) jsimd_ycc_rgb_convert(j_decompress_ptr cinfo,
+ JSAMPIMAGE input_buf, JDIMENSION input_row,
+ JSAMPARRAY output_buf, int num_rows);
+EXTERN(void) jsimd_ycc_rgb565_convert(j_decompress_ptr cinfo,
+ JSAMPIMAGE input_buf,
+ JDIMENSION input_row,
+ JSAMPARRAY output_buf, int num_rows);
+EXTERN(void) jsimd_c_null_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
+ JSAMPIMAGE output_buf, JDIMENSION output_row,
+ int num_rows);
+
+EXTERN(int) jsimd_can_h2v2_downsample(void);
+EXTERN(int) jsimd_can_h2v1_downsample(void);
+
+EXTERN(void) jsimd_h2v2_downsample(j_compress_ptr cinfo,
+ jpeg_component_info *compptr,
+ JSAMPARRAY input_data,
+ JSAMPARRAY output_data);
+
+EXTERN(int) jsimd_can_h2v2_smooth_downsample(void);
+
+EXTERN(void) jsimd_h2v2_smooth_downsample(j_compress_ptr cinfo,
+ jpeg_component_info *compptr,
+ JSAMPARRAY input_data,
+ JSAMPARRAY output_data);
+
+EXTERN(void) jsimd_h2v1_downsample(j_compress_ptr cinfo,
+ jpeg_component_info *compptr,
+ JSAMPARRAY input_data,
+ JSAMPARRAY output_data);
+
+EXTERN(int) jsimd_can_h2v2_upsample(void);
+EXTERN(int) jsimd_can_h2v1_upsample(void);
+EXTERN(int) jsimd_can_int_upsample(void);
+
+EXTERN(void) jsimd_h2v2_upsample(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr,
+ JSAMPARRAY input_data,
+ JSAMPARRAY *output_data_ptr);
+EXTERN(void) jsimd_h2v1_upsample(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr,
+ JSAMPARRAY input_data,
+ JSAMPARRAY *output_data_ptr);
+EXTERN(void) jsimd_int_upsample(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr,
+ JSAMPARRAY input_data,
+ JSAMPARRAY *output_data_ptr);
+
+EXTERN(int) jsimd_can_h2v2_fancy_upsample(void);
+EXTERN(int) jsimd_can_h2v1_fancy_upsample(void);
+
+EXTERN(void) jsimd_h2v2_fancy_upsample(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr,
+ JSAMPARRAY input_data,
+ JSAMPARRAY *output_data_ptr);
+EXTERN(void) jsimd_h2v1_fancy_upsample(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr,
+ JSAMPARRAY input_data,
+ JSAMPARRAY *output_data_ptr);
+
+EXTERN(int) jsimd_can_h2v2_merged_upsample(void);
+EXTERN(int) jsimd_can_h2v1_merged_upsample(void);
+
+EXTERN(void) jsimd_h2v2_merged_upsample(j_decompress_ptr cinfo,
+ JSAMPIMAGE input_buf,
+ JDIMENSION in_row_group_ctr,
+ JSAMPARRAY output_buf);
+EXTERN(void) jsimd_h2v1_merged_upsample(j_decompress_ptr cinfo,
+ JSAMPIMAGE input_buf,
+ JDIMENSION in_row_group_ctr,
+ JSAMPARRAY output_buf);
+
+EXTERN(int) jsimd_can_huff_encode_one_block(void);
+
+EXTERN(JOCTET *) jsimd_huff_encode_one_block(void *state, JOCTET *buffer,
+ JCOEFPTR block, int last_dc_val,
+ c_derived_tbl *dctbl,
+ c_derived_tbl *actbl);
+
+EXTERN(int) jsimd_can_encode_mcu_AC_first_prepare(void);
+
+EXTERN(void) jsimd_encode_mcu_AC_first_prepare
+ (const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al,
+ JCOEF *values, size_t *zerobits);
+
+EXTERN(int) jsimd_can_encode_mcu_AC_refine_prepare(void);
+
+EXTERN(int) jsimd_encode_mcu_AC_refine_prepare
+ (const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al,
+ JCOEF *absvalues, size_t *bits);
diff --git a/src/3rdparty/libjpeg/src/jsimd_none.c b/src/3rdparty/libjpeg/src/jsimd_none.c
index f29030cfa7..3cb6c80f8a 100644
--- a/src/3rdparty/libjpeg/src/jsimd_none.c
+++ b/src/3rdparty/libjpeg/src/jsimd_none.c
@@ -3,7 +3,7 @@
*
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
* Copyright (C) 2009-2011, 2014, D. R. Commander.
- * Copyright (C) 2015, Matthieu Darbois.
+ * Copyright (C) 2015-2016, 2018, Matthieu Darbois.
*
* Based on the x86 SIMD extension for IJG JPEG library,
* Copyright (C) 1999-2006, MIYASAKA Masaru.
@@ -20,385 +20,399 @@
#include "jsimddct.h"
GLOBAL(int)
-jsimd_can_rgb_ycc (void)
+jsimd_can_rgb_ycc(void)
{
return 0;
}
GLOBAL(int)
-jsimd_can_rgb_gray (void)
+jsimd_can_rgb_gray(void)
{
return 0;
}
GLOBAL(int)
-jsimd_can_ycc_rgb (void)
+jsimd_can_ycc_rgb(void)
{
return 0;
}
GLOBAL(int)
-jsimd_can_ycc_rgb565 (void)
+jsimd_can_ycc_rgb565(void)
{
return 0;
}
GLOBAL(int)
-jsimd_c_can_null_convert (void)
+jsimd_c_can_null_convert(void)
{
return 0;
}
GLOBAL(void)
-jsimd_rgb_ycc_convert (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
- JDIMENSION output_row, int num_rows)
+jsimd_rgb_ycc_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
+ JSAMPIMAGE output_buf, JDIMENSION output_row,
+ int num_rows)
{
}
GLOBAL(void)
-jsimd_rgb_gray_convert (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
- JDIMENSION output_row, int num_rows)
+jsimd_rgb_gray_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
+ JSAMPIMAGE output_buf, JDIMENSION output_row,
+ int num_rows)
{
}
GLOBAL(void)
-jsimd_ycc_rgb_convert (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
+jsimd_ycc_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION input_row, JSAMPARRAY output_buf,
+ int num_rows)
{
}
GLOBAL(void)
-jsimd_ycc_rgb565_convert (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
+jsimd_ycc_rgb565_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION input_row, JSAMPARRAY output_buf,
+ int num_rows)
{
}
GLOBAL(void)
-jsimd_c_null_convert (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
- JDIMENSION output_row, int num_rows)
+jsimd_c_null_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
+ JSAMPIMAGE output_buf, JDIMENSION output_row,
+ int num_rows)
{
}
GLOBAL(int)
-jsimd_can_h2v2_downsample (void)
+jsimd_can_h2v2_downsample(void)
{
return 0;
}
GLOBAL(int)
-jsimd_can_h2v1_downsample (void)
+jsimd_can_h2v1_downsample(void)
{
return 0;
}
GLOBAL(int)
-jsimd_can_h2v2_smooth_downsample (void)
+jsimd_can_h2v2_smooth_downsample(void)
{
return 0;
}
GLOBAL(void)
-jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY output_data)
+jsimd_h2v2_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
+ JSAMPARRAY input_data, JSAMPARRAY output_data)
{
}
GLOBAL(void)
-jsimd_h2v2_smooth_downsample (j_compress_ptr cinfo,
- jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY output_data)
+jsimd_h2v2_smooth_downsample(j_compress_ptr cinfo,
+ jpeg_component_info *compptr,
+ JSAMPARRAY input_data, JSAMPARRAY output_data)
{
}
GLOBAL(void)
-jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY output_data)
+jsimd_h2v1_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
+ JSAMPARRAY input_data, JSAMPARRAY output_data)
{
}
GLOBAL(int)
-jsimd_can_h2v2_upsample (void)
+jsimd_can_h2v2_upsample(void)
{
return 0;
}
GLOBAL(int)
-jsimd_can_h2v1_upsample (void)
+jsimd_can_h2v1_upsample(void)
{
return 0;
}
GLOBAL(int)
-jsimd_can_int_upsample (void)
+jsimd_can_int_upsample(void)
{
return 0;
}
GLOBAL(void)
-jsimd_int_upsample (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
+jsimd_int_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
{
}
GLOBAL(void)
-jsimd_h2v2_upsample (j_decompress_ptr cinfo,
- jpeg_component_info *compptr,
- JSAMPARRAY input_data,
- JSAMPARRAY *output_data_ptr)
+jsimd_h2v2_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
{
}
GLOBAL(void)
-jsimd_h2v1_upsample (j_decompress_ptr cinfo,
- jpeg_component_info *compptr,
- JSAMPARRAY input_data,
- JSAMPARRAY *output_data_ptr)
+jsimd_h2v1_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
{
}
GLOBAL(int)
-jsimd_can_h2v2_fancy_upsample (void)
+jsimd_can_h2v2_fancy_upsample(void)
{
return 0;
}
GLOBAL(int)
-jsimd_can_h2v1_fancy_upsample (void)
+jsimd_can_h2v1_fancy_upsample(void)
{
return 0;
}
GLOBAL(void)
-jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo,
- jpeg_component_info *compptr,
- JSAMPARRAY input_data,
- JSAMPARRAY *output_data_ptr)
+jsimd_h2v2_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
{
}
GLOBAL(void)
-jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo,
- jpeg_component_info *compptr,
- JSAMPARRAY input_data,
- JSAMPARRAY *output_data_ptr)
+jsimd_h2v1_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
{
}
GLOBAL(int)
-jsimd_can_h2v2_merged_upsample (void)
+jsimd_can_h2v2_merged_upsample(void)
{
return 0;
}
GLOBAL(int)
-jsimd_can_h2v1_merged_upsample (void)
+jsimd_can_h2v1_merged_upsample(void)
{
return 0;
}
GLOBAL(void)
-jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf,
- JDIMENSION in_row_group_ctr,
- JSAMPARRAY output_buf)
+jsimd_h2v2_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
{
}
GLOBAL(void)
-jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf,
- JDIMENSION in_row_group_ctr,
- JSAMPARRAY output_buf)
+jsimd_h2v1_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
+ JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
{
}
GLOBAL(int)
-jsimd_can_convsamp (void)
+jsimd_can_convsamp(void)
{
return 0;
}
GLOBAL(int)
-jsimd_can_convsamp_float (void)
+jsimd_can_convsamp_float(void)
{
return 0;
}
GLOBAL(void)
-jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col,
- DCTELEM *workspace)
+jsimd_convsamp(JSAMPARRAY sample_data, JDIMENSION start_col,
+ DCTELEM *workspace)
{
}
GLOBAL(void)
-jsimd_convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col,
- FAST_FLOAT *workspace)
+jsimd_convsamp_float(JSAMPARRAY sample_data, JDIMENSION start_col,
+ FAST_FLOAT *workspace)
{
}
GLOBAL(int)
-jsimd_can_fdct_islow (void)
+jsimd_can_fdct_islow(void)
{
return 0;
}
GLOBAL(int)
-jsimd_can_fdct_ifast (void)
+jsimd_can_fdct_ifast(void)
{
return 0;
}
GLOBAL(int)
-jsimd_can_fdct_float (void)
+jsimd_can_fdct_float(void)
{
return 0;
}
GLOBAL(void)
-jsimd_fdct_islow (DCTELEM *data)
+jsimd_fdct_islow(DCTELEM *data)
{
}
GLOBAL(void)
-jsimd_fdct_ifast (DCTELEM *data)
+jsimd_fdct_ifast(DCTELEM *data)
{
}
GLOBAL(void)
-jsimd_fdct_float (FAST_FLOAT *data)
+jsimd_fdct_float(FAST_FLOAT *data)
{
}
GLOBAL(int)
-jsimd_can_quantize (void)
+jsimd_can_quantize(void)
{
return 0;
}
GLOBAL(int)
-jsimd_can_quantize_float (void)
+jsimd_can_quantize_float(void)
{
return 0;
}
GLOBAL(void)
-jsimd_quantize (JCOEFPTR coef_block, DCTELEM *divisors,
- DCTELEM *workspace)
+jsimd_quantize(JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace)
{
}
GLOBAL(void)
-jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT *divisors,
- FAST_FLOAT *workspace)
+jsimd_quantize_float(JCOEFPTR coef_block, FAST_FLOAT *divisors,
+ FAST_FLOAT *workspace)
{
}
GLOBAL(int)
-jsimd_can_idct_2x2 (void)
+jsimd_can_idct_2x2(void)
{
return 0;
}
GLOBAL(int)
-jsimd_can_idct_4x4 (void)
+jsimd_can_idct_4x4(void)
{
return 0;
}
GLOBAL(int)
-jsimd_can_idct_6x6 (void)
+jsimd_can_idct_6x6(void)
{
return 0;
}
GLOBAL(int)
-jsimd_can_idct_12x12 (void)
+jsimd_can_idct_12x12(void)
{
return 0;
}
GLOBAL(void)
-jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf,
- JDIMENSION output_col)
+jsimd_idct_2x2(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
{
}
GLOBAL(void)
-jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf,
- JDIMENSION output_col)
+jsimd_idct_4x4(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
{
}
GLOBAL(void)
-jsimd_idct_6x6 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf,
- JDIMENSION output_col)
+jsimd_idct_6x6(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
{
}
GLOBAL(void)
-jsimd_idct_12x12 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf,
- JDIMENSION output_col)
+jsimd_idct_12x12(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
{
}
GLOBAL(int)
-jsimd_can_idct_islow (void)
+jsimd_can_idct_islow(void)
{
return 0;
}
GLOBAL(int)
-jsimd_can_idct_ifast (void)
+jsimd_can_idct_ifast(void)
{
return 0;
}
GLOBAL(int)
-jsimd_can_idct_float (void)
+jsimd_can_idct_float(void)
{
return 0;
}
GLOBAL(void)
-jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf,
- JDIMENSION output_col)
+jsimd_idct_islow(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
{
}
GLOBAL(void)
-jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf,
- JDIMENSION output_col)
+jsimd_idct_ifast(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
{
}
GLOBAL(void)
-jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf,
- JDIMENSION output_col)
+jsimd_idct_float(j_decompress_ptr cinfo, jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
{
}
GLOBAL(int)
-jsimd_can_huff_encode_one_block (void)
+jsimd_can_huff_encode_one_block(void)
{
return 0;
}
-GLOBAL(JOCTET*)
-jsimd_huff_encode_one_block (void *state, JOCTET *buffer, JCOEFPTR block,
- int last_dc_val, c_derived_tbl *dctbl,
- c_derived_tbl *actbl)
+GLOBAL(JOCTET *)
+jsimd_huff_encode_one_block(void *state, JOCTET *buffer, JCOEFPTR block,
+ int last_dc_val, c_derived_tbl *dctbl,
+ c_derived_tbl *actbl)
{
return NULL;
}
+
+GLOBAL(int)
+jsimd_can_encode_mcu_AC_first_prepare(void)
+{
+ return 0;
+}
+
+GLOBAL(void)
+jsimd_encode_mcu_AC_first_prepare(const JCOEF *block,
+ const int *jpeg_natural_order_start, int Sl,
+ int Al, JCOEF *values, size_t *zerobits)
+{
+}
+
+GLOBAL(int)
+jsimd_can_encode_mcu_AC_refine_prepare(void)
+{
+ return 0;
+}
+
+GLOBAL(int)
+jsimd_encode_mcu_AC_refine_prepare(const JCOEF *block,
+ const int *jpeg_natural_order_start, int Sl,
+ int Al, JCOEF *absvalues, size_t *bits)
+{
+ return 0;
+}
diff --git a/src/3rdparty/libjpeg/src/jsimddct.h b/src/3rdparty/libjpeg/src/jsimddct.h
index b19ab48d40..55ee8cf67f 100644
--- a/src/3rdparty/libjpeg/src/jsimddct.h
+++ b/src/3rdparty/libjpeg/src/jsimddct.h
@@ -9,66 +9,62 @@
*
*/
-EXTERN(int) jsimd_can_convsamp (void);
-EXTERN(int) jsimd_can_convsamp_float (void);
+EXTERN(int) jsimd_can_convsamp(void);
+EXTERN(int) jsimd_can_convsamp_float(void);
-EXTERN(void) jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col,
- DCTELEM *workspace);
-EXTERN(void) jsimd_convsamp_float (JSAMPARRAY sample_data,
- JDIMENSION start_col,
- FAST_FLOAT *workspace);
+EXTERN(void) jsimd_convsamp(JSAMPARRAY sample_data, JDIMENSION start_col,
+ DCTELEM *workspace);
+EXTERN(void) jsimd_convsamp_float(JSAMPARRAY sample_data, JDIMENSION start_col,
+ FAST_FLOAT *workspace);
-EXTERN(int) jsimd_can_fdct_islow (void);
-EXTERN(int) jsimd_can_fdct_ifast (void);
-EXTERN(int) jsimd_can_fdct_float (void);
+EXTERN(int) jsimd_can_fdct_islow(void);
+EXTERN(int) jsimd_can_fdct_ifast(void);
+EXTERN(int) jsimd_can_fdct_float(void);
-EXTERN(void) jsimd_fdct_islow (DCTELEM *data);
-EXTERN(void) jsimd_fdct_ifast (DCTELEM *data);
-EXTERN(void) jsimd_fdct_float (FAST_FLOAT *data);
+EXTERN(void) jsimd_fdct_islow(DCTELEM *data);
+EXTERN(void) jsimd_fdct_ifast(DCTELEM *data);
+EXTERN(void) jsimd_fdct_float(FAST_FLOAT *data);
-EXTERN(int) jsimd_can_quantize (void);
-EXTERN(int) jsimd_can_quantize_float (void);
+EXTERN(int) jsimd_can_quantize(void);
+EXTERN(int) jsimd_can_quantize_float(void);
-EXTERN(void) jsimd_quantize (JCOEFPTR coef_block, DCTELEM *divisors,
- DCTELEM *workspace);
-EXTERN(void) jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT *divisors,
- FAST_FLOAT *workspace);
+EXTERN(void) jsimd_quantize(JCOEFPTR coef_block, DCTELEM *divisors,
+ DCTELEM *workspace);
+EXTERN(void) jsimd_quantize_float(JCOEFPTR coef_block, FAST_FLOAT *divisors,
+ FAST_FLOAT *workspace);
-EXTERN(int) jsimd_can_idct_2x2 (void);
-EXTERN(int) jsimd_can_idct_4x4 (void);
-EXTERN(int) jsimd_can_idct_6x6 (void);
-EXTERN(int) jsimd_can_idct_12x12 (void);
+EXTERN(int) jsimd_can_idct_2x2(void);
+EXTERN(int) jsimd_can_idct_4x4(void);
+EXTERN(int) jsimd_can_idct_6x6(void);
+EXTERN(int) jsimd_can_idct_12x12(void);
-EXTERN(void) jsimd_idct_2x2 (j_decompress_ptr cinfo,
- jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf,
- JDIMENSION output_col);
-EXTERN(void) jsimd_idct_4x4 (j_decompress_ptr cinfo,
- jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf,
- JDIMENSION output_col);
-EXTERN(void) jsimd_idct_6x6 (j_decompress_ptr cinfo,
- jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf,
- JDIMENSION output_col);
-EXTERN(void) jsimd_idct_12x12 (j_decompress_ptr cinfo,
- jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf,
- JDIMENSION output_col);
+EXTERN(void) jsimd_idct_2x2(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr, JCOEFPTR coef_block,
+ JSAMPARRAY output_buf, JDIMENSION output_col);
+EXTERN(void) jsimd_idct_4x4(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr, JCOEFPTR coef_block,
+ JSAMPARRAY output_buf, JDIMENSION output_col);
+EXTERN(void) jsimd_idct_6x6(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr, JCOEFPTR coef_block,
+ JSAMPARRAY output_buf, JDIMENSION output_col);
+EXTERN(void) jsimd_idct_12x12(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col);
-EXTERN(int) jsimd_can_idct_islow (void);
-EXTERN(int) jsimd_can_idct_ifast (void);
-EXTERN(int) jsimd_can_idct_float (void);
+EXTERN(int) jsimd_can_idct_islow(void);
+EXTERN(int) jsimd_can_idct_ifast(void);
+EXTERN(int) jsimd_can_idct_float(void);
-EXTERN(void) jsimd_idct_islow (j_decompress_ptr cinfo,
- jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf,
- JDIMENSION output_col);
-EXTERN(void) jsimd_idct_ifast (j_decompress_ptr cinfo,
- jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf,
- JDIMENSION output_col);
-EXTERN(void) jsimd_idct_float (j_decompress_ptr cinfo,
- jpeg_component_info *compptr,
- JCOEFPTR coef_block, JSAMPARRAY output_buf,
- JDIMENSION output_col);
+EXTERN(void) jsimd_idct_islow(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col);
+EXTERN(void) jsimd_idct_ifast(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col);
+EXTERN(void) jsimd_idct_float(j_decompress_ptr cinfo,
+ jpeg_component_info *compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col);
diff --git a/src/3rdparty/libjpeg/src/jstdhuff.c b/src/3rdparty/libjpeg/src/jstdhuff.c
index e202e8e7ec..036d6495a5 100644
--- a/src/3rdparty/libjpeg/src/jstdhuff.c
+++ b/src/3rdparty/libjpeg/src/jstdhuff.c
@@ -17,8 +17,8 @@
*/
LOCAL(void)
-add_huff_table (j_common_ptr cinfo,
- JHUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val)
+add_huff_table(j_common_ptr cinfo, JHUFF_TBL **htblptr, const UINT8 *bits,
+ const UINT8 *val)
/* Define a Huffman table */
{
int nsymbols, len;
@@ -50,71 +50,79 @@ add_huff_table (j_common_ptr cinfo,
LOCAL(void)
-std_huff_tables (j_common_ptr cinfo)
+std_huff_tables(j_common_ptr cinfo)
/* Set up the standard Huffman tables (cf. JPEG standard section K.3) */
/* IMPORTANT: these are only valid for 8-bit data precision! */
{
JHUFF_TBL **dc_huff_tbl_ptrs, **ac_huff_tbl_ptrs;
- static const UINT8 bits_dc_luminance[17] =
- { /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 };
- static const UINT8 val_dc_luminance[] =
- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
+ static const UINT8 bits_dc_luminance[17] = {
+ /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0
+ };
+ static const UINT8 val_dc_luminance[] = {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
+ };
- static const UINT8 bits_dc_chrominance[17] =
- { /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 };
- static const UINT8 val_dc_chrominance[] =
- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
+ static const UINT8 bits_dc_chrominance[17] = {
+ /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0
+ };
+ static const UINT8 val_dc_chrominance[] = {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
+ };
- static const UINT8 bits_ac_luminance[17] =
- { /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d };
- static const UINT8 val_ac_luminance[] =
- { 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
- 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
- 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08,
- 0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0,
- 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16,
- 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28,
- 0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
- 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
- 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
- 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
- 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
- 0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
- 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
- 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
- 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6,
- 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5,
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4,
- 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
- 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
- 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
- 0xf9, 0xfa };
+ static const UINT8 bits_ac_luminance[17] = {
+ /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d
+ };
+ static const UINT8 val_ac_luminance[] = {
+ 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
+ 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
+ 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08,
+ 0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0,
+ 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16,
+ 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28,
+ 0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
+ 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
+ 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
+ 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
+ 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
+ 0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
+ 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
+ 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
+ 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6,
+ 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5,
+ 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4,
+ 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
+ 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
+ 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
+ 0xf9, 0xfa
+ };
- static const UINT8 bits_ac_chrominance[17] =
- { /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 };
- static const UINT8 val_ac_chrominance[] =
- { 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,
- 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
- 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
- 0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0,
- 0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34,
- 0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26,
- 0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38,
- 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
- 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
- 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
- 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
- 0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
- 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96,
- 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5,
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4,
- 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3,
- 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2,
- 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
- 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
- 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
- 0xf9, 0xfa };
+ static const UINT8 bits_ac_chrominance[17] = {
+ /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77
+ };
+ static const UINT8 val_ac_chrominance[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,
+ 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
+ 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
+ 0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0,
+ 0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34,
+ 0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26,
+ 0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38,
+ 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
+ 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
+ 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
+ 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
+ 0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96,
+ 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5,
+ 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4,
+ 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3,
+ 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2,
+ 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
+ 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
+ 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
+ 0xf9, 0xfa
+ };
if (cinfo->is_decompressor) {
dc_huff_tbl_ptrs = ((j_decompress_ptr)cinfo)->dc_huff_tbl_ptrs;
diff --git a/src/3rdparty/libjpeg/src/jutils.c b/src/3rdparty/libjpeg/src/jutils.c
index f9d35023e5..5c5bb17dc5 100644
--- a/src/3rdparty/libjpeg/src/jutils.c
+++ b/src/3rdparty/libjpeg/src/jutils.c
@@ -53,7 +53,7 @@ const int jpeg_zigzag_order[DCTSIZE2] = {
* fake entries.
*/
-const int jpeg_natural_order[DCTSIZE2+16] = {
+const int jpeg_natural_order[DCTSIZE2 + 16] = {
0, 1, 8, 16, 9, 2, 3, 10,
17, 24, 32, 25, 18, 11, 4, 5,
12, 19, 26, 33, 40, 48, 41, 34,
@@ -72,7 +72,7 @@ const int jpeg_natural_order[DCTSIZE2+16] = {
*/
GLOBAL(long)
-jdiv_round_up (long a, long b)
+jdiv_round_up(long a, long b)
/* Compute a/b rounded up to next integer, ie, ceil(a/b) */
/* Assumes a >= 0, b > 0 */
{
@@ -81,7 +81,7 @@ jdiv_round_up (long a, long b)
GLOBAL(long)
-jround_up (long a, long b)
+jround_up(long a, long b)
/* Compute a rounded up to next multiple of b, ie, ceil(a/b)*b */
/* Assumes a >= 0, b > 0 */
{
@@ -91,9 +91,9 @@ jround_up (long a, long b)
GLOBAL(void)
-jcopy_sample_rows (JSAMPARRAY input_array, int source_row,
- JSAMPARRAY output_array, int dest_row,
- int num_rows, JDIMENSION num_cols)
+jcopy_sample_rows(JSAMPARRAY input_array, int source_row,
+ JSAMPARRAY output_array, int dest_row, int num_rows,
+ JDIMENSION num_cols)
/* Copy some rows of samples from one place to another.
* num_rows rows are copied from input_array[source_row++]
* to output_array[dest_row++]; these areas may overlap for duplication.
@@ -101,7 +101,7 @@ jcopy_sample_rows (JSAMPARRAY input_array, int source_row,
*/
{
register JSAMPROW inptr, outptr;
- register size_t count = (size_t) (num_cols * sizeof(JSAMPLE));
+ register size_t count = (size_t)(num_cols * sizeof(JSAMPLE));
register int row;
input_array += source_row;
@@ -116,8 +116,8 @@ jcopy_sample_rows (JSAMPARRAY input_array, int source_row,
GLOBAL(void)
-jcopy_block_row (JBLOCKROW input_row, JBLOCKROW output_row,
- JDIMENSION num_blocks)
+jcopy_block_row(JBLOCKROW input_row, JBLOCKROW output_row,
+ JDIMENSION num_blocks)
/* Copy a row of coefficient blocks from one place to another. */
{
MEMCOPY(output_row, input_row, num_blocks * (DCTSIZE2 * sizeof(JCOEF)));
@@ -125,7 +125,7 @@ jcopy_block_row (JBLOCKROW input_row, JBLOCKROW output_row,
GLOBAL(void)
-jzero_far (void *target, size_t bytestozero)
+jzero_far(void *target, size_t bytestozero)
/* Zero out a chunk of memory. */
/* This might be sample-array data, block-array data, or alloc_large data. */
{
diff --git a/src/3rdparty/libjpeg/src/jversion.h b/src/3rdparty/libjpeg/src/jversion.h
index 7e44eaa3c5..2039f44c3a 100644
--- a/src/3rdparty/libjpeg/src/jversion.h
+++ b/src/3rdparty/libjpeg/src/jversion.h
@@ -4,7 +4,7 @@
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1991-2012, Thomas G. Lane, Guido Vollbeding.
* libjpeg-turbo Modifications:
- * Copyright (C) 2010, 2012-2017, D. R. Commander.
+ * Copyright (C) 2010, 2012-2018, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@@ -35,15 +35,18 @@
* their code
*/
-#define JCOPYRIGHT "Copyright (C) 2009-2017 D. R. Commander\n" \
- "Copyright (C) 2011-2016 Siarhei Siamashka\n" \
- "Copyright (C) 2015-2016 Matthieu Darbois\n" \
- "Copyright (C) 2015 Google, Inc.\n" \
- "Copyright (C) 2013-2014 MIPS Technologies, Inc.\n" \
- "Copyright (C) 2013 Linaro Limited\n" \
- "Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies)\n" \
- "Copyright (C) 2009 Pierre Ossman for Cendio AB\n" \
- "Copyright (C) 1999-2006 MIYASAKA Masaru\n" \
- "Copyright (C) 1991-2016 Thomas G. Lane, Guido Vollbeding" \
-
-#define JCOPYRIGHT_SHORT "Copyright (C) 1991-2017 The libjpeg-turbo Project and many others"
+#define JCOPYRIGHT \
+ "Copyright (C) 2009-2018 D. R. Commander\n" \
+ "Copyright (C) 2011-2016 Siarhei Siamashka\n" \
+ "Copyright (C) 2015-2016, 2018 Matthieu Darbois\n" \
+ "Copyright (C) 2015 Intel Corporation\n" \
+ "Copyright (C) 2015 Google, Inc.\n" \
+ "Copyright (C) 2013-2014 MIPS Technologies, Inc.\n" \
+ "Copyright (C) 2013 Linaro Limited\n" \
+ "Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies)\n" \
+ "Copyright (C) 2009 Pierre Ossman for Cendio AB\n" \
+ "Copyright (C) 1999-2006 MIYASAKA Masaru\n" \
+ "Copyright (C) 1991-2016 Thomas G. Lane, Guido Vollbeding"
+
+#define JCOPYRIGHT_SHORT \
+ "Copyright (C) 1991-2018 The libjpeg-turbo Project and many others"
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
index 7951e95db5..adb84a1856 100644
--- a/src/corelib/codecs/qtextcodec.cpp
+++ b/src/corelib/codecs/qtextcodec.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
+** Copyright (C) 2018 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -1236,6 +1237,19 @@ bool QTextDecoder::hasFailure() const
return state.invalidChars != 0;
}
+/*!
+ \internal
+ \since 5.12
+
+ Determines whether the decoder needs more bytes to continue decoding. That
+ is, this signifies that the input string ended in the middle of a
+ multi-byte sequence. Note that it's possible some codecs do not report this.
+ */
+bool QTextDecoder::needsMoreData() const
+{
+ return state.remainingChars;
+}
+
QT_END_NAMESPACE
#endif // QT_NO_TEXTCODEC
diff --git a/src/corelib/codecs/qtextcodec.h b/src/corelib/codecs/qtextcodec.h
index 8153bebac8..09d21166d8 100644
--- a/src/corelib/codecs/qtextcodec.h
+++ b/src/corelib/codecs/qtextcodec.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -162,6 +162,7 @@ public:
QString toUnicode(const QByteArray &ba);
void toUnicode(QString *target, const char *chars, int len);
bool hasFailure() const;
+ bool needsMoreData() const;
private:
const QTextCodec *c;
QTextCodec::ConverterState state;
diff --git a/src/corelib/codecs/qutfcodec_p.h b/src/corelib/codecs/qutfcodec_p.h
index 659a229dae..7405996fba 100644
--- a/src/corelib/codecs/qutfcodec_p.h
+++ b/src/corelib/codecs/qutfcodec_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2016 Intel Corporation.
+** Copyright (C) 2018 The Qt Company Ltd.
+** Copyright (C) 2018 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qeasingcurve.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qeasingcurve.cpp
index 97453e2b06..88f1e90713 100644
--- a/src/corelib/doc/snippets/code/src_corelib_tools_qeasingcurve.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_tools_qeasingcurve.cpp
@@ -48,11 +48,15 @@
**
****************************************************************************/
+//! [typedef]
+qreal myEasingFunction(qreal progress);
+//! [typedef]
+
//! [0]
QEasingCurve easing(QEasingCurve::InOutQuad);
- for (qreal t = 0.0; t < 1.0; t+=0.1)
- qWarning() << "Effective progress" << t << " is
+ for (qreal t = 0.0; t < 1.0; t += 0.1)
+ qWarning() << "Effective progress" << t << "is"
<< easing.valueForProgress(t);
//! [0]
diff --git a/src/corelib/doc/src/resource-system.qdoc b/src/corelib/doc/src/resource-system.qdoc
index e32343bb1b..9b6b613f79 100644
--- a/src/corelib/doc/src/resource-system.qdoc
+++ b/src/corelib/doc/src/resource-system.qdoc
@@ -42,6 +42,7 @@
\l rcc (Qt's resource compiler), and QFile.
\section1 Resource Collection Files (\c{.qrc})
+ \target {Resource Collection Files}
The resources associated with an application are specified in a
\c .qrc file, an XML-based file format that lists files on the
diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h
index a8dbb3edcd..506c8513dc 100644
--- a/src/corelib/global/qconfig-bootstrapped.h
+++ b/src/corelib/global/qconfig-bootstrapped.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -77,6 +77,7 @@
#define QT_CRYPTOGRAPHICHASH_ONLY_SHA1
#define QT_FEATURE_cxx11_random (QT_HAS_INCLUDE(<random>) ? 1 : -1)
#define QT_NO_DATASTREAM
+#define QT_FEATURE_datestring 1
#define QT_FEATURE_datetimeparser -1
#define QT_FEATURE_etw -1
#define QT_FEATURE_getauxval (QT_HAS_INCLUDE(<sys/auxv.h>) ? 1 : -1)
@@ -115,6 +116,7 @@
#define QT_NO_SYSTEMLOCALE
#define QT_FEATURE_systemsemaphore -1
#define QT_FEATURE_temporaryfile 1
+#define QT_FEATURE_textdate 1
#define QT_FEATURE_thread -1
#define QT_FEATURE_timezone -1
#define QT_FEATURE_topleveldomain -1
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index 422d08f32c..e727f00c8e 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -267,7 +267,7 @@ QLibraryInfo::licensedProducts()
\deprecated
This function used to return the installation date for this build of Qt, but now returns a constant date.
*/
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
#if QT_DEPRECATED_SINCE(5, 5)
QDate
QLibraryInfo::buildDate()
@@ -275,7 +275,7 @@ QLibraryInfo::buildDate()
return QDate::fromString(QString::fromLatin1(qt_configure_installation + 12), Qt::ISODate);
}
#endif
-#endif //QT_NO_DATESTRING
+#endif // datestring
#if defined(Q_CC_INTEL) // must be before GNU, Clang and MSVC because ICC/ICL claim to be them
# ifdef __INTEL_CLANG_COMPILER
diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h
index 809813d99d..80fc5bd4fc 100644
--- a/src/corelib/global/qlibraryinfo.h
+++ b/src/corelib/global/qlibraryinfo.h
@@ -56,11 +56,11 @@ public:
static QT_DEPRECATED QString licensedProducts();
#endif
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
#if QT_DEPRECATED_SINCE(5, 5)
static QT_DEPRECATED QDate buildDate();
#endif // QT_DEPRECATED_SINCE(5, 5)
-#endif //QT_NO_DATESTRING
+#endif // datestring
static const char * build() Q_DECL_NOTHROW;
diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h
index cb98bef347..5a2a29a327 100644
--- a/src/corelib/kernel/qcore_unix_p.h
+++ b/src/corelib/kernel/qcore_unix_p.h
@@ -178,7 +178,7 @@ inline void qt_ignore_sigpipe()
#if defined(Q_PROCESSOR_X86_32) && defined(__GLIBC__)
# if !__GLIBC_PREREQ(2, 22)
-int qt_open64(const char *pathname, int flags, mode_t);
+Q_CORE_EXPORT int qt_open64(const char *pathname, int flags, mode_t);
# undef QT_OPEN
# define QT_OPEN qt_open64
# endif
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 66afa52617..1917f318c6 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -3653,13 +3653,17 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i
if (sender->d_func()->isDeclarativeSignalConnected(signal_index)
&& QAbstractDeclarativeData::signalEmitted) {
+ Q_TRACE(QMetaObject_activate_begin_declarative_signal, sender, signal_index);
QAbstractDeclarativeData::signalEmitted(sender->d_func()->declarativeData, sender,
signal_index, argv);
+ Q_TRACE(QMetaObject_activate_end_declarative_signal, sender, signal_index);
}
if (!sender->d_func()->isSignalConnected(signal_index, /*checkDeclarative =*/ false)
&& !qt_signal_spy_callback_set.signal_begin_callback
- && !qt_signal_spy_callback_set.signal_end_callback) {
+ && !qt_signal_spy_callback_set.signal_end_callback
+ && !Q_TRACE_ENABLED(QMetaObject_activate_begin_signal)
+ && !Q_TRACE_ENABLED(QMetaObject_activate_end_signal)) {
// The possible declarative connection is done, and nothing else is connected, so:
return;
}
@@ -3669,6 +3673,7 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i
qt_signal_spy_callback_set.signal_begin_callback(sender, signal_index,
argv ? argv : empty_argv);
}
+ Q_TRACE(QMetaObject_activate_begin_signal, sender, signal_index);
{
QMutexLocker locker(signalSlotLock(sender));
@@ -3699,6 +3704,7 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i
locker.unlock();
if (qt_signal_spy_callback_set.signal_end_callback != 0)
qt_signal_spy_callback_set.signal_end_callback(sender, signal_index);
+ Q_TRACE(QMetaObject_activate_end_signal, sender, signal_index);
return;
}
@@ -3759,7 +3765,9 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i
c->slotObj->ref();
QScopedPointer<QtPrivate::QSlotObjectBase, QSlotObjectBaseDeleter> obj(c->slotObj);
locker.unlock();
+ Q_TRACE(QMetaObject_activate_begin_slot_functor, obj.data());
obj->call(receiver, argv ? argv : empty_argv);
+ Q_TRACE(QMetaObject_activate_end_slot_functor, obj.data());
// Make sure the slot object gets destroyed before the mutex is locked again, as the
// destructor of the slot object might also lock a mutex from the signalSlotLock() mutex pool,
@@ -3775,9 +3783,11 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i
locker.unlock();
if (qt_signal_spy_callback_set.slot_begin_callback != 0)
qt_signal_spy_callback_set.slot_begin_callback(receiver, methodIndex, argv ? argv : empty_argv);
+ Q_TRACE(QMetaObject_activate_begin_slot, receiver, methodIndex);
callFunction(receiver, QMetaObject::InvokeMetaMethod, method_relative, argv ? argv : empty_argv);
+ Q_TRACE(QMetaObject_activate_end_slot, receiver, methodIndex);
if (qt_signal_spy_callback_set.slot_end_callback != 0)
qt_signal_spy_callback_set.slot_end_callback(receiver, methodIndex);
locker.relock();
@@ -3790,9 +3800,11 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i
method,
argv ? argv : empty_argv);
}
+ Q_TRACE(QMetaObject_activate_begin_slot, receiver, method);
metacall(receiver, QMetaObject::InvokeMetaMethod, method, argv ? argv : empty_argv);
+ Q_TRACE(QMetaObject_activate_end_slot, receiver, method);
if (qt_signal_spy_callback_set.slot_end_callback != 0)
qt_signal_spy_callback_set.slot_end_callback(receiver, method);
@@ -3813,7 +3825,7 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i
if (qt_signal_spy_callback_set.signal_end_callback != 0)
qt_signal_spy_callback_set.signal_end_callback(sender, signal_index);
-
+ Q_TRACE(QMetaObject_activate_end_signal, sender, signal_index);
}
/*!
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index 4d1aa911f7..0b4c3f387f 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -468,7 +468,7 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
case QVariant::Double:
*str = QString::number(d->data.d, 'g', QLocale::FloatingPointShortest);
break;
-#if !defined(QT_NO_DATESTRING)
+#if QT_CONFIG(datestring)
case QVariant::Date:
*str = v_cast<QDate>(d)->toString(Qt::ISODate);
break;
@@ -617,7 +617,7 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
QDate *dt = static_cast<QDate *>(result);
if (d->type == QVariant::DateTime)
*dt = v_cast<QDateTime>(d)->date();
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
else if (d->type == QVariant::String)
*dt = QDate::fromString(*v_cast<QString>(d), Qt::ISODate);
#endif
@@ -632,7 +632,7 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
case QVariant::DateTime:
*t = v_cast<QDateTime>(d)->time();
break;
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
case QVariant::String:
*t = QTime::fromString(*v_cast<QString>(d), Qt::ISODate);
break;
@@ -645,7 +645,7 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
case QVariant::DateTime: {
QDateTime *dt = static_cast<QDateTime *>(result);
switch (d->type) {
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
case QVariant::String:
*dt = QDateTime::fromString(*v_cast<QString>(d), Qt::ISODate);
break;
diff --git a/src/corelib/plugin/qelfparser_p.h b/src/corelib/plugin/qelfparser_p.h
index 1d3578255f..cdf055329d 100644
--- a/src/corelib/plugin/qelfparser_p.h
+++ b/src/corelib/plugin/qelfparser_p.h
@@ -84,7 +84,7 @@ public:
int m_endian;
int m_bits;
- int m_stringTableFileOffset;
+ qelfoff_t m_stringTableFileOffset;
template <typename T>
T read(const char *s)
diff --git a/src/corelib/qtcore.tracepoints b/src/corelib/qtcore.tracepoints
index 2e78490ab5..33734a4274 100644
--- a/src/corelib/qtcore.tracepoints
+++ b/src/corelib/qtcore.tracepoints
@@ -23,3 +23,12 @@ QCoreApplication_notify_after_delivery(QObject *receiver, QEvent *event, int typ
QObject_ctor(QObject *object)
QObject_dtor(QObject *object)
+
+QMetaObject_activate_begin_signal(QObject *sender, int signalIndex)
+QMetaObject_activate_end_signal(QObject *sender, int signalIndex)
+QMetaObject_activate_begin_slot(QObject *receiver, int slotIndex)
+QMetaObject_activate_end_slot(QObject *receiver, int slotIndex)
+QMetaObject_activate_begin_slot_functor(void *slotObject)
+QMetaObject_activate_end_slot_functor(void *slotObject)
+QMetaObject_activate_begin_declarative_signal(QObject *sender, int signalIndex)
+QMetaObject_activate_end_declarative_signal(QObject *sender, int signalIndex)
diff --git a/src/corelib/serialization/qdatastream.cpp b/src/corelib/serialization/qdatastream.cpp
index 60467b4824..c81da70e61 100644
--- a/src/corelib/serialization/qdatastream.cpp
+++ b/src/corelib/serialization/qdatastream.cpp
@@ -564,7 +564,7 @@ void QDataStream::setByteOrder(ByteOrder bo)
\value Qt_5_9 Same as Qt_5_6
\value Qt_5_10 Same as Qt_5_6
\value Qt_5_11 Same as Qt_5_6
- \value Qt_5_12 Same as Qt_5_6
+ \value Qt_5_12 Version 18 (Qt 5.12)
\omitvalue Qt_DefaultCompiledVersion
\sa setVersion(), version()
diff --git a/src/corelib/serialization/qxmlstream.cpp b/src/corelib/serialization/qxmlstream.cpp
index f18c4cc8e7..5002848d83 100644
--- a/src/corelib/serialization/qxmlstream.cpp
+++ b/src/corelib/serialization/qxmlstream.cpp
@@ -3956,13 +3956,13 @@ void QXmlStreamWriter::writeCurrentToken(const QXmlStreamReader &reader)
writeEndDocument();
break;
case QXmlStreamReader::StartElement: {
+ writeStartElement(reader.namespaceUri().toString(), reader.name().toString());
QXmlStreamNamespaceDeclarations namespaceDeclarations = reader.namespaceDeclarations();
for (int i = 0; i < namespaceDeclarations.size(); ++i) {
const QXmlStreamNamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.at(i);
writeNamespace(namespaceDeclaration.namespaceUri().toString(),
namespaceDeclaration.prefix().toString());
}
- writeStartElement(reader.namespaceUri().toString(), reader.name().toString());
writeAttributes(reader.attributes());
} break;
case QXmlStreamReader::EndElement:
diff --git a/src/corelib/thread/qfuturewatcher.cpp b/src/corelib/thread/qfuturewatcher.cpp
index 5b68af1fbc..faeb6b3a28 100644
--- a/src/corelib/thread/qfuturewatcher.cpp
+++ b/src/corelib/thread/qfuturewatcher.cpp
@@ -98,7 +98,9 @@ QT_BEGIN_NAMESPACE
/*! \fn template <typename T> QFutureWatcher<T>::QFutureWatcher(QObject *parent)
- Constructs a new QFutureWatcher with the given \a parent.
+ Constructs a new QFutureWatcher with the given \a parent. Until a future is
+ set with setFuture(), the functions isStarted(), isCanceled(), and
+ isFinished() return \c true.
*/
QFutureWatcherBase::QFutureWatcherBase(QObject *parent)
:QObject(*new QFutureWatcherBasePrivate, parent)
@@ -241,7 +243,7 @@ QString QFutureWatcherBase::progressText() const
/*! \fn template <typename T> bool QFutureWatcher<T>::isStarted() const
Returns \c true if the asynchronous computation represented by the future()
- has been started; otherwise returns \c false.
+ has been started, or if no future has been set; otherwise returns \c false.
*/
bool QFutureWatcherBase::isStarted() const
{
@@ -272,7 +274,7 @@ bool QFutureWatcherBase::isRunning() const
/*! \fn template <typename T> bool QFutureWatcher<T>::isCanceled() const
Returns \c true if the asynchronous computation has been canceled with the
- cancel() function; otherwise returns \c false.
+ cancel() function, or if no future has been set; otherwise returns \c false.
Be aware that the computation may still be running even though this
function returns \c true. See cancel() for more details.
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
index 5df0508829..d2d6435004 100644
--- a/src/corelib/thread/qthread.cpp
+++ b/src/corelib/thread/qthread.cpp
@@ -879,6 +879,7 @@ QThreadPrivate::QThreadPrivate(QThreadData *d) : data(d ? d : new QThreadData)
QThreadPrivate::~QThreadPrivate()
{
+ data->thread = nullptr; // prevent QThreadData from deleting the QThreadPrivate (again).
delete data;
}
diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp
index caf51722cd..eebaf90d9b 100644
--- a/src/corelib/thread/qthread_win.cpp
+++ b/src/corelib/thread/qthread_win.cpp
@@ -511,7 +511,7 @@ void QThread::start(Priority priority)
#endif // Q_OS_WINRT
if (!d->handle) {
- qErrnoWarning(errno, "QThread::start: Failed to create thread");
+ qErrnoWarning("QThread::start: Failed to create thread");
d->running = false;
d->finished = true;
return;
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 58755c94bb..816bd974eb 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -171,7 +171,7 @@ static ParsedDate getDateFromJulianDay(qint64 julianDay)
static const char monthDays[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
-#ifndef QT_NO_TEXTDATE
+#if QT_CONFIG(textdate)
static const char qt_shortMonthNames[][4] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
@@ -200,9 +200,9 @@ static int fromShortMonthName(const QStringRef &monthName)
}
return -1;
}
-#endif // QT_NO_TEXTDATE
+#endif // textdate
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
struct ParsedRfcDateTime {
QDate date;
QTime time;
@@ -241,7 +241,7 @@ static ParsedRfcDateTime rfcDateImpl(const QString &s)
return result;
}
-#endif // QT_NO_DATESTRING
+#endif // datestring
// Return offset in [+-]HH:mm format
static QString toOffsetString(Qt::DateFormat format, int offset)
@@ -254,6 +254,7 @@ static QString toOffsetString(Qt::DateFormat format, int offset)
(qAbs(offset) / 60) % 60);
}
+#if QT_CONFIG(datestring)
// Parse offset in [+-]HH[[:]mm] format
static int fromOffsetString(const QStringRef &offsetString, bool *valid) Q_DECL_NOTHROW
{
@@ -298,6 +299,7 @@ static int fromOffsetString(const QStringRef &offsetString, bool *valid) Q_DECL_
*valid = true;
return sign * ((hour * 60) + minute) * 60;
}
+#endif // datestring
/*****************************************************************************
QDate member functions
@@ -324,20 +326,19 @@ static int fromOffsetString(const QStringRef &offsetString, bool *valid) Q_DECL_
\brief The QDate class provides date functions.
- A QDate object contains a calendar date, i.e. year, month, and day
- numbers, in the Gregorian calendar. It can read the current date
- from the system clock. It provides functions for comparing dates,
- and for manipulating dates. For example, it is possible to add
- and subtract days, months, and years to dates.
+ A QDate object encodes a calendar date, i.e. year, month, and day numbers,
+ in the proleptic Gregorian calendar by default. It can read the current date
+ from the system clock. It provides functions for comparing dates, and for
+ manipulating dates. For example, it is possible to add and subtract days,
+ months, and years to dates.
- A QDate object is typically created by giving the year,
- month, and day numbers explicitly. Note that QDate interprets two
- digit years as is, i.e., years 0 - 99. A QDate can also be
- constructed with the static function currentDate(), which creates
- a QDate object containing the system clock's date. An explicit
- date can also be set using setDate(). The fromString() function
- returns a QDate given a string and a date format which is used to
- interpret the date within the string.
+ A QDate object is typically created by giving the year, month, and day
+ numbers explicitly. Note that QDate interprets two digit years as presented,
+ i.e., as years 0 through 99, without adding any offset. A QDate can also be
+ constructed with the static function currentDate(), which creates a QDate
+ object containing the system clock's date. An explicit date can also be set
+ using setDate(). The fromString() function returns a QDate given a string
+ and a date format which is used to interpret the date within the string.
The year(), month(), and day() functions provide access to the
year, month, and day numbers. Also, dayOfWeek() and dayOfYear()
@@ -361,9 +362,9 @@ static int fromOffsetString(const QStringRef &offsetString, bool *valid) Q_DECL_
\section2 No Year 0
- There is no year 0. Dates in that year are considered invalid. The
- year -1 is the year "1 before Christ" or "1 before current era."
- The day before 1 January 1 CE is 31 December 1 BCE.
+ There is no year 0. Dates in that year are considered invalid. The year -1
+ is the year "1 before Christ" or "1 before current era." The day before 1
+ January 1 CE, QDate(1, 1, 1), is 31 December 1 BCE, QDate(-1, 12, 31).
\section2 Range of Valid Dates
@@ -613,7 +614,7 @@ int QDate::weekNumber(int *yearNumber) const
return week;
}
-#if QT_DEPRECATED_SINCE(5, 11) && !defined(QT_NO_TEXTDATE)
+#if QT_DEPRECATED_SINCE(5, 11) && QT_CONFIG(textdate)
/*!
\since 4.5
\deprecated
@@ -775,11 +776,11 @@ QString QDate::longDayName(int weekday, MonthNameType type)
}
return QString();
}
-#endif // QT_NO_TEXTDATE && deprecated
+#endif // textdate && deprecated
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
-#ifndef QT_NO_TEXTDATE
+#if QT_CONFIG(textdate)
static QString toStringTextDate(QDate date)
{
const ParsedDate pd = getDateFromJulianDay(date.toJulianDay());
@@ -789,7 +790,7 @@ static QString toStringTextDate(QDate date)
+ QString::number(pd.day) + sp
+ QString::number(pd.year);
}
-#endif // QT_NO_TEXTDATE
+#endif // textdate
static QString toStringIsoDate(qint64 jd)
{
@@ -865,7 +866,7 @@ QString QDate::toString(Qt::DateFormat format) const
case Qt::RFC2822Date:
return QLocale::c().toString(*this, QStringViewLiteral("dd MMM yyyy"));
default:
-#ifndef QT_NO_TEXTDATE
+#if QT_CONFIG(textdate)
case Qt::TextDate:
return toStringTextDate(*this);
#endif
@@ -939,7 +940,7 @@ QString QDate::toString(const QString &format) const
}
#endif
-#endif //QT_NO_DATESTRING
+#endif // datestring
/*!
\fn bool QDate::setYMD(int y, int m, int d)
@@ -1201,7 +1202,7 @@ qint64 QDate::daysTo(const QDate &d) const
\sa QTime::currentTime(), QDateTime::currentDateTime()
*/
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
/*!
\fn QDate QDate::fromString(const QString &string, Qt::DateFormat format)
@@ -1234,7 +1235,7 @@ QDate QDate::fromString(const QString& string, Qt::DateFormat format)
case Qt::RFC2822Date:
return rfcDateImpl(string).date;
default:
-#ifndef QT_NO_TEXTDATE
+#if QT_CONFIG(textdate)
case Qt::TextDate: {
QVector<QStringRef> parts = string.splitRef(QLatin1Char(' '), QString::SkipEmptyParts);
@@ -1255,7 +1256,7 @@ QDate QDate::fromString(const QString& string, Qt::DateFormat format)
return QDate(year, month, parts.at(2).toInt());
}
-#endif // QT_NO_TEXTDATE
+#endif // textdate
case Qt::ISODate: {
// Semi-strict parsing, must be long enough and have non-numeric separators
if (string.size() < 10 || string.at(4).isDigit() || string.at(7).isDigit()
@@ -1350,7 +1351,7 @@ QDate QDate::fromString(const QString &string, const QString &format)
#endif
return date;
}
-#endif // QT_NO_DATESTRING
+#endif // datestring
/*!
\overload
@@ -1416,11 +1417,12 @@ bool QDate::isLeapYear(int y)
\brief The QTime class provides clock time functions.
- A QTime object contains a clock time, i.e. the number of hours,
- minutes, seconds, and milliseconds since midnight. It can read the
- current time from the system clock and measure a span of elapsed
- time. It provides functions for comparing times and for
- manipulating a time by adding a number of milliseconds.
+ A QTime object contains a clock time, which it can express as the
+ numbers of hours, minutes, seconds, and milliseconds since
+ midnight. It can read the current time from the system clock and
+ measure a span of elapsed time. It provides functions for
+ comparing times and for manipulating a time by adding a number of
+ milliseconds.
QTime uses the 24-hour clock format; it has no concept of AM/PM.
Unlike QDateTime, QTime knows nothing about time zones or
@@ -1438,15 +1440,15 @@ bool QDate::isLeapYear(int y)
of the time. The same information is provided in textual format by
the toString() function.
- QTime provides a full set of operators to compare two QTime
- objects. QTime A is considered smaller than QTime B if A is
- earlier than B.
-
The addSecs() and addMSecs() functions provide the time a given
number of seconds or milliseconds later than a given time.
Correspondingly, the number of seconds or milliseconds
between two times can be found using secsTo() or msecsTo().
+ QTime provides a full set of operators to compare two QTime
+ objects; an earlier time is considered smaller than a later one;
+ if A.msecsTo(B) is positive, then A < B.
+
QTime can be used to measure a span of elapsed time using the
start(), restart(), and elapsed() functions.
@@ -1566,7 +1568,7 @@ int QTime::msec() const
return ds() % 1000;
}
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
/*!
\overload
@@ -1702,7 +1704,7 @@ QString QTime::toString(const QString &format) const
}
#endif
-#endif //QT_NO_DATESTRING
+#endif // datestring
/*!
Sets the time to hour \a h, minute \a m, seconds \a s and
@@ -1887,7 +1889,7 @@ int QTime::msecsTo(const QTime &t) const
operating system; not all systems provide 1-millisecond accuracy.
*/
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
static QTime fromIsoTimeString(const QStringRef &string, Qt::DateFormat format, bool *isMidnight24)
{
@@ -2069,7 +2071,7 @@ QTime QTime::fromString(const QString &string, const QString &format)
return time;
}
-#endif // QT_NO_DATESTRING
+#endif // datestring
/*!
@@ -3007,8 +3009,8 @@ inline qint64 QDateTimePrivate::zoneMSecsToEpochMSecs(qint64 zoneMSecs, const QT
\brief The QDateTime class provides date and time functions.
- A QDateTime object contains a calendar date and a clock time (a
- "datetime"). It is a combination of the QDate and QTime classes.
+ A QDateTime object encodes a calendar date and a clock time (a
+ "datetime"). It combines features of the QDate and QTime classes.
It can read the current datetime from the system clock. It
provides functions for comparing datetimes and for manipulating a
datetime by adding a number of seconds, days, months, or years.
@@ -3773,7 +3775,7 @@ void QDateTime::setTime_t(uint secsSince1Jan1970UTC)
}
#endif
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
/*!
\fn QString QDateTime::toString(Qt::DateFormat format) const
@@ -3848,7 +3850,7 @@ QString QDateTime::toString(Qt::DateFormat format) const
return buf;
}
default:
-#ifndef QT_NO_TEXTDATE
+#if QT_CONFIG(textdate)
case Qt::TextDate: {
const QPair<QDate, QTime> p = getDateTime(d);
buf = p.first.toString(Qt::TextDate);
@@ -3993,7 +3995,7 @@ QString QDateTime::toString(const QString &format) const
}
#endif
-#endif //QT_NO_DATESTRING
+#endif // datestring
static inline void massageAdjustedDateTime(const QDateTimeData &d, QDate *date, QTime *time)
{
@@ -4722,7 +4724,7 @@ int QDateTime::utcOffset() const
}
#endif // QT_DEPRECATED_SINCE
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
/*!
\fn QDateTime QDateTime::fromString(const QString &string, Qt::DateFormat format)
@@ -4827,7 +4829,7 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format)
date = date.addDays(1);
return QDateTime(date, time, spec, offset);
}
-#if !defined(QT_NO_TEXTDATE)
+#if QT_CONFIG(textdate)
case Qt::TextDate: {
QVector<QStringRef> parts = string.splitRef(QLatin1Char(' '), QString::SkipEmptyParts);
@@ -4936,7 +4938,7 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format)
return QDateTime(date, time, Qt::UTC);
}
}
-#endif //QT_NO_TEXTDATE
+#endif // textdate
}
return QDateTime();
@@ -5071,7 +5073,7 @@ QDateTime QDateTime::fromString(const QString &string, const QString &format)
return QDateTime();
}
-#endif // QT_NO_DATESTRING
+#endif // datestring
/*!
\fn QDateTime QDateTime::toLocalTime() const
@@ -5330,7 +5332,7 @@ QDataStream &operator>>(QDataStream &in, QDateTime &dateTime)
Date / Time Debug Streams
*****************************************************************************/
-#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_NO_DATESTRING)
+#if !defined(QT_NO_DEBUG_STREAM) && QT_CONFIG(datestring)
QDebug operator<<(QDebug dbg, const QDate &date)
{
QDebugStateSaver saver(dbg);
@@ -5382,7 +5384,7 @@ QDebug operator<<(QDebug dbg, const QDateTime &date)
}
return dbg.nospace() << ')';
}
-#endif
+#endif // debug_stream && datestring
/*! \fn uint qHash(const QDateTime &key, uint seed = 0)
\relates QHash
diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h
index 5a7b75db62..43271b34ed 100644
--- a/src/corelib/tools/qdatetime.h
+++ b/src/corelib/tools/qdatetime.h
@@ -81,7 +81,7 @@ public:
int daysInYear() const;
int weekNumber(int *yearNum = nullptr) const;
-#if QT_DEPRECATED_SINCE(5, 10) && !defined QT_NO_TEXTDATE
+#if QT_DEPRECATED_SINCE(5, 10) && QT_CONFIG(textdate)
QT_DEPRECATED_X("Use QLocale::monthName or QLocale::standaloneMonthName")
static QString shortMonthName(int month, MonthNameType type = DateFormat);
QT_DEPRECATED_X("Use QLocale::dayName or QLocale::standaloneDayName")
@@ -90,8 +90,8 @@ public:
static QString longMonthName(int month, MonthNameType type = DateFormat);
QT_DEPRECATED_X("Use QLocale::dayName or QLocale::standaloneDayName")
static QString longDayName(int weekday, MonthNameType type = DateFormat);
-#endif // QT_NO_TEXTDATE && deprecated
-#ifndef QT_NO_DATESTRING
+#endif // textdate && deprecated
+#if QT_CONFIG(datestring)
QString toString(Qt::DateFormat f = Qt::TextDate) const;
#if QT_STRINGVIEW_LEVEL < 2
QString toString(const QString &format) const;
@@ -123,7 +123,7 @@ QT_DEPRECATED inline bool setYMD(int y, int m, int d)
Q_DECL_CONSTEXPR bool operator>=(const QDate &other) const { return jd >= other.jd; }
static QDate currentDate();
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
static QDate fromString(const QString &s, Qt::DateFormat f = Qt::TextDate);
static QDate fromString(const QString &s, const QString &format);
#endif
@@ -167,7 +167,7 @@ public:
int minute() const;
int second() const;
int msec() const;
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
QString toString(Qt::DateFormat f = Qt::TextDate) const;
#if QT_STRINGVIEW_LEVEL < 2
QString toString(const QString &format) const;
@@ -192,7 +192,7 @@ public:
Q_DECL_CONSTEXPR inline int msecsSinceStartOfDay() const { return mds == NullTime ? 0 : mds; }
static QTime currentTime();
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
static QTime fromString(const QString &s, Qt::DateFormat f = Qt::TextDate);
static QTime fromString(const QString &s, const QString &format);
#endif
@@ -303,7 +303,7 @@ public:
void setMSecsSinceEpoch(qint64 msecs);
void setSecsSinceEpoch(qint64 secs);
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
QString toString(Qt::DateFormat f = Qt::TextDate) const;
#if QT_STRINGVIEW_LEVEL < 2
QString toString(const QString &format) const;
@@ -342,7 +342,7 @@ public:
static QDateTime currentDateTime();
static QDateTime currentDateTimeUtc();
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
static QDateTime fromString(const QString &s, Qt::DateFormat f = Qt::TextDate);
static QDateTime fromString(const QString &s, const QString &format);
#endif
@@ -386,7 +386,7 @@ private:
friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QDateTime &);
#endif
-#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_NO_DATESTRING)
+#if !defined(QT_NO_DEBUG_STREAM) && QT_CONFIG(datestring)
friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QDateTime &);
#endif
};
@@ -401,7 +401,7 @@ Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QDateTime &);
Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QDateTime &);
#endif // QT_NO_DATASTREAM
-#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_NO_DATESTRING)
+#if !defined(QT_NO_DEBUG_STREAM) && QT_CONFIG(datestring)
Q_CORE_EXPORT QDebug operator<<(QDebug, const QDate &);
Q_CORE_EXPORT QDebug operator<<(QDebug, const QTime &);
Q_CORE_EXPORT QDebug operator<<(QDebug, const QDateTime &);
diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp
index d03518e70d..18c44c3a17 100644
--- a/src/corelib/tools/qdatetimeparser.cpp
+++ b/src/corelib/tools/qdatetimeparser.cpp
@@ -77,7 +77,7 @@ QDateTimeParser::~QDateTimeParser()
int QDateTimeParser::getDigit(const QDateTime &t, int index) const
{
if (index < 0 || index >= sectionNodes.size()) {
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
qWarning("QDateTimeParser::getDigit() Internal error (%s %d)",
qPrintable(t.toString()), index);
#else
@@ -103,7 +103,7 @@ int QDateTimeParser::getDigit(const QDateTime &t, int index) const
default: break;
}
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
qWarning("QDateTimeParser::getDigit() Internal error 2 (%s %d)",
qPrintable(t.toString()), index);
#else
@@ -127,7 +127,7 @@ int QDateTimeParser::getDigit(const QDateTime &t, int index) const
bool QDateTimeParser::setDigit(QDateTime &v, int index, int newVal) const
{
if (index < 0 || index >= sectionNodes.size()) {
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
qWarning("QDateTimeParser::setDigit() Internal error (%s %d %d)",
qPrintable(v.toString()), index, newVal);
#else
@@ -612,7 +612,7 @@ int QDateTimeParser::sectionSize(int sectionIndex) const
int QDateTimeParser::sectionMaxSize(Section s, int count) const
{
-#ifndef QT_NO_TEXTDATE
+#if QT_CONFIG(textdate)
int mcount = 12;
#endif
@@ -636,14 +636,14 @@ int QDateTimeParser::sectionMaxSize(Section s, int count) const
case DaySection: return 2;
case DayOfWeekSectionShort:
case DayOfWeekSectionLong:
-#ifdef QT_NO_TEXTDATE
+#if !QT_CONFIG(textdate)
return 2;
#else
mcount = 7;
Q_FALLTHROUGH();
#endif
case MonthSection:
-#ifdef QT_NO_TEXTDATE
+#if !QT_CONFIG(textdate)
return 2;
#else
if (count <= 2)
@@ -725,7 +725,7 @@ QString QDateTimeParser::sectionText(int sectionIndex) const
}
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
QDateTimeParser::ParsedSection
QDateTimeParser::parseSection(const QDateTime &currentValue, int sectionIndex,
@@ -1727,7 +1727,7 @@ QDateTimeParser::AmPmFinder QDateTimeParser::findAmPm(QString &str, int sectionI
return PossibleBoth;
return (!broken[amindex] ? PossibleAM : PossiblePM);
}
-#endif // QT_NO_DATESTRING
+#endif // datestring
/*!
\internal
@@ -1958,7 +1958,7 @@ QString QDateTimeParser::stateName(State s) const
}
}
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
bool QDateTimeParser::fromString(const QString &t, QDate *date, QTime *time) const
{
QDateTime val(QDate(1900, 1, 1), QDATETIMEEDIT_TIME_MIN);
@@ -1983,7 +1983,7 @@ bool QDateTimeParser::fromString(const QString &t, QDate *date, QTime *time) con
}
return true;
}
-#endif // QT_NO_DATESTRING
+#endif // datestring
QDateTime QDateTimeParser::getMinimum() const
{
diff --git a/src/corelib/tools/qdatetimeparser_p.h b/src/corelib/tools/qdatetimeparser_p.h
index c9e63fe307..f7e6e351fe 100644
--- a/src/corelib/tools/qdatetimeparser_p.h
+++ b/src/corelib/tools/qdatetimeparser_p.h
@@ -180,7 +180,7 @@ public:
LowerCase
};
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
StateNode parse(QString input, int position, const QDateTime &defaultValue, bool fixup) const;
bool fromString(const QString &text, QDate *date, QTime *time) const;
#endif
@@ -202,7 +202,7 @@ public:
private:
int sectionMaxSize(Section s, int count) const;
QString sectionText(const QString &text, int sectionIndex, int index) const;
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
StateNode scanString(const QDateTime &defaultValue,
bool fixup, QString *input) const;
struct ParsedSection {
@@ -237,7 +237,7 @@ private:
PossibleBoth = 4
};
AmPmFinder findAmPm(QString &str, int index, int *used = 0) const;
-#endif // QT_NO_DATESTRING
+#endif // datestring
bool potentialValue(const QStringRef &str, int min, int max, int index,
const QDateTime &currentValue, int insert) const;
diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp
index 235ca625c1..f82048db0f 100644
--- a/src/corelib/tools/qeasingcurve.cpp
+++ b/src/corelib/tools/qeasingcurve.cpp
@@ -292,7 +292,7 @@
This is a typedef for a pointer to a function with the following
signature:
- \snippet code/src_corelib_tools_qeasingcurve.cpp 0
+ \snippet code/src_corelib_tools_qeasingcurve.cpp typedef
*/
#include "qeasingcurve.h"
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 0081b5d566..38bd195fba 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -2079,7 +2079,7 @@ QString QLocale::dateTimeFormat(FormatType format) const
\sa timeFormat(), toDate(), toDateTime(), QTime::fromString()
*/
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
QTime QLocale::toTime(const QString &string, FormatType format) const
{
return toTime(string, timeFormat(format));
@@ -2097,7 +2097,7 @@ QTime QLocale::toTime(const QString &string, FormatType format) const
\sa dateFormat(), toTime(), toDateTime(), QDate::fromString()
*/
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
QDate QLocale::toDate(const QString &string, FormatType format) const
{
return toDate(string, dateFormat(format));
@@ -2116,7 +2116,7 @@ QDate QLocale::toDate(const QString &string, FormatType format) const
\sa dateTimeFormat(), toTime(), toDate(), QDateTime::fromString()
*/
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
QDateTime QLocale::toDateTime(const QString &string, FormatType format) const
{
return toDateTime(string, dateTimeFormat(format));
@@ -2134,7 +2134,7 @@ QDateTime QLocale::toDateTime(const QString &string, FormatType format) const
\sa timeFormat(), toDate(), toDateTime(), QTime::fromString()
*/
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
QTime QLocale::toTime(const QString &string, const QString &format) const
{
QTime time;
@@ -2165,7 +2165,7 @@ QTime QLocale::toTime(const QString &string, const QString &format) const
\sa dateFormat(), toTime(), toDateTime(), QDate::fromString()
*/
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
QDate QLocale::toDate(const QString &string, const QString &format) const
{
QDate date;
@@ -2196,7 +2196,7 @@ QDate QLocale::toDate(const QString &string, const QString &format) const
\sa dateTimeFormat(), toTime(), toDate(), QDateTime::fromString()
*/
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
QDateTime QLocale::toDateTime(const QString &string, const QString &format) const
{
#if QT_CONFIG(datetimeparser)
diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h
index 2c7229d28b..af0eb2929e 100644
--- a/src/corelib/tools/qlocale.h
+++ b/src/corelib/tools/qlocale.h
@@ -1009,7 +1009,7 @@ public:
QString dateFormat(FormatType format = LongFormat) const;
QString timeFormat(FormatType format = LongFormat) const;
QString dateTimeFormat(FormatType format = LongFormat) const;
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
QDate toDate(const QString &string, FormatType = LongFormat) const;
QTime toTime(const QString &string, FormatType = LongFormat) const;
QDateTime toDateTime(const QString &string, FormatType format = LongFormat) const;
diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp
index 62eeb74727..5ce7e309bb 100644
--- a/src/gui/image/qimagewriter.cpp
+++ b/src/gui/image/qimagewriter.cpp
@@ -264,7 +264,7 @@ QImageWriterPrivate::QImageWriterPrivate(QImageWriter *qq)
deleteDevice = false;
handler = 0;
quality = -1;
- compression = 0;
+ compression = -1;
gamma = 0.0;
optimizedWrite = false;
progressiveScanWrite = false;
diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp
index b456c1ca31..b787629f6a 100644
--- a/src/gui/kernel/qplatformdialoghelper.cpp
+++ b/src/gui/kernel/qplatformdialoghelper.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -44,6 +44,7 @@
#include <QtCore/QSharedData>
#include <QtCore/QSettings>
#include <QtCore/QUrl>
+#include <QtCore/QVector>
#include <QtGui/QColor>
#include <algorithm>
@@ -786,7 +787,8 @@ class QMessageDialogOptionsPrivate : public QSharedData
public:
QMessageDialogOptionsPrivate() :
icon(QMessageDialogOptions::NoIcon),
- buttons(QPlatformDialogHelper::Ok)
+ buttons(QPlatformDialogHelper::Ok),
+ nextCustomButtonId(QPlatformDialogHelper::LastButton + 1)
{}
QString windowTitle;
@@ -795,6 +797,8 @@ public:
QString informativeText;
QString detailedText;
QPlatformDialogHelper::StandardButtons buttons;
+ QVector<QMessageDialogOptions::CustomButton> customButtons;
+ int nextCustomButtonId;
};
QMessageDialogOptions::QMessageDialogOptions(QMessageDialogOptionsPrivate *dd)
@@ -886,6 +890,35 @@ QPlatformDialogHelper::StandardButtons QMessageDialogOptions::standardButtons()
return d->buttons;
}
+int QMessageDialogOptions::addButton(const QString &label, QPlatformDialogHelper::ButtonRole role,
+ void *buttonImpl)
+{
+ const CustomButton b(d->nextCustomButtonId++, label, role, buttonImpl);
+ d->customButtons.append(b);
+ return b.id;
+}
+
+static inline bool operator==(const QMessageDialogOptions::CustomButton &a,
+ const QMessageDialogOptions::CustomButton &b) {
+ return a.id == b.id;
+}
+
+void QMessageDialogOptions::removeButton(int id)
+{
+ d->customButtons.removeOne(CustomButton(id));
+}
+
+const QVector<QMessageDialogOptions::CustomButton> &QMessageDialogOptions::customButtons()
+{
+ return d->customButtons;
+}
+
+const QMessageDialogOptions::CustomButton *QMessageDialogOptions::customButton(int id)
+{
+ int i = d->customButtons.indexOf(CustomButton(id));
+ return (i < 0 ? nullptr : &d->customButtons.at(i));
+}
+
QPlatformDialogHelper::ButtonRole QPlatformDialogHelper::buttonRole(QPlatformDialogHelper::StandardButton button)
{
switch (button) {
diff --git a/src/gui/kernel/qplatformdialoghelper.h b/src/gui/kernel/qplatformdialoghelper.h
index 3000bd1af1..2c050535d8 100644
--- a/src/gui/kernel/qplatformdialoghelper.h
+++ b/src/gui/kernel/qplatformdialoghelper.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -460,6 +460,26 @@ public:
void setStandardButtons(QPlatformDialogHelper::StandardButtons buttons);
QPlatformDialogHelper::StandardButtons standardButtons() const;
+ struct CustomButton {
+ explicit CustomButton(
+ int id = -1, const QString &label = QString(),
+ QPlatformDialogHelper::ButtonRole role = QPlatformDialogHelper::InvalidRole,
+ void *button = nullptr) :
+ label(label), role(role), id(id), button(button)
+ {}
+
+ QString label;
+ QPlatformDialogHelper::ButtonRole role;
+ int id;
+ void *button; // strictly internal use only
+ };
+
+ int addButton(const QString &label, QPlatformDialogHelper::ButtonRole role,
+ void *buttonImpl = nullptr);
+ void removeButton(int id);
+ const QVector<CustomButton> &customButtons();
+ const CustomButton *customButton(int id);
+
private:
QMessageDialogOptionsPrivate *d;
};
diff --git a/src/gui/kernel/qplatformscreen.cpp b/src/gui/kernel/qplatformscreen.cpp
index 358ff16930..9614be7f3e 100644
--- a/src/gui/kernel/qplatformscreen.cpp
+++ b/src/gui/kernel/qplatformscreen.cpp
@@ -72,7 +72,7 @@ QPlatformScreen::~QPlatformScreen()
This function is called when Qt needs to be able to grab the content of a window.
- Returnes the content of the window specified with the WId handle within the boundaries of
+ Returns the content of the window specified with the WId handle within the boundaries of
QRect(x,y,width,height).
*/
QPixmap QPlatformScreen::grabWindow(WId window, int x, int y, int width, int height) const
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp
index e83f76fb06..50f05721f7 100644
--- a/src/gui/kernel/qplatformwindow.cpp
+++ b/src/gui/kernel/qplatformwindow.cpp
@@ -140,7 +140,7 @@ void QPlatformWindow::setGeometry(const QRect &rect)
}
/*!
- Returnes the current geometry of a window
+ Returns the current geometry of a window
*/
QRect QPlatformWindow::geometry() const
{
diff --git a/src/gui/opengl/qopenglbuffer.cpp b/src/gui/opengl/qopenglbuffer.cpp
index 69c2baa8d9..000494244d 100644
--- a/src/gui/opengl/qopenglbuffer.cpp
+++ b/src/gui/opengl/qopenglbuffer.cpp
@@ -43,6 +43,10 @@
#include "qopenglbuffer.h"
#include <private/qopenglextensions_p.h>
+#ifndef GL_CONTEXT_LOST
+#define GL_CONTEXT_LOST 0x0507
+#endif
+
QT_BEGIN_NAMESPACE
/*!
@@ -346,7 +350,14 @@ bool QOpenGLBuffer::read(int offset, void *data, int count)
Q_D(QOpenGLBuffer);
if (!d->funcs->hasOpenGLFeature(QOpenGLFunctions::Buffers) || !d->guard->id())
return false;
- while (d->funcs->glGetError() != GL_NO_ERROR) ; // Clear error state.
+
+ while (true) { // Clear error state.
+ GLenum error = d->funcs->glGetError();
+ if (error == GL_NO_ERROR)
+ break;
+ if (error == GL_CONTEXT_LOST)
+ return false;
+ };
d->funcs->glGetBufferSubData(d->type, offset, count, data);
return d->funcs->glGetError() == GL_NO_ERROR;
#else
diff --git a/src/gui/opengl/qopengldebug.cpp b/src/gui/opengl/qopengldebug.cpp
index f6c3af37dd..7072db5af4 100644
--- a/src/gui/opengl/qopengldebug.cpp
+++ b/src/gui/opengl/qopengldebug.cpp
@@ -100,6 +100,10 @@ QT_BEGIN_NAMESPACE
\endcode
+ If you try to clear the error stack, make sure not just keep going until
+ GL_NO_ERROR is returned but also break on GL_CONTEXT_LOST as that error
+ value will keep repeating.
+
There are also many other information we are interested in (as application
developers), for instance performance issues, or warnings about using
deprecated APIs. Those kind of messages are not reported through the
diff --git a/src/gui/opengl/qopenglprogrambinarycache.cpp b/src/gui/opengl/qopenglprogrambinarycache.cpp
index f2d093ebed..0f03101329 100644
--- a/src/gui/opengl/qopenglprogrambinarycache.cpp
+++ b/src/gui/opengl/qopenglprogrambinarycache.cpp
@@ -54,6 +54,10 @@ QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(DBG_SHADER_CACHE)
+#ifndef GL_CONTEXT_LOST
+#define GL_CONTEXT_LOST 0x0507
+#endif
+
#ifndef GL_PROGRAM_BINARY_LENGTH
#define GL_PROGRAM_BINARY_LENGTH 0x8741
#endif
@@ -161,7 +165,11 @@ bool QOpenGLProgramBinaryCache::verifyHeader(const QByteArray &buf) const
bool QOpenGLProgramBinaryCache::setProgramBinary(uint programId, uint blobFormat, const void *p, uint blobSize)
{
QOpenGLExtraFunctions *funcs = QOpenGLContext::currentContext()->extraFunctions();
- while (funcs->glGetError() != GL_NO_ERROR) { }
+ while (true) {
+ GLenum error = funcs->glGetError();
+ if (error == GL_NO_ERROR || error == GL_CONTEXT_LOST)
+ break;
+ }
funcs->glProgramBinary(programId, blobFormat, p, blobSize);
GLenum err = funcs->glGetError();
@@ -337,7 +345,11 @@ void QOpenGLProgramBinaryCache::save(const QByteArray &cacheKey, uint programId)
QOpenGLExtraFunctions *funcs = QOpenGLContext::currentContext()->extraFunctions();
GLint blobSize = 0;
- while (funcs->glGetError() != GL_NO_ERROR) { }
+ while (true) {
+ GLenum error = funcs->glGetError();
+ if (error == GL_NO_ERROR || error == GL_CONTEXT_LOST)
+ break;
+ }
funcs->glGetProgramiv(programId, GL_PROGRAM_BINARY_LENGTH, &blobSize);
const int headerSize = FULL_HEADER_SIZE(info.glvendor.size() + info.glrenderer.size() + info.glversion.size());
diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp
index 6d7aecac6f..c39177080d 100644
--- a/src/gui/opengl/qopenglshaderprogram.cpp
+++ b/src/gui/opengl/qopenglshaderprogram.cpp
@@ -39,7 +39,7 @@
#include "qopenglshaderprogram.h"
#include "qopenglprogrambinarycache_p.h"
-#include "qopenglfunctions.h"
+#include "qopenglextrafunctions.h"
#include "private/qopenglcontext_p.h"
#include <QtCore/private/qobject_p.h>
#include <QtCore/qdebug.h>
@@ -170,13 +170,13 @@ QT_BEGIN_NAMESPACE
\value Vertex Vertex shader written in the OpenGL Shading Language (GLSL).
\value Fragment Fragment shader written in the OpenGL Shading Language (GLSL).
\value Geometry Geometry shaders written in the OpenGL Shading Language (GLSL)
- based on the OpenGL core feature (requires OpenGL >= 3.2).
+ (requires OpenGL >= 3.2 or OpenGL ES >= 3.2).
\value TessellationControl Tessellation control shaders written in the OpenGL
- shading language (GLSL), based on the core feature (requires OpenGL >= 4.0).
+ shading language (GLSL) (requires OpenGL >= 4.0 or OpenGL ES >= 3.2).
\value TessellationEvaluation Tessellation evaluation shaders written in the OpenGL
- shading language (GLSL), based on the core feature (requires OpenGL >= 4.0).
- \value Compute Compute shaders written in the OpenGL shading language (GLSL),
- based on the core feature (requires OpenGL >= 4.3).
+ shading language (GLSL) (requires OpenGL >= 4.0 or OpenGL ES >= 3.2).
+ \value Compute Compute shaders written in the OpenGL shading language (GLSL)
+ (requires OpenGL >= 4.3 or OpenGL ES >= 3.1).
*/
Q_LOGGING_CATEGORY(DBG_SHADER_CACHE, "qt.opengl.diskcache")
@@ -223,26 +223,18 @@ static inline bool isFormatGLES(const QSurfaceFormat &f)
static inline bool supportsGeometry(const QSurfaceFormat &f)
{
-#ifndef QT_OPENGL_ES_2
- if (!isFormatGLES(f))
- return (f.version() >= qMakePair<int, int>(3, 2));
- else
- return false;
-#else
- Q_UNUSED(f);
- return false;
-#endif
+ return f.version() >= qMakePair(3, 2);
}
static inline bool supportsCompute(const QSurfaceFormat &f)
{
#ifndef QT_OPENGL_ES_2
if (!isFormatGLES(f))
- return (f.version() >= qMakePair<int, int>(4, 3));
+ return f.version() >= qMakePair(4, 3);
else
- return (f.version() >= qMakePair<int, int>(3, 1));
+ return f.version() >= qMakePair(3, 1);
#else
- return (f.version() >= qMakePair<int, int>(3, 1));
+ return f.version() >= qMakePair(3, 1);
#endif
}
@@ -250,12 +242,11 @@ static inline bool supportsTessellation(const QSurfaceFormat &f)
{
#ifndef QT_OPENGL_ES_2
if (!isFormatGLES(f))
- return (f.version() >= qMakePair<int, int>(4, 0));
+ return f.version() >= qMakePair(4, 0);
else
- return false;
+ return f.version() >= qMakePair(3, 2);
#else
- Q_UNUSED(f);
- return false;
+ return f.version() >= qMakePair(3, 2);
#endif
}
@@ -267,7 +258,7 @@ public:
: shaderGuard(0)
, shaderType(type)
, compiled(false)
- , glfuncs(new QOpenGLFunctions(ctx))
+ , glfuncs(new QOpenGLExtraFunctions(ctx))
, supportsGeometryShaders(false)
, supportsTessellationShaders(false)
, supportsComputeShaders(false)
@@ -286,7 +277,7 @@ public:
bool compiled;
QString log;
- QOpenGLFunctions *glfuncs;
+ QOpenGLExtraFunctions *glfuncs;
// Support for geometry shaders
bool supportsGeometryShaders;
@@ -802,7 +793,7 @@ public:
, linked(false)
, inited(false)
, removingShaders(false)
- , glfuncs(new QOpenGLFunctions)
+ , glfuncs(new QOpenGLExtraFunctions)
#ifndef QT_OPENGL_ES_2
, tessellationFuncs(0)
#endif
@@ -820,10 +811,9 @@ public:
QList<QOpenGLShader *> shaders;
QList<QOpenGLShader *> anonShaders;
- QOpenGLFunctions *glfuncs;
-
+ QOpenGLExtraFunctions *glfuncs;
#ifndef QT_OPENGL_ES_2
- // Tessellation shader support
+ // for tessellation features not in GLES 3.2
QOpenGLFunctions_4_0_Core *tessellationFuncs;
#endif
@@ -913,10 +903,7 @@ bool QOpenGLShaderProgram::init()
d->glfuncs->initializeOpenGLFunctions();
#ifndef QT_OPENGL_ES_2
- // Resolve OpenGL 4 functions for tessellation shader support
- QSurfaceFormat format = context->format();
- if (!context->isOpenGLES()
- && format.version() >= qMakePair<int, int>(4, 0)) {
+ if (!context->isOpenGLES() && context->format().version() >= qMakePair(4, 0)) {
d->tessellationFuncs = context->versionFunctions<QOpenGLFunctions_4_0_Core>();
d->tessellationFuncs->initializeOpenGLFunctions();
}
@@ -3508,13 +3495,8 @@ int QOpenGLShaderProgram::maxGeometryOutputVertices() const
*/
void QOpenGLShaderProgram::setPatchVertexCount(int count)
{
-#ifndef QT_OPENGL_ES_2
Q_D(QOpenGLShaderProgram);
- if (d->tessellationFuncs)
- d->tessellationFuncs->glPatchParameteri(GL_PATCH_VERTICES, count);
-#else
- Q_UNUSED(count);
-#endif
+ d->glfuncs->glPatchParameteri(GL_PATCH_VERTICES, count);
}
/*!
@@ -3527,15 +3509,10 @@ void QOpenGLShaderProgram::setPatchVertexCount(int count)
*/
int QOpenGLShaderProgram::patchVertexCount() const
{
-#ifndef QT_OPENGL_ES_2
int patchVertices = 0;
Q_D(const QOpenGLShaderProgram);
- if (d->tessellationFuncs)
- d->tessellationFuncs->glGetIntegerv(GL_PATCH_VERTICES, &patchVertices);
+ d->glfuncs->glGetIntegerv(GL_PATCH_VERTICES, &patchVertices);
return patchVertices;
-#else
- return 0;
-#endif
}
/*!
@@ -3553,6 +3530,9 @@ int QOpenGLShaderProgram::patchVertexCount() const
function when needed, as QOpenGLShaderProgram will not apply this for
you. This is purely a convenience function.
+ \note This function is only available with OpenGL >= 4.0 and is not supported
+ with OpenGL ES 3.2.
+
\sa defaultOuterTessellationLevels(), setDefaultInnerTessellationLevels()
*/
void QOpenGLShaderProgram::setDefaultOuterTessellationLevels(const QVector<float> &levels)
@@ -3590,6 +3570,9 @@ void QOpenGLShaderProgram::setDefaultOuterTessellationLevels(const QVector<float
\note This returns the global OpenGL state value. It is not specific to
this QOpenGLShaderProgram instance.
+ \note This function is only supported with OpenGL >= 4.0 and will not
+ return valid results with OpenGL ES 3.2.
+
\sa setDefaultOuterTessellationLevels(), defaultInnerTessellationLevels()
*/
QVector<float> QOpenGLShaderProgram::defaultOuterTessellationLevels() const
@@ -3620,6 +3603,9 @@ QVector<float> QOpenGLShaderProgram::defaultOuterTessellationLevels() const
function when needed, as QOpenGLShaderProgram will not apply this for
you. This is purely a convenience function.
+ \note This function is only available with OpenGL >= 4.0 and is not supported
+ with OpenGL ES 3.2.
+
\sa defaultInnerTessellationLevels(), setDefaultOuterTessellationLevels()
*/
void QOpenGLShaderProgram::setDefaultInnerTessellationLevels(const QVector<float> &levels)
@@ -3657,6 +3643,9 @@ void QOpenGLShaderProgram::setDefaultInnerTessellationLevels(const QVector<float
\note This returns the global OpenGL state value. It is not specific to
this QOpenGLShaderProgram instance.
+ \note This function is only supported with OpenGL >= 4.0 and will not
+ return valid results with OpenGL ES 3.2.
+
\sa setDefaultInnerTessellationLevels(), defaultOuterTessellationLevels()
*/
QVector<float> QOpenGLShaderProgram::defaultInnerTessellationLevels() const
diff --git a/src/gui/painting/qcosmeticstroker_p.h b/src/gui/painting/qcosmeticstroker_p.h
index 68f4e00cdc..082ddee30f 100644
--- a/src/gui/painting/qcosmeticstroker_p.h
+++ b/src/gui/painting/qcosmeticstroker_p.h
@@ -85,6 +85,7 @@ public:
// used to avoid drop outs or duplicated points
enum Direction {
+ NoDirection = 0,
TopToBottom = 0x1,
BottomToTop = 0x2,
LeftToRight = 0x4,
@@ -104,7 +105,7 @@ public:
patternOffset(0),
legacyRounding(false),
current_span(0),
- lastDir(LeftToRight),
+ lastDir(NoDirection),
lastAxisAligned(false)
{ setup(); }
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 4b1031daaf..0264059a5c 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -5205,8 +5205,10 @@ void qBlendTexture(int count, const QSpan *spans, void *userData)
case QImage::Format_RGB16:
proc = processTextureSpansRGB16[blendType];
break;
+#if defined(__SSE2__) || defined(__ARM_NEON__) || (Q_PROCESSOR_WORDSIZE == 8)
case QImage::Format_ARGB32:
case QImage::Format_RGBA8888:
+#endif
case QImage::Format_BGR30:
case QImage::Format_A2BGR30_Premultiplied:
case QImage::Format_RGB30:
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index f32c31d18e..af8fcf369c 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -80,7 +80,8 @@ QTextCursorPrivate::QTextCursorPrivate(const QTextCursorPrivate &rhs)
visualNavigation = rhs.visualNavigation;
keepPositionOnInsert = rhs.keepPositionOnInsert;
changed = rhs.changed;
- priv->addCursor(this);
+ if (priv != nullptr)
+ priv->addCursor(this);
}
QTextCursorPrivate::~QTextCursorPrivate()
diff --git a/src/network/access/access.pri b/src/network/access/access.pri
index b068f96283..8a92308f12 100644
--- a/src/network/access/access.pri
+++ b/src/network/access/access.pri
@@ -24,8 +24,7 @@ HEADERS += \
access/qabstractnetworkcache.h \
access/qnetworkfile_p.h \
access/qhsts_p.h \
- access/qhstspolicy.h \
- access/qhstsstore_p.h
+ access/qhstspolicy.h
SOURCES += \
access/qnetworkaccessauthenticationmanager.cpp \
@@ -45,8 +44,7 @@ SOURCES += \
access/qabstractnetworkcache.cpp \
access/qnetworkfile.cpp \
access/qhsts.cpp \
- access/qhstspolicy.cpp \
- access/qhstsstore.cpp
+ access/qhstspolicy.cpp
qtConfig(ftp) {
HEADERS += \
@@ -66,6 +64,14 @@ qtConfig(networkdiskcache) {
SOURCES += access/qnetworkdiskcache.cpp
}
+qtConfig(settings) {
+ HEADERS += \
+ access/qhstsstore_p.h
+
+ SOURCES += \
+ access/qhstsstore.cpp
+}
+
mac: LIBS_PRIVATE += -framework Security
wasm {
diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp
index 719e3536b4..feece4ebaf 100644
--- a/src/network/access/qftp.cpp
+++ b/src/network/access/qftp.cpp
@@ -525,7 +525,7 @@ static void _q_parseUnixDir(const QStringList &tokens, const QString &userName,
// Resolve the modification date by parsing all possible formats
QDateTime dateTime;
int n = 0;
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
do {
dateTime = QLocale::c().toDateTime(dateString, formats.at(n++));
} while (n < formats.size() && (!dateTime.isValid()));
@@ -600,7 +600,7 @@ static void _q_parseDosDir(const QStringList &tokens, const QString &userName, Q
info->setWritable(info->isFile());
QDateTime dateTime;
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
dateTime = QLocale::c().toDateTime(tokens.at(1), QLatin1String("MM-dd-yy hh:mmAP"));
if (dateTime.date().year() < 1971) {
dateTime.setDate(QDate(dateTime.date().year() + 100,
diff --git a/src/network/access/qhsts.cpp b/src/network/access/qhsts.cpp
index a015feb044..ce70b6af90 100644
--- a/src/network/access/qhsts.cpp
+++ b/src/network/access/qhsts.cpp
@@ -37,13 +37,16 @@
**
****************************************************************************/
-#include "qhstsstore_p.h"
#include "qhsts_p.h"
#include "QtCore/private/qipaddress_p.h"
#include "QtCore/qvector.h"
#include "QtCore/qlist.h"
+#if QT_CONFIG(settings)
+#include "qhstsstore_p.h"
+#endif // QT_CONFIG(settings)
+
QT_BEGIN_NAMESPACE
static bool is_valid_domain_name(const QString &host)
@@ -83,8 +86,10 @@ void QHstsCache::updateFromHeaders(const QList<QPair<QByteArray, QByteArray>> &h
QHstsHeaderParser parser;
if (parser.parse(headers)) {
updateKnownHost(url.host(), parser.expirationDate(), parser.includeSubDomains());
+#if QT_CONFIG(settings)
if (hstsStore)
hstsStore->synchronize();
+#endif // QT_CONFIG(settings)
}
}
@@ -93,12 +98,14 @@ void QHstsCache::updateFromPolicies(const QVector<QHstsPolicy> &policies)
for (const auto &policy : policies)
updateKnownHost(policy.host(), policy.expiry(), policy.includesSubDomains());
+#if QT_CONFIG(settings)
if (hstsStore && policies.size()) {
// These policies are coming either from store or from QNAM's setter
// function. As a result we can notice expired or new policies, time
// to sync ...
hstsStore->synchronize();
}
+#endif // QT_CONFIG(settings)
}
void QHstsCache::updateKnownHost(const QUrl &url, const QDateTime &expires,
@@ -108,8 +115,10 @@ void QHstsCache::updateKnownHost(const QUrl &url, const QDateTime &expires,
return;
updateKnownHost(url.host(), expires, includeSubDomains);
+#if QT_CONFIG(settings)
if (hstsStore)
hstsStore->synchronize();
+#endif // QT_CONFIG(settings)
}
void QHstsCache::updateKnownHost(const QString &host, const QDateTime &expires,
@@ -137,8 +146,10 @@ void QHstsCache::updateKnownHost(const QString &host, const QDateTime &expires,
}
knownHosts.insert(pos, {hostName, newPolicy});
+#if QT_CONFIG(settings)
if (hstsStore)
hstsStore->addToObserved(newPolicy);
+#endif // QT_CONFIG(settings)
return;
}
@@ -149,8 +160,10 @@ void QHstsCache::updateKnownHost(const QString &host, const QDateTime &expires,
else
return;
+#if QT_CONFIG(settings)
if (hstsStore)
hstsStore->addToObserved(newPolicy);
+#endif // QT_CONFIG(settings)
}
bool QHstsCache::isKnownHost(const QUrl &url) const
@@ -187,10 +200,12 @@ bool QHstsCache::isKnownHost(const QUrl &url) const
if (pos != knownHosts.end()) {
if (pos->second.isExpired()) {
knownHosts.erase(pos);
+#if QT_CONFIG(settings)
if (hstsStore) {
// Inform our store that this policy has expired.
hstsStore->addToObserved(pos->second);
}
+#endif // QT_CONFIG(settings)
} else if (!superDomainMatch || pos->second.includesSubDomains()) {
return true;
}
@@ -221,6 +236,7 @@ QVector<QHstsPolicy> QHstsCache::policies() const
return values;
}
+#if QT_CONFIG(settings)
void QHstsCache::setStore(QHstsStore *store)
{
// Caller retains ownership of store, which must outlive this cache.
@@ -248,6 +264,7 @@ void QHstsCache::setStore(QHstsStore *store)
updateFromPolicies(restored);
}
}
+#endif // QT_CONFIG(settings)
// The parser is quite simple: 'nextToken' knowns exactly what kind of tokens
// are valid and it will return false if something else was found; then
diff --git a/src/network/access/qhsts_p.h b/src/network/access/qhsts_p.h
index bc8708341d..c219d9eab5 100644
--- a/src/network/access/qhsts_p.h
+++ b/src/network/access/qhsts_p.h
@@ -69,8 +69,6 @@ QT_BEGIN_NAMESPACE
template<typename T> class QList;
template <typename T> class QVector;
-class QHstsStore;
-
class Q_AUTOTEST_EXPORT QHstsCache
{
public:
@@ -85,7 +83,9 @@ public:
QVector<QHstsPolicy> policies() const;
- void setStore(QHstsStore *store);
+#if QT_CONFIG(settings)
+ void setStore(class QHstsStore *store);
+#endif // QT_CONFIG(settings)
private:
@@ -119,7 +119,9 @@ private:
};
mutable std::map<HostName, QHstsPolicy> knownHosts;
+#if QT_CONFIG(settings)
QHstsStore *hstsStore = nullptr;
+#endif // QT_CONFIG(settings)
};
class Q_AUTOTEST_EXPORT QHstsHeaderParser
diff --git a/src/network/access/qhstsstore_p.h b/src/network/access/qhstsstore_p.h
index 13042839c4..e82596b250 100644
--- a/src/network/access/qhstsstore_p.h
+++ b/src/network/access/qhstsstore_p.h
@@ -53,6 +53,8 @@
#include <QtNetwork/private/qtnetworkglobal_p.h>
+QT_REQUIRE_CONFIG(settings);
+
#include <QtCore/qsettings.h>
#include <QtCore/qvector.h>
diff --git a/src/network/access/qnetworkaccessftpbackend.cpp b/src/network/access/qnetworkaccessftpbackend.cpp
index 269845ed39..fd6589b396 100644
--- a/src/network/access/qnetworkaccessftpbackend.cpp
+++ b/src/network/access/qnetworkaccessftpbackend.cpp
@@ -423,7 +423,7 @@ void QNetworkAccessFtpBackend::ftpRawCommandReply(int code, const QString &text)
if (id == sizeId) {
// reply to the size command
setHeader(QNetworkRequest::ContentLengthHeader, text.toLongLong());
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
} else if (id == mdtmId) {
QDateTime dt = QDateTime::fromString(text, QLatin1String("yyyyMMddHHmmss"));
setHeader(QNetworkRequest::LastModifiedHeader, dt);
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index bec98a3f58..263469ce38 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -48,6 +48,10 @@
#include "qhstspolicy.h"
#include "qhsts_p.h"
+#if QT_CONFIG(settings)
+#include "qhstsstore_p.h"
+#endif // QT_CONFIG(settings)
+
#include "QtNetwork/qnetworksession.h"
#include "QtNetwork/private/qsharednetworksession_p.h"
@@ -763,9 +767,14 @@ bool QNetworkAccessManager::isStrictTransportSecurityEnabled() const
void QNetworkAccessManager::enableStrictTransportSecurityStore(bool enabled, const QString &storeDir)
{
+#if QT_CONFIG(settings)
Q_D(QNetworkAccessManager);
d->stsStore.reset(enabled ? new QHstsStore(storeDir) : nullptr);
d->stsCache.setStore(d->stsStore.data());
+#else
+ Q_UNUSED(enabled) Q_UNUSED(storeDir)
+ qWarning("HSTS permanent store requires the feature 'settings' enabled");
+#endif // QT_CONFIG(settings)
}
/*!
@@ -779,8 +788,12 @@ void QNetworkAccessManager::enableStrictTransportSecurityStore(bool enabled, con
bool QNetworkAccessManager::isStrictTransportSecurityStoreEnabled() const
{
+#if QT_CONFIG(settings)
Q_D(const QNetworkAccessManager);
return bool(d->stsStore.data());
+#else
+ return false;
+#endif // QT_CONFIG(settings)
}
/*!
@@ -930,7 +943,7 @@ QNetworkReply *QNetworkAccessManager::put(const QNetworkRequest &request, QHttpM
/*!
Uploads the contents of \a data to the destination \a request and
- returnes a new QNetworkReply object that will be open for reply.
+ returns a new QNetworkReply object that will be open for reply.
\a data must be opened for reading when this function is called
and must remain valid until the finished() signal is emitted for
diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h
index ffed24a314..5cab4928e4 100644
--- a/src/network/access/qnetworkaccessmanager_p.h
+++ b/src/network/access/qnetworkaccessmanager_p.h
@@ -56,7 +56,6 @@
#include "qnetworkaccesscache_p.h"
#include "qnetworkaccessbackend_p.h"
#include "qnetworkrequest.h"
-#include "qhstsstore_p.h"
#include "qhsts_p.h"
#include "private/qobject_p.h"
#include "QtNetwork/qnetworkproxy.h"
@@ -66,6 +65,10 @@
#include "QtNetwork/qnetworkconfigmanager.h"
#endif
+#if QT_CONFIG(settings)
+#include "qhstsstore_p.h"
+#endif // QT_CONFIG(settings)
+
QT_BEGIN_NAMESPACE
class QAuthenticator;
@@ -215,7 +218,9 @@ public:
Q_AUTOTEST_EXPORT static void clearConnectionCache(QNetworkAccessManager *manager);
QHstsCache stsCache;
+#if QT_CONFIG(settings)
QScopedPointer<QHstsStore> stsStore;
+#endif // QT_CONFIG(settings)
bool stsEnabled = false;
#ifndef QT_NO_BEARERMANAGEMENT
diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp
index 57529761ee..689eecfbb9 100644
--- a/src/network/access/qnetworkrequest.cpp
+++ b/src/network/access/qnetworkrequest.cpp
@@ -47,7 +47,7 @@
#include "QtCore/qdatetime.h"
#include <ctype.h>
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
# include <stdio.h>
#endif
@@ -1273,7 +1273,7 @@ QDateTime QNetworkHeadersPrivate::fromHttpDate(const QByteArray &value)
int pos = value.indexOf(',');
QDateTime dt;
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
if (pos == -1) {
// no comma -> asctime(3) format
dt = QDateTime::fromString(QString::fromLatin1(value), Qt::TextDate);
@@ -1300,7 +1300,7 @@ QDateTime QNetworkHeadersPrivate::fromHttpDate(const QByteArray &value)
dt = c.toDateTime(sansWeekday, QLatin1String("dd-MMM-yy hh:mm:ss 'GMT'"));
}
}
-#endif // QT_NO_DATESTRING
+#endif // datestring
if (dt.isValid())
dt.setTimeSpec(Qt::UTC);
diff --git a/src/network/kernel/qdnslookup.cpp b/src/network/kernel/qdnslookup.cpp
index 10ff35b72c..1b66829070 100644
--- a/src/network/kernel/qdnslookup.cpp
+++ b/src/network/kernel/qdnslookup.cpp
@@ -49,7 +49,9 @@
QT_BEGIN_NAMESPACE
+#if QT_CONFIG(thread)
Q_GLOBAL_STATIC(QDnsLookupThreadPool, theDnsLookupThreadPool);
+#endif
static bool qt_qdnsmailexchangerecord_less_than(const QDnsMailExchangeRecord &r1, const QDnsMailExchangeRecord &r2)
{
@@ -503,7 +505,9 @@ void QDnsLookup::lookup()
connect(d->runnable, SIGNAL(finished(QDnsLookupReply)),
this, SLOT(_q_lookupFinished(QDnsLookupReply)),
Qt::BlockingQueuedConnection);
+#if QT_CONFIG(thread)
theDnsLookupThreadPool()->start(d->runnable);
+#endif
}
/*!
@@ -1016,6 +1020,7 @@ void QDnsLookupRunnable::run()
emit finished(reply);
}
+#if QT_CONFIG(thread)
QDnsLookupThreadPool::QDnsLookupThreadPool()
: signalsConnected(false)
{
@@ -1051,7 +1056,7 @@ void QDnsLookupThreadPool::_q_applicationDestroyed()
waitForDone();
signalsConnected = false;
}
-
+#endif // QT_CONFIG(thread)
QT_END_NAMESPACE
#include "moc_qdnslookup.cpp"
diff --git a/src/network/kernel/qdnslookup_p.h b/src/network/kernel/qdnslookup_p.h
index 4584396efe..2dc98e527a 100644
--- a/src/network/kernel/qdnslookup_p.h
+++ b/src/network/kernel/qdnslookup_p.h
@@ -55,7 +55,9 @@
#include "QtCore/qmutex.h"
#include "QtCore/qrunnable.h"
#include "QtCore/qsharedpointer.h"
+#if QT_CONFIG(thread)
#include "QtCore/qthreadpool.h"
+#endif
#include "QtNetwork/qdnslookup.h"
#include "QtNetwork/qhostaddress.h"
#include "private/qobject_p.h"
@@ -132,6 +134,7 @@ private:
QHostAddress nameserver;
};
+#if QT_CONFIG(thread)
class QDnsLookupThreadPool : public QThreadPool
{
Q_OBJECT
@@ -147,6 +150,7 @@ private:
QMutex signalsMutex;
bool signalsConnected;
};
+#endif // QT_CONFIG(thread)
class QDnsRecordPrivate : public QSharedData
{
diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp
index 4682070712..0973d0dd52 100644
--- a/src/network/kernel/qhostinfo.cpp
+++ b/src/network/kernel/qhostinfo.cpp
@@ -704,6 +704,7 @@ void QHostInfoRunnable::run()
hostInfo.setLookupId(id);
resultEmitter.emitResultsReady(hostInfo);
+#if QT_CONFIG(thread)
// now also iterate through the postponed ones
{
QMutexLocker locker(&manager->mutex);
@@ -720,6 +721,7 @@ void QHostInfoRunnable::run()
manager->postponedLookups.erase(partitionBegin, partitionEnd);
}
+#endif
manager->lookupFinished(this);
// thread goes back to QThreadPool
@@ -728,8 +730,10 @@ void QHostInfoRunnable::run()
QHostInfoLookupManager::QHostInfoLookupManager() : mutex(QMutex::Recursive), wasDeleted(false)
{
moveToThread(QCoreApplicationPrivate::mainThread());
+#if QT_CONFIG(thread)
connect(QCoreApplication::instance(), SIGNAL(destroyed()), SLOT(waitForThreadPoolDone()), Qt::DirectConnection);
threadPool.setMaxThreadCount(20); // do up to 20 DNS lookups in parallel
+#endif
}
QHostInfoLookupManager::~QHostInfoLookupManager()
@@ -744,15 +748,19 @@ void QHostInfoLookupManager::clear()
{
{
QMutexLocker locker(&mutex);
- qDeleteAll(postponedLookups);
qDeleteAll(scheduledLookups);
qDeleteAll(finishedLookups);
+#if QT_CONFIG(thread)
+ qDeleteAll(postponedLookups);
postponedLookups.clear();
+#endif
scheduledLookups.clear();
finishedLookups.clear();
}
+#if QT_CONFIG(thread)
threadPool.waitForDone();
+#endif
cache.clear();
}
@@ -776,6 +784,7 @@ void QHostInfoLookupManager::work()
finishedLookups.clear();
}
+#if QT_CONFIG(thread)
auto isAlreadyRunning = [this](QHostInfoRunnable *lookup) {
return any_of(currentLookups.cbegin(), currentLookups.cend(), ToBeLookedUpEquals(lookup->toBeLookedUp));
};
@@ -808,6 +817,10 @@ void QHostInfoLookupManager::work()
}
scheduledLookups.erase(scheduledLookups.begin(), it);
}
+#else
+ if (!scheduledLookups.isEmpty())
+ scheduledLookups.takeFirst()->run();
+#endif
}
// called by QHostInfo
@@ -829,6 +842,7 @@ void QHostInfoLookupManager::abortLookup(int id)
QMutexLocker locker(&this->mutex);
+#if QT_CONFIG(thread)
// is postponed? delete and return
for (int i = 0; i < postponedLookups.length(); i++) {
if (postponedLookups.at(i)->id == id) {
@@ -836,6 +850,7 @@ void QHostInfoLookupManager::abortLookup(int id)
return;
}
}
+#endif
// is scheduled? delete and return
for (int i = 0; i < scheduledLookups.length(); i++) {
@@ -866,7 +881,9 @@ void QHostInfoLookupManager::lookupFinished(QHostInfoRunnable *r)
return;
QMutexLocker locker(&this->mutex);
+#if QT_CONFIG(thread)
currentLookups.removeOne(r);
+#endif
finishedLookups.append(r);
work();
}
diff --git a/src/network/kernel/qhostinfo_p.h b/src/network/kernel/qhostinfo_p.h
index 82cf34719f..8cce302166 100644
--- a/src/network/kernel/qhostinfo_p.h
+++ b/src/network/kernel/qhostinfo_p.h
@@ -61,7 +61,9 @@
#include "QtCore/qobject.h"
#include "QtCore/qpointer.h"
#include "QtCore/qthread.h"
+#if QT_CONFIG(thread)
#include "QtCore/qthreadpool.h"
+#endif
#include "QtCore/qrunnable.h"
#include "QtCore/qlist.h"
#include "QtCore/qqueue.h"
@@ -238,20 +240,25 @@ public:
friend class QHostInfoRunnable;
protected:
+#if QT_CONFIG(thread)
QList<QHostInfoRunnable*> currentLookups; // in progress
QList<QHostInfoRunnable*> postponedLookups; // postponed because in progress for same host
+#endif
QQueue<QHostInfoRunnable*> scheduledLookups; // not yet started
QList<QHostInfoRunnable*> finishedLookups; // recently finished
QList<int> abortedLookups; // ids of aborted lookups
+#if QT_CONFIG(thread)
QThreadPool threadPool;
-
+#endif
QMutex mutex;
bool wasDeleted;
private slots:
+#if QT_CONFIG(thread)
void waitForThreadPoolDone() { threadPool.waitForDone(); }
+#endif
};
QT_END_NAMESPACE
diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp
index 31ff296480..d153e0b929 100644
--- a/src/network/ssl/qsslcertificate.cpp
+++ b/src/network/ssl/qsslcertificate.cpp
@@ -761,7 +761,7 @@ QDebug operator<<(QDebug debug, const QSslCertificate &certificate)
<< ", " << certificate.issuerDisplayName()
<< ", " << certificate.subjectDisplayName()
<< ", " << certificate.subjectAlternativeNames()
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
<< ", " << certificate.effectiveDate()
<< ", " << certificate.expiryDate()
#endif
diff --git a/src/network/ssl/qsslcertificate_openssl.cpp b/src/network/ssl/qsslcertificate_openssl.cpp
index e87264c972..fa87cfeaaf 100644
--- a/src/network/ssl/qsslcertificate_openssl.cpp
+++ b/src/network/ssl/qsslcertificate_openssl.cpp
@@ -44,8 +44,9 @@
#include "qsslkey_p.h"
#include "qsslcertificateextension_p.h"
+#if QT_CONFIG(thread)
#include <QtCore/private/qmutexpool_p.h>
-
+#endif
QT_BEGIN_NAMESPACE
// forward declaration
@@ -90,7 +91,9 @@ bool QSslCertificate::isSelfSigned() const
QByteArray QSslCertificate::version() const
{
+#if QT_CONFIG(thread)
QMutexLocker lock(QMutexPool::globalInstanceGet(d.data()));
+#endif
if (d->versionString.isEmpty() && d->x509)
d->versionString = QByteArray::number(qlonglong(q_X509_get_version(d->x509)) + 1);
@@ -99,7 +102,9 @@ QByteArray QSslCertificate::version() const
QByteArray QSslCertificate::serialNumber() const
{
+#if QT_CONFIG(thread)
QMutexLocker lock(QMutexPool::globalInstanceGet(d.data()));
+#endif
if (d->serialNumberString.isEmpty() && d->x509) {
ASN1_INTEGER *serialNumber = q_X509_get_serialNumber(d->x509);
QByteArray hexString;
@@ -116,7 +121,9 @@ QByteArray QSslCertificate::serialNumber() const
QStringList QSslCertificate::issuerInfo(SubjectInfo info) const
{
+#if QT_CONFIG(thread)
QMutexLocker lock(QMutexPool::globalInstanceGet(d.data()));
+#endif
// lazy init
if (d->issuerInfo.isEmpty() && d->x509)
d->issuerInfo =
@@ -127,7 +134,9 @@ QStringList QSslCertificate::issuerInfo(SubjectInfo info) const
QStringList QSslCertificate::issuerInfo(const QByteArray &attribute) const
{
+#if QT_CONFIG(thread)
QMutexLocker lock(QMutexPool::globalInstanceGet(d.data()));
+#endif
// lazy init
if (d->issuerInfo.isEmpty() && d->x509)
d->issuerInfo =
@@ -138,7 +147,9 @@ QStringList QSslCertificate::issuerInfo(const QByteArray &attribute) const
QStringList QSslCertificate::subjectInfo(SubjectInfo info) const
{
+#if QT_CONFIG(thread)
QMutexLocker lock(QMutexPool::globalInstanceGet(d.data()));
+#endif
// lazy init
if (d->subjectInfo.isEmpty() && d->x509)
d->subjectInfo =
@@ -149,7 +160,9 @@ QStringList QSslCertificate::subjectInfo(SubjectInfo info) const
QStringList QSslCertificate::subjectInfo(const QByteArray &attribute) const
{
+#if QT_CONFIG(thread)
QMutexLocker lock(QMutexPool::globalInstanceGet(d.data()));
+#endif
// lazy init
if (d->subjectInfo.isEmpty() && d->x509)
d->subjectInfo =
@@ -160,7 +173,9 @@ QStringList QSslCertificate::subjectInfo(const QByteArray &attribute) const
QList<QByteArray> QSslCertificate::subjectInfoAttributes() const
{
+#if QT_CONFIG(thread)
QMutexLocker lock(QMutexPool::globalInstanceGet(d.data()));
+#endif
// lazy init
if (d->subjectInfo.isEmpty() && d->x509)
d->subjectInfo =
@@ -171,7 +186,9 @@ QList<QByteArray> QSslCertificate::subjectInfoAttributes() const
QList<QByteArray> QSslCertificate::issuerInfoAttributes() const
{
+#if QT_CONFIG(thread)
QMutexLocker lock(QMutexPool::globalInstanceGet(d.data()));
+#endif
// lazy init
if (d->issuerInfo.isEmpty() && d->x509)
d->issuerInfo =
diff --git a/src/network/ssl/qsslcontext_openssl11.cpp b/src/network/ssl/qsslcontext_openssl11.cpp
index 7d11e51e8b..708cb7bb0e 100644
--- a/src/network/ssl/qsslcontext_openssl11.cpp
+++ b/src/network/ssl/qsslcontext_openssl11.cpp
@@ -159,20 +159,20 @@ init_context:
case QSsl::TlsV1SslV3:
case QSsl::AnyProtocol:
minVersion = SSL3_VERSION;
- maxVersion = TLS_MAX_VERSION;
+ maxVersion = 0;
break;
case QSsl::SecureProtocols:
case QSsl::TlsV1_0OrLater:
minVersion = TLS1_VERSION;
- maxVersion = TLS_MAX_VERSION;
+ maxVersion = 0;
break;
case QSsl::TlsV1_1OrLater:
minVersion = TLS1_1_VERSION;
- maxVersion = TLS_MAX_VERSION;
+ maxVersion = 0;
break;
case QSsl::TlsV1_2OrLater:
minVersion = TLS1_2_VERSION;
- maxVersion = TLS_MAX_VERSION;
+ maxVersion = 0;
break;
#if QT_CONFIG(dtls)
case QSsl::DtlsV1_0:
diff --git a/src/network/ssl/qsslpresharedkeyauthenticator.h b/src/network/ssl/qsslpresharedkeyauthenticator.h
index d0e2eda973..423f7731b4 100644
--- a/src/network/ssl/qsslpresharedkeyauthenticator.h
+++ b/src/network/ssl/qsslpresharedkeyauthenticator.h
@@ -45,6 +45,8 @@
#include <QtCore/QSharedDataPointer>
#include <QtCore/QMetaType>
+QT_REQUIRE_CONFIG(ssl);
+
QT_BEGIN_NAMESPACE
class QSslPreSharedKeyAuthenticatorPrivate;
diff --git a/src/network/ssl/qsslsocket_mac.cpp b/src/network/ssl/qsslsocket_mac.cpp
index 730a9552b5..9166e0ac29 100644
--- a/src/network/ssl/qsslsocket_mac.cpp
+++ b/src/network/ssl/qsslsocket_mac.cpp
@@ -410,7 +410,7 @@ void QSslSocketBackendPrivate::continueHandshake()
Q_Q(QSslSocket);
connectionEncrypted = true;
-#if QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_13, __IPHONE_11_0, __TVOS_11_0, __WATCHOS_4_0)
+#if QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_13_4, __IPHONE_11_0, __TVOS_11_0, __WATCHOS_4_0)
// Unlike OpenSSL, Secure Transport does not allow to negotiate protocols via
// a callback during handshake. We can only set our list of preferred protocols
// (and send it during handshake) and then receive what our peer has sent to us.
@@ -920,7 +920,7 @@ bool QSslSocketBackendPrivate::initSslContext()
return false;
}
-#if QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_13, __IPHONE_11_0, __TVOS_11_0, __WATCHOS_4_0)
+#if QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_13_4, __IPHONE_11_0, __TVOS_11_0, __WATCHOS_4_0)
if (__builtin_available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *)) {
const auto protocolNames = configuration.nextAllowedProtocols;
QCFType<CFMutableArrayRef> cfNames(CFArrayCreateMutable(nullptr, 0, &kCFTypeArrayCallBacks));
diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp
index 63cb276d54..8af9b5d77e 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols.cpp
+++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp
@@ -63,7 +63,9 @@
# include <QtCore/qlibrary.h>
#endif
#include <QtCore/qmutex.h>
+#if QT_CONFIG(thread)
#include <private/qmutexpool_p.h>
+#endif
#include <QtCore/qdatetime.h>
#if defined(Q_OS_UNIX)
#include <QtCore/qdir.h>
@@ -903,11 +905,13 @@ bool q_resolveOpenSslSymbols()
{
static bool symbolsResolved = false;
static bool triedToResolveSymbols = false;
+#if QT_CONFIG(thread)
#if QT_CONFIG(opensslv11)
QMutexLocker locker(QMutexPool::globalInstanceGet((void *)&q_OPENSSL_init_ssl));
#else
QMutexLocker locker(QMutexPool::globalInstanceGet((void *)&q_SSL_library_init));
#endif
+#endif
if (symbolsResolved)
return true;
if (triedToResolveSymbols)
diff --git a/src/platformheaders/cocoafunctions/qcocoawindowfunctions.qdoc b/src/platformheaders/cocoafunctions/qcocoawindowfunctions.qdoc
index 876096e40f..e164a92e22 100644
--- a/src/platformheaders/cocoafunctions/qcocoawindowfunctions.qdoc
+++ b/src/platformheaders/cocoafunctions/qcocoawindowfunctions.qdoc
@@ -46,7 +46,7 @@
/*!
\fn QByteArray QCocoaWindowFunctions::bottomLeftClippedByNSWindowOffsetIdentifier()
- This function returnes the bytearray that can be used to query
+ This function returns the bytearray that can be used to query
QGuiApplication::platformFunction to retrieve the BottomLeftClippedByNSWindowOffset function.
*/
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index 5faeca0618..5ac28ce798 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
@@ -317,9 +317,9 @@ static void getFontDescription(CTFontDescriptorRef font, FontDescription *fd)
if (styles) {
if (CFNumberRef weightValue = (CFNumberRef) CFDictionaryGetValue(styles, kCTFontWeightTrait)) {
- float normalizedWeight;
- if (CFNumberGetValue(weightValue, kCFNumberFloatType, &normalizedWeight))
- fd->weight = QCoreTextFontEngine::qtWeightFromCFWeight(normalizedWeight);
+ double normalizedWeight;
+ if (CFNumberGetValue(weightValue, kCFNumberFloat64Type, &normalizedWeight))
+ fd->weight = QCoreTextFontEngine::qtWeightFromCFWeight(float(normalizedWeight));
}
if (CFNumberRef italic = (CFNumberRef) CFDictionaryGetValue(styles, kCTFontSlantTrait)) {
double d;
diff --git a/src/plugins/platforms/android/qandroidplatformdialoghelpers.cpp b/src/plugins/platforms/android/qandroidplatformdialoghelpers.cpp
index ced35c4cfa..9218afa7f5 100644
--- a/src/plugins/platforms/android/qandroidplatformdialoghelpers.cpp
+++ b/src/plugins/platforms/android/qandroidplatformdialoghelpers.cpp
@@ -1,5 +1,6 @@
/****************************************************************************
**
+** Copyright (C) 2018 The Qt Company Ltd.
** Copyright (C) 2013 BogDan Vatra <bogdan@kde.org>
** Contact: https://www.qt.io/licensing/
**
@@ -117,6 +118,15 @@ bool QAndroidPlatformMessageDialogHelper::show(Qt::WindowFlags windowFlags
void QAndroidPlatformMessageDialogHelper::addButtons(QSharedPointer<QMessageDialogOptions> opt, ButtonRole role)
{
+ for (const QMessageDialogOptions::CustomButton &b : opt->customButtons()) {
+ if (b.role == role) {
+ QString label = b.label;
+ label.remove(QChar('&'));
+ m_javaMessageDialog.callMethod<void>("addButton", "(ILjava/lang/String;)V", b.id,
+ QJNIObjectPrivate::fromString(label).object());
+ }
+ }
+
for (int i = QPlatformDialogHelper::FirstButton; i < QPlatformDialogHelper::LastButton; i<<=1) {
StandardButton b = static_cast<StandardButton>(i);
if (buttonRole(b) == role && (opt->standardButtons() & i)) {
@@ -144,6 +154,12 @@ void QAndroidPlatformMessageDialogHelper::dialogResult(int buttonID)
QPlatformDialogHelper::StandardButton standardButton = static_cast<QPlatformDialogHelper::StandardButton>(buttonID);
QPlatformDialogHelper::ButtonRole role = QPlatformDialogHelper::buttonRole(standardButton);
+ if (buttonID > QPlatformDialogHelper::LastButton) {
+ const QMessageDialogOptions::CustomButton *custom = options()->customButton(buttonID);
+ Q_ASSERT(custom);
+ role = custom->role;
+ }
+
emit clicked(standardButton, role);
}
diff --git a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm
index 60eb8cdf68..c1711e7cd4 100644
--- a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm
+++ b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm
@@ -225,6 +225,9 @@ QHash<QPlatformTheme::Palette, QPalette*> qt_mac_createRolePalettes()
pal.setBrush(QPalette::Active, QPalette::Base, qt_mac_toQColor([NSColor textBackgroundColor]));
pal.setBrush(QPalette::Disabled, QPalette::Base,
pal.brush(QPalette::Active, QPalette::Base));
+ } else if (mac_widget_colors[i].paletteRole == QPlatformTheme::LabelPalette) {
+ qc = qt_mac_toQColor([NSColor labelColor]);
+ pal.setBrush(QPalette::Inactive, QPalette::ToolTipText, qc);
}
palettes.insert(mac_widget_colors[i].paletteRole, &pal);
}
diff --git a/src/plugins/platforms/wasm/qwasmcompositor.cpp b/src/plugins/platforms/wasm/qwasmcompositor.cpp
index f3ea013325..3dc6b7d2f3 100644
--- a/src/plugins/platforms/wasm/qwasmcompositor.cpp
+++ b/src/plugins/platforms/wasm/qwasmcompositor.cpp
@@ -642,7 +642,7 @@ void QWasmCompositor::drawShadePanel(QWasmTitleBarOptions options, QPainter *pai
void QWasmCompositor::drawWindow(QOpenGLTextureBlitter *blitter, QWasmScreen *screen, QWasmWindow *window)
{
- if (window->window()->type() != Qt::Popup)
+ if (window->window()->type() != Qt::Popup && !(window->m_windowState & Qt::WindowFullScreen))
drawWindowDecorations(blitter, screen, window);
drawWindowContent(blitter, screen, window);
}
diff --git a/src/plugins/platforms/wasm/qwasmeventtranslator.cpp b/src/plugins/platforms/wasm/qwasmeventtranslator.cpp
index 6545eda4e3..95bedf701c 100644
--- a/src/plugins/platforms/wasm/qwasmeventtranslator.cpp
+++ b/src/plugins/platforms/wasm/qwasmeventtranslator.cpp
@@ -362,13 +362,15 @@ void QWasmEventTranslator::processMouse(int eventType, const EmscriptenMouseEven
if (mouseEvent->button == 0) {
pressedWindow = window2;
buttonEventType = QEvent::MouseButtonPress;
- if (htmlWindow && window2->flags().testFlag(Qt::WindowTitleHint) && htmlWindow->isPointOnTitle(point))
- draggedWindow = window2;
- else if (htmlWindow && htmlWindow->isPointOnResizeRegion(point)) {
- draggedWindow = window2;
- resizeMode = htmlWindow->resizeModeAtPoint(point);
- resizePoint = point;
- resizeStartRect = window2->geometry();
+ if (!(htmlWindow->m_windowState & Qt::WindowFullScreen) && !(htmlWindow->m_windowState & Qt::WindowMaximized)) {
+ if (htmlWindow && window2->flags().testFlag(Qt::WindowTitleHint) && htmlWindow->isPointOnTitle(point))
+ draggedWindow = window2;
+ else if (htmlWindow && htmlWindow->isPointOnResizeRegion(point)) {
+ draggedWindow = window2;
+ resizeMode = htmlWindow->resizeModeAtPoint(point);
+ resizePoint = point;
+ resizeStartRect = window2->geometry();
+ }
}
}
@@ -399,14 +401,16 @@ void QWasmEventTranslator::processMouse(int eventType, const EmscriptenMouseEven
case 8://move //drag event
{
buttonEventType = QEvent::MouseMove;
- if (resizeMode == QWasmWindow::ResizeNone && draggedWindow) {
- draggedWindow->setX(draggedWindow->x() + mouseEvent->movementX);
- draggedWindow->setY(draggedWindow->y() + mouseEvent->movementY);
- }
+ if (!(htmlWindow->m_windowState & Qt::WindowFullScreen) && !(htmlWindow->m_windowState & Qt::WindowMaximized)) {
+ if (resizeMode == QWasmWindow::ResizeNone && draggedWindow) {
+ draggedWindow->setX(draggedWindow->x() + mouseEvent->movementX);
+ draggedWindow->setY(draggedWindow->y() + mouseEvent->movementY);
+ }
- if (resizeMode != QWasmWindow::ResizeNone) {
- QPoint delta = QPoint(mouseEvent->canvasX, mouseEvent->canvasY) - resizePoint;
- resizeWindow(draggedWindow, resizeMode, resizeStartRect, delta);
+ if (resizeMode != QWasmWindow::ResizeNone && !(htmlWindow->m_windowState & Qt::WindowFullScreen)) {
+ QPoint delta = QPoint(mouseEvent->canvasX, mouseEvent->canvasY) - resizePoint;
+ resizeWindow(draggedWindow, resizeMode, resizeStartRect, delta);
+ }
}
break;
}
diff --git a/src/plugins/platforms/wasm/qwasmwindow.cpp b/src/plugins/platforms/wasm/qwasmwindow.cpp
index 0489813929..c4167be71e 100644
--- a/src/plugins/platforms/wasm/qwasmwindow.cpp
+++ b/src/plugins/platforms/wasm/qwasmwindow.cpp
@@ -83,8 +83,6 @@ void QWasmWindow::initialize()
setWindowState(window()->windowStates());
setWindowFlags(window()->flags());
setWindowTitle(window()->title());
- m_hasTitle = window()->flags().testFlag(Qt::WindowTitleHint) && m_needsCompositor;
-
if (window()->isTopLevel())
setWindowIcon(window()->icon());
m_normalGeometry = rect;
@@ -135,8 +133,8 @@ void QWasmWindow::setVisible(bool visible)
QMargins QWasmWindow::frameMargins() const
{
- int border = m_hasTitle ? 4. * (qreal(qt_defaultDpiX()) / 96.0) : 0;
- int titleBarHeight = m_hasTitle ? titleHeight() : 0;
+ int border = hasTitleBar() ? 4. * (qreal(qt_defaultDpiX()) / 96.0) : 0;
+ int titleBarHeight = hasTitleBar() ? titleHeight() : 0;
QMargins margins;
margins.setLeft(border);
@@ -177,7 +175,7 @@ void QWasmWindow::injectMousePressed(const QPoint &local, const QPoint &global,
Q_UNUSED(local);
Q_UNUSED(mods);
- if (!m_hasTitle || button != Qt::LeftButton)
+ if (!hasTitleBar() || button != Qt::LeftButton)
return;
if (maxButtonRect().contains(global))
@@ -198,7 +196,7 @@ void QWasmWindow::injectMouseReleased(const QPoint &local, const QPoint &global,
Q_UNUSED(local);
Q_UNUSED(mods);
- if (!m_hasTitle || button != Qt::LeftButton)
+ if (!hasTitleBar() || button != Qt::LeftButton)
return;
if (closeButtonRect().contains(global) && m_activeControl == QWasmCompositor::SC_TitleBarCloseButton)
@@ -395,4 +393,9 @@ void QWasmWindow::requestUpdate()
QPlatformWindow::requestUpdate();
}
+bool QWasmWindow::hasTitleBar() const
+{
+ return !(m_windowState & Qt::WindowFullScreen) && (window()->flags().testFlag(Qt::WindowTitleHint) && m_needsCompositor);
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/wasm/qwasmwindow.h b/src/plugins/platforms/wasm/qwasmwindow.h
index a0c463e796..cbbce99aeb 100644
--- a/src/plugins/platforms/wasm/qwasmwindow.h
+++ b/src/plugins/platforms/wasm/qwasmwindow.h
@@ -105,6 +105,7 @@ public:
protected:
void invalidate();
+ bool hasTitleBar() const;
protected:
friend class QWasmScreen;
@@ -119,6 +120,8 @@ protected:
WId m_winid = 0;
bool m_hasTitle = false;
bool m_needsCompositor = false;
+ friend class QWasmCompositor;
+ friend class QWasmEventTranslator;
};
QT_END_NAMESPACE
#endif // QWASMWINDOW_H
diff --git a/src/plugins/platforms/windows/qwindowsclipboard.cpp b/src/plugins/platforms/windows/qwindowsclipboard.cpp
index 53f329422c..8b386da9f7 100644
--- a/src/plugins/platforms/windows/qwindowsclipboard.cpp
+++ b/src/plugins/platforms/windows/qwindowsclipboard.cpp
@@ -50,6 +50,7 @@
#include <QtCore/qdebug.h>
#include <QtCore/qmimedata.h>
#include <QtCore/qstringlist.h>
+#include <QtCore/qthread.h>
#include <QtCore/qvariant.h>
#include <QtCore/qurl.h>
@@ -318,7 +319,15 @@ void QWindowsClipboard::setMimeData(QMimeData *mimeData, QClipboard::Mode mode)
m_data = new QWindowsOleDataObject(mimeData);
}
- const HRESULT src = OleSetClipboard(m_data);
+ HRESULT src = S_FALSE;
+ int attempts = 0;
+ for (; attempts < 3; ++attempts) {
+ src = OleSetClipboard(m_data);
+ if (src != CLIPBRD_E_CANT_OPEN || QWindowsContext::isSessionLocked())
+ break;
+ QThread::msleep(100);
+ }
+
if (src != S_OK) {
QString mimeDataFormats = mimeData ?
mimeData->formats().join(QLatin1String(", ")) : QString(QStringLiteral("NULL"));
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 373758b49e..9bce72d853 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -86,6 +86,7 @@
#include <windowsx.h>
#include <comdef.h>
#include <dbt.h>
+#include <wtsapi32.h>
QT_BEGIN_NAMESPACE
@@ -754,6 +755,37 @@ QWindowsWindow *QWindowsContext::findPlatformWindowAt(HWND parent,
return result;
}
+bool QWindowsContext::isSessionLocked()
+{
+ bool result = false;
+ const DWORD sessionId = WTSGetActiveConsoleSessionId();
+ if (sessionId != 0xFFFFFFFF) {
+ LPTSTR buffer = nullptr;
+ DWORD size = 0;
+#if !defined(Q_CC_MINGW)
+ if (WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE, sessionId,
+ WTSSessionInfoEx, &buffer, &size) == TRUE
+ && size > 0) {
+ const WTSINFOEXW *info = reinterpret_cast<WTSINFOEXW *>(buffer);
+ result = info->Level == 1 && info->Data.WTSInfoExLevel1.SessionFlags == WTS_SESSIONSTATE_LOCK;
+ WTSFreeMemory(buffer);
+ }
+#else // MinGW as of 7.3 does not have WTSINFOEXW in wtsapi32.h
+ // Retrieve the flags which are at offset 16 due to padding for 32/64bit alike.
+ if (WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE, sessionId,
+ WTS_INFO_CLASS(25), &buffer, &size) == TRUE
+ && size >= 20) {
+ const DWORD *p = reinterpret_cast<DWORD *>(buffer);
+ const DWORD level = *p;
+ const DWORD sessionFlags = *(p + 4);
+ result = level == 1 && sessionFlags == 1;
+ WTSFreeMemory(buffer);
+ }
+#endif // Q_CC_MINGW
+ }
+ return result;
+}
+
QWindowsMimeConverter &QWindowsContext::mimeConverter() const
{
return d->m_mimeConverter;
diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h
index 622c729a10..19e9c26130 100644
--- a/src/plugins/platforms/windows/qwindowscontext.h
+++ b/src/plugins/platforms/windows/qwindowscontext.h
@@ -224,6 +224,8 @@ public:
bool useRTLExtensions() const;
QList<int> possibleKeys(const QKeyEvent *e) const;
+ static bool isSessionLocked();
+
QWindowsMimeConverter &mimeConverter() const;
QWindowsScreenManager &screenManager();
QWindowsTabletSupport *tabletSupport() const;
diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp
index 825602e7dc..4f669a5509 100644
--- a/src/plugins/platforms/windows/qwindowscursor.cpp
+++ b/src/plugins/platforms/windows/qwindowscursor.cpp
@@ -660,18 +660,18 @@ QPoint QWindowsCursor::mousePosition()
return QPoint(p.x, p.y);
}
-QWindowsCursor::CursorState QWindowsCursor::cursorState()
+QWindowsCursor::State QWindowsCursor::cursorState()
{
enum { cursorShowing = 0x1, cursorSuppressed = 0x2 }; // Windows 8: CURSOR_SUPPRESSED
CURSORINFO cursorInfo;
cursorInfo.cbSize = sizeof(CURSORINFO);
if (GetCursorInfo(&cursorInfo)) {
- if (cursorInfo.flags & CursorShowing)
- return CursorShowing;
+ if (cursorInfo.flags & cursorShowing)
+ return State::Showing;
if (cursorInfo.flags & cursorSuppressed)
- return CursorSuppressed;
+ return State::Suppressed;
}
- return CursorHidden;
+ return State::Hidden;
}
QPoint QWindowsCursor::pos() const
diff --git a/src/plugins/platforms/windows/qwindowscursor.h b/src/plugins/platforms/windows/qwindowscursor.h
index 1816732594..8495b51a5a 100644
--- a/src/plugins/platforms/windows/qwindowscursor.h
+++ b/src/plugins/platforms/windows/qwindowscursor.h
@@ -89,10 +89,10 @@ typedef QSharedPointer<CursorHandle> CursorHandlePtr;
class QWindowsCursor : public QPlatformCursor
{
public:
- enum CursorState {
- CursorShowing,
- CursorHidden,
- CursorSuppressed // Cursor suppressed by touch interaction (Windows 8).
+ enum class State {
+ Showing,
+ Hidden,
+ Suppressed // Cursor suppressed by touch interaction (Windows 8).
};
struct PixmapCursor {
@@ -119,7 +119,7 @@ public:
static HCURSOR createCursorFromShape(Qt::CursorShape cursorShape, const QPlatformScreen *screen = nullptr);
static QPoint mousePosition();
- static CursorState cursorState();
+ static State cursorState();
CursorHandlePtr standardWindowCursor(Qt::CursorShape s = Qt::ArrowCursor);
CursorHandlePtr pixmapWindowCursor(const QCursor &c);
diff --git a/src/plugins/platforms/windows/qwindowsdrag.cpp b/src/plugins/platforms/windows/qwindowsdrag.cpp
index 8d4e4dc611..b7d225cb00 100644
--- a/src/plugins/platforms/windows/qwindowsdrag.cpp
+++ b/src/plugins/platforms/windows/qwindowsdrag.cpp
@@ -260,7 +260,7 @@ private:
};
QWindowsOleDropSource::QWindowsOleDropSource(QWindowsDrag *drag)
- : m_mode(QWindowsCursor::cursorState() != QWindowsCursor::CursorSuppressed ? MouseDrag : TouchDrag)
+ : m_mode(QWindowsCursor::cursorState() != QWindowsCursor::State::Suppressed ? MouseDrag : TouchDrag)
, m_drag(drag)
, m_windowUnderMouse(QWindowsContext::instance()->windowUnderMouse())
, m_currentButtons(Qt::NoButton)
@@ -455,7 +455,7 @@ QWindowsOleDropSource::GiveFeedback(DWORD dwEffect)
break;
case TouchDrag:
// "Touch drag" with an unsuppressed cursor may happen with RDP (see createCursors())
- if (QWindowsCursor::cursorState() != QWindowsCursor::CursorSuppressed)
+ if (QWindowsCursor::cursorState() != QWindowsCursor::State::Suppressed)
SetCursor(nullptr);
if (!m_touchDragWindow)
m_touchDragWindow = new QWindowsDragCursorWindow;
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index 7d621126b9..9e03d09607 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -393,7 +393,7 @@ QWindowsStaticOpenGLContext *QWindowsStaticOpenGLContext::doCreate()
switch (requestedRenderer) {
case QWindowsOpenGLTester::DesktopGl:
if (QWindowsStaticOpenGLContext *glCtx = QOpenGLStaticContext::create()) {
- if ((QWindowsOpenGLTester::supportedRenderers() & QWindowsOpenGLTester::DisableRotationFlag)
+ if ((QWindowsOpenGLTester::supportedRenderers(requestedRenderer) & QWindowsOpenGLTester::DisableRotationFlag)
&& !QWindowsScreen::setOrientationPreference(Qt::LandscapeOrientation)) {
qCWarning(lcQpaGl, "Unable to disable rotation.");
}
@@ -407,19 +407,19 @@ QWindowsStaticOpenGLContext *QWindowsStaticOpenGLContext::doCreate()
case QWindowsOpenGLTester::AngleRendererD3d11Warp:
return QWindowsEGLStaticContext::create(requestedRenderer);
case QWindowsOpenGLTester::Gles:
- return QWindowsEGLStaticContext::create(QWindowsOpenGLTester::supportedGlesRenderers());
+ return QWindowsEGLStaticContext::create(requestedRenderer);
case QWindowsOpenGLTester::SoftwareRasterizer:
if (QWindowsStaticOpenGLContext *swCtx = QOpenGLStaticContext::create(true))
return swCtx;
qCWarning(lcQpaGl, "Software OpenGL failed. Falling back to system OpenGL.");
- if (QWindowsOpenGLTester::supportedRenderers() & QWindowsOpenGLTester::DesktopGl)
+ if (QWindowsOpenGLTester::supportedRenderers(requestedRenderer) & QWindowsOpenGLTester::DesktopGl)
return QOpenGLStaticContext::create();
return nullptr;
default:
break;
}
- const QWindowsOpenGLTester::Renderers supportedRenderers = QWindowsOpenGLTester::supportedRenderers();
+ const QWindowsOpenGLTester::Renderers supportedRenderers = QWindowsOpenGLTester::supportedRenderers(requestedRenderer);
if (supportedRenderers.testFlag(QWindowsOpenGLTester::DisableProgramCacheFlag)
&& !QCoreApplication::testAttribute(Qt::AA_DisableShaderDiskCache)) {
QCoreApplication::setAttribute(Qt::AA_DisableShaderDiskCache);
@@ -441,7 +441,7 @@ QWindowsStaticOpenGLContext *QWindowsStaticOpenGLContext::doCreate()
#elif defined(QT_OPENGL_ES_2)
QWindowsOpenGLTester::Renderers glesRenderers = QWindowsOpenGLTester::requestedGlesRenderer();
if (glesRenderers == QWindowsOpenGLTester::InvalidRenderer)
- glesRenderers = QWindowsOpenGLTester::supportedGlesRenderers();
+ glesRenderers = QWindowsOpenGLTester::supportedRenderers(QWindowsOpenGLTester::AngleRendererD3d11);
return QWindowsEGLStaticContext::create(glesRenderers);
#elif !defined(QT_NO_OPENGL)
return QOpenGLStaticContext::create();
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp
index 1209b6c4b4..9e6101b758 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.cpp
+++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp
@@ -877,10 +877,26 @@ bool QWindowsKeyMapper::translateKeyEvent(QWindow *widget, HWND hwnd,
bool QWindowsKeyMapper::translateMultimediaKeyEventInternal(QWindow *window, const MSG &msg)
{
#if defined(WM_APPCOMMAND)
+ const int cmd = GET_APPCOMMAND_LPARAM(msg.lParam);
// QTBUG-57198, do not send mouse-synthesized commands as key events in addition
- if (GET_DEVICE_LPARAM(msg.lParam) == FAPPCOMMAND_MOUSE)
+ switch (GET_DEVICE_LPARAM(msg.lParam)) {
+ case FAPPCOMMAND_MOUSE:
return false;
- const int cmd = GET_APPCOMMAND_LPARAM(msg.lParam);
+ case FAPPCOMMAND_KEY:
+ // QTBUG-62838, swallow WM_KEYDOWN, WM_KEYUP for commands that are
+ // reflected in VK(s) like VK_MEDIA_NEXT_TRACK. Don't do that for
+ // APPCOMMAND_BROWSER_HOME as that one does not trigger two events
+ if (cmd != APPCOMMAND_BROWSER_HOME) {
+ MSG peekedMsg;
+ if (PeekMessage(&peekedMsg, msg.hwnd, 0, 0, PM_NOREMOVE)
+ && peekedMsg.message == WM_KEYDOWN) {
+ PeekMessage(&peekedMsg, msg.hwnd, 0, 0, PM_REMOVE);
+ PeekMessage(&peekedMsg, msg.hwnd, 0, 0, PM_REMOVE);
+ }
+ }
+ break;
+ }
+
const int dwKeys = GET_KEYSTATE_LPARAM(msg.lParam);
int state = 0;
state |= (dwKeys & MK_SHIFT ? int(Qt::ShiftModifier) : 0);
diff --git a/src/plugins/platforms/windows/qwindowsopengltester.cpp b/src/plugins/platforms/windows/qwindowsopengltester.cpp
index 9a630aff4f..3efccf0f32 100644
--- a/src/plugins/platforms/windows/qwindowsopengltester.cpp
+++ b/src/plugins/platforms/windows/qwindowsopengltester.cpp
@@ -247,11 +247,12 @@ typedef QHash<QOpenGLConfig::Gpu, QWindowsOpenGLTester::Renderers> SupportedRend
Q_GLOBAL_STATIC(SupportedRenderersCache, supportedRenderersCache)
#endif
-QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(const GpuDescription &gpu, bool glesOnly)
+QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(const GpuDescription &gpu,
+ Renderer requested)
{
- Q_UNUSED(gpu)
- Q_UNUSED(glesOnly)
#if defined(QT_NO_OPENGL)
+ Q_UNUSED(gpu)
+ Q_UNUSED(requested)
return 0;
#else
QOpenGLConfig::Gpu qgpu = QOpenGLConfig::Gpu::fromDevice(gpu.vendorId, gpu.deviceId, gpu.driverVersion, gpu.description);
@@ -265,8 +266,11 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(c
| QWindowsOpenGLTester::AngleRendererD3d11Warp
| QWindowsOpenGLTester::SoftwareRasterizer);
- if (!glesOnly && testDesktopGL())
- result |= QWindowsOpenGLTester::DesktopGl;
+ // Don't test for GL if explicitly requested or GLES only is requested
+ if (requested == DesktopGl
+ || ((requested & GlesMask) == 0 && testDesktopGL())) {
+ result |= QWindowsOpenGLTester::DesktopGl;
+ }
const char bugListFileVar[] = "QT_OPENGL_BUGLIST";
QString buglistFileName = QStringLiteral(":/qt-project.org/windows/openglblacklists/default.json");
@@ -310,19 +314,11 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(c
#endif // !QT_NO_OPENGL
}
-QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::supportedGlesRenderers()
-{
- const GpuDescription gpu = GpuDescription::detect();
- const QWindowsOpenGLTester::Renderers result = detectSupportedRenderers(gpu, true);
- qCDebug(lcQpaGl) << __FUNCTION__ << gpu << "renderer: " << result;
- return result;
-}
-
-QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::supportedRenderers()
+QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::supportedRenderers(Renderer requested)
{
const GpuDescription gpu = GpuDescription::detect();
- const QWindowsOpenGLTester::Renderers result = detectSupportedRenderers(gpu, false);
- qCDebug(lcQpaGl) << __FUNCTION__ << gpu << "renderer: " << result;
+ const QWindowsOpenGLTester::Renderers result = detectSupportedRenderers(gpu, requested);
+ qCDebug(lcQpaGl) << __FUNCTION__ << gpu << requested << "renderer: " << result;
return result;
}
diff --git a/src/plugins/platforms/windows/qwindowsopengltester.h b/src/plugins/platforms/windows/qwindowsopengltester.h
index bec87c1f86..08628c2586 100644
--- a/src/plugins/platforms/windows/qwindowsopengltester.h
+++ b/src/plugins/platforms/windows/qwindowsopengltester.h
@@ -91,11 +91,10 @@ public:
static Renderer requestedGlesRenderer();
static Renderer requestedRenderer();
- static Renderers supportedGlesRenderers();
- static Renderers supportedRenderers();
+ static QWindowsOpenGLTester::Renderers supportedRenderers(Renderer requested);
private:
- static QWindowsOpenGLTester::Renderers detectSupportedRenderers(const GpuDescription &gpu, bool glesOnly);
+ static Renderers detectSupportedRenderers(const GpuDescription &gpu, Renderer requested);
static bool testDesktopGL();
};
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.h b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.h
index 11684de721..325d5b3de4 100644
--- a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.h
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.h
@@ -86,7 +86,7 @@ public:
HRESULT STDMETHODCALLTYPE GetRuntimeId(SAFEARRAY **pRetVal) override;
HRESULT STDMETHODCALLTYPE get_BoundingRectangle(UiaRect *pRetVal) override;
HRESULT STDMETHODCALLTYPE GetEmbeddedFragmentRoots(SAFEARRAY **pRetVal) override;
- HRESULT STDMETHODCALLTYPE SetFocus();
+ HRESULT STDMETHODCALLTYPE SetFocus() override;
HRESULT STDMETHODCALLTYPE get_FragmentRoot(IRawElementProviderFragmentRoot **pRetVal) override;
// IRawElementProviderFragmentRoot methods
diff --git a/src/plugins/platforms/windows/windows.pri b/src/plugins/platforms/windows/windows.pri
index c1d4e907d9..db06a6a2a3 100644
--- a/src/plugins/platforms/windows/windows.pri
+++ b/src/plugins/platforms/windows/windows.pri
@@ -7,7 +7,7 @@ qtConfig(opengl):!qtConfig(opengles2):!qtConfig(dynamicgl): LIBS *= -lopengl32
mingw: LIBS *= -luuid
# For the dialog helpers:
-LIBS += -lshlwapi -lshell32 -ladvapi32
+LIBS += -lshlwapi -lshell32 -ladvapi32 -lwtsapi32
DEFINES *= QT_NO_CAST_FROM_ASCII QT_NO_FOREACH
diff --git a/src/plugins/platforms/winrt/main.cpp b/src/plugins/platforms/winrt/main.cpp
index 222287b3ef..a37bd1e3d8 100644
--- a/src/plugins/platforms/winrt/main.cpp
+++ b/src/plugins/platforms/winrt/main.cpp
@@ -58,7 +58,7 @@ QPlatformIntegration *QWinRTIntegrationPlugin::create(const QString& system, con
if (!system.compare(QLatin1String("winrt"), Qt::CaseInsensitive))
return QWinRTIntegration::create();
- return 0;
+ return nullptr;
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/winrt/qwinrtbackingstore.h b/src/plugins/platforms/winrt/qwinrtbackingstore.h
index 51fa13845e..b62d340b82 100644
--- a/src/plugins/platforms/winrt/qwinrtbackingstore.h
+++ b/src/plugins/platforms/winrt/qwinrtbackingstore.h
@@ -54,7 +54,7 @@ class QWinRTBackingStore : public QPlatformBackingStore
{
public:
explicit QWinRTBackingStore(QWindow *window);
- ~QWinRTBackingStore();
+ ~QWinRTBackingStore() override;
QPaintDevice *paintDevice() override;
void beginPaint(const QRegion &) override;
void endPaint() override;
diff --git a/src/plugins/platforms/winrt/qwinrtcanvas.cpp b/src/plugins/platforms/winrt/qwinrtcanvas.cpp
index ad77d811e6..dd6b52d9cd 100644
--- a/src/plugins/platforms/winrt/qwinrtcanvas.cpp
+++ b/src/plugins/platforms/winrt/qwinrtcanvas.cpp
@@ -70,10 +70,6 @@ QWinRTCanvas::QWinRTCanvas(const std::function<QWindow*()> &delegateWindow)
delegate = delegateWindow;
}
-QWinRTCanvas::~QWinRTCanvas()
-{
-}
-
HRESULT STDMETHODCALLTYPE QWinRTCanvas::QueryInterface(REFIID iid, LPVOID *iface)
{
if (!iface)
diff --git a/src/plugins/platforms/winrt/qwinrtcanvas.h b/src/plugins/platforms/winrt/qwinrtcanvas.h
index 68c15c7602..bc3b708ac2 100644
--- a/src/plugins/platforms/winrt/qwinrtcanvas.h
+++ b/src/plugins/platforms/winrt/qwinrtcanvas.h
@@ -54,7 +54,7 @@ class QWinRTCanvas:
{
public:
QWinRTCanvas(const std::function<QWindow*()> &delegateWindow);
- virtual ~QWinRTCanvas();
+ ~QWinRTCanvas() override = default;
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *iface) override;
HRESULT STDMETHODCALLTYPE GetIids(ULONG *iidCount, IID **iids) override;
diff --git a/src/plugins/platforms/winrt/qwinrtclipboard.cpp b/src/plugins/platforms/winrt/qwinrtclipboard.cpp
index 05c34b82f8..fd0ed8aed2 100644
--- a/src/plugins/platforms/winrt/qwinrtclipboard.cpp
+++ b/src/plugins/platforms/winrt/qwinrtclipboard.cpp
@@ -99,7 +99,7 @@ QMimeData *QWinRTClipboard::mimeData(QClipboard::Mode mode)
quint32 size;
const wchar_t *textStr = result.GetRawBuffer(&size);
- QString text = QString::fromWCharArray(textStr, size);
+ QString text = QString::fromWCharArray(textStr, int(size));
text.replace(QLatin1String("\r\n"), QLatin1String("\n"));
if (m_mimeData) {
@@ -161,7 +161,8 @@ void QWinRTClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
&package);
const QString nativeString = convertToWindowsLineEnding(text);
- HStringReference textRef(reinterpret_cast<LPCWSTR>(nativeString.utf16()), nativeString.length());
+ HStringReference textRef(reinterpret_cast<LPCWSTR>(nativeString.utf16()),
+ uint(nativeString.length()));
hr = package->SetText(textRef.Get());
RETURN_HR_IF_FAILED("Could not set text to clipboard data package.");
diff --git a/src/plugins/platforms/winrt/qwinrtcursor.cpp b/src/plugins/platforms/winrt/qwinrtcursor.cpp
index f22b9a435a..180905945b 100644
--- a/src/plugins/platforms/winrt/qwinrtcursor.cpp
+++ b/src/plugins/platforms/winrt/qwinrtcursor.cpp
@@ -78,10 +78,6 @@ QWinRTCursor::QWinRTCursor()
Q_ASSERT_SUCCEEDED(hr);
}
-QWinRTCursor::~QWinRTCursor()
-{
-}
-
#ifndef QT_NO_CURSOR
void QWinRTCursor::changeCursor(QCursor *windowCursor, QWindow *window)
{
@@ -183,14 +179,15 @@ QPoint QWinRTCursor::pos() const
return hr;
});
Q_ASSERT_SUCCEEDED(hr);
- QPoint position = QPoint(point.X, point.Y);
+ QPointF position(qreal(point.X), qreal(point.Y));
// If no cursor get_PointerPosition returns SHRT_MIN for x and y
- if (position.x() == SHRT_MIN && position.y() == SHRT_MIN || FAILED(hr))
+ if ((int(position.x()) == SHRT_MIN && int(position.y()) == SHRT_MIN)
+ || FAILED(hr))
return QPointF(Q_INFINITY, Q_INFINITY).toPoint();
- position.rx() -= bounds.X;
- position.ry() -= bounds.Y;
+ position.rx() -= qreal(bounds.X);
+ position.ry() -= qreal(bounds.Y);
position *= screen->scaleFactor();
- return position;
+ return position.toPoint();
}
void QWinRTCursor::setPos(const QPoint &pos)
@@ -199,7 +196,7 @@ void QWinRTCursor::setPos(const QPoint &pos)
Q_ASSERT(screen);
ComPtr<ICoreWindow> coreWindow = screen->coreWindow();
Q_ASSERT(coreWindow);
- const QPointF scaledPos = pos / screen->scaleFactor();
+ const QPointF scaledPos = QPointF(pos) / screen->scaleFactor();
QWinRTScreen::MousePositionTransition t;
HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([coreWindow, scaledPos, &t]() {
ComPtr<ICoreWindow2> coreWindow2;
@@ -211,7 +208,8 @@ void QWinRTCursor::setPos(const QPoint &pos)
Point mousePos;
hr = coreWindow->get_PointerPosition(&mousePos);
RETURN_HR_IF_FAILED("Failed to obtain mouse position.");
- const Point p = {FLOAT(scaledPos.x() + bounds.X), FLOAT(scaledPos.y() + bounds.Y)};
+ const Point p = { FLOAT(scaledPos.x()) + bounds.X,
+ FLOAT(scaledPos.y()) + bounds.Y };
const bool wasInWindow = qIsPointInRect(mousePos, bounds);
const bool willBeInWindow = qIsPointInRect(p, bounds);
if (wasInWindow && willBeInWindow)
diff --git a/src/plugins/platforms/winrt/qwinrtcursor.h b/src/plugins/platforms/winrt/qwinrtcursor.h
index 253827f38f..eca3d8c7ca 100644
--- a/src/plugins/platforms/winrt/qwinrtcursor.h
+++ b/src/plugins/platforms/winrt/qwinrtcursor.h
@@ -49,7 +49,7 @@ class QWinRTCursor : public QPlatformCursor
{
public:
explicit QWinRTCursor();
- ~QWinRTCursor();
+ ~QWinRTCursor() override = default;
#ifndef QT_NO_CURSOR
void changeCursor(QCursor * windowCursor, QWindow *window) override;
#endif
diff --git a/src/plugins/platforms/winrt/qwinrtdrag.cpp b/src/plugins/platforms/winrt/qwinrtdrag.cpp
index 0c918230b3..3ed4cd692d 100644
--- a/src/plugins/platforms/winrt/qwinrtdrag.cpp
+++ b/src/plugins/platforms/winrt/qwinrtdrag.cpp
@@ -81,7 +81,7 @@ ComPtr<IBuffer> createIBufferFromData(const char *data, qint32 size)
}
ComPtr<IBuffer> buffer;
- const UINT32 length = size;
+ const UINT32 length = UINT32(size);
hr = bufferFactory->Create(length, &buffer);
Q_ASSERT_SUCCEEDED(hr);
hr = buffer->put_Length(length);
@@ -118,13 +118,13 @@ inline QString hStringToQString(const HString &hString)
{
quint32 l;
const wchar_t *raw = hString.GetRawBuffer(&l);
- return (QString::fromWCharArray(raw, l));
+ return (QString::fromWCharArray(raw, int(l)));
}
inline HString qStringToHString(const QString &qString)
{
HString h;
- h.Set(reinterpret_cast<const wchar_t*>(qString.utf16()), qString.size());
+ h.Set(reinterpret_cast<const wchar_t*>(qString.utf16()), uint(qString.size()));
return h;
}
@@ -184,10 +184,6 @@ QWinRTInternalMimeData::QWinRTInternalMimeData()
}
}
-QWinRTInternalMimeData::~QWinRTInternalMimeData()
-{
-}
-
bool QWinRTInternalMimeData::hasFormat_sys(const QString &mimetype) const
{
qCDebug(lcQpaMime) << __FUNCTION__ << mimetype;
@@ -311,7 +307,7 @@ QVariant QWinRTInternalMimeData::retrieveData_sys(const QString &mimetype, QVari
ComPtr<IAsyncOperation<IInspectable*>> op;
ComPtr<IInspectable> res;
HString type;
- type.Set(reinterpret_cast<const wchar_t*>(mimetype.utf16()), mimetype.size());
+ type.Set(reinterpret_cast<const wchar_t*>(mimetype.utf16()), uint(mimetype.size()));
hr = dataView->GetDataAsync(type.Get(), &op);
RETURN_OK_IF_FAILED("Could not query custom drag data.");
hr = QWinRTFunctions::await(op, res.GetAddressOf());
@@ -434,7 +430,7 @@ QVariant QWinRTInternalMimeData::retrieveData_sys(const QString &mimetype, QVari
IID_PPV_ARGS(&bufferFactory));
Q_ASSERT_SUCCEEDED(hr);
- UINT32 length = qBound(quint64(0), quint64(size), quint64(UINT_MAX));
+ UINT32 length = UINT32(qBound(quint64(0), quint64(size), quint64(UINT_MAX)));
ComPtr<IBuffer> buffer;
hr = bufferFactory->Create(length, &buffer);
Q_ASSERT_SUCCEEDED(hr);
@@ -452,7 +448,7 @@ QVariant QWinRTInternalMimeData::retrieveData_sys(const QString &mimetype, QVari
byte *bytes;
hr = byteArrayAccess->Buffer(&bytes);
- QByteArray array((char *)bytes, length);
+ QByteArray array((char *)bytes, int(length));
result.setValue(array);
return S_OK;
}
@@ -559,7 +555,7 @@ extern ComPtr<ABI::Windows::UI::Input::IPointerPoint> qt_winrt_lastPointerPoint;
QWinRTDrag::QWinRTDrag()
: QPlatformDrag()
- , m_dragTarget(0)
+ , m_dragTarget(nullptr)
{
qCDebug(lcQpaMime) << __FUNCTION__;
m_enter = new Q_INST_DRAGHANDLER(Enter);
@@ -612,7 +608,7 @@ Qt::DropAction QWinRTDrag::drag(QDrag *drag)
ComPtr<IAsyncOperation<ABI::Windows::ApplicationModel::DataTransfer::DataPackageOperation>> op;
EventRegistrationToken startingToken;
- hr = QEventDispatcherWinRT::runOnXamlThread([drag, &op, &hr, elem3, &startingToken, this]() {
+ hr = QEventDispatcherWinRT::runOnXamlThread([drag, &op, &hr, elem3, &startingToken]() {
hr = elem3->put_CanDrag(true);
Q_ASSERT_SUCCEEDED(hr);
@@ -660,7 +656,8 @@ Qt::DropAction QWinRTDrag::drag(QDrag *drag)
const QImage image = image2.convertToFormat(QImage::Format_ARGB32);
if (!image.isNull()) {
// Create IBuffer containing image
- ComPtr<IBuffer> imageBuffer = createIBufferFromData(reinterpret_cast<const char*>(image.bits()), image.byteCount());
+ ComPtr<IBuffer> imageBuffer
+ = createIBufferFromData(reinterpret_cast<const char*>(image.bits()), int(image.sizeInBytes()));
ComPtr<ISoftwareBitmapFactory> bitmapFactory;
hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Graphics_Imaging_SoftwareBitmap).Get(),
@@ -697,7 +694,7 @@ Qt::DropAction QWinRTDrag::drag(QDrag *drag)
hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Storage_Streams_InMemoryRandomAccessStream).Get(), &ras);
Q_ASSERT_SUCCEEDED(hr);
- hr = ras->put_Size(data.size());
+ hr = ras->put_Size(UINT64(data.size()));
ComPtr<IOutputStream> outputStream;
hr = ras->GetOutputStreamAt(0, &outputStream);
Q_ASSERT_SUCCEEDED(hr);
@@ -802,7 +799,7 @@ void QWinRTDrag::handleNativeDragEvent(IInspectable *sender, ABI::Windows::UI::X
Point relativePoint;
hr = e->GetPosition(m_ui.Get(), &relativePoint);
RETURN_VOID_IF_FAILED("Could not query drag position.");
- const QPoint p(relativePoint.X, relativePoint.Y);
+ const QPoint p(int(relativePoint.X), int(relativePoint.Y));
ComPtr<IDragEventArgs2> e2;
hr = e->QueryInterface(IID_PPV_ARGS(&e2));
diff --git a/src/plugins/platforms/winrt/qwinrtdrag.h b/src/plugins/platforms/winrt/qwinrtdrag.h
index 3868c9f015..ab57999bba 100644
--- a/src/plugins/platforms/winrt/qwinrtdrag.h
+++ b/src/plugins/platforms/winrt/qwinrtdrag.h
@@ -77,7 +77,7 @@ class QWinRTInternalMimeData;
class QWinRTInternalMimeData : public QInternalMimeData {
public:
QWinRTInternalMimeData();
- virtual ~QWinRTInternalMimeData();
+ ~QWinRTInternalMimeData() override = default;
bool hasFormat_sys(const QString &mimetype) const override;
QStringList formats_sys() const override;
@@ -92,7 +92,7 @@ private:
class QWinRTDrag : public QPlatformDrag {
public:
QWinRTDrag();
- virtual ~QWinRTDrag();
+ ~QWinRTDrag() override;
static QWinRTDrag *instance();
Qt::DropAction drag(QDrag *) override;
diff --git a/src/plugins/platforms/winrt/qwinrteglcontext.h b/src/plugins/platforms/winrt/qwinrteglcontext.h
index 325dc82c40..8dbd0fc7d0 100644
--- a/src/plugins/platforms/winrt/qwinrteglcontext.h
+++ b/src/plugins/platforms/winrt/qwinrteglcontext.h
@@ -50,7 +50,7 @@ class QWinRTEGLContext : public QPlatformOpenGLContext
{
public:
explicit QWinRTEGLContext(QOpenGLContext *context);
- ~QWinRTEGLContext();
+ ~QWinRTEGLContext() override;
void initialize() override;
diff --git a/src/plugins/platforms/winrt/qwinrteventdispatcher.h b/src/plugins/platforms/winrt/qwinrteventdispatcher.h
index 4c5c19c6b0..61c824f0a9 100644
--- a/src/plugins/platforms/winrt/qwinrteventdispatcher.h
+++ b/src/plugins/platforms/winrt/qwinrteventdispatcher.h
@@ -48,7 +48,7 @@ class QWinRTEventDispatcher : public QEventDispatcherWinRT
{
Q_OBJECT
public:
- explicit QWinRTEventDispatcher(QObject *parent = 0);
+ explicit QWinRTEventDispatcher(QObject *parent = nullptr);
protected:
bool hasPendingEvents() override;
diff --git a/src/plugins/platforms/winrt/qwinrtfiledialoghelper.cpp b/src/plugins/platforms/winrt/qwinrtfiledialoghelper.cpp
index 3c90334c8c..114d6dacd8 100644
--- a/src/plugins/platforms/winrt/qwinrtfiledialoghelper.cpp
+++ b/src/plugins/platforms/winrt/qwinrtfiledialoghelper.cpp
@@ -51,7 +51,7 @@
#include <wrl.h>
#include <windows.foundation.h>
#include <windows.storage.pickers.h>
-#include <Windows.ApplicationModel.activation.h>
+#include <Windows.Applicationmodel.Activation.h>
using namespace Microsoft::WRL;
using namespace Microsoft::WRL::Wrappers;
@@ -73,12 +73,12 @@ class WindowsStringVector : public RuntimeClass<IVector<HSTRING>>
public:
HRESULT __stdcall GetAt(quint32 index, HSTRING *item)
{
- *item = impl.at(index);
+ *item = impl.at(int(index));
return S_OK;
}
HRESULT __stdcall get_Size(quint32 *size)
{
- *size = impl.size();
+ *size = quint32(impl.size());
return S_OK;
}
HRESULT __stdcall GetView(IVectorView<HSTRING> **view)
@@ -108,7 +108,7 @@ public:
HRESULT hr = WindowsDuplicateString(item, &newItem);
if (FAILED(hr))
return hr;
- impl[index] = newItem;
+ impl[int(index)] = newItem;
return S_OK;
}
HRESULT __stdcall InsertAt(quint32 index, HSTRING item)
@@ -117,12 +117,12 @@ public:
HRESULT hr = WindowsDuplicateString(item, &newItem);
if (FAILED(hr))
return hr;
- impl.insert(index, newItem);
+ impl.insert(int(index), newItem);
return S_OK;
}
HRESULT __stdcall RemoveAt(quint32 index)
{
- WindowsDeleteString(impl.takeAt(index));
+ WindowsDeleteString(impl.takeAt(int(index)));
return S_OK;
}
HRESULT __stdcall Append(HSTRING item)
@@ -164,7 +164,7 @@ static bool initializePicker(HSTRING runtimeId, T **picker, const QSharedPointer
if (options->isLabelExplicitlySet(QFileDialogOptions::Accept)) {
const QString labelText = options->labelText(QFileDialogOptions::Accept);
HStringReference labelTextRef(reinterpret_cast<const wchar_t *>(labelText.utf16()),
- labelText.length());
+ uint(labelText.length()));
hr = (*picker)->put_CommitButtonText(labelTextRef.Get());
RETURN_FALSE_IF_FAILED("Failed to set commit button text");
}
@@ -188,7 +188,7 @@ static bool initializeOpenPickerOptions(T *picker, const QSharedPointer<QFileDia
// Remove leading star
const int offset = (filter.length() > 1 && filter.startsWith(QLatin1Char('*'))) ? 1 : 0;
HStringReference filterRef(reinterpret_cast<const wchar_t *>(filter.utf16() + offset),
- filter.length() - offset);
+ uint(filter.length() - offset));
hr = filters->Append(filterRef.Get());
if (FAILED(hr)) {
qWarning("Failed to add named file filter \"%s\": %s",
@@ -290,16 +290,12 @@ QWinRTFileDialogHelper::QWinRTFileDialogHelper()
d->shown = false;
}
-QWinRTFileDialogHelper::~QWinRTFileDialogHelper()
-{
-}
-
void QWinRTFileDialogHelper::exec()
{
Q_D(QWinRTFileDialogHelper);
if (!d->shown)
- show(Qt::Dialog, Qt::ApplicationModal, 0);
+ show(Qt::Dialog, Qt::ApplicationModal, nullptr);
d->loop.exec();
}
@@ -369,7 +365,7 @@ bool QWinRTFileDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModalit
// Remove leading star
const int starOffset = (filter.length() > 1 && filter.startsWith(QLatin1Char('*'))) ? 1 : 0;
HStringReference filterRef(reinterpret_cast<const wchar_t *>(filter.utf16() + starOffset),
- filter.length() - starOffset);
+ uint(filter.length() - starOffset));
hr = entry->Append(filterRef.Get());
if (FAILED(hr)) {
qWarning("Failed to add named file filter \"%s\": %s",
@@ -379,7 +375,7 @@ bool QWinRTFileDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModalit
const int offset = namedFilter.indexOf(QLatin1String(" ("));
const QString filterTitle = namedFilter.mid(0, offset);
HStringReference namedFilterRef(reinterpret_cast<const wchar_t *>(filterTitle.utf16()),
- filterTitle.length());
+ uint(filterTitle.length()));
boolean replaced;
hr = choices->Insert(namedFilterRef.Get(), entry.Get(), &replaced);
// Only print a warning as * or *.* is not a valid choice on Windows 10
@@ -396,7 +392,7 @@ bool QWinRTFileDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModalit
if (!suffix.startsWith(QLatin1Char('.')))
suffix.prepend(QLatin1Char('.'));
HStringReference nativeSuffix(reinterpret_cast<const wchar_t *>(suffix.utf16()),
- suffix.length());
+ uint(suffix.length()));
hr = picker->put_DefaultFileExtension(nativeSuffix.Get());
RETURN_FALSE_IF_FAILED_WITH_ARGS("Failed to set default file extension \"%s\"", qPrintable(suffix));
}
@@ -404,7 +400,7 @@ bool QWinRTFileDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModalit
const QString suggestedName = QFileInfo(d->saveFileName.toLocalFile()).fileName();
if (!suggestedName.isEmpty()) {
HStringReference nativeSuggestedName(reinterpret_cast<const wchar_t *>(suggestedName.utf16()),
- suggestedName.length());
+ uint(suggestedName.length()));
hr = picker->put_SuggestedFileName(nativeSuggestedName.Get());
RETURN_FALSE_IF_FAILED("Failed to set suggested file name");
}
diff --git a/src/plugins/platforms/winrt/qwinrtfiledialoghelper.h b/src/plugins/platforms/winrt/qwinrtfiledialoghelper.h
index 99239aad3a..994d099dcf 100644
--- a/src/plugins/platforms/winrt/qwinrtfiledialoghelper.h
+++ b/src/plugins/platforms/winrt/qwinrtfiledialoghelper.h
@@ -70,7 +70,7 @@ class QWinRTFileDialogHelper : public QPlatformFileDialogHelper
Q_OBJECT
public:
explicit QWinRTFileDialogHelper();
- ~QWinRTFileDialogHelper();
+ ~QWinRTFileDialogHelper() override = default;
void exec() override;
bool show(Qt::WindowFlags, Qt::WindowModality, QWindow *) override;
diff --git a/src/plugins/platforms/winrt/qwinrtfileengine.cpp b/src/plugins/platforms/winrt/qwinrtfileengine.cpp
index 76efdf6cc8..3014b30c38 100644
--- a/src/plugins/platforms/winrt/qwinrtfileengine.cpp
+++ b/src/plugins/platforms/winrt/qwinrtfileengine.cpp
@@ -122,10 +122,6 @@ QWinRTFileEngineHandler::QWinRTFileEngineHandler()
{
}
-QWinRTFileEngineHandler::~QWinRTFileEngineHandler()
-{
-}
-
void QWinRTFileEngineHandler::registerFile(const QString &fileName, IStorageItem *file)
{
handlerInstance->d_func()->files.insert(QDir::cleanPath(fileName), file);
@@ -168,7 +164,7 @@ static HRESULT getDestinationFolder(const QString &fileName, const QString &newF
const QString newFilePath = QDir::toNativeSeparators(newFileInfo.absolutePath());
HStringReference nativeNewFilePath(reinterpret_cast<LPCWSTR>(newFilePath.utf16()),
- newFilePath.length());
+ uint(newFilePath.length()));
hr = folderFactory->GetFolderFromPathAsync(nativeNewFilePath.Get(), &op);
}
if (FAILED(hr))
@@ -181,10 +177,6 @@ QWinRTFileEngine::QWinRTFileEngine(const QString &fileName, IStorageItem *file)
{
}
-QWinRTFileEngine::~QWinRTFileEngine()
-{
-}
-
bool QWinRTFileEngine::open(QIODevice::OpenMode openMode)
{
Q_D(QWinRTFileEngine);
@@ -278,7 +270,7 @@ bool QWinRTFileEngine::seek(qint64 pos)
if (!d->stream)
return false;
- HRESULT hr = d->stream->Seek(pos);
+ HRESULT hr = d->stream->Seek(UINT64(pos));
RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::PositionError, false);
d->pos = pos;
return SUCCEEDED(hr);
@@ -311,7 +303,8 @@ bool QWinRTFileEngine::copy(const QString &newName)
RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::CopyError, false);
const QString destinationName = QFileInfo(newName).fileName();
- HStringReference nativeDestinationName(reinterpret_cast<LPCWSTR>(destinationName.utf16()), destinationName.length());
+ HStringReference nativeDestinationName(reinterpret_cast<LPCWSTR>(destinationName.utf16()),
+ uint(destinationName.length()));
ComPtr<IAsyncOperation<StorageFile *>> op;
hr = file->CopyOverloadDefaultOptions(destinationFolder.Get(), nativeDestinationName.Get(), &op);
RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::CopyError, false);
@@ -332,7 +325,8 @@ bool QWinRTFileEngine::rename(const QString &newName)
RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::RenameError, false);
const QString destinationName = QFileInfo(newName).fileName();
- HStringReference nativeDestinationName(reinterpret_cast<LPCWSTR>(destinationName.utf16()), destinationName.length());
+ HStringReference nativeDestinationName(reinterpret_cast<LPCWSTR>(destinationName.utf16()),
+ uint(destinationName.length()));
ComPtr<IAsyncAction> op;
hr = d->file->RenameAsyncOverloadDefaultOptions(nativeDestinationName.Get(), &op);
RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::RenameError, false);
@@ -349,7 +343,8 @@ bool QWinRTFileEngine::renameOverwrite(const QString &newName)
RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::RenameError, false);
const QString destinationName = QFileInfo(newName).fileName();
- HStringReference nativeDestinationName(reinterpret_cast<LPCWSTR>(destinationName.utf16()), destinationName.length());
+ HStringReference nativeDestinationName(reinterpret_cast<LPCWSTR>(destinationName.utf16()),
+ uint(destinationName.length()));
ComPtr<IAsyncAction> op;
hr = d->file->RenameAsync(nativeDestinationName.Get(), NameCollisionOption_ReplaceExisting, &op);
RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::RenameError, false);
@@ -451,7 +446,7 @@ qint64 QWinRTFileEngine::read(char *data, qint64 maxlen)
HRESULT hr = d->stream.As(&stream);
RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::ReadError, -1);
- UINT32 length = qBound(quint64(0), quint64(maxlen), quint64(UINT_MAX));
+ UINT32 length = UINT32(qBound(quint64(0), quint64(maxlen), quint64(UINT32_MAX)));
ComPtr<IBuffer> buffer;
hr = d->bufferFactory->Create(length, &buffer);
RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::ReadError, -1);
@@ -494,7 +489,7 @@ qint64 QWinRTFileEngine::write(const char *data, qint64 maxlen)
HRESULT hr = d->stream.As(&stream);
RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::WriteError, -1);
- UINT32 length = qBound(quint64(0), quint64(maxlen), quint64(UINT_MAX));
+ UINT32 length = UINT32(qBound(quint64(0), quint64(maxlen), quint64(UINT_MAX)));
ComPtr<IBuffer> buffer;
hr = d->bufferFactory->Create(length, &buffer);
RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::WriteError, -1);
diff --git a/src/plugins/platforms/winrt/qwinrtfileengine.h b/src/plugins/platforms/winrt/qwinrtfileengine.h
index 73ff54b0c8..4485917c9e 100644
--- a/src/plugins/platforms/winrt/qwinrtfileengine.h
+++ b/src/plugins/platforms/winrt/qwinrtfileengine.h
@@ -57,7 +57,7 @@ class QWinRTFileEngineHandler : public QAbstractFileEngineHandler
{
public:
QWinRTFileEngineHandler();
- ~QWinRTFileEngineHandler();
+ ~QWinRTFileEngineHandler() override = default;
QAbstractFileEngine *create(const QString &fileName) const override;
static void registerFile(const QString &fileName, ABI::Windows::Storage::IStorageItem *file);
@@ -73,7 +73,7 @@ class QWinRTFileEngine : public QAbstractFileEngine
{
public:
QWinRTFileEngine(const QString &fileName, ABI::Windows::Storage::IStorageItem *file);
- ~QWinRTFileEngine();
+ ~QWinRTFileEngine() override = default;
bool open(QIODevice::OpenMode openMode) override;
bool close() override;
diff --git a/src/plugins/platforms/winrt/qwinrtinputcontext.cpp b/src/plugins/platforms/winrt/qwinrtinputcontext.cpp
index 63e5b0cf27..f7e91bb047 100644
--- a/src/plugins/platforms/winrt/qwinrtinputcontext.cpp
+++ b/src/plugins/platforms/winrt/qwinrtinputcontext.cpp
@@ -64,8 +64,8 @@ inline QRectF getInputPaneRect(ComPtr<IInputPane> pane, qreal scaleFactor)
{
Rect rect;
pane->get_OccludedRect(&rect);
- return QRectF(qRound(rect.X * scaleFactor), qRound(rect.Y * scaleFactor),
- qRound(rect.Width * scaleFactor), qRound(rect.Height * scaleFactor));
+ return QRectF(qRound(qreal(rect.X) * scaleFactor), qRound(qreal(rect.Y) * scaleFactor),
+ qRound(qreal(rect.Width) * scaleFactor), qRound(qreal(rect.Height) * scaleFactor));
}
/*!
@@ -205,6 +205,8 @@ void QWinRTInputContext::showInputPanel()
void QWinRTInputContext::hideInputPanel()
{
qCDebug(lcQpaInputMethods) << __FUNCTION__;
+ if (!m_isInputPanelVisible)
+ return;
QEventDispatcherWinRT::runOnXamlThread([&]() {
ComPtr<IInputPane2> inputPane;
diff --git a/src/plugins/platforms/winrt/qwinrtintegration.h b/src/plugins/platforms/winrt/qwinrtintegration.h
index 7c83e27c26..636e594b4b 100644
--- a/src/plugins/platforms/winrt/qwinrtintegration.h
+++ b/src/plugins/platforms/winrt/qwinrtintegration.h
@@ -75,7 +75,7 @@ class QWinRTIntegration : public QPlatformIntegration
private:
explicit QWinRTIntegration();
public:
- ~QWinRTIntegration();
+ ~QWinRTIntegration() override;
static QWinRTIntegration *create()
{
diff --git a/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.cpp b/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.cpp
index d69c63e9a4..7016b47f7e 100644
--- a/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.cpp
+++ b/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.cpp
@@ -99,7 +99,7 @@ void QWinRTMessageDialogHelper::exec()
Q_D(QWinRTMessageDialogHelper);
if (!d->shown)
- show(Qt::Dialog, Qt::ApplicationModal, 0);
+ show(Qt::Dialog, Qt::ApplicationModal, nullptr);
d->loop.exec();
}
@@ -134,9 +134,11 @@ bool QWinRTMessageDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModa
RETURN_FALSE_IF_FAILED("Failed to create command factory");
ComPtr<IMessageDialog> dialog;
- HStringReference nativeText(reinterpret_cast<LPCWSTR>(text.utf16()), text.size());
+ HStringReference nativeText(reinterpret_cast<LPCWSTR>(text.utf16()),
+ uint(text.size()));
if (!title.isEmpty()) {
- HStringReference nativeTitle(reinterpret_cast<LPCWSTR>(title.utf16()), title.size());
+ HStringReference nativeTitle(reinterpret_cast<LPCWSTR>(title.utf16()),
+ uint(title.size()));
hr = dialogFactory->CreateWithTitle(nativeText.Get(), nativeTitle.Get(), &dialog);
RETURN_FALSE_IF_FAILED("Failed to create dialog with title");
} else {
@@ -162,7 +164,8 @@ bool QWinRTMessageDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModa
continue;
// Add native command
const QString label = d->theme->standardButtonText(i);
- HStringReference nativeLabel(reinterpret_cast<LPCWSTR>(label.utf16()), label.size());
+ HStringReference nativeLabel(reinterpret_cast<LPCWSTR>(label.utf16()),
+ uint(label.size()));
ComPtr<IUICommand> command;
hr = commandFactory->Create(nativeLabel.Get(), &command);
RETURN_HR_IF_FAILED("Failed to create message box command");
diff --git a/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.h b/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.h
index 14b6d4b715..ab704b1c7d 100644
--- a/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.h
+++ b/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.h
@@ -67,7 +67,7 @@ class QWinRTMessageDialogHelper : public QPlatformMessageDialogHelper
Q_OBJECT
public:
explicit QWinRTMessageDialogHelper(const QWinRTTheme *theme);
- ~QWinRTMessageDialogHelper();
+ ~QWinRTMessageDialogHelper() override;
void exec() override;
bool show(Qt::WindowFlags windowFlags,
diff --git a/src/plugins/platforms/winrt/qwinrtscreen.h b/src/plugins/platforms/winrt/qwinrtscreen.h
index 6d0d3cdf52..cde148a638 100644
--- a/src/plugins/platforms/winrt/qwinrtscreen.h
+++ b/src/plugins/platforms/winrt/qwinrtscreen.h
@@ -89,7 +89,7 @@ class QWinRTScreen : public QPlatformScreen
{
public:
explicit QWinRTScreen();
- ~QWinRTScreen();
+ ~QWinRTScreen() override;
QRect geometry() const override;
QRect availableGeometry() const override;
diff --git a/src/plugins/platforms/winrt/qwinrtservices.cpp b/src/plugins/platforms/winrt/qwinrtservices.cpp
index 05620ca4c8..b27c408f40 100644
--- a/src/plugins/platforms/winrt/qwinrtservices.cpp
+++ b/src/plugins/platforms/winrt/qwinrtservices.cpp
@@ -83,17 +83,14 @@ QWinRTServices::QWinRTServices()
Q_ASSERT_X(SUCCEEDED(hr), Q_FUNC_INFO, qPrintable(qt_error_string(hr)));
}
-QWinRTServices::~QWinRTServices()
-{
-}
-
bool QWinRTServices::openUrl(const QUrl &url)
{
Q_D(QWinRTServices);
ComPtr<IUriRuntimeClass> uri;
QString urlString = url.toString();
- HStringReference uriString(reinterpret_cast<LPCWSTR>(urlString.utf16()), urlString.length());
+ HStringReference uriString(reinterpret_cast<LPCWSTR>(urlString.utf16()),
+ uint(urlString.length()));
HRESULT hr = d->uriFactory->CreateUri(uriString.Get(), &uri);
RETURN_FALSE_IF_FAILED("Failed to create URI from QUrl.");
@@ -122,7 +119,8 @@ bool QWinRTServices::openDocument(const QUrl &url)
}
if (!file) {
const QString pathString = QDir::toNativeSeparators(url.toLocalFile());
- HStringReference path(reinterpret_cast<LPCWSTR>(pathString.utf16()), pathString.length());
+ HStringReference path(reinterpret_cast<LPCWSTR>(pathString.utf16()),
+ uint(pathString.length()));
ComPtr<IAsyncOperation<StorageFile *>> op;
hr = d->fileFactory->GetFileFromPathAsync(path.Get(), &op);
RETURN_FALSE_IF_FAILED("Failed to initialize file URI.");
diff --git a/src/plugins/platforms/winrt/qwinrtservices.h b/src/plugins/platforms/winrt/qwinrtservices.h
index 80b9a6c92a..202ce722cf 100644
--- a/src/plugins/platforms/winrt/qwinrtservices.h
+++ b/src/plugins/platforms/winrt/qwinrtservices.h
@@ -50,7 +50,7 @@ class QWinRTServices : public QPlatformServices
{
public:
explicit QWinRTServices();
- ~QWinRTServices();
+ ~QWinRTServices() override = default;
bool openUrl(const QUrl &url) override;
bool openDocument(const QUrl &url) override;
diff --git a/src/plugins/platforms/winrt/qwinrtwindow.cpp b/src/plugins/platforms/winrt/qwinrtwindow.cpp
index cbf0ba36c9..29d234d276 100644
--- a/src/plugins/platforms/winrt/qwinrtwindow.cpp
+++ b/src/plugins/platforms/winrt/qwinrtwindow.cpp
@@ -126,7 +126,7 @@ QWinRTWindow::QWinRTWindow(QWindow *window)
hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_Xaml_Controls_Canvas).Get(),
IID_PPV_ARGS(&d->canvas));
Q_ASSERT_SUCCEEDED(hr);
- hr = QEventDispatcherWinRT::runOnXamlThread([this, d]() {
+ hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
// Create a new swapchain and place it inside the canvas
HRESULT hr;
hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_UI_Xaml_Controls_SwapChainPanel).Get(),
diff --git a/src/plugins/platforms/winrt/qwinrtwindow.h b/src/plugins/platforms/winrt/qwinrtwindow.h
index 9604b4bbaa..0445e6bf54 100644
--- a/src/plugins/platforms/winrt/qwinrtwindow.h
+++ b/src/plugins/platforms/winrt/qwinrtwindow.h
@@ -54,7 +54,7 @@ class QWinRTWindow : public QPlatformWindow
{
public:
QWinRTWindow(QWindow *window);
- ~QWinRTWindow();
+ ~QWinRTWindow() override;
QSurfaceFormat format() const override;
bool isActive() const override;
diff --git a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
index e2455f87fb..58da2a3c51 100644
--- a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
+++ b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
@@ -130,7 +130,7 @@ static inline QByteArray fromUnicode(QTextCodec *tc, const QString &str)
static inline QVariant qDateFromString(const QString &val)
{
-#ifdef QT_NO_DATESTRING
+#if !QT_CONFIG(datestring)
Q_UNUSED(val);
return QVariant(val);
#else
@@ -142,7 +142,7 @@ static inline QVariant qDateFromString(const QString &val)
static inline QVariant qTimeFromString(const QString &val)
{
-#ifdef QT_NO_DATESTRING
+#if !QT_CONFIG(datestring)
Q_UNUSED(val);
return QVariant(val);
#else
@@ -154,7 +154,7 @@ static inline QVariant qTimeFromString(const QString &val)
static inline QVariant qDateTimeFromString(QString &val)
{
-#ifdef QT_NO_DATESTRING
+#if !QT_CONFIG(datestring)
Q_UNUSED(val);
return QVariant(val);
#else
diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp
index 5796644d34..bf0493b0c3 100644
--- a/src/plugins/sqldrivers/psql/qsql_psql.cpp
+++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp
@@ -679,7 +679,7 @@ QVariant QPSQLResult::data(int i)
if (val[0] == '\0') {
return QVariant(QDate());
} else {
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
return QVariant(QDate::fromString(QString::fromLatin1(val), Qt::ISODate));
#else
return QVariant(QString::fromLatin1(val));
@@ -687,7 +687,7 @@ QVariant QPSQLResult::data(int i)
}
case QVariant::Time: {
const QString str = QString::fromLatin1(val);
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
if (str.isEmpty())
return QVariant(QTime());
else
@@ -698,7 +698,7 @@ QVariant QPSQLResult::data(int i)
}
case QVariant::DateTime: {
QString dtval = QString::fromLatin1(val);
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
if (dtval.length() < 10) {
return QVariant(QDateTime());
} else {
@@ -1500,7 +1500,7 @@ QString QPSQLDriver::formatValue(const QSqlField &field, bool trimStrings) const
} else {
switch (int(field.type())) {
case QVariant::DateTime:
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
if (field.value().toDateTime().isValid()) {
// we force the value to be considered with a timezone information, and we force it to be UTC
// this is safe since postgresql stores only the UTC value and not the timezone offset (only used
@@ -1513,10 +1513,10 @@ QString QPSQLDriver::formatValue(const QSqlField &field, bool trimStrings) const
}
#else
r = QLatin1String("NULL");
-#endif // QT_NO_DATESTRING
+#endif // datestring
break;
case QVariant::Time:
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
if (field.value().toTime().isValid()) {
r = QLatin1Char('\'') + field.value().toTime().toString(QLatin1String("hh:mm:ss.zzz")) + QLatin1Char('\'');
} else
diff --git a/src/sql/kernel/qsqldriver.cpp b/src/sql/kernel/qsqldriver.cpp
index 2d306e9fae..8c6ae382f6 100644
--- a/src/sql/kernel/qsqldriver.cpp
+++ b/src/sql/kernel/qsqldriver.cpp
@@ -617,7 +617,7 @@ QString QSqlDriver::formatValue(const QSqlField &field, bool trimStrings) const
else
r = field.value().toString();
break;
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
case QVariant::Date:
if (field.value().toDate().isValid())
r = QLatin1Char('\'') + field.value().toDate().toString(Qt::ISODate)
diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h
index 927b68bd27..2578037946 100644
--- a/src/testlib/qtest.h
+++ b/src/testlib/qtest.h
@@ -87,7 +87,7 @@ template<> inline char *toString(const QByteArray &ba)
return QTest::toPrettyCString(ba.constData(), ba.length());
}
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
template<> inline char *toString(const QTime &time)
{
return time.isValid()
@@ -108,7 +108,7 @@ template<> inline char *toString(const QDateTime &dateTime)
? qstrdup(qPrintable(dateTime.toString(QStringViewLiteral("yyyy/MM/dd hh:mm:ss.zzz[t]"))))
: qstrdup("Invalid QDateTime");
}
-#endif // QT_NO_DATESTRING
+#endif // datestring
template<> inline char *toString(const QChar &c)
{
diff --git a/src/widgets/configure.json b/src/widgets/configure.json
index 0015c9160a..b3a5227d26 100644
--- a/src/widgets/configure.json
+++ b/src/widgets/configure.json
@@ -81,7 +81,7 @@
"label": "QFileSystemModel",
"purpose": "Provides a data model for the local filesystem.",
"section": "File I/O",
- "condition": "features.itemmodel && features.thread",
+ "condition": "features.itemmodel",
"output": [ "publicFeature", "feature" ]
},
"itemviews": {
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index e4edd2f6ef..e54fdc97d4 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -797,7 +797,7 @@ QString QFileSystemModelPrivate::time(const QModelIndex &index) const
{
if (!index.isValid())
return QString();
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
return node(index)->lastModified().toString(Qt::SystemLocaleDate);
#else
Q_UNUSED(index);
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 6de952a1d3..c9f72da060 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtWidgets module of the Qt Toolkit.
@@ -64,6 +64,7 @@
#include <QtGui/qfont.h>
#include <QtGui/qfontmetrics.h>
#include <QtGui/qclipboard.h>
+#include "private/qabstractbutton_p.h"
#include <private/qdesktopwidget_p.h>
#ifdef Q_OS_WIN
@@ -492,9 +493,17 @@ void QMessageBoxPrivate::_q_buttonClicked(QAbstractButton *button)
void QMessageBoxPrivate::_q_clicked(QPlatformDialogHelper::StandardButton button, QPlatformDialogHelper::ButtonRole role)
{
- Q_UNUSED(role);
Q_Q(QMessageBox);
- q->done(button);
+ if (button > QPlatformDialogHelper::LastButton) {
+ // It's a custom button, and the QPushButton in options is just a proxy
+ // for the button on the platform dialog. Simulate the user clicking it.
+ clickedButton = static_cast<QAbstractButton *>(options->customButton(button)->button);
+ Q_ASSERT(clickedButton);
+ clickedButton->click();
+ q->done(role);
+ } else {
+ q->done(button);
+ }
}
/*!
@@ -831,6 +840,8 @@ void QMessageBox::addButton(QAbstractButton *button, ButtonRole role)
if (!button)
return;
removeButton(button);
+ d->options->addButton(button->text(), static_cast<QPlatformDialogHelper::ButtonRole>(role),
+ button);
d->buttonBox->addButton(button, (QDialogButtonBox::ButtonRole)role);
d->customButtonList.append(button);
d->autoAddOkButton = false;
@@ -2678,7 +2689,11 @@ void QMessageBoxPrivate::helperPrepareShow(QPlatformDialogHelper *)
void QMessageBoxPrivate::helperDone(QDialog::DialogCode code, QPlatformDialogHelper *)
{
Q_Q(QMessageBox);
- clickedButton = q->button(QMessageBox::StandardButton(code));
+ QAbstractButton *button = q->button(QMessageBox::StandardButton(code));
+ // If it was a custom button, a custom ID was used, so we won't get a valid pointer here.
+ // In that case, clickedButton has already been set in _q_buttonClicked.
+ if (button)
+ clickedButton = button;
}
/*!
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index 7cc694a613..37af4ecda0 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -3215,7 +3215,8 @@ void QGraphicsScene::update(const QRectF &rect)
view->d_func()->updateRectF(rect);
}
} else {
- d->updatedRects << rect;
+ if (!d->updatedRects.contains(rect))
+ d->updatedRects << rect;
}
}
diff --git a/src/widgets/itemviews/qdirmodel.cpp b/src/widgets/itemviews/qdirmodel.cpp
index 449850c42e..78fc623fb5 100644
--- a/src/widgets/itemviews/qdirmodel.cpp
+++ b/src/widgets/itemviews/qdirmodel.cpp
@@ -1319,7 +1319,7 @@ QString QDirModelPrivate::type(const QModelIndex &index) const
QString QDirModelPrivate::time(const QModelIndex &index) const
{
-#ifndef QT_NO_DATESTRING
+#if QT_CONFIG(datestring)
return node(index)->info.lastModified().toString(Qt::LocalDate);
#else
Q_UNUSED(index);
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index 2f276a7a8c..b7de69d63a 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -2213,9 +2213,6 @@ void QHeaderViewPrivate::_q_sectionsAboutToBeChanged(const QList<QPersistentMode
? model->index(0, logical, root)
: model->index(logical, 0, root),
s});
-
- if (layoutChangePersistentSections.size() > 1000)
- break;
}
}
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 4adccceebb..a1a861e216 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -4497,16 +4497,14 @@ void QWidget::setForegroundRole(QPalette::ColorRole role)
and these styles typically do not follow the palette. Because of this,
assigning roles to a widget's palette is not guaranteed to change the
appearance of the widget. Instead, you may choose to apply a \l
- styleSheet. You can refer to our Knowledge Base article
- \l{http://qt.nokia.com/developer/knowledgebase/22}{here} for more
- information.
+ styleSheet.
\warning Do not use this function in conjunction with \l{Qt Style Sheets}.
When using style sheets, the palette of a widget can be customized using
the "color", "background-color", "selection-color",
"selection-background-color" and "alternate-background-color".
- \sa QApplication::palette(), QWidget::font()
+ \sa QApplication::palette(), QWidget::font(), \l {Qt Style Sheets}
*/
const QPalette &QWidget::palette() const
{
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp
index df280119cb..0daa4a4b41 100644
--- a/src/widgets/util/qcompleter.cpp
+++ b/src/widgets/util/qcompleter.cpp
@@ -1243,7 +1243,14 @@ void QCompleter::setPopup(QAbstractItemView *popup)
Qt::FocusPolicy origPolicy = Qt::NoFocus;
if (d->widget)
origPolicy = d->widget->focusPolicy();
- popup->setParent(nullptr, Qt::Popup);
+
+ // Mark the widget window as a popup, so that if the last non-popup window is closed by the
+ // user, the application should not be prevented from exiting. It needs to be set explicitly via
+ // setWindowFlag(), because passing the flag via setParent(parent, windowFlags) does not call
+ // QWidgetPrivate::adjustQuitOnCloseAttribute(), and causes an application not to exit if the
+ // popup ends up being the last window.
+ popup->setParent(nullptr);
+ popup->setWindowFlag(Qt::Popup);
popup->setFocusPolicy(Qt::NoFocus);
if (d->widget)
d->widget->setFocusPolicy(origPolicy);
diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp
index 3026a5b7d6..54504d124b 100644
--- a/src/widgets/widgets/qdockarealayout.cpp
+++ b/src/widgets/widgets/qdockarealayout.cpp
@@ -3295,6 +3295,8 @@ int QDockAreaLayout::separatorMove(const QList<int> &separator, const QPoint &or
delta = pick(o, dest - origin);
delta = separatorMoveHelper(list, sep_index, delta, sep);
+ fallbackToSizeHints = false;
+
if (index == QInternal::LeftDock || index == QInternal::RightDock)
setGrid(0, &list);
else
diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp
index 8639f57ea1..f32cd26478 100644
--- a/src/widgets/widgets/qmdiarea.cpp
+++ b/src/widgets/widgets/qmdiarea.cpp
@@ -954,7 +954,7 @@ void QMdiAreaPrivate::rearrange(Rearranger *rearranger)
}
}
- if (active && rearranger->type() == Rearranger::RegularTiler) {
+ if (active && rearranger->type() == Rearranger::RegularTiler && !tileCalledFromResizeEvent) {
// Move active window in front if necessary. That's the case if we
// have any windows with staysOnTopHint set.
int indexToActive = widgets.indexOf((QWidget *)active);
diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp
index 000f33e350..63db93d43f 100644
--- a/src/widgets/widgets/qplaintextedit.cpp
+++ b/src/widgets/widgets/qplaintextedit.cpp
@@ -2633,8 +2633,8 @@ void QPlainTextEdit::setReadOnly(bool ro)
} else {
flags = Qt::TextEditorInteraction;
}
- setAttribute(Qt::WA_InputMethodEnabled, shouldEnableInputMethod(this));
d->control->setTextInteractionFlags(flags);
+ setAttribute(Qt::WA_InputMethodEnabled, shouldEnableInputMethod(this));
QEvent event(QEvent::ReadOnlyChange);
QApplication::sendEvent(this, &event);
}