From 6131388cc42e0967028afb2245413b7d0ffcc164 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 8 Jul 2011 11:34:26 +0100 Subject: [PATCH] jpeg cmyk write was not inverting the change to vips_sink_disc() for vips2jpeg make CMYK write fail, argh thanks to Ole for the report --- ChangeLog | 1 + TODO | 7 +++++++ libvips/format/im_vips2jpeg.c | 19 ++++++++++--------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5d8d3e6a..03eaf704 100644 --- a/ChangeLog +++ b/ChangeLog @@ -68,6 +68,7 @@ - added VipsPool, got rid of floating refs again, argh - VIPS_EXEEXT is now part of the exported API - im_blend() also does sizealike, oops +- jpeg write was not inverting CMYK, thanks Ole 30/11/10 started 7.24.0 - bump for new stable diff --git a/TODO b/TODO index 74ed761d..3ae14470 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,10 @@ +- icc import / export should cast their inputs, they insist on uchar etc. at + the moment + + +- can we call vips7 funcs from the vips8 interface? + + - revisit orc conv use an 8.8 accumulator ... build the scale into the 8.8 coeffs ... no div at diff --git a/libvips/format/im_vips2jpeg.c b/libvips/format/im_vips2jpeg.c index 74b38608..94a645ba 100644 --- a/libvips/format/im_vips2jpeg.c +++ b/libvips/format/im_vips2jpeg.c @@ -38,6 +38,8 @@ * 18/7/10 * - collect im_vips2bufjpeg() output in a list of blocks ... we no * longer overallocate or underallocate + * 8/7/11 + * - oop CMYK write was not inverting, thanks Ole */ /* @@ -540,16 +542,16 @@ write_jpeg_block( REGION *region, Rect *area, void *a ) Write *write = (Write *) a; int i; - /* We are running in a background thread. We need to catch longjmp()s - * here instead. - */ - if( setjmp( write->eman.jmp ) ) - return( -1 ); - for( i = 0; i < area->height; i++ ) write->row_pointer[i] = (JSAMPROW) IM_REGION_ADDR( region, 0, area->top + i ); + /* We are running in a background thread. We need to catch any + * longjmp()s from jpeg_write_scanlines() here. + */ + if( setjmp( write->eman.jmp ) ) + return( -1 ); + jpeg_write_scanlines( &write->cinfo, write->row_pointer, area->height ); return( 0 ); @@ -609,8 +611,7 @@ write_vips( Write *write, int qfac, const char *profile ) /* Build VIPS output stuff now we know the image we'll be writing. */ - if( !(write->row_pointer = - IM_ARRAY( NULL, write->in->Ysize, JSAMPROW )) ) + if( !(write->row_pointer = IM_ARRAY( NULL, in->Ysize, JSAMPROW )) ) return( -1 ); /* Rest to default. @@ -641,7 +642,7 @@ write_vips( Write *write, int qfac, const char *profile ) /* Write data. Note that the write function grabs the longjmp()! */ - if( vips_sink_disc( write->in, write_jpeg_block, write ) ) + if( vips_sink_disc( in, write_jpeg_block, write ) ) return( -1 ); /* We have to reinstate the setjmp() before we jpeg_finish_compress().