webpsave_buffer no longer ignores @lossless

the @lossless arg to webpsave buffer was never wired up to anything,
thanks aaron42net.

see

https://github.com/jcupitt/libvips/issues/410
This commit is contained in:
John Cupitt 2016-03-31 21:48:40 +01:00
parent 65be59e3dc
commit f3835ef0bf
2 changed files with 38 additions and 12 deletions

View File

@ -21,6 +21,7 @@
- switches to disable PPM, Rad and Analyze support
- added VIPS_COUNT_PIXELS(), overcomputation tracking
- @out_format in vips_system() can contain [options]
- webpsave_buffer no longer ignores @lossless, thanks aaron42net
24/3/16 started 8.2.4
- fix nohalo and vsqbs interpolators, thanks Rafael

View File

@ -2,6 +2,8 @@
*
* 6/8/13
* - from vips2jpeg.c
* 31/5/16
* - buffer write ignored lossless, thanks aaron42net
*/
/*
@ -131,24 +133,47 @@ vips__webp_write_buffer( VipsImage *in, void **obuf, size_t *olen,
int Q, gboolean lossless )
{
VipsImage *memory;
webp_encoder encoder;
if( !(memory = vips_image_copy_memory( in )) )
return( -1 );
if( in->Bands == 4 )
encoder = WebPEncodeRGBA;
else
encoder = WebPEncodeRGB;
if( lossless ) {
webp_encoder_lossless encoder;
if( !(*olen = encoder( VIPS_IMAGE_ADDR( memory, 0, 0 ),
memory->Xsize, memory->Ysize,
VIPS_IMAGE_SIZEOF_LINE( memory ),
Q, (uint8_t **) obuf )) ) {
VIPS_UNREF( memory );
vips_error( "vips2webp", "%s", _( "unable to encode" ) );
return( -1 );
if( in->Bands == 4 )
encoder = WebPEncodeLosslessRGBA;
else
encoder = WebPEncodeLosslessRGB;
if( !(*olen = encoder( VIPS_IMAGE_ADDR( memory, 0, 0 ),
memory->Xsize, memory->Ysize,
VIPS_IMAGE_SIZEOF_LINE( memory ),
(uint8_t **) obuf )) ) {
VIPS_UNREF( memory );
vips_error( "vips2webp",
"%s", _( "unable to encode" ) );
return( -1 );
}
}
else {
webp_encoder encoder;
if( in->Bands == 4 )
encoder = WebPEncodeRGBA;
else
encoder = WebPEncodeRGB;
if( !(*olen = encoder( VIPS_IMAGE_ADDR( memory, 0, 0 ),
memory->Xsize, memory->Ysize,
VIPS_IMAGE_SIZEOF_LINE( memory ),
Q, (uint8_t **) obuf )) ) {
VIPS_UNREF( memory );
vips_error( "vips2webp",
"%s", _( "unable to encode" ) );
return( -1 );
}
}
VIPS_UNREF( memory );
return( 0 );