Commit 30cf5e01 authored by Juha Reunanen's avatar Juha Reunanen Committed by Alexander Alekhin

Update libjpeg-turbo from 1.5.3 to 2.0.2

parent 5421d086
...@@ -2,11 +2,11 @@ project(${JPEG_LIBRARY} C) ...@@ -2,11 +2,11 @@ project(${JPEG_LIBRARY} C)
ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter -Wsign-compare -Wshorten-64-to-32 -Wimplicit-fallthrough) ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter -Wsign-compare -Wshorten-64-to-32 -Wimplicit-fallthrough)
set(VERSION_MAJOR 1) set(VERSION_MAJOR 2)
set(VERSION_MINOR 5) set(VERSION_MINOR 0)
set(VERSION_REVISION 3) set(VERSION_REVISION 2)
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}) set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION})
set(LIBJPEG_TURBO_VERSION_NUMBER 1005003) set(LIBJPEG_TURBO_VERSION_NUMBER 2000002)
string(TIMESTAMP BUILD "opencv-${OPENCV_VERSION}-libjpeg-turbo") string(TIMESTAMP BUILD "opencv-${OPENCV_VERSION}-libjpeg-turbo")
if(CMAKE_BUILD_TYPE STREQUAL "Debug") if(CMAKE_BUILD_TYPE STREQUAL "Debug")
......
...@@ -11,9 +11,10 @@ libjpeg-turbo is covered by three compatible BSD-style open source licenses: ...@@ -11,9 +11,10 @@ libjpeg-turbo is covered by three compatible BSD-style open source licenses:
- The Modified (3-clause) BSD License, which is listed below - 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 - The [zlib License](https://opensource.org/licenses/Zlib)
This license is a subset of the other two, and it covers the libjpeg-turbo This license is a subset of the other two, and it covers the libjpeg-turbo
SIMD extensions. SIMD extensions.
...@@ -65,7 +66,7 @@ best of our understanding. ...@@ -65,7 +66,7 @@ best of our understanding.
2. If your binary distribution includes or uses the TurboJPEG API, then 2. If your binary distribution includes or uses the TurboJPEG API, then
your product documentation must include the text of the Modified BSD your product documentation must include the text of the Modified BSD
License. License (see below.)
**Origin** **Origin**
- Clause 2 of the Modified BSD License - Clause 2 of the Modified BSD License
...@@ -90,7 +91,8 @@ best of our understanding. ...@@ -90,7 +91,8 @@ best of our understanding.
The Modified (3-clause) BSD License The Modified (3-clause) BSD License
=================================== ===================================
Copyright (C)\<YEAR\> \<AUTHOR\>. All Rights Reserved. Copyright (C)2009-2019 D. R. Commander. All Rights Reserved.
Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met: modification, are permitted provided that the following conditions are met:
...@@ -117,23 +119,14 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ...@@ -117,23 +119,14 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
The zlib License Why Three Licenses?
================ ===================
Copyright (C) \<YEAR\>, \<AUTHOR\>. The zlib License could have been used instead of the Modified (3-clause) BSD
License, and since the IJG License effectively subsumes the distribution
This software is provided 'as-is', without any express or implied conditions of the zlib License, this would have effectively placed
warranty. In no event will the authors be held liable for any damages libjpeg-turbo binary distributions under the IJG License. However, the IJG
arising from the use of this software. License specifically refers to the Independent JPEG Group and does not extend
attribution and endorsement protections to other entities. Thus, it was
Permission is granted to anyone to use this software for any purpose, desirable to choose a license that granted us the same protections for new code
including commercial applications, and to alter it and redistribute it that were granted to the IJG for code derived from their software.
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
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.
...@@ -43,7 +43,7 @@ User documentation: ...@@ -43,7 +43,7 @@ User documentation:
change.log Version-to-version change highlights. change.log Version-to-version change highlights.
Programmer and internal documentation: Programmer and internal documentation:
libjpeg.txt How to use the JPEG library in your own programs. 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. structure.txt Overview of the JPEG library's internal structure.
coderules.txt Coding style rules --- please read if you contribute code. 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 ...@@ -159,12 +159,6 @@ commercial products, provided that all warranty or liability claims are
assumed by the product vendor. 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. The IJG distribution formerly included code to read and write GIF files.
To avoid entanglement with the Unisys LZW patent (now expired), GIF reading To avoid entanglement with the Unisys LZW patent (now expired), GIF reading
support has been removed altogether, and the GIF writer has been simplified 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 ...@@ -185,8 +179,8 @@ We recommend reading one or more of these references before trying to
understand the innards of the JPEG software. understand the innards of the JPEG software.
The best short technical introduction to the JPEG compression algorithm is The best short technical introduction to the JPEG compression algorithm is
Wallace, Gregory K. "The JPEG Still Picture Compression Standard", Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44. Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44.
(Adjacent articles in that issue discuss MPEG motion picture compression, (Adjacent articles in that issue discuss MPEG motion picture compression,
applications of JPEG, and related topics.) If you don't have the CACM issue 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 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 ...@@ -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. numbers ISO/IEC IS 10918-2, ITU-T T.83.
The JPEG standard does not specify all details of an interchangeable file The JPEG standard does not specify all details of an interchangeable file
format. For the omitted details we follow the "JFIF" conventions, revision 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 1.02. JFIF version 1 has been adopted as ISO/IEC 10918-5 (05/2013) and
and thus received a formal publication status. It is available as a free Recommendation ITU-T T.871 (05/2011): Information technology - Digital
download in PDF format from compression and coding of continuous-tone still images: JPEG File Interchange
http://www.ecma-international.org/publications/techreports/E-TR-098.htm. Format (JFIF). It is available as a free download in PDF file format from
A PostScript version of the JFIF document is available at https://www.iso.org/standard/54989.html and http://www.itu.int/rec/T-REC-T.871.
http://www.ijg.org/files/jfif.ps.gz. There is also a plain text version at A PDF file of the older JFIF 1.02 specification is available at
http://www.ijg.org/files/jfif.txt.gz, but it is missing the figures. http://www.w3.org/Graphics/JPEG/jfif3.pdf.
The TIFF 6.0 file format specification can be obtained by FTP from 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 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 ...@@ -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/. 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 If you don't have Web or FTP access, send e-mail to mail-server@rtfm.mit.edu
with body with body
send usenet/news.answers/jpeg-faq/part1 send usenet/news.answers/jpeg-faq/part1
send usenet/news.answers/jpeg-faq/part2 send usenet/news.answers/jpeg-faq/part2
FILE FORMAT WARS FILE FORMAT COMPATIBILITY
================ =========================
The ISO/IEC JTC1/SC29/WG1 standards committee (also known as JPEG, together This software implements ITU T.81 | ISO/IEC 10918 with some extensions from
with ITU-T SG16) currently promotes different formats containing the name ITU T.871 | ISO/IEC 10918-5 (JPEG File Interchange Format-- see REFERENCES).
"JPEG" which are incompatible with original DCT-based JPEG. IJG therefore does Informally, the term "JPEG image" or "JPEG file" most often refers to JFIF or
not support these formats (see REFERENCES). Indeed, one of the original a subset thereof, but there are other formats containing the name "JPEG" that
reasons for developing this free software was to help force convergence on are incompatible with the DCT-based JPEG standard or with JFIF (for instance,
common, interoperable format standards for JPEG files. JPEG 2000 and JPEG XR). This software therefore does not support these
Don't use an incompatible file format! formats. Indeed, one of the original reasons for developing this free software
(In any case, our decoder will remain capable of reading existing JPEG was to help force convergence on a common, interoperable format standard for
image files indefinitely.) 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 TO DO
......
...@@ -2,8 +2,9 @@ Background ...@@ -2,8 +2,9 @@ Background
========== ==========
libjpeg-turbo is a JPEG image codec that uses SIMD instructions (MMX, SSE2, libjpeg-turbo is a JPEG image codec that uses SIMD instructions (MMX, SSE2,
NEON, AltiVec) to accelerate baseline JPEG compression and decompression on AVX2, NEON, AltiVec) to accelerate baseline JPEG compression and decompression
x86, x86-64, ARM, and PowerPC systems. On such systems, libjpeg-turbo is 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 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 systems, libjpeg-turbo can still outperform libjpeg by a significant amount, by
virtue of its highly-optimized Huffman coding routines. In many cases, the virtue of its highly-optimized Huffman coding routines. In many cases, the
...@@ -48,7 +49,10 @@ JPEG images: ...@@ -48,7 +49,10 @@ JPEG images:
straightforward to achieve using the underlying libjpeg API, such as straightforward to achieve using the underlying libjpeg API, such as
generating planar YUV images and performing multiple simultaneous lossless generating planar YUV images and performing multiple simultaneous lossless
transforms on an image. The Java interface for libjpeg-turbo is written on 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> - **libjpeg API**<br>
This is the de facto industry-standard API for compressing and decompressing This is the de facto industry-standard API for compressing and decompressing
...@@ -56,7 +60,8 @@ JPEG images: ...@@ -56,7 +60,8 @@ JPEG images:
more powerful. The libjpeg API implementation in libjpeg-turbo is both more powerful. The libjpeg API implementation in libjpeg-turbo is both
API/ABI-compatible and mathematically compatible with libjpeg v6b. It can 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 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 There is no significant performance advantage to either API when both are used
to perform similar operations. to perform similar operations.
......
/* jconfig.vc --- jconfig.h for Microsoft Visual C++ on Windows 95 or NT. */ /* Version ID for the JPEG library.
/* see jconfig.txt for explanations */ * 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 1
#define JPEG_LIB_VERSION @JPEG_LIB_VERSION@ /* Support arithmetic decoding */
#define LIBJPEG_TURBO_VERSION @VERSION@ #cmakedefine D_ARITH_CODING_SUPPORTED 1
#define LIBJPEG_TURBO_VERSION_NUMBER @LIBJPEG_TURBO_VERSION_NUMBER@
#cmakedefine C_ARITH_CODING_SUPPORTED /* Support in-memory source/destination managers */
#cmakedefine D_ARITH_CODING_SUPPORTED #cmakedefine MEM_SRCDST_SUPPORTED 1
#cmakedefine MEM_SRCDST_SUPPORTED
/* Use accelerated SIMD routines. */
#cmakedefine WITH_SIMD 1
/* /*
* Define BITS_IN_JSAMPLE as either * Define BITS_IN_JSAMPLE as either
...@@ -19,35 +32,42 @@ ...@@ -19,35 +32,42 @@
#define BITS_IN_JSAMPLE @BITS_IN_JSAMPLE@ /* use 8 or 12 */ #define BITS_IN_JSAMPLE @BITS_IN_JSAMPLE@ /* use 8 or 12 */
#define HAVE_UNSIGNED_CHAR /* Define to 1 if you have the <locale.h> header file. */
#define HAVE_UNSIGNED_SHORT #cmakedefine HAVE_LOCALE_H 1
/* #define void char */
/* #define const */
#undef __CHAR_UNSIGNED__
#define HAVE_STDDEF_H
#define HAVE_STDLIB_H
#undef NEED_BSD_STRINGS
#undef NEED_SYS_TYPES_H
#undef NEED_FAR_POINTERS /* we presume a 32-bit flat memory model */
#undef INCOMPLETE_TYPES_BROKEN
/* Define "boolean" as unsigned char, not int, per Windows custom */
#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 */
/* Define "INT32" as int, not long, per Windows custom */ /* Define to 1 if you have the <stddef.h> header file. */
#if !(defined(_BASETSD_H_) || defined(_BASETSD_H)) /* don't conflict if basetsd.h already read */ #cmakedefine HAVE_STDDEF_H 1
typedef short INT16;
typedef signed int INT32;
#endif
#define XMD_H /* prevent jmorecfg.h from redefining it */
#ifdef JPEG_INTERNALS /* Define to 1 if you have the <stdlib.h> header file. */
#cmakedefine HAVE_STDLIB_H 1
#undef RIGHT_SHIFT_IS_UNSIGNED /* Define if you need to include <sys/types.h> to get size_t. */
#cmakedefine NEED_SYS_TYPES_H 1
/* Define if you have BSD-like bzero and bcopy in <strings.h> rather than
memset/memcpy in <string.h>. */
#cmakedefine NEED_BSD_STRINGS 1
/* Define to 1 if the system has the type `unsigned char'. */
#cmakedefine HAVE_UNSIGNED_CHAR 1
/* Define to 1 if the system has the type `unsigned short'. */
#cmakedefine HAVE_UNSIGNED_SHORT 1
/* Compiler does not support pointers to undefined structures. */
#cmakedefine INCOMPLETE_TYPES_BROKEN 1
/* Define if your (broken) compiler shifts signed values as if they were
unsigned. */
#cmakedefine RIGHT_SHIFT_IS_UNSIGNED 1
/* Define to 1 if type `char' is unsigned and you are not using gcc. */
#ifndef __CHAR_UNSIGNED__
#cmakedefine __CHAR_UNSIGNED__ 1
#endif
#define SIZEOF_SIZE_T @SIZEOF_SIZE_T@ /* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
#endif /* JPEG_INTERNALS */ /* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */
#define JPEG_LIB_VERSION @JPEG_LIB_VERSION@
#define LIBJPEG_TURBO_VERSION @VERSION@
#define LIBJPEG_TURBO_VERSION_NUMBER @LIBJPEG_TURBO_VERSION_NUMBER@
#cmakedefine C_ARITH_CODING_SUPPORTED
#cmakedefine D_ARITH_CODING_SUPPORTED
#cmakedefine MEM_SRCDST_SUPPORTED
#cmakedefine WITH_SIMD
#define BITS_IN_JSAMPLE @BITS_IN_JSAMPLE@ /* use 8 or 12 */
#define HAVE_STDDEF_H
#define HAVE_STDLIB_H
#undef NEED_SYS_TYPES_H
#undef NEED_BSD_STRINGS
#define HAVE_UNSIGNED_CHAR
#define HAVE_UNSIGNED_SHORT
#undef INCOMPLETE_TYPES_BROKEN
#undef RIGHT_SHIFT_IS_UNSIGNED
#undef __CHAR_UNSIGNED__
/* Define "boolean" as unsigned char, not int, per Windows custom */
#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 */
/* Define "INT32" as int, not long, per Windows custom */
#if !(defined(_BASETSD_H_) || defined(_BASETSD_H)) /* don't conflict if basetsd.h already read */
typedef short INT16;
typedef signed int INT32;
#endif
#define XMD_H /* prevent jmorecfg.h from redefining it */
#define VERSION "@VERSION@" /* libjpeg-turbo build number */
#define BUILD "@BUILD@" #define BUILD "@BUILD@"
#define PACKAGE_NAME "@CMAKE_PROJECT_NAME@"
/* Compiler's inline keyword */
#ifndef INLINE #undef inline
#if defined(__GNUC__)
#define INLINE inline __attribute__((always_inline)) /* How to obtain function inlining. */
#elif defined(_MSC_VER) #define INLINE @INLINE@
#define INLINE __forceinline
#else /* Define to the full name of this package. */
#define INLINE #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
#endif #endif
...@@ -4,16 +4,16 @@ ...@@ -4,16 +4,16 @@
* This file was part of the Independent JPEG Group's software: * This file was part of the Independent JPEG Group's software:
* Developed 1997-2009 by Guido Vollbeding. * Developed 1997-2009 by Guido Vollbeding.
* libjpeg-turbo Modifications: * 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 * For conditions of distribution and use, see the accompanying README.ijg
* file. * file.
* *
* This file contains probability estimation tables for common use in * This file contains probability estimation tables for common use in
* arithmetic entropy encoding and decoding routines. * arithmetic entropy encoding and decoding routines.
* *
* This data represents Table D.2 in the JPEG spec (ISO/IEC IS 10918-1 * This data represents Table D.2 in
* and CCITT Recommendation ITU-T T.81) and Table 24 in the JBIG spec * Recommendation ITU-T T.81 (1992) | ISO/IEC 10918-1:1994 and Table 24 in
* (ISO/IEC IS 11544 and CCITT Recommendation ITU-T T.82). * Recommendation ITU-T T.82 (1993) | ISO/IEC 11544:1993.
*/ */
#define JPEG_INTERNALS #define JPEG_INTERNALS
...@@ -29,9 +29,10 @@ ...@@ -29,9 +29,10 @@
* implementation (jbig_tab.c). * 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 * Index, Qe_Value, Next_Index_LPS, Next_Index_MPS, Switch_MPS
*/ */
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
*/ */
GLOBAL(void) 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; int i;
...@@ -41,7 +41,7 @@ jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize) ...@@ -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); ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version);
if (structsize != sizeof(struct jpeg_compress_struct)) if (structsize != sizeof(struct jpeg_compress_struct))
ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE, 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. /* For debugging purposes, we zero the whole master structure.
* But the application has already set the err pointer, and may have set * 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) ...@@ -59,7 +59,7 @@ jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize)
cinfo->is_decompressor = FALSE; cinfo->is_decompressor = FALSE;
/* Initialize a memory manager instance for this object */ /* 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. */ /* Zero out pointers to permanent structures. */
cinfo->progress = NULL; cinfo->progress = NULL;
...@@ -83,7 +83,7 @@ jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize) ...@@ -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 */ /* Must do it here for emit_dqt in case jpeg_write_tables is used */
cinfo->block_size = DCTSIZE; cinfo->block_size = DCTSIZE;
cinfo->natural_order = jpeg_natural_order; cinfo->natural_order = jpeg_natural_order;
cinfo->lim_Se = DCTSIZE2-1; cinfo->lim_Se = DCTSIZE2 - 1;
#endif #endif
cinfo->script_space = NULL; cinfo->script_space = NULL;
...@@ -100,9 +100,9 @@ jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize) ...@@ -100,9 +100,9 @@ jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize)
*/ */
GLOBAL(void) 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) ...@@ -112,9 +112,9 @@ jpeg_destroy_compress (j_compress_ptr cinfo)
*/ */
GLOBAL(void) 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) ...@@ -131,7 +131,7 @@ jpeg_abort_compress (j_compress_ptr cinfo)
*/ */
GLOBAL(void) GLOBAL(void)
jpeg_suppress_tables (j_compress_ptr cinfo, boolean suppress) jpeg_suppress_tables(j_compress_ptr cinfo, boolean suppress)
{ {
int i; int i;
JQUANT_TBL *qtbl; JQUANT_TBL *qtbl;
...@@ -159,7 +159,7 @@ jpeg_suppress_tables (j_compress_ptr cinfo, boolean suppress) ...@@ -159,7 +159,7 @@ jpeg_suppress_tables (j_compress_ptr cinfo, boolean suppress)
*/ */
GLOBAL(void) GLOBAL(void)
jpeg_finish_compress (j_compress_ptr cinfo) jpeg_finish_compress(j_compress_ptr cinfo)
{ {
JDIMENSION iMCU_row; JDIMENSION iMCU_row;
...@@ -172,18 +172,18 @@ jpeg_finish_compress (j_compress_ptr cinfo) ...@@ -172,18 +172,18 @@ jpeg_finish_compress (j_compress_ptr cinfo)
} else if (cinfo->global_state != CSTATE_WRCOEFS) } else if (cinfo->global_state != CSTATE_WRCOEFS)
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
/* Perform any remaining passes */ /* Perform any remaining passes */
while (! cinfo->master->is_last_pass) { while (!cinfo->master->is_last_pass) {
(*cinfo->master->prepare_for_pass) (cinfo); (*cinfo->master->prepare_for_pass) (cinfo);
for (iMCU_row = 0; iMCU_row < cinfo->total_iMCU_rows; iMCU_row++) { for (iMCU_row = 0; iMCU_row < cinfo->total_iMCU_rows; iMCU_row++) {
if (cinfo->progress != NULL) { if (cinfo->progress != NULL) {
cinfo->progress->pass_counter = (long) iMCU_row; cinfo->progress->pass_counter = (long)iMCU_row;
cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows; cinfo->progress->pass_limit = (long)cinfo->total_iMCU_rows;
(*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
} }
/* We bypass the main controller and invoke coef controller directly; /* We bypass the main controller and invoke coef controller directly;
* all work is being done from the coefficient buffer. * 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); ERREXIT(cinfo, JERR_CANT_SUSPEND);
} }
(*cinfo->master->finish_pass) (cinfo); (*cinfo->master->finish_pass) (cinfo);
...@@ -192,7 +192,7 @@ jpeg_finish_compress (j_compress_ptr cinfo) ...@@ -192,7 +192,7 @@ jpeg_finish_compress (j_compress_ptr cinfo)
(*cinfo->marker->write_file_trailer) (cinfo); (*cinfo->marker->write_file_trailer) (cinfo);
(*cinfo->dest->term_destination) (cinfo); (*cinfo->dest->term_destination) (cinfo);
/* We can use jpeg_abort to release memory and reset global_state */ /* 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) ...@@ -204,8 +204,8 @@ jpeg_finish_compress (j_compress_ptr cinfo)
*/ */
GLOBAL(void) GLOBAL(void)
jpeg_write_marker (j_compress_ptr cinfo, int marker, jpeg_write_marker(j_compress_ptr cinfo, int marker, const JOCTET *dataptr,
const JOCTET *dataptr, unsigned int datalen) unsigned int datalen)
{ {
void (*write_marker_byte) (j_compress_ptr info, int val); void (*write_marker_byte) (j_compress_ptr info, int val);
...@@ -226,7 +226,7 @@ jpeg_write_marker (j_compress_ptr cinfo, int marker, ...@@ -226,7 +226,7 @@ jpeg_write_marker (j_compress_ptr cinfo, int marker,
/* Same, but piecemeal. */ /* Same, but piecemeal. */
GLOBAL(void) 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 || if (cinfo->next_scanline != 0 ||
(cinfo->global_state != CSTATE_SCANNING && (cinfo->global_state != CSTATE_SCANNING &&
...@@ -238,7 +238,7 @@ jpeg_write_m_header (j_compress_ptr cinfo, int marker, unsigned int datalen) ...@@ -238,7 +238,7 @@ jpeg_write_m_header (j_compress_ptr cinfo, int marker, unsigned int datalen)
} }
GLOBAL(void) 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); (*cinfo->marker->write_marker_byte) (cinfo, val);
} }
...@@ -266,13 +266,13 @@ jpeg_write_m_byte (j_compress_ptr cinfo, int val) ...@@ -266,13 +266,13 @@ jpeg_write_m_byte (j_compress_ptr cinfo, int val)
*/ */
GLOBAL(void) GLOBAL(void)
jpeg_write_tables (j_compress_ptr cinfo) jpeg_write_tables(j_compress_ptr cinfo)
{ {
if (cinfo->global_state != CSTATE_START) if (cinfo->global_state != CSTATE_START)
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
/* (Re)initialize error mgr and destination modules */ /* (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); (*cinfo->dest->init_destination) (cinfo);
/* Initialize the marker writer ... bit of a crock to do it here. */ /* Initialize the marker writer ... bit of a crock to do it here. */
jinit_marker_writer(cinfo); jinit_marker_writer(cinfo);
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
*/ */
GLOBAL(void) 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) if (cinfo->global_state != CSTATE_START)
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
...@@ -45,7 +45,7 @@ jpeg_start_compress (j_compress_ptr cinfo, boolean write_all_tables) ...@@ -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 */ jpeg_suppress_tables(cinfo, FALSE); /* mark all tables to be written */
/* (Re)initialize error mgr and destination modules */ /* (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); (*cinfo->dest->init_destination) (cinfo);
/* Perform master selection of active modules */ /* Perform master selection of active modules */
jinit_compress_master(cinfo); jinit_compress_master(cinfo);
...@@ -75,8 +75,8 @@ jpeg_start_compress (j_compress_ptr cinfo, boolean write_all_tables) ...@@ -75,8 +75,8 @@ jpeg_start_compress (j_compress_ptr cinfo, boolean write_all_tables)
*/ */
GLOBAL(JDIMENSION) GLOBAL(JDIMENSION)
jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines, jpeg_write_scanlines(j_compress_ptr cinfo, JSAMPARRAY scanlines,
JDIMENSION num_lines) JDIMENSION num_lines)
{ {
JDIMENSION row_ctr, rows_left; JDIMENSION row_ctr, rows_left;
...@@ -87,9 +87,9 @@ jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines, ...@@ -87,9 +87,9 @@ jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines,
/* Call progress monitor hook if present */ /* Call progress monitor hook if present */
if (cinfo->progress != NULL) { if (cinfo->progress != NULL) {
cinfo->progress->pass_counter = (long) cinfo->next_scanline; cinfo->progress->pass_counter = (long)cinfo->next_scanline;
cinfo->progress->pass_limit = (long) cinfo->image_height; cinfo->progress->pass_limit = (long)cinfo->image_height;
(*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
} }
/* Give master control module another chance if this is first call to /* 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, ...@@ -118,8 +118,8 @@ jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines,
*/ */
GLOBAL(JDIMENSION) GLOBAL(JDIMENSION)
jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data, jpeg_write_raw_data(j_compress_ptr cinfo, JSAMPIMAGE data,
JDIMENSION num_lines) JDIMENSION num_lines)
{ {
JDIMENSION lines_per_iMCU_row; JDIMENSION lines_per_iMCU_row;
...@@ -132,9 +132,9 @@ jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data, ...@@ -132,9 +132,9 @@ jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data,
/* Call progress monitor hook if present */ /* Call progress monitor hook if present */
if (cinfo->progress != NULL) { if (cinfo->progress != NULL) {
cinfo->progress->pass_counter = (long) cinfo->next_scanline; cinfo->progress->pass_counter = (long)cinfo->next_scanline;
cinfo->progress->pass_limit = (long) cinfo->image_height; cinfo->progress->pass_limit = (long)cinfo->image_height;
(*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
} }
/* Give master control module another chance if this is first call to /* 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, ...@@ -151,7 +151,7 @@ jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data,
ERREXIT(cinfo, JERR_BUFFER_SIZE); ERREXIT(cinfo, JERR_BUFFER_SIZE);
/* Directly compress the row. */ /* 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. */ /* If compressor did not consume the whole row, suspend processing. */
return 0; return 0;
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -29,13 +29,13 @@ ...@@ -29,13 +29,13 @@
INLINE INLINE
LOCAL(void) LOCAL(void)
rgb_ycc_convert_internal (j_compress_ptr cinfo, rgb_ycc_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row,
JDIMENSION output_row, int num_rows) 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 int r, g, b;
register JLONG * ctab = cconvert->rgb_ycc_tab; register JLONG *ctab = cconvert->rgb_ycc_tab;
register JSAMPROW inptr; register JSAMPROW inptr;
register JSAMPROW outptr0, outptr1, outptr2; register JSAMPROW outptr0, outptr1, outptr2;
register JDIMENSION col; register JDIMENSION col;
...@@ -58,17 +58,14 @@ rgb_ycc_convert_internal (j_compress_ptr cinfo, ...@@ -58,17 +58,14 @@ rgb_ycc_convert_internal (j_compress_ptr cinfo,
* need the general RIGHT_SHIFT macro. * need the general RIGHT_SHIFT macro.
*/ */
/* Y */ /* Y */
outptr0[col] = (JSAMPLE) outptr0[col] = (JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) ctab[b + B_Y_OFF]) >> SCALEBITS);
>> SCALEBITS);
/* Cb */ /* Cb */
outptr1[col] = (JSAMPLE) outptr1[col] = (JSAMPLE)((ctab[r + R_CB_OFF] + ctab[g + G_CB_OFF] +
((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF]) ctab[b + B_CB_OFF]) >> SCALEBITS);
>> SCALEBITS);
/* Cr */ /* Cr */
outptr2[col] = (JSAMPLE) outptr2[col] = (JSAMPLE)((ctab[r + R_CR_OFF] + ctab[g + G_CR_OFF] +
((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF]) ctab[b + B_CR_OFF]) >> SCALEBITS);
>> SCALEBITS);
} }
} }
} }
...@@ -86,13 +83,13 @@ rgb_ycc_convert_internal (j_compress_ptr cinfo, ...@@ -86,13 +83,13 @@ rgb_ycc_convert_internal (j_compress_ptr cinfo,
INLINE INLINE
LOCAL(void) LOCAL(void)
rgb_gray_convert_internal (j_compress_ptr cinfo, rgb_gray_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row,
JDIMENSION output_row, int num_rows) 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 int r, g, b;
register JLONG * ctab = cconvert->rgb_ycc_tab; register JLONG *ctab = cconvert->rgb_ycc_tab;
register JSAMPROW inptr; register JSAMPROW inptr;
register JSAMPROW outptr; register JSAMPROW outptr;
register JDIMENSION col; register JDIMENSION col;
...@@ -108,9 +105,8 @@ rgb_gray_convert_internal (j_compress_ptr cinfo, ...@@ -108,9 +105,8 @@ rgb_gray_convert_internal (j_compress_ptr cinfo,
b = GETJSAMPLE(inptr[RGB_BLUE]); b = GETJSAMPLE(inptr[RGB_BLUE]);
inptr += RGB_PIXELSIZE; inptr += RGB_PIXELSIZE;
/* Y */ /* Y */
outptr[col] = (JSAMPLE) outptr[col] = (JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) ctab[b + B_Y_OFF]) >> SCALEBITS);
>> SCALEBITS);
} }
} }
} }
...@@ -123,9 +119,9 @@ rgb_gray_convert_internal (j_compress_ptr cinfo, ...@@ -123,9 +119,9 @@ rgb_gray_convert_internal (j_compress_ptr cinfo,
INLINE INLINE
LOCAL(void) LOCAL(void)
rgb_rgb_convert_internal (j_compress_ptr cinfo, rgb_rgb_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row,
JDIMENSION output_row, int num_rows) int num_rows)
{ {
register JSAMPROW inptr; register JSAMPROW inptr;
register JSAMPROW outptr0, outptr1, outptr2; register JSAMPROW outptr0, outptr1, outptr2;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -20,9 +20,9 @@ ...@@ -20,9 +20,9 @@
*/ */
#if BITS_IN_JSAMPLE == 8 #if BITS_IN_JSAMPLE == 8
#define MAX_COEF_BITS 10 #define MAX_COEF_BITS 10
#else #else
#define MAX_COEF_BITS 14 #define MAX_COEF_BITS 14
#endif #endif
/* Derived data constructed for each Huffman table */ /* Derived data constructed for each Huffman table */
...@@ -34,10 +34,9 @@ typedef struct { ...@@ -34,10 +34,9 @@ typedef struct {
} c_derived_tbl; } c_derived_tbl;
/* Expand a Huffman table definition into the derived format */ /* Expand a Huffman table definition into the derived format */
EXTERN(void) jpeg_make_c_derived_tbl EXTERN(void) jpeg_make_c_derived_tbl(j_compress_ptr cinfo, boolean isDC,
(j_compress_ptr cinfo, boolean isDC, int tblno, int tblno, c_derived_tbl **pdtbl);
c_derived_tbl ** pdtbl);
/* Generate an optimal table definition given the specified counts */ /* Generate an optimal table definition given the specified counts */
EXTERN(void) jpeg_gen_optimal_table EXTERN(void) jpeg_gen_optimal_table(j_compress_ptr cinfo, JHUFF_TBL *htbl,
(j_compress_ptr cinfo, JHUFF_TBL *htbl, long freq[]); long freq[]);
...@@ -28,13 +28,13 @@ ...@@ -28,13 +28,13 @@
*/ */
GLOBAL(void) GLOBAL(void)
jinit_compress_master (j_compress_ptr cinfo) jinit_compress_master(j_compress_ptr cinfo)
{ {
/* Initialize master control (includes parameter checking/processing) */ /* Initialize master control (includes parameter checking/processing) */
jinit_c_master_control(cinfo, FALSE /* full compression */); jinit_c_master_control(cinfo, FALSE /* full compression */);
/* Preprocessing */ /* Preprocessing */
if (! cinfo->raw_data_in) { if (!cinfo->raw_data_in) {
jinit_color_converter(cinfo); jinit_color_converter(cinfo);
jinit_downsampler(cinfo); jinit_downsampler(cinfo);
jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */); jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */);
...@@ -60,14 +60,14 @@ jinit_compress_master (j_compress_ptr cinfo) ...@@ -60,14 +60,14 @@ jinit_compress_master (j_compress_ptr cinfo)
} }
/* Need a full-image coefficient buffer in any multi-pass mode. */ /* Need a full-image coefficient buffer in any multi-pass mode. */
jinit_c_coef_controller(cinfo, jinit_c_coef_controller(cinfo, (boolean)(cinfo->num_scans > 1 ||
(boolean) (cinfo->num_scans > 1 || cinfo->optimize_coding)); cinfo->optimize_coding));
jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */); jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */);
jinit_marker_writer(cinfo); jinit_marker_writer(cinfo);
/* We can now tell the memory manager to allocate virtual arrays. */ /* 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. /* Write the datastream header (SOI) immediately.
* Frame and scan headers are postponed till later. * Frame and scan headers are postponed till later.
......
...@@ -39,9 +39,10 @@ typedef my_main_controller *my_main_ptr; ...@@ -39,9 +39,10 @@ typedef my_main_controller *my_main_ptr;
/* Forward declarations */ /* Forward declarations */
METHODDEF(void) process_data_simple_main METHODDEF(void) process_data_simple_main(j_compress_ptr cinfo,
(j_compress_ptr cinfo, JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JSAMPARRAY input_buf,
JDIMENSION in_rows_avail); JDIMENSION *in_row_ctr,
JDIMENSION in_rows_avail);
/* /*
...@@ -49,9 +50,9 @@ METHODDEF(void) process_data_simple_main ...@@ -49,9 +50,9 @@ METHODDEF(void) process_data_simple_main
*/ */
METHODDEF(void) 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. */ /* Do nothing in raw-data mode. */
if (cinfo->raw_data_in) if (cinfo->raw_data_in)
...@@ -75,19 +76,18 @@ start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode) ...@@ -75,19 +76,18 @@ start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
*/ */
METHODDEF(void) METHODDEF(void)
process_data_simple_main (j_compress_ptr cinfo, process_data_simple_main(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail)
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) { while (main_ptr->cur_iMCU_row < cinfo->total_iMCU_rows) {
/* Read input data if we haven't filled the main buffer yet */ /* Read input data if we haven't filled the main buffer yet */
if (main_ptr->rowgroup_ctr < DCTSIZE) if (main_ptr->rowgroup_ctr < DCTSIZE)
(*cinfo->prep->pre_process_data) (cinfo, (*cinfo->prep->pre_process_data) (cinfo, input_buf, in_row_ctr,
input_buf, in_row_ctr, in_rows_avail, in_rows_avail, main_ptr->buffer,
main_ptr->buffer, &main_ptr->rowgroup_ctr, &main_ptr->rowgroup_ctr,
(JDIMENSION) DCTSIZE); (JDIMENSION)DCTSIZE);
/* If we don't have a full iMCU row buffered, return to application for /* 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 * 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, ...@@ -97,14 +97,14 @@ process_data_simple_main (j_compress_ptr cinfo,
return; return;
/* Send the completed row to the compressor */ /* 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 /* If compressor did not consume the whole row, then we must need to
* suspend processing and return to the application. In this situation * suspend processing and return to the application. In this situation
* we pretend we didn't yet consume the last input row; otherwise, if * 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 * it happened to be the last row of the image, the application would
* think we were done. * think we were done.
*/ */
if (! main_ptr->suspended) { if (!main_ptr->suspended) {
(*in_row_ctr)--; (*in_row_ctr)--;
main_ptr->suspended = TRUE; main_ptr->suspended = TRUE;
} }
...@@ -128,16 +128,16 @@ process_data_simple_main (j_compress_ptr cinfo, ...@@ -128,16 +128,16 @@ process_data_simple_main (j_compress_ptr cinfo,
*/ */
GLOBAL(void) 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; my_main_ptr main_ptr;
int ci; int ci;
jpeg_component_info *compptr; jpeg_component_info *compptr;
main_ptr = (my_main_ptr) 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)); 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; main_ptr->pub.start_pass = start_pass_main;
/* We don't need to create a buffer in raw-data mode. */ /* 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) ...@@ -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; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) { ci++, compptr++) {
main_ptr->buffer[ci] = (*cinfo->mem->alloc_sarray) 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, compptr->width_in_blocks * DCTSIZE,
(JDIMENSION) (compptr->v_samp_factor * DCTSIZE)); (JDIMENSION)(compptr->v_samp_factor * DCTSIZE));
} }
} }
} }
...@@ -110,30 +110,30 @@ typedef my_marker_writer *my_marker_ptr; ...@@ -110,30 +110,30 @@ typedef my_marker_writer *my_marker_ptr;
*/ */
LOCAL(void) LOCAL(void)
emit_byte (j_compress_ptr cinfo, int val) emit_byte(j_compress_ptr cinfo, int val)
/* Emit a byte */ /* Emit a byte */
{ {
struct jpeg_destination_mgr *dest = cinfo->dest; 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->free_in_buffer == 0) {
if (! (*dest->empty_output_buffer) (cinfo)) if (!(*dest->empty_output_buffer) (cinfo))
ERREXIT(cinfo, JERR_CANT_SUSPEND); ERREXIT(cinfo, JERR_CANT_SUSPEND);
} }
} }
LOCAL(void) 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 a marker code */
{ {
emit_byte(cinfo, 0xFF); emit_byte(cinfo, 0xFF);
emit_byte(cinfo, (int) mark); emit_byte(cinfo, (int)mark);
} }
LOCAL(void) 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 a 2-byte integer; these are always MSB first in JPEG files */
{ {
emit_byte(cinfo, (value >> 8) & 0xFF); emit_byte(cinfo, (value >> 8) & 0xFF);
...@@ -146,7 +146,7 @@ emit_2bytes (j_compress_ptr cinfo, int value) ...@@ -146,7 +146,7 @@ emit_2bytes (j_compress_ptr cinfo, int value)
*/ */
LOCAL(int) LOCAL(int)
emit_dqt (j_compress_ptr cinfo, int index) emit_dqt(j_compress_ptr cinfo, int index)
/* Emit a DQT marker */ /* Emit a DQT marker */
/* Returns the precision used (0 = 8bits, 1 = 16bits) for baseline checking */ /* Returns the precision used (0 = 8bits, 1 = 16bits) for baseline checking */
{ {
...@@ -163,19 +163,19 @@ emit_dqt (j_compress_ptr cinfo, int index) ...@@ -163,19 +163,19 @@ emit_dqt (j_compress_ptr cinfo, int index)
prec = 1; prec = 1;
} }
if (! qtbl->sent_table) { if (!qtbl->sent_table) {
emit_marker(cinfo, M_DQT); 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++) { for (i = 0; i < DCTSIZE2; i++) {
/* The table entries must be emitted in zigzag order. */ /* The table entries must be emitted in zigzag order. */
unsigned int qval = qtbl->quantval[jpeg_natural_order[i]]; unsigned int qval = qtbl->quantval[jpeg_natural_order[i]];
if (prec) if (prec)
emit_byte(cinfo, (int) (qval >> 8)); emit_byte(cinfo, (int)(qval >> 8));
emit_byte(cinfo, (int) (qval & 0xFF)); emit_byte(cinfo, (int)(qval & 0xFF));
} }
qtbl->sent_table = TRUE; qtbl->sent_table = TRUE;
...@@ -186,7 +186,7 @@ emit_dqt (j_compress_ptr cinfo, int index) ...@@ -186,7 +186,7 @@ emit_dqt (j_compress_ptr cinfo, int index)
LOCAL(void) 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 */ /* Emit a DHT marker */
{ {
JHUFF_TBL *htbl; JHUFF_TBL *htbl;
...@@ -202,7 +202,7 @@ emit_dht (j_compress_ptr cinfo, int index, boolean is_ac) ...@@ -202,7 +202,7 @@ emit_dht (j_compress_ptr cinfo, int index, boolean is_ac)
if (htbl == NULL) if (htbl == NULL)
ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, index); ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, index);
if (! htbl->sent_table) { if (!htbl->sent_table) {
emit_marker(cinfo, M_DHT); emit_marker(cinfo, M_DHT);
length = 0; length = 0;
...@@ -224,7 +224,7 @@ emit_dht (j_compress_ptr cinfo, int index, boolean is_ac) ...@@ -224,7 +224,7 @@ emit_dht (j_compress_ptr cinfo, int index, boolean is_ac)
LOCAL(void) LOCAL(void)
emit_dac (j_compress_ptr cinfo) emit_dac(j_compress_ptr cinfo)
/* Emit a DAC marker */ /* Emit a DAC marker */
/* Since the useful info is so small, we want to emit all the tables in */ /* 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. */ /* one DAC marker. Therefore this routine does its own scan of the table. */
...@@ -255,12 +255,12 @@ emit_dac (j_compress_ptr cinfo) ...@@ -255,12 +255,12 @@ emit_dac (j_compress_ptr cinfo)
if (length) { if (length) {
emit_marker(cinfo, M_DAC); 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++) { for (i = 0; i < NUM_ARITH_TBLS; i++) {
if (dc_in_use[i]) { if (dc_in_use[i]) {
emit_byte(cinfo, 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]) { if (ac_in_use[i]) {
emit_byte(cinfo, i + 0x10); emit_byte(cinfo, i + 0x10);
...@@ -273,19 +273,19 @@ emit_dac (j_compress_ptr cinfo) ...@@ -273,19 +273,19 @@ emit_dac (j_compress_ptr cinfo)
LOCAL(void) LOCAL(void)
emit_dri (j_compress_ptr cinfo) emit_dri(j_compress_ptr cinfo)
/* Emit a DRI marker */ /* Emit a DRI marker */
{ {
emit_marker(cinfo, M_DRI); emit_marker(cinfo, M_DRI);
emit_2bytes(cinfo, 4); /* fixed length */ emit_2bytes(cinfo, 4); /* fixed length */
emit_2bytes(cinfo, (int) cinfo->restart_interval); emit_2bytes(cinfo, (int)cinfo->restart_interval);
} }
LOCAL(void) LOCAL(void)
emit_sof (j_compress_ptr cinfo, JPEG_MARKER code) emit_sof(j_compress_ptr cinfo, JPEG_MARKER code)
/* Emit a SOF marker */ /* Emit a SOF marker */
{ {
int ci; int ci;
...@@ -296,13 +296,12 @@ emit_sof (j_compress_ptr cinfo, JPEG_MARKER code) ...@@ -296,13 +296,12 @@ emit_sof (j_compress_ptr cinfo, JPEG_MARKER code)
emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */ emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */
/* Make sure image isn't bigger than SOF field can handle */ /* Make sure image isn't bigger than SOF field can handle */
if ((long) cinfo->_jpeg_height > 65535L || if ((long)cinfo->_jpeg_height > 65535L || (long)cinfo->_jpeg_width > 65535L)
(long) cinfo->_jpeg_width > 65535L) ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int)65535);
ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) 65535);
emit_byte(cinfo, cinfo->data_precision); emit_byte(cinfo, cinfo->data_precision);
emit_2bytes(cinfo, (int) cinfo->_jpeg_height); emit_2bytes(cinfo, (int)cinfo->_jpeg_height);
emit_2bytes(cinfo, (int) cinfo->_jpeg_width); emit_2bytes(cinfo, (int)cinfo->_jpeg_width);
emit_byte(cinfo, cinfo->num_components); emit_byte(cinfo, cinfo->num_components);
...@@ -316,7 +315,7 @@ emit_sof (j_compress_ptr cinfo, JPEG_MARKER code) ...@@ -316,7 +315,7 @@ emit_sof (j_compress_ptr cinfo, JPEG_MARKER code)
LOCAL(void) LOCAL(void)
emit_sos (j_compress_ptr cinfo) emit_sos(j_compress_ptr cinfo)
/* Emit a SOS marker */ /* Emit a SOS marker */
{ {
int i, td, ta; int i, td, ta;
...@@ -351,7 +350,7 @@ emit_sos (j_compress_ptr cinfo) ...@@ -351,7 +350,7 @@ emit_sos (j_compress_ptr cinfo)
LOCAL(void) LOCAL(void)
emit_jfif_app0 (j_compress_ptr cinfo) emit_jfif_app0(j_compress_ptr cinfo)
/* Emit a JFIF-compliant APP0 marker */ /* Emit a JFIF-compliant APP0 marker */
{ {
/* /*
...@@ -378,15 +377,15 @@ emit_jfif_app0 (j_compress_ptr cinfo) ...@@ -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_major_version); /* Version fields */
emit_byte(cinfo, cinfo->JFIF_minor_version); emit_byte(cinfo, cinfo->JFIF_minor_version);
emit_byte(cinfo, cinfo->density_unit); /* Pixel size information */ emit_byte(cinfo, cinfo->density_unit); /* Pixel size information */
emit_2bytes(cinfo, (int) cinfo->X_density); emit_2bytes(cinfo, (int)cinfo->X_density);
emit_2bytes(cinfo, (int) cinfo->Y_density); emit_2bytes(cinfo, (int)cinfo->Y_density);
emit_byte(cinfo, 0); /* No thumbnail image */ emit_byte(cinfo, 0); /* No thumbnail image */
emit_byte(cinfo, 0); emit_byte(cinfo, 0);
} }
LOCAL(void) LOCAL(void)
emit_adobe_app14 (j_compress_ptr cinfo) emit_adobe_app14(j_compress_ptr cinfo)
/* Emit an Adobe APP14 marker */ /* Emit an Adobe APP14 marker */
{ {
/* /*
...@@ -440,19 +439,19 @@ emit_adobe_app14 (j_compress_ptr cinfo) ...@@ -440,19 +439,19 @@ emit_adobe_app14 (j_compress_ptr cinfo)
*/ */
METHODDEF(void) 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 */ /* Emit an arbitrary marker header */
{ {
if (datalen > (unsigned int) 65533) /* safety check */ if (datalen > (unsigned int)65533) /* safety check */
ERREXIT(cinfo, JERR_BAD_LENGTH); 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) 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 one byte of marker parameters following write_marker_header */
{ {
emit_byte(cinfo, val); emit_byte(cinfo, val);
...@@ -471,9 +470,9 @@ write_marker_byte (j_compress_ptr cinfo, int val) ...@@ -471,9 +470,9 @@ write_marker_byte (j_compress_ptr cinfo, int val)
*/ */
METHODDEF(void) 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 */ emit_marker(cinfo, M_SOI); /* first the SOI */
...@@ -496,7 +495,7 @@ write_file_header (j_compress_ptr cinfo) ...@@ -496,7 +495,7 @@ write_file_header (j_compress_ptr cinfo)
*/ */
METHODDEF(void) METHODDEF(void)
write_frame_header (j_compress_ptr cinfo) write_frame_header(j_compress_ptr cinfo)
{ {
int ci, prec; int ci, prec;
boolean is_baseline; boolean is_baseline;
...@@ -556,9 +555,9 @@ write_frame_header (j_compress_ptr cinfo) ...@@ -556,9 +555,9 @@ write_frame_header (j_compress_ptr cinfo)
*/ */
METHODDEF(void) 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; int i;
jpeg_component_info *compptr; jpeg_component_info *compptr;
...@@ -600,7 +599,7 @@ write_scan_header (j_compress_ptr cinfo) ...@@ -600,7 +599,7 @@ write_scan_header (j_compress_ptr cinfo)
*/ */
METHODDEF(void) METHODDEF(void)
write_file_trailer (j_compress_ptr cinfo) write_file_trailer(j_compress_ptr cinfo)
{ {
emit_marker(cinfo, M_EOI); emit_marker(cinfo, M_EOI);
} }
...@@ -614,7 +613,7 @@ write_file_trailer (j_compress_ptr cinfo) ...@@ -614,7 +613,7 @@ write_file_trailer (j_compress_ptr cinfo)
*/ */
METHODDEF(void) METHODDEF(void)
write_tables_only (j_compress_ptr cinfo) write_tables_only(j_compress_ptr cinfo)
{ {
int i; int i;
...@@ -622,10 +621,10 @@ write_tables_only (j_compress_ptr cinfo) ...@@ -622,10 +621,10 @@ write_tables_only (j_compress_ptr cinfo)
for (i = 0; i < NUM_QUANT_TBLS; i++) { for (i = 0; i < NUM_QUANT_TBLS; i++) {
if (cinfo->quant_tbl_ptrs[i] != NULL) 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++) { for (i = 0; i < NUM_HUFF_TBLS; i++) {
if (cinfo->dc_huff_tbl_ptrs[i] != NULL) if (cinfo->dc_huff_tbl_ptrs[i] != NULL)
emit_dht(cinfo, i, FALSE); emit_dht(cinfo, i, FALSE);
...@@ -643,15 +642,15 @@ write_tables_only (j_compress_ptr cinfo) ...@@ -643,15 +642,15 @@ write_tables_only (j_compress_ptr cinfo)
*/ */
GLOBAL(void) GLOBAL(void)
jinit_marker_writer (j_compress_ptr cinfo) jinit_marker_writer(j_compress_ptr cinfo)
{ {
my_marker_ptr marker; my_marker_ptr marker;
/* Create the subobject */ /* Create the subobject */
marker = (my_marker_ptr) 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)); sizeof(my_marker_writer));
cinfo->marker = (struct jpeg_marker_writer *) marker; cinfo->marker = (struct jpeg_marker_writer *)marker;
/* Initialize method pointers */ /* Initialize method pointers */
marker->pub.write_file_header = write_file_header; marker->pub.write_file_header = write_file_header;
marker->pub.write_frame_header = write_frame_header; marker->pub.write_frame_header = write_frame_header;
......
This diff is collapsed.
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
*/ */
GLOBAL(void) GLOBAL(void)
jpeg_abort (j_common_ptr cinfo) jpeg_abort(j_common_ptr cinfo)
{ {
int pool; int pool;
...@@ -40,7 +40,7 @@ jpeg_abort (j_common_ptr cinfo) ...@@ -40,7 +40,7 @@ jpeg_abort (j_common_ptr cinfo)
/* Releasing pools in reverse order might help avoid fragmentation /* Releasing pools in reverse order might help avoid fragmentation
* with some (brain-damaged) malloc libraries. * 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); (*cinfo->mem->free_pool) (cinfo, pool);
} }
...@@ -50,7 +50,7 @@ jpeg_abort (j_common_ptr cinfo) ...@@ -50,7 +50,7 @@ jpeg_abort (j_common_ptr cinfo)
/* Try to keep application from accessing now-deleted marker list. /* Try to keep application from accessing now-deleted marker list.
* A bit kludgy to do it here, but this is the most central place. * 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 { } else {
cinfo->global_state = CSTATE_START; cinfo->global_state = CSTATE_START;
} }
...@@ -69,7 +69,7 @@ jpeg_abort (j_common_ptr cinfo) ...@@ -69,7 +69,7 @@ jpeg_abort (j_common_ptr cinfo)
*/ */
GLOBAL(void) GLOBAL(void)
jpeg_destroy (j_common_ptr cinfo) jpeg_destroy(j_common_ptr cinfo)
{ {
/* We need only tell the memory manager to release everything. */ /* We need only tell the memory manager to release everything. */
/* NB: mem pointer is NULL if memory mgr failed to initialize. */ /* NB: mem pointer is NULL if memory mgr failed to initialize. */
...@@ -86,7 +86,7 @@ jpeg_destroy (j_common_ptr cinfo) ...@@ -86,7 +86,7 @@ jpeg_destroy (j_common_ptr cinfo)
*/ */
GLOBAL(JQUANT_TBL *) GLOBAL(JQUANT_TBL *)
jpeg_alloc_quant_table (j_common_ptr cinfo) jpeg_alloc_quant_table(j_common_ptr cinfo)
{ {
JQUANT_TBL *tbl; JQUANT_TBL *tbl;
...@@ -98,7 +98,7 @@ jpeg_alloc_quant_table (j_common_ptr cinfo) ...@@ -98,7 +98,7 @@ jpeg_alloc_quant_table (j_common_ptr cinfo)
GLOBAL(JHUFF_TBL *) GLOBAL(JHUFF_TBL *)
jpeg_alloc_huff_table (j_common_ptr cinfo) jpeg_alloc_huff_table(j_common_ptr cinfo)
{ {
JHUFF_TBL *tbl; JHUFF_TBL *tbl;
......
This diff is collapsed.
This diff is collapsed.
...@@ -78,9 +78,9 @@ typedef my_prep_controller *my_prep_ptr; ...@@ -78,9 +78,9 @@ typedef my_prep_controller *my_prep_ptr;
*/ */
METHODDEF(void) 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) if (pass_mode != JBUF_PASS_THRU)
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
...@@ -106,14 +106,14 @@ start_pass_prep (j_compress_ptr cinfo, J_BUF_MODE pass_mode) ...@@ -106,14 +106,14 @@ start_pass_prep (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
*/ */
LOCAL(void) LOCAL(void)
expand_bottom_edge (JSAMPARRAY image_data, JDIMENSION num_cols, expand_bottom_edge(JSAMPARRAY image_data, JDIMENSION num_cols, int input_rows,
int input_rows, int output_rows) int output_rows)
{ {
register int row; register int row;
for (row = input_rows; row < output_rows; row++) { for (row = input_rows; row < output_rows; row++) {
jcopy_sample_rows(image_data, input_rows-1, image_data, row, jcopy_sample_rows(image_data, input_rows - 1, image_data, row, 1,
1, num_cols); num_cols);
} }
} }
...@@ -128,13 +128,12 @@ expand_bottom_edge (JSAMPARRAY image_data, JDIMENSION num_cols, ...@@ -128,13 +128,12 @@ expand_bottom_edge (JSAMPARRAY image_data, JDIMENSION num_cols,
*/ */
METHODDEF(void) METHODDEF(void)
pre_process_data (j_compress_ptr cinfo, pre_process_data(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail,
JDIMENSION in_rows_avail, JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr,
JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr, JDIMENSION out_row_groups_avail)
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 numrows, ci;
JDIMENSION inrows; JDIMENSION inrows;
jpeg_component_info *compptr; jpeg_component_info *compptr;
...@@ -144,10 +143,10 @@ pre_process_data (j_compress_ptr cinfo, ...@@ -144,10 +143,10 @@ pre_process_data (j_compress_ptr cinfo,
/* Do color conversion to fill the conversion buffer. */ /* Do color conversion to fill the conversion buffer. */
inrows = in_rows_avail - *in_row_ctr; inrows = in_rows_avail - *in_row_ctr;
numrows = cinfo->max_v_samp_factor - prep->next_buf_row; 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, (*cinfo->cconvert->color_convert) (cinfo, input_buf + *in_row_ctr,
prep->color_buf, prep->color_buf,
(JDIMENSION) prep->next_buf_row, (JDIMENSION)prep->next_buf_row,
numrows); numrows);
*in_row_ctr += numrows; *in_row_ctr += numrows;
prep->next_buf_row += numrows; prep->next_buf_row += numrows;
...@@ -164,7 +163,7 @@ pre_process_data (j_compress_ptr cinfo, ...@@ -164,7 +163,7 @@ pre_process_data (j_compress_ptr cinfo,
/* If we've filled the conversion buffer, empty it. */ /* If we've filled the conversion buffer, empty it. */
if (prep->next_buf_row == cinfo->max_v_samp_factor) { if (prep->next_buf_row == cinfo->max_v_samp_factor) {
(*cinfo->downsample->downsample) (cinfo, (*cinfo->downsample->downsample) (cinfo,
prep->color_buf, (JDIMENSION) 0, prep->color_buf, (JDIMENSION)0,
output_buf, *out_row_group_ctr); output_buf, *out_row_group_ctr);
prep->next_buf_row = 0; prep->next_buf_row = 0;
(*out_row_group_ctr)++; (*out_row_group_ctr)++;
...@@ -172,14 +171,12 @@ pre_process_data (j_compress_ptr cinfo, ...@@ -172,14 +171,12 @@ pre_process_data (j_compress_ptr cinfo,
/* If at bottom of image, pad the output to a full iMCU height. /* 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! * Note we assume the caller is providing a one-iMCU-height output buffer!
*/ */
if (prep->rows_to_go == 0 && if (prep->rows_to_go == 0 && *out_row_group_ctr < out_row_groups_avail) {
*out_row_group_ctr < out_row_groups_avail) {
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) { ci++, compptr++) {
expand_bottom_edge(output_buf[ci], expand_bottom_edge(output_buf[ci], compptr->width_in_blocks * DCTSIZE,
compptr->width_in_blocks * DCTSIZE, (int)(*out_row_group_ctr * compptr->v_samp_factor),
(int) (*out_row_group_ctr * compptr->v_samp_factor), (int)(out_row_groups_avail * compptr->v_samp_factor));
(int) (out_row_groups_avail * compptr->v_samp_factor));
} }
*out_row_group_ctr = out_row_groups_avail; *out_row_group_ctr = out_row_groups_avail;
break; /* can exit outer loop without test */ break; /* can exit outer loop without test */
...@@ -195,13 +192,12 @@ pre_process_data (j_compress_ptr cinfo, ...@@ -195,13 +192,12 @@ pre_process_data (j_compress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
pre_process_context (j_compress_ptr cinfo, pre_process_context(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail,
JDIMENSION in_rows_avail, JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr,
JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr, JDIMENSION out_row_groups_avail)
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 numrows, ci;
int buf_height = cinfo->max_v_samp_factor * 3; int buf_height = cinfo->max_v_samp_factor * 3;
JDIMENSION inrows; JDIMENSION inrows;
...@@ -211,19 +207,18 @@ pre_process_context (j_compress_ptr cinfo, ...@@ -211,19 +207,18 @@ pre_process_context (j_compress_ptr cinfo,
/* Do color conversion to fill the conversion buffer. */ /* Do color conversion to fill the conversion buffer. */
inrows = in_rows_avail - *in_row_ctr; inrows = in_rows_avail - *in_row_ctr;
numrows = prep->next_buf_stop - prep->next_buf_row; 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, (*cinfo->cconvert->color_convert) (cinfo, input_buf + *in_row_ctr,
prep->color_buf, prep->color_buf,
(JDIMENSION) prep->next_buf_row, (JDIMENSION)prep->next_buf_row,
numrows); numrows);
/* Pad at top of image, if first time through */ /* Pad at top of image, if first time through */
if (prep->rows_to_go == cinfo->image_height) { if (prep->rows_to_go == cinfo->image_height) {
for (ci = 0; ci < cinfo->num_components; ci++) { for (ci = 0; ci < cinfo->num_components; ci++) {
int row; int row;
for (row = 1; row <= cinfo->max_v_samp_factor; row++) { for (row = 1; row <= cinfo->max_v_samp_factor; row++) {
jcopy_sample_rows(prep->color_buf[ci], 0, jcopy_sample_rows(prep->color_buf[ci], 0, prep->color_buf[ci],
prep->color_buf[ci], -row, -row, 1, cinfo->image_width);
1, cinfo->image_width);
} }
} }
} }
...@@ -245,9 +240,8 @@ pre_process_context (j_compress_ptr cinfo, ...@@ -245,9 +240,8 @@ pre_process_context (j_compress_ptr cinfo,
} }
/* If we've gotten enough data, downsample a row group. */ /* If we've gotten enough data, downsample a row group. */
if (prep->next_buf_row == prep->next_buf_stop) { if (prep->next_buf_row == prep->next_buf_stop) {
(*cinfo->downsample->downsample) (cinfo, (*cinfo->downsample->downsample) (cinfo, prep->color_buf,
prep->color_buf, (JDIMENSION)prep->this_row_group,
(JDIMENSION) prep->this_row_group,
output_buf, *out_row_group_ctr); output_buf, *out_row_group_ctr);
(*out_row_group_ctr)++; (*out_row_group_ctr)++;
/* Advance pointers with wraparound as necessary. */ /* Advance pointers with wraparound as necessary. */
...@@ -267,9 +261,9 @@ pre_process_context (j_compress_ptr cinfo, ...@@ -267,9 +261,9 @@ pre_process_context (j_compress_ptr cinfo,
*/ */
LOCAL(void) 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 rgroup_height = cinfo->max_v_samp_factor;
int ci, i; int ci, i;
jpeg_component_info *compptr; jpeg_component_info *compptr;
...@@ -279,7 +273,7 @@ create_context_buffer (j_compress_ptr cinfo) ...@@ -279,7 +273,7 @@ create_context_buffer (j_compress_ptr cinfo)
* we need five row groups' worth of pointers for each component. * we need five row groups' worth of pointers for each component.
*/ */
fake_buffer = (JSAMPARRAY) 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) * (cinfo->num_components * 5 * rgroup_height) *
sizeof(JSAMPROW)); sizeof(JSAMPROW));
...@@ -290,10 +284,10 @@ create_context_buffer (j_compress_ptr cinfo) ...@@ -290,10 +284,10 @@ create_context_buffer (j_compress_ptr cinfo)
* horizontally within the buffer, if it so chooses. * horizontally within the buffer, if it so chooses.
*/ */
true_buffer = (*cinfo->mem->alloc_sarray) true_buffer = (*cinfo->mem->alloc_sarray)
((j_common_ptr) cinfo, JPOOL_IMAGE, ((j_common_ptr)cinfo, JPOOL_IMAGE,
(JDIMENSION) (((long) compptr->width_in_blocks * DCTSIZE * (JDIMENSION)(((long)compptr->width_in_blocks * DCTSIZE *
cinfo->max_h_samp_factor) / compptr->h_samp_factor), cinfo->max_h_samp_factor) / compptr->h_samp_factor),
(JDIMENSION) (3 * rgroup_height)); (JDIMENSION)(3 * rgroup_height));
/* Copy true buffer row pointers into the middle of the fake row array */ /* Copy true buffer row pointers into the middle of the fake row array */
MEMCOPY(fake_buffer + rgroup_height, true_buffer, MEMCOPY(fake_buffer + rgroup_height, true_buffer,
3 * rgroup_height * sizeof(JSAMPROW)); 3 * rgroup_height * sizeof(JSAMPROW));
...@@ -315,7 +309,7 @@ create_context_buffer (j_compress_ptr cinfo) ...@@ -315,7 +309,7 @@ create_context_buffer (j_compress_ptr cinfo)
*/ */
GLOBAL(void) 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; my_prep_ptr prep;
int ci; int ci;
...@@ -325,9 +319,9 @@ jinit_c_prep_controller (j_compress_ptr cinfo, boolean need_full_buffer) ...@@ -325,9 +319,9 @@ jinit_c_prep_controller (j_compress_ptr cinfo, boolean need_full_buffer)
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
prep = (my_prep_ptr) 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)); 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; prep->pub.start_pass = start_pass_prep;
/* Allocate the color conversion buffer. /* Allocate the color conversion buffer.
...@@ -348,10 +342,10 @@ jinit_c_prep_controller (j_compress_ptr cinfo, boolean need_full_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; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) { ci++, compptr++) {
prep->color_buf[ci] = (*cinfo->mem->alloc_sarray) prep->color_buf[ci] = (*cinfo->mem->alloc_sarray)
((j_common_ptr) cinfo, JPOOL_IMAGE, ((j_common_ptr)cinfo, JPOOL_IMAGE,
(JDIMENSION) (((long) compptr->width_in_blocks * DCTSIZE * (JDIMENSION)(((long)compptr->width_in_blocks * DCTSIZE *
cinfo->max_h_samp_factor) / compptr->h_samp_factor), cinfo->max_h_samp_factor) / compptr->h_samp_factor),
(JDIMENSION) cinfo->max_v_samp_factor); (JDIMENSION)cinfo->max_v_samp_factor);
} }
} }
} }
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -59,10 +59,10 @@ typedef my_coef_controller *my_coef_ptr; ...@@ -59,10 +59,10 @@ typedef my_coef_controller *my_coef_ptr;
LOCAL(void) 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) */ /* 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 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. * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
...@@ -71,7 +71,7 @@ start_iMCU_row (j_decompress_ptr cinfo) ...@@ -71,7 +71,7 @@ start_iMCU_row (j_decompress_ptr cinfo)
if (cinfo->comps_in_scan > 1) { if (cinfo->comps_in_scan > 1) {
coef->MCU_rows_per_iMCU_row = 1; coef->MCU_rows_per_iMCU_row = 1;
} else { } 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; coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
else else
coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height; coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -44,12 +44,12 @@ typedef my_main_controller *my_main_ptr; ...@@ -44,12 +44,12 @@ typedef my_main_controller *my_main_ptr;
LOCAL(void) 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. /* 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. * 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 ci, i, rgroup;
int M = cinfo->_min_DCT_scaled_size; int M = cinfo->_min_DCT_scaled_size;
jpeg_component_info *compptr; jpeg_component_info *compptr;
...@@ -62,10 +62,10 @@ set_wraparound_pointers (j_decompress_ptr cinfo) ...@@ -62,10 +62,10 @@ set_wraparound_pointers (j_decompress_ptr cinfo)
xbuf0 = main_ptr->xbuffer[0][ci]; xbuf0 = main_ptr->xbuffer[0][ci];
xbuf1 = main_ptr->xbuffer[1][ci]; xbuf1 = main_ptr->xbuffer[1][ci];
for (i = 0; i < rgroup; i++) { for (i = 0; i < rgroup; i++) {
xbuf0[i - rgroup] = xbuf0[rgroup*(M+1) + i]; xbuf0[i - rgroup] = xbuf0[rgroup * (M + 1) + i];
xbuf1[i - rgroup] = xbuf1[rgroup*(M+1) + i]; xbuf1[i - rgroup] = xbuf1[rgroup * (M + 1) + i];
xbuf0[rgroup*(M+2) + i] = xbuf0[i]; xbuf0[rgroup * (M + 2) + i] = xbuf0[i];
xbuf1[rgroup*(M+2) + i] = xbuf1[i]; xbuf1[rgroup * (M + 2) + i] = xbuf1[i];
} }
} }
} }
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -61,14 +61,18 @@ ...@@ -61,14 +61,18 @@
#ifdef NEED_BSD_STRINGS #ifdef NEED_BSD_STRINGS
#include <strings.h> #include <strings.h>
#define MEMZERO(target,size) bzero((void *)(target), (size_t)(size)) #define MEMZERO(target, size) \
#define MEMCOPY(dest,src,size) bcopy((const void *)(src), (void *)(dest), (size_t)(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 */ #else /* not BSD, assume ANSI/SysV string lib */
#include <string.h> #include <string.h>
#define MEMZERO(target,size) memset((void *)(target), 0, (size_t)(size)) #define MEMZERO(target, size) \
#define MEMCOPY(dest,src,size) memcpy((void *)(dest), (const void *)(src), (size_t)(size)) memset((void *)(target), 0, (size_t)(size))
#define MEMCOPY(dest, src, size) \
memcpy((void *)(dest), (const void *)(src), (size_t)(size))
#endif #endif
...@@ -78,7 +82,7 @@ ...@@ -78,7 +82,7 @@
* CAUTION: argument order is different from underlying functions! * CAUTION: argument order is different from underlying functions!
*/ */
#define JFREAD(file,buf,sizeofbuf) \ #define JFREAD(file, buf, sizeofbuf) \
((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) ((size_t)fread((void *)(buf), (size_t)1, (size_t)(sizeofbuf), (file)))
#define JFWRITE(file,buf,sizeofbuf) \ #define JFWRITE(file, buf, sizeofbuf) \
((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) ((size_t)fwrite((const void *)(buf), (size_t)1, (size_t)(sizeofbuf), (file)))
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment