/*
- * Copyright (C)2009-2016 D. R. Commander. All Rights Reserved.
+ * Copyright (C)2009-2017 D. R. Commander. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
|| 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
}
#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;
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)
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");
}
#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;
}
}
+ 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,
}
}
+ 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)
{
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)
}
}
+ 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;
}
}
+ 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;
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. */
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];