Merge tag '1.5.2'
Tag 1.5.2 release * tag '1.5.2': (54 commits) x86: Fix "short jump is out of range" w/ NASM<2.04 TurboJPEG: Document xform issue w/ big marker data Java TJBench: Fix parsing of -warmup argument Build: Disable warmup in TJBench regression tests TJBench: Improve consistency of results TurboJPEG: C API documentation buglet TJBench: Code formatting tweaks TJBench: Fix errors when decomp. files w/ ICC data BUILDING.md: Include Android/x86 build recipes Travis: Fix OS X build Restore compatibility with older autoconf releases Attribute ARM runtime detection code to Nokia Honor max_memory_to_use/JPEGMEM/-maxmemory AppVeyor: Fix CI build TurboJPEG: Fix potential memory leaks Always tweak EXIF w/h tags w/ lossless transforms Fix error w/ lossless crop & libjpeg v7 emulation Include jpeg_skip/crop_scanlines() in jpeg7.dll libjpeg.txt: Include partial decomp. in TOC Slightly de-confusify cjpeg, jpegtran usage info ...
This commit is contained in:
79
turbojpeg.c
79
turbojpeg.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2009-2016 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2009-2017 D. R. Commander. All Rights Reserved.
|
||||
* mozjpeg Modifications:
|
||||
* Copyright (C) 2014, Mozilla Corporation.
|
||||
*
|
||||
@@ -780,13 +780,6 @@ DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, const unsigned char *srcBuf,
|
||||
|| jpegSubsamp<0 || jpegSubsamp>=NUMSUBOPT || jpegQual<0 || jpegQual>100)
|
||||
_throw("tjCompress2(): Invalid argument");
|
||||
|
||||
if(setjmp(this->jerr.setjmp_buffer))
|
||||
{
|
||||
/* If we get here, the JPEG code has signaled an error. */
|
||||
retval=-1;
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
if(pitch==0) pitch=width*tjPixelSize[pixelFormat];
|
||||
|
||||
#ifndef JCS_EXTENSIONS
|
||||
@@ -799,6 +792,16 @@ DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, const unsigned char *srcBuf,
|
||||
}
|
||||
#endif
|
||||
|
||||
if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)*height))==NULL)
|
||||
_throw("tjCompress2(): Memory allocation failure");
|
||||
|
||||
if(setjmp(this->jerr.setjmp_buffer))
|
||||
{
|
||||
/* If we get here, the JPEG code has signaled an error. */
|
||||
retval=-1;
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
cinfo->image_width=width;
|
||||
cinfo->image_height=height;
|
||||
|
||||
@@ -815,8 +818,6 @@ DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, const unsigned char *srcBuf,
|
||||
return -1;
|
||||
|
||||
jpeg_start_compress(cinfo, TRUE);
|
||||
if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)*height))==NULL)
|
||||
_throw("tjCompress2(): Memory allocation failure");
|
||||
for(i=0; i<height; i++)
|
||||
{
|
||||
if(flags&TJFLAG_BOTTOMUP)
|
||||
@@ -896,13 +897,6 @@ DLLEXPORT int DLLCALL tjEncodeYUVPlanes(tjhandle handle,
|
||||
if(subsamp!=TJSAMP_GRAY && (!dstPlanes[1] || !dstPlanes[2]))
|
||||
_throw("tjEncodeYUVPlanes(): Invalid argument");
|
||||
|
||||
if(setjmp(this->jerr.setjmp_buffer))
|
||||
{
|
||||
/* If we get here, the JPEG code has signaled an error. */
|
||||
retval=-1;
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
if(pixelFormat==TJPF_CMYK)
|
||||
_throw("tjEncodeYUVPlanes(): Cannot generate YUV images from CMYK pixels");
|
||||
|
||||
@@ -918,6 +912,13 @@ DLLEXPORT int DLLCALL tjEncodeYUVPlanes(tjhandle handle,
|
||||
}
|
||||
#endif
|
||||
|
||||
if(setjmp(this->jerr.setjmp_buffer))
|
||||
{
|
||||
/* If we get here, the JPEG code has signaled an error. */
|
||||
retval=-1;
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
cinfo->image_width=width;
|
||||
cinfo->image_height=height;
|
||||
|
||||
@@ -994,6 +995,13 @@ DLLEXPORT int DLLCALL tjEncodeYUVPlanes(tjhandle handle,
|
||||
}
|
||||
}
|
||||
|
||||
if(setjmp(this->jerr.setjmp_buffer))
|
||||
{
|
||||
/* If we get here, the JPEG code has signaled an error. */
|
||||
retval=-1;
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
for(row=0; row<ph0; row+=cinfo->max_v_samp_factor)
|
||||
{
|
||||
(*cinfo->cconvert->color_convert)(cinfo, &row_pointer[row], tmpbuf, 0,
|
||||
@@ -1168,6 +1176,13 @@ DLLEXPORT int DLLCALL tjCompressFromYUVPlanes(tjhandle handle,
|
||||
}
|
||||
}
|
||||
|
||||
if(setjmp(this->jerr.setjmp_buffer))
|
||||
{
|
||||
/* If we get here, the JPEG code has signaled an error. */
|
||||
retval=-1;
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
for(row=0; row<(int)cinfo->image_height;
|
||||
row+=cinfo->max_v_samp_factor*DCTSIZE)
|
||||
{
|
||||
@@ -1446,6 +1461,12 @@ DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle,
|
||||
if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)
|
||||
*dinfo->output_height))==NULL)
|
||||
_throw("tjDecompress2(): Memory allocation failure");
|
||||
if(setjmp(this->jerr.setjmp_buffer))
|
||||
{
|
||||
/* If we get here, the JPEG code has signaled an error. */
|
||||
retval=-1;
|
||||
goto bailout;
|
||||
}
|
||||
for(i=0; i<(int)dinfo->output_height; i++)
|
||||
{
|
||||
if(flags&TJFLAG_BOTTOMUP)
|
||||
@@ -1668,6 +1689,13 @@ DLLEXPORT int DLLCALL tjDecodeYUVPlanes(tjhandle handle,
|
||||
}
|
||||
}
|
||||
|
||||
if(setjmp(this->jerr.setjmp_buffer))
|
||||
{
|
||||
/* If we get here, the JPEG code has signaled an error. */
|
||||
retval=-1;
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
for(row=0; row<ph0; row+=dinfo->max_v_samp_factor)
|
||||
{
|
||||
JDIMENSION inrow=0, outrow=0;
|
||||
@@ -1848,6 +1876,13 @@ DLLEXPORT int DLLCALL tjDecompressToYUVPlanes(tjhandle handle,
|
||||
}
|
||||
}
|
||||
|
||||
if(setjmp(this->jerr.setjmp_buffer))
|
||||
{
|
||||
/* If we get here, the JPEG code has signaled an error. */
|
||||
retval=-1;
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
if(flags&TJFLAG_FASTUPSAMPLE) dinfo->do_fancy_upsampling=FALSE;
|
||||
if(flags&TJFLAG_FASTDCT) dinfo->dct_method=JDCT_FASTEST;
|
||||
dinfo->raw_data_out=TRUE;
|
||||
@@ -2025,6 +2060,11 @@ DLLEXPORT int DLLCALL tjTransform(tjhandle handle,
|
||||
else if(flags&TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1");
|
||||
else if(flags&TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
|
||||
|
||||
if((xinfo=(jpeg_transform_info *)malloc(sizeof(jpeg_transform_info)*n))
|
||||
==NULL)
|
||||
_throw("tjTransform(): Memory allocation failure");
|
||||
MEMZERO(xinfo, sizeof(jpeg_transform_info)*n);
|
||||
|
||||
if(setjmp(this->jerr.setjmp_buffer))
|
||||
{
|
||||
/* If we get here, the JPEG code has signaled an error. */
|
||||
@@ -2034,11 +2074,6 @@ DLLEXPORT int DLLCALL tjTransform(tjhandle handle,
|
||||
|
||||
jpeg_mem_src_tj(dinfo, jpegBuf, jpegSize);
|
||||
|
||||
if((xinfo=(jpeg_transform_info *)malloc(sizeof(jpeg_transform_info)*n))
|
||||
==NULL)
|
||||
_throw("tjTransform(): Memory allocation failure");
|
||||
MEMZERO(xinfo, sizeof(jpeg_transform_info)*n);
|
||||
|
||||
for(i=0; i<n; i++)
|
||||
{
|
||||
xinfo[i].transform=xformtypes[t[i].op];
|
||||
|
||||
Reference in New Issue
Block a user