forked from libjpeg-turbo/libjpeg-turbo
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace INT32 with a new internal datatype (JLONG)
These days, INT32 is a commonly-defined datatype in system headers. We cannot eliminate the definition of that datatype from jmorecfg.h, since the INT32 typedef has technically been part of the libjpeg API since version 5 (1994.) However, using INT32 internally is risky, because the inclusion of a particular header (Xmd.h, for instance) could change the definition of INT32 from long to int on 64-bit platforms and thus change the internal behavior of libjpeg-turbo in unexpected ways (for instance, failing to correctly set __INT32_IS_ACTUALLY_LONG to match the INT32 typedef-- perhaps as a result of including the wrong version of jpeglib.h-- could cause libjpeg-turbo to produce incorrect results.) The library has always been built in environments in which INT32 is effectively long (on Windows, long is always 32-bit, so effectively it's the same as int), so it makes sense to turn INT32 into an explicitly long datatype. This ensures that libjpeg-turbo will always behave consistently, regardless of the headers included at compile time. Addresses a concern expressed in libjpeg-turbo#26.
- Loading branch information
1 parent
250c887
commit 1e32fe3
Showing
38 changed files
with
478 additions
and
447 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
* libjpeg-turbo Modifications: | ||
* Copyright 2009 Pierre Ossman <[email protected]> for Cendio AB | ||
* Copyright (C) 2014, MIPS Technologies, Inc., California | ||
* Copyright (C) 2015, D. R. Commander. | ||
* For conditions of distribution and use, see the accompanying README.ijg | ||
* file. | ||
* | ||
|
@@ -150,7 +151,7 @@ int_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, | |
JDIMENSION outcol, outcol_h; /* outcol_h == outcol*h_expand */ | ||
JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; | ||
JSAMPROW inptr, outptr; | ||
INT32 outvalue; | ||
JLONG outvalue; | ||
|
||
h_expand = cinfo->max_h_samp_factor / compptr->h_samp_factor; | ||
v_expand = cinfo->max_v_samp_factor / compptr->v_samp_factor; | ||
|
@@ -173,7 +174,7 @@ int_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, | |
for (v = 0; v < v_expand; v++) { | ||
inptr = input_data[inrow+v] + outcol_h; | ||
for (h = 0; h < h_expand; h++) { | ||
outvalue += (INT32) GETJSAMPLE(*inptr++); | ||
outvalue += (JLONG) GETJSAMPLE(*inptr++); | ||
} | ||
} | ||
*outptr++ = (JSAMPLE) ((outvalue + numpix2) / numpix); | ||
|
@@ -302,7 +303,7 @@ h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, | |
JDIMENSION colctr; | ||
JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; | ||
register JSAMPROW inptr0, inptr1, above_ptr, below_ptr, outptr; | ||
INT32 membersum, neighsum, memberscale, neighscale; | ||
JLONG membersum, neighsum, memberscale, neighscale; | ||
|
||
/* Expand input data enough to let all the output samples be generated | ||
* by the standard loop. Special-casing padded output would be more | ||
|
@@ -402,7 +403,7 @@ fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr, | |
JDIMENSION colctr; | ||
JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; | ||
register JSAMPROW inptr, above_ptr, below_ptr, outptr; | ||
INT32 membersum, neighsum, memberscale, neighscale; | ||
JLONG membersum, neighsum, memberscale, neighscale; | ||
int colsum, lastcolsum, nextcolsum; | ||
|
||
/* Expand input data enough to let all the output samples be generated | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
* Copyright (C) 1994-1997, Thomas G. Lane. | ||
* libjpeg-turbo Modifications: | ||
* Copyright 2009 Pierre Ossman <[email protected]> for Cendio AB | ||
* Copyright (C) 2010, D. R. Commander. | ||
* Copyright (C) 2010, 2015, D. R. Commander. | ||
* For conditions of distribution and use, see the accompanying README.ijg | ||
* file. | ||
* | ||
|
@@ -411,7 +411,7 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) | |
JCOEF * workspace; | ||
int *coef_bits; | ||
JQUANT_TBL *quanttbl; | ||
INT32 Q00,Q01,Q02,Q10,Q11,Q20, num; | ||
JLONG Q00,Q01,Q02,Q10,Q11,Q20, num; | ||
int DC1,DC2,DC3,DC4,DC5,DC6,DC7,DC8,DC9; | ||
int Al, pred; | ||
|
||
|
Oops, something went wrong.