diff --git a/source/codeblocks/AssaultCube.cbp b/source/codeblocks/AssaultCube.cbp
index d91dbaf3..7ba43fe2 100644
--- a/source/codeblocks/AssaultCube.cbp
+++ b/source/codeblocks/AssaultCube.cbp
@@ -41,7 +41,7 @@
-
+
diff --git a/source/include/jconfig.h b/source/include/jconfig.h
index 5cafaa25..679404da 100644
--- a/source/include/jconfig.h
+++ b/source/include/jconfig.h
@@ -1,5 +1,5 @@
-/* jconfig.vc --- jconfig.h for Microsoft Visual C++ on Windows 95 or NT. */
-/* see jconfig.doc for explanations */
+/* jconfig.vc --- jconfig.h for Microsoft Visual C++ on Windows 95 or NT. */
+/* see jconfig.txt for explanations */
#define HAVE_PROTOTYPES
#define HAVE_UNSIGNED_CHAR
diff --git a/source/include/jerror.h b/source/include/jerror.h
index fcdf6a83..1cfb2b19 100644
--- a/source/include/jerror.h
+++ b/source/include/jerror.h
@@ -2,6 +2,7 @@
* jerror.h
*
* Copyright (C) 1994-1997, Thomas G. Lane.
+ * Modified 1997-2009 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -39,17 +40,15 @@ typedef enum {
JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d") /* Must be first entry! */
/* For maintenance convenience, list is alphabetical by message code name */
-JMESSAGE(JERR_ARITH_NOTIMPL,
- "Sorry, there are legal restrictions on arithmetic coding")
JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix")
JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix")
JMESSAGE(JERR_BAD_BUFFER_MODE, "Bogus buffer control mode")
JMESSAGE(JERR_BAD_COMPONENT_ID, "Invalid component ID %d in SOS")
JMESSAGE(JERR_BAD_CROP_SPEC, "Invalid crop request")
JMESSAGE(JERR_BAD_DCT_COEF, "DCT coefficient out of range")
-JMESSAGE(JERR_BAD_DCTSIZE, "IDCT output block size %d not supported")
+JMESSAGE(JERR_BAD_DCTSIZE, "DCT scaled block size %dx%d not supported")
JMESSAGE(JERR_BAD_DROP_SAMPLING,
- "Component index %d: mismatching sampling ratio %d:%d, %d:%d, %c")
+ "Component index %d: mismatching sampling ratio %d:%d, %d:%d, %c")
JMESSAGE(JERR_BAD_HUFF_TABLE, "Bogus Huffman table definition")
JMESSAGE(JERR_BAD_IN_COLORSPACE, "Bogus input colorspace")
JMESSAGE(JERR_BAD_J_COLORSPACE, "Bogus JPEG colorspace")
@@ -96,6 +95,7 @@ JMESSAGE(JERR_MISSING_DATA, "Scan script does not transmit all data")
JMESSAGE(JERR_MODE_CHANGE, "Invalid color quantization mode change")
JMESSAGE(JERR_NOTIMPL, "Not implemented yet")
JMESSAGE(JERR_NOT_COMPILED, "Requested feature was omitted at compile time")
+JMESSAGE(JERR_NO_ARITH_TABLE, "Arithmetic table 0x%02x was not defined")
JMESSAGE(JERR_NO_BACKING_STORE, "Backing store not supported")
JMESSAGE(JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined")
JMESSAGE(JERR_NO_IMAGE, "JPEG datastream contains no image")
@@ -173,6 +173,7 @@ JMESSAGE(JTRC_UNKNOWN_IDS,
JMESSAGE(JTRC_XMS_CLOSE, "Freed XMS handle %u")
JMESSAGE(JTRC_XMS_OPEN, "Obtained XMS handle %u")
JMESSAGE(JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d")
+JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code")
JMESSAGE(JWRN_BOGUS_PROGRESSION,
"Inconsistent progression sequence for component %d coefficient %d")
JMESSAGE(JWRN_EXTRANEOUS_DATA,
diff --git a/source/include/jmorecfg.h b/source/include/jmorecfg.h
index f54191b0..a84a7ec3 100644
--- a/source/include/jmorecfg.h
+++ b/source/include/jmorecfg.h
@@ -2,6 +2,7 @@
* jmorecfg.h
*
* Copyright (C) 1991-1997, Thomas G. Lane.
+ * Modified 1997-2009 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -22,11 +23,6 @@
#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */
-#if (defined (_MSC_VER) && (_MSC_VER >= 800))
-#define HAVE_UNSIGNED_CHAR
-#define HAVE_ALL_INTS
-#define EXTERN(type) extern type __cdecl
-#endif
/*
* Maximum number of components (color channels) allowed in JPEG image.
@@ -135,7 +131,6 @@ typedef char JOCTET;
*/
/* UINT8 must hold at least the values 0..255. */
-#ifndef HAVE_ALL_INTS
#ifdef HAVE_UNSIGNED_CHAR
typedef unsigned char UINT8;
@@ -163,11 +158,15 @@ typedef short INT16;
/* INT32 must hold at least signed 32-bit values. */
-#if !defined(XMD_H) && !defined(_WIN32) /* X11/xmd.h correctly defines INT32 */
+#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
+#ifndef _BASETSD_H /* MinGW's basetsd.h */
+#ifndef _BASETSD_H_ /* Microsoft defines it in basetsd.h */
+#ifndef QGLOBAL_H /* Qt defines it in qglobal.h */
typedef long INT32;
#endif
-
-#endif /* HAVE_ALL_INTS */
+#endif
+#endif
+#endif
/* Datatype used for image dimensions. The JPEG standard only supports
* images up to 64K*64K due to 16-bit fields in SOF markers. Therefore
@@ -188,63 +187,14 @@ typedef unsigned int JDIMENSION;
* or code profilers that require it.
*/
-#ifdef _WIN32
-# if defined(ALL_STATIC)
-# if defined(JPEG_DLL)
-# undef JPEG_DLL
-# endif
-# if !defined(JPEG_STATIC)
-# define JPEG_STATIC
-# endif
-# endif
-# if defined(JPEG_DLL)
-# if defined(JPEG_STATIC)
-# undef JPEG_STATIC
-# endif
-# endif
-# if defined(JPEG_DLL)
-/* building a DLL */
-# define JPEG_IMPEXP __declspec(dllexport)
-# elif defined(JPEG_STATIC)
-/* building or linking to a static library */
-# define JPEG_IMPEXP
-# else
-/* linking to the DLL */
-# define JPEG_IMPEXP __declspec(dllimport)
-# endif
-# if !defined(JPEG_API)
-# define JPEG_API __cdecl
-# endif
-/* The only remaining magic that is necessary for cygwin */
-#elif defined(__CYGWIN__)
-# if !defined(JPEG_IMPEXP)
-# define JPEG_IMPEXP
-# endif
-# if !defined(JPEG_API)
-# define JPEG_API __cdecl
-# endif
-#endif
-
-/* Ensure our magic doesn't hurt other platforms */
-#if !defined(JPEG_IMPEXP)
-# define JPEG_IMPEXP
-#endif
-#if !defined(JPEG_API)
-# define JPEG_API
-#endif
-
/* a function called through method pointers: */
-#define METHODDEF(type) static type
+#define METHODDEF(type) static type
/* a function used only in its module: */
-#define LOCAL(type) static type
+#define LOCAL(type) static type
/* a function referenced thru EXTERNs: */
-#define GLOBAL(type) type JPEG_API
+#define GLOBAL(type) type
/* a reference to a GLOBAL function: */
-#ifndef EXTERN
-# define EXTERN(type) extern JPEG_IMPEXP type JPEG_API
-/* a reference to a "GLOBAL" function exported by sourcefiles of utility progs */
-#endif /* EXTERN */
-#define EXTERN_1(type) extern type JPEG_API
+#define EXTERN(type) extern type
/* This macro is used to declare a "method", that is, a function pointer.
@@ -266,16 +216,12 @@ typedef unsigned int JDIMENSION;
* explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
*/
-/* jmorecfg.h line 220 */
-/* HJH modification: several of the windows header files already define FAR
- because of this, the code below was changed so that it only tinkers with
- the FAR define if FAR is still undefined */
#ifndef FAR
- #ifdef NEED_FAR_POINTERS
- #define FAR far
- #else
- #define FAR
- #endif
+#ifdef NEED_FAR_POINTERS
+#define FAR far
+#else
+#define FAR
+#endif
#endif
@@ -319,8 +265,6 @@ typedef int boolean;
* (You may HAVE to do that if your compiler doesn't like null source files.)
*/
-/* Arithmetic coding is unsupported for legal reasons. Complaints to IBM. */
-
/* Capability options common to encoder and decoder: */
#define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */
@@ -329,9 +273,10 @@ typedef int boolean;
/* Encoder capability options: */
-#undef C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
+#define C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
+#define DCT_SCALING_SUPPORTED /* Input rescaling via DCT? (Requires DCT_ISLOW)*/
#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */
/* Note: if you selected 12-bit data precision, it is dangerous to turn off
* ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit
@@ -345,12 +290,12 @@ typedef int boolean;
/* Decoder capability options: */
-#undef D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
+#define D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
+#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */
#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */
#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */
-#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */
#undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */
#define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */
#define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */
diff --git a/source/include/jpeglib.h b/source/include/jpeglib.h
index e5fed222..341a19c9 100644
--- a/source/include/jpeglib.h
+++ b/source/include/jpeglib.h
@@ -2,6 +2,7 @@
* jpeglib.h
*
* Copyright (C) 1991-1998, Thomas G. Lane.
+ * Modified 2002-2009 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -10,21 +11,9 @@
* and perhaps jerror.h if they want to know the exact error codes.
*/
-
-typedef unsigned char UINT8;
-typedef signed char INT8;
-typedef unsigned short UINT16;
-typedef short INT16;
-typedef unsigned UINT32;
-typedef int INT32;
-
#ifndef JPEGLIB_H
#define JPEGLIB_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/*
* First we include the configuration files that record how this
* installation of the JPEG library is set up. jconfig.h can be
@@ -37,15 +26,18 @@ extern "C" {
#endif
#include "jmorecfg.h" /* seldom changed options */
+
#ifdef __cplusplus
+#ifndef DONT_USE_EXTERN_C
extern "C" {
-#endif /* __cplusplus */
+#endif
+#endif
/* Version ID for the JPEG library.
- * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60".
+ * Might be useful for tests like "#if JPEG_LIB_VERSION >= 70".
*/
-#define JPEG_LIB_VERSION 62 /* Version 6b */
+#define JPEG_LIB_VERSION 70 /* Version 7.0 */
/* Various constants determining the sizes of things.
@@ -100,7 +92,7 @@ typedef struct {
* (not the zigzag order in which they are stored in a JPEG DQT marker).
* CAUTION: IJG versions prior to v6a kept this array in zigzag order.
*/
- unsigned int quantval[DCTSIZE2]; /* quantization step for each coefficient */
+ UINT16 quantval[DCTSIZE2]; /* quantization step for each coefficient */
/* This field is used only during compression. It's initialized FALSE when
* the table is created, and set TRUE when it's been output to the file.
* You could suppress output of a table by setting this to TRUE.
@@ -153,18 +145,18 @@ typedef struct {
*/
JDIMENSION width_in_blocks;
JDIMENSION height_in_blocks;
- /* Size of a DCT block in samples. Always DCTSIZE for compression.
- * For decompression this is the size of the output from one DCT block,
- * reflecting any scaling we choose to apply during the IDCT step.
- * Values of 1,2,4,8 are likely to be supported. Note that different
- * components may receive different IDCT scalings.
+ /* Size of a DCT block in samples,
+ * reflecting any scaling we choose to apply during the DCT step.
+ * Values from 1 to 16 are supported.
+ * Note that different components may receive different DCT scalings.
*/
- int DCT_scaled_size;
+ int DCT_h_scaled_size;
+ int DCT_v_scaled_size;
/* The downsampled dimensions are the component's actual, unpadded number
- * of samples at the main buffer (preprocessing/compression interface), thus
- * downsampled_width = ceil(image_width * Hi/Hmax)
- * and similarly for height. For decompression, IDCT scaling is included, so
- * downsampled_width = ceil(image_width * Hi/Hmax * DCT_scaled_size/DCTSIZE)
+ * of samples at the main buffer (preprocessing/compression interface);
+ * DCT scaling is included, so
+ * downsampled_width = ceil(image_width * Hi/Hmax * DCT_h_scaled_size/DCTSIZE)
+ * and similarly for height.
*/
JDIMENSION downsampled_width; /* actual width in samples */
JDIMENSION downsampled_height; /* actual height in samples */
@@ -306,6 +298,17 @@ struct jpeg_compress_struct {
* helper routines to simplify changing parameters.
*/
+ unsigned int scale_num, scale_denom; /* fraction by which to scale image */
+
+ JDIMENSION jpeg_width; /* scaled JPEG image width */
+ JDIMENSION jpeg_height; /* scaled JPEG image height */
+ /* Dimensions of actual JPEG image that will be written to file,
+ * derived from input dimensions by scaling factors above.
+ * These fields are computed by jpeg_start_compress().
+ * You can also use jpeg_calc_jpeg_dimensions() to determine these values
+ * in advance of calling jpeg_start_compress().
+ */
+
int data_precision; /* bits of precision in image data */
int num_components; /* # of color components in JPEG image */
@@ -313,14 +316,17 @@ struct jpeg_compress_struct {
jpeg_component_info * comp_info;
/* comp_info[i] describes component that appears i'th in SOF */
-
+
JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS];
- /* ptrs to coefficient quantization tables, or NULL if not defined */
-
+ int q_scale_factor[NUM_QUANT_TBLS];
+ /* ptrs to coefficient quantization tables, or NULL if not defined,
+ * and corresponding scale factors (percentage, initialized 100).
+ */
+
JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];
JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];
/* ptrs to Huffman coding tables, or NULL if not defined */
-
+
UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */
UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */
UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */
@@ -336,6 +342,7 @@ struct jpeg_compress_struct {
boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
boolean optimize_coding; /* TRUE=optimize entropy encoding parms */
boolean CCIR601_sampling; /* TRUE=first samples are cosited */
+ boolean do_fancy_downsampling; /* TRUE=apply fancy downsampling */
int smoothing_factor; /* 1..100, or 0 for no input smoothing */
J_DCT_METHOD dct_method; /* DCT algorithm selector */
@@ -379,6 +386,9 @@ struct jpeg_compress_struct {
int max_h_samp_factor; /* largest h_samp_factor */
int max_v_samp_factor; /* largest v_samp_factor */
+ int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any component */
+ int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any component */
+
JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */
/* The coefficient controller receives data in units of MCU rows as defined
* for fully interleaved scans (whether the JPEG file is interleaved or not).
@@ -590,7 +600,8 @@ struct jpeg_decompress_struct {
int max_h_samp_factor; /* largest h_samp_factor */
int max_v_samp_factor; /* largest v_samp_factor */
- int min_DCT_scaled_size; /* smallest DCT_scaled_size of any component */
+ int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any component */
+ int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any component */
JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */
/* The coefficient controller's input and output progress is measured in
@@ -598,7 +609,7 @@ struct jpeg_decompress_struct {
* in fully interleaved JPEG scans, but are used whether the scan is
* interleaved or not. We define an iMCU row as v_samp_factor DCT block
* rows of each component. Therefore, the IDCT output contains
- * v_samp_factor*DCT_scaled_size sample rows of a component per iMCU row.
+ * v_samp_factor*DCT_v_scaled_size sample rows of a component per iMCU row.
*/
JSAMPLE * sample_range_limit; /* table for fast range-limiting */
@@ -856,6 +867,7 @@ typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo));
#define jpeg_default_colorspace jDefColorspace
#define jpeg_set_quality jSetQuality
#define jpeg_set_linear_quality jSetLQuality
+#define jpeg_default_qtables jDefQTables
#define jpeg_add_quant_table jAddQuantTable
#define jpeg_quality_scaling jQualityScaling
#define jpeg_simple_progression jSimProgress
@@ -865,6 +877,7 @@ typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo));
#define jpeg_start_compress jStrtCompress
#define jpeg_write_scanlines jWrtScanlines
#define jpeg_finish_compress jFinCompress
+#define jpeg_calc_jpeg_dimensions jCjpegDimensions
#define jpeg_write_raw_data jWrtRawData
#define jpeg_write_marker jWrtMarker
#define jpeg_write_m_header jWrtMHeader
@@ -936,6 +949,8 @@ EXTERN(void) jpeg_set_quality JPP((j_compress_ptr cinfo, int quality,
EXTERN(void) jpeg_set_linear_quality JPP((j_compress_ptr cinfo,
int scale_factor,
boolean force_baseline));
+EXTERN(void) jpeg_default_qtables JPP((j_compress_ptr cinfo,
+ boolean force_baseline));
EXTERN(void) jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl,
const unsigned int *basic_table,
int scale_factor,
@@ -955,12 +970,15 @@ EXTERN(JDIMENSION) jpeg_write_scanlines JPP((j_compress_ptr cinfo,
JDIMENSION num_lines));
EXTERN(void) jpeg_finish_compress JPP((j_compress_ptr cinfo));
+/* Precalculate JPEG dimensions for current compression parameters. */
+EXTERN(void) jpeg_calc_jpeg_dimensions JPP((j_compress_ptr cinfo));
+
/* Replaces jpeg_write_scanlines when writing raw downsampled data. */
EXTERN(JDIMENSION) jpeg_write_raw_data JPP((j_compress_ptr cinfo,
JSAMPIMAGE data,
JDIMENSION num_lines));
-/* Write a special marker. See libjpeg.doc concerning safe usage. */
+/* Write a special marker. See libjpeg.txt concerning safe usage. */
EXTERN(void) jpeg_write_marker
JPP((j_compress_ptr cinfo, int marker,
const JOCTET * dataptr, unsigned int datalen));
@@ -1095,9 +1113,6 @@ struct jpeg_color_quantizer { long dummy; };
#endif /* JPEG_INTERNALS */
#endif /* INCOMPLETE_TYPES_BROKEN */
-#ifdef __cplusplus
-}
-#endif
/*
* The JPEG library modules define JPEG_INTERNALS before including this file.
@@ -1112,7 +1127,9 @@ struct jpeg_color_quantizer { long dummy; };
#endif
#ifdef __cplusplus
+#ifndef DONT_USE_EXTERN_C
}
#endif
+#endif
#endif /* JPEGLIB_H */
diff --git a/source/lib/jpeg.lib b/source/lib/jpeg.lib
new file mode 100644
index 00000000..47bde251
Binary files /dev/null and b/source/lib/jpeg.lib differ
diff --git a/source/src/Makefile b/source/src/Makefile
index 4760ba25..e7a43ff7 100644
--- a/source/src/Makefile
+++ b/source/src/Makefile
@@ -16,7 +16,7 @@ endif
ifneq (,$(findstring MINGW,$(PLATFORM)))
WINDRES= windres
CLIENT_INCLUDES= $(INCLUDES) -I../include
-CLIENT_LIBS= -mwindows -L../lib -lSDL -lSDL_image -lzdll -lopengl32 -lenet -lOpenAL32 -llibvorbisfile -llibjpeg-static-mt -llibintl -lws2_32 -lwinmm
+CLIENT_LIBS= -mwindows -L../lib -lSDL -lSDL_image -lzdll -lopengl32 -lenet -lOpenAL32 -llibvorbisfile -ljpeg -llibintl -lws2_32 -lwinmm
else
override CXXFLAGS+= -rdynamic
CLIENT_INCLUDES= $(INCLUDES) -I/usr/X11R6/include `sdl-config --cflags`