Compare commits

...

9 Commits

Author SHA1 Message Date
DRC
97f8ec4b60 I'm not sure why, but this was necessary in order to return the 32-bit performance to the 0.0.90 baseline
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@165 632fc199-4ca6-4c93-a231-07263d6284db
2010-03-20 22:38:53 +00:00
DRC
1e6b5b4884 Clarify license description
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@164 632fc199-4ca6-4c93-a231-07263d6284db
2010-03-20 20:00:51 +00:00
DRC
ae19bf6f15 Add ChangeLog to repository
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@163 632fc199-4ca6-4c93-a231-07263d6284db
2010-03-15 11:40:31 +00:00
DRC
e885a8bf41 Fix data corruption issues when decompressing large JPEG images and/or using buffered I/O. Specifically, decode_mcu_fast() can potentially process more than 1 MCU, so make sure there is enough space in the buffer to accommodate this case. Otherwise, the buffer pointer goes negative, and bad mojo ensues. Also, the fast decoder's method of handling unread markers doesn't make libjpeg's restart handler happy, so disable fast decode when restarts are used.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@162 632fc199-4ca6-4c93-a231-07263d6284db
2010-03-15 11:34:58 +00:00
DRC
0b7d4ed792 Include ChangeLog.txt in dist
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@161 632fc199-4ca6-4c93-a231-07263d6284db
2010-03-03 09:37:58 +00:00
DRC
10a094f0e6 Bump version number
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@160 632fc199-4ca6-4c93-a231-07263d6284db
2010-03-03 09:36:31 +00:00
DRC
f8b77c44f1 Don't allow code path to be forced on a system that doesn't support it
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@159 632fc199-4ca6-4c93-a231-07263d6284db
2010-03-03 08:46:29 +00:00
DRC
048990944f Bleepin' Windows uses LLP64, not LP64
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@158 632fc199-4ca6-4c93-a231-07263d6284db
2010-02-26 23:01:19 +00:00
DRC
d3c7eff53d Oops. Debian users might like documentation as well.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@157 632fc199-4ca6-4c93-a231-07263d6284db
2010-02-25 20:14:10 +00:00
17 changed files with 62 additions and 36 deletions

7
ChangeLog.txt Normal file
View File

@@ -0,0 +1,7 @@
Significant changes since 0.0.90
================================
[1] Added documentation to .deb packages
[2] 2968313: Fixed data corruption issues when decompressing large JPEG images
and/or using buffered I/O with the libjpeg-turbo decompressor

View File

@@ -82,7 +82,8 @@ DISTMANS= cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 wrjpgcom.1
DOCS= README install.doc usage.doc wizard.doc example.c libjpeg.doc \
structure.doc coderules.doc filelist.doc jconfig.doc change.log \
README-turbo.txt rdrle.c wrrle.c LICENSE.txt LGPL.txt BUILDING.txt
README-turbo.txt rdrle.c wrrle.c LICENSE.txt LGPL.txt BUILDING.txt \
ChangeLog.txt
TESTFILES= testorig.jpg testorig.ppm testimg.bmp testimgflt.jpg \
testimgfst.jpg testimgint.jpg testimgp.jpg testimgfst.ppm testimgint.ppm

View File

@@ -28,8 +28,13 @@ libraries can be used as drop-in replacements for libjpeg on most systems.
Some of the optimizations to the Huffman encoder/decoder were borrowed from
VirtualGL, and thus the libjpeg-turbo distribution, as a whole, falls under the
wxWindows Library Licence, Version 3.1. A copy of this license can be found in
this directory under LICENSE.txt. The rest of the source code, apart from
these modifications, falls under a less restrictive license (see README.)
this directory under LICENSE.txt. The wxWindows Library License is based on
the LGPL but includes provisions which allow the Library to be statically
linked into proprietary libraries and applications without requiring the
resulting binaries to be distributed under the terms of the LGPL.
The rest of the source code, apart from these modifications, falls under a less
restrictive, BSD-style license (see README.)
*******************************************************************************

View File

@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.56])
AC_INIT([libjpeg-turbo], [0.0.90])
AC_INIT([libjpeg-turbo], [0.0.91])
BUILD=`date +%Y%m%d`
AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2])

View File

@@ -49,7 +49,7 @@ int jpeg_first_bit_table_init=0;
*/
typedef struct {
long put_buffer; /* current bit-accumulation buffer */
size_t put_buffer; /* current bit-accumulation buffer */
int put_bits; /* # of bits now in it */
int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */
} savable_state;
@@ -489,8 +489,8 @@ LOCAL(boolean)
flush_bits (working_state * state)
{
unsigned char _buffer[BUFSIZE], *buffer;
long put_buffer; int put_bits;
int bytes, bytestocopy, localbuf = 0;
size_t put_buffer; int put_bits;
size_t bytes, bytestocopy; int localbuf = 0;
put_buffer = state->cur.put_buffer;
put_bits = state->cur.put_bits;
@@ -515,9 +515,9 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val,
int nbits;
int r, sflag, size, code;
unsigned char _buffer[BUFSIZE], *buffer;
long put_buffer; int put_bits;
size_t put_buffer; int put_bits;
int code_0xf0 = actbl->ehufco[0xf0], size_0xf0 = actbl->ehufsi[0xf0];
int bytes, bytestocopy, localbuf = 0;
size_t bytes, bytestocopy; int localbuf = 0;
put_buffer = state->cur.put_buffer;
put_bits = state->cur.put_bits;

View File

@@ -765,20 +765,25 @@ METHODDEF(boolean)
decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
int usefast = 1;
/* Process restart marker if needed; may have to suspend */
if (cinfo->restart_interval) {
if (entropy->restarts_to_go == 0)
if (! process_restart(cinfo))
return FALSE;
usefast = 0;
}
if (cinfo->src->bytes_in_buffer < BUFSIZE * cinfo->blocks_in_MCU)
usefast = 0;
/* If we've run out of data, just leave the MCU set to zeroes.
* This way, we return uniform gray for the remainder of the segment.
*/
if (! entropy->pub.insufficient_data) {
if (cinfo->src->bytes_in_buffer >= BUFSIZE) {
if (usefast) {
if (!decode_mcu_fast(cinfo, MCU_data)) return FALSE;
}
else {

View File

@@ -75,7 +75,7 @@ EXTERN(void) jpeg_make_d_derived_tbl
#if __WORDSIZE == 64
typedef long bit_buf_type; /* type of bit-extraction buffer */
typedef size_t bit_buf_type; /* type of bit-extraction buffer */
#define BIT_BUF_SIZE 64 /* size of buffer in bits */
#else

View File

@@ -122,7 +122,7 @@ typedef struct {
jvirt_barray_ptr virt_barray_list;
/* This counts total space obtained from jpeg_get_small/large */
long total_space_allocated;
size_t total_space_allocated;
/* alloc_sarray and alloc_barray set this value for use by virtual
* array routines.
@@ -317,8 +317,8 @@ alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
/* OK, allocate the object from the current pool */
data_ptr = (char *) hdr_ptr; /* point to first data byte in pool... */
data_ptr += SIZEOF(small_pool_hdr); /* ...by skipping the header... */
if ((unsigned long)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
data_ptr += ALIGN_SIZE - (unsigned long)data_ptr % ALIGN_SIZE;
if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
data_ptr += hdr_ptr->bytes_used; /* point to place for object */
hdr_ptr->bytes_used += sizeofobject;
hdr_ptr->bytes_left -= sizeofobject;
@@ -382,8 +382,8 @@ alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
data_ptr = (char *) hdr_ptr; /* point to first data byte in pool... */
data_ptr += SIZEOF(small_pool_hdr); /* ...by skipping the header... */
if ((unsigned long)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
data_ptr += ALIGN_SIZE - (unsigned long)data_ptr % ALIGN_SIZE;
if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
return (void FAR *) data_ptr;
}
@@ -420,7 +420,7 @@ alloc_sarray (j_common_ptr cinfo, int pool_id,
/* Make sure each row is properly aligned */
if ((ALIGN_SIZE % SIZEOF(JSAMPLE)) != 0)
out_of_memory(cinfo, 5); /* safety check */
samplesperrow = jround_up(samplesperrow, (2 * ALIGN_SIZE) / SIZEOF(JSAMPLE));
samplesperrow = (JDIMENSION)jround_up(samplesperrow, (2 * ALIGN_SIZE) / SIZEOF(JSAMPLE));
/* Calculate max # of rows allowed in one allocation chunk */
ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) /
@@ -608,8 +608,8 @@ realize_virt_arrays (j_common_ptr cinfo)
/* Allocate the in-memory buffers for any unrealized virtual arrays */
{
my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
long space_per_minheight, maximum_space, avail_mem;
long minheights, max_minheights;
size_t space_per_minheight, maximum_space, avail_mem;
size_t minheights, max_minheights;
jvirt_sarray_ptr sptr;
jvirt_barray_ptr bptr;

View File

@@ -69,9 +69,9 @@ jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject)
* Here we always say, "we got all you want bud!"
*/
GLOBAL(long)
jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed,
long max_bytes_needed, long already_allocated)
GLOBAL(size_t)
jpeg_mem_available (j_common_ptr cinfo, size_t min_bytes_needed,
size_t max_bytes_needed, size_t already_allocated)
{
return max_bytes_needed;
}

View File

@@ -100,10 +100,10 @@ EXTERN(void) jpeg_free_large JPP((j_common_ptr cinfo, void FAR * object,
* Conversely, zero may be returned to always use the minimum amount of memory.
*/
EXTERN(long) jpeg_mem_available JPP((j_common_ptr cinfo,
long min_bytes_needed,
long max_bytes_needed,
long already_allocated));
EXTERN(size_t) jpeg_mem_available JPP((j_common_ptr cinfo,
size_t min_bytes_needed,
size_t max_bytes_needed,
size_t already_allocated));
/*

View File

@@ -369,7 +369,7 @@ EXTERN(void) jinit_memory_mgr JPP((j_common_ptr cinfo));
/* Utility routines in jutils.c */
EXTERN(long) jdiv_round_up JPP((long a, long b));
EXTERN(long) jround_up JPP((long a, long b));
EXTERN(size_t) jround_up JPP((size_t a, size_t b));
EXTERN(void) jcopy_sample_rows JPP((JSAMPARRAY input_array, int source_row,
JSAMPARRAY output_array, int dest_row,
int num_rows, JDIMENSION num_cols));

View File

@@ -77,8 +77,8 @@ jdiv_round_up (long a, long b)
}
GLOBAL(long)
jround_up (long a, long b)
GLOBAL(size_t)
jround_up (size_t a, size_t b)
/* Compute a rounded up to next multiple of b, ie, ceil(a/b)*b */
/* Assumes a >= 0, b > 0 */
{

View File

@@ -49,6 +49,12 @@ mv $TMPDIR/opt/$PACKAGE_NAME/$__LIB/libturbojpeg.* $TMPDIR/usr/$__LIB
/sbin/ldconfig -n $TMPDIR/usr/$__LIB
mkdir -p $TMPDIR/usr/include
mv $TMPDIR/opt/$PACKAGE_NAME/include/turbojpeg.h $TMPDIR/usr/include
mkdir -p $TMPDIR/usr/share/doc/$PACKAGE_NAME-$VERSION
install -m 644 $SRCDIR/LICENSE.txt $TMPDIR/usr/share/doc/$PACKAGE_NAME-$VERSION
install -m 644 $SRCDIR/LGPL.txt $TMPDIR/usr/share/doc/$PACKAGE_NAME-$VERSION
install -m 644 $SRCDIR/README-turbo.txt $TMPDIR/usr/share/doc/$PACKAGE_NAME-$VERSION
install -m 644 $SRCDIR/README $TMPDIR/usr/share/doc/$PACKAGE_NAME-$VERSION
install -m 644 $SRCDIR/libjpeg.doc $TMPDIR/usr/share/doc/$PACKAGE_NAME-$VERSION
sudo chown -Rh root:root $TMPDIR/*
dpkg -b $TMPDIR $PACKAGE_NAME\_$DEBARCH.deb

View File

@@ -1,5 +1,6 @@
/* Copyright (C)2004 Landmark Graphics Corporation
* Copyright (C)2005 Sun Microsystems, Inc.
* Copyright (C)2010 D. R. Commander
*
* This library is free software and may be redistributed and/or modified under
* the terms of the wxWindows Library License, Version 3.1 or (at your option)
@@ -49,7 +50,7 @@ static __inline int numprocs(void)
#ifdef _WIN32
DWORD_PTR ProcAff, SysAff, i; int count=0;
if(!GetProcessAffinityMask(GetCurrentProcess(), &ProcAff, &SysAff)) return(1);
for(i=0; i<sizeof(long)*8; i++) if(ProcAff&(1<<i)) count++;
for(i=0; i<sizeof(long*)*8; i++) if(ProcAff&(1LL<<i)) count++;
return(count);
#elif defined (__APPLE__)
return(1);

View File

@@ -48,16 +48,16 @@ init_simd (void)
/* Force different settings through environment variables */
env = getenv("JSIMD_FORCEMMX");
if ((env != NULL) && (strcmp(env, "1") == 0))
simd_support = JSIMD_MMX;
simd_support &= JSIMD_MMX;
env = getenv("JSIMD_FORCE3DNOW");
if ((env != NULL) && (strcmp(env, "1") == 0))
simd_support = JSIMD_3DNOW|JSIMD_MMX;
simd_support &= JSIMD_3DNOW|JSIMD_MMX;
env = getenv("JSIMD_FORCESSE");
if ((env != NULL) && (strcmp(env, "1") == 0))
simd_support = JSIMD_SSE|JSIMD_MMX;
simd_support &= JSIMD_SSE|JSIMD_MMX;
env = getenv("JSIMD_FORCESSE2");
if ((env != NULL) && (strcmp(env, "1") == 0))
simd_support = JSIMD_SSE2;
simd_support &= JSIMD_SSE2;
}
GLOBAL(int)

View File

@@ -24,7 +24,7 @@
* In the PIC cases, we have no guarantee that constants will keep
* their alignment. This macro allows us to verify it at runtime.
*/
#define IS_ALIGNED(ptr, order) (((unsigned long)ptr & ((1 << order) - 1)) == 0)
#define IS_ALIGNED(ptr, order) (((size_t)ptr & ((1 << order) - 1)) == 0)
#define IS_ALIGNED_SSE(ptr) (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */

View File

@@ -192,7 +192,8 @@ DLLEXPORT int DLLCALL tjCompress(tjhandle h,
j->cinfo.image_height-j->cinfo.next_scanline);
}
jpeg_finish_compress(&j->cinfo);
*size=TJBUFSIZE(j->cinfo.image_width, j->cinfo.image_height)-(j->jdms.free_in_buffer);
*size=TJBUFSIZE(j->cinfo.image_width, j->cinfo.image_height)
-(unsigned long)(j->jdms.free_in_buffer);
if(row_pointer) free(row_pointer);
return 0;