revise formatting, add docs

fix up some formatting from https://github.com/libvips/libvips/pull/1552

plus some other small changes
This commit is contained in:
John Cupitt 2020-02-18 17:37:56 +00:00
parent fefefdf3e2
commit 0a23bf3578
6 changed files with 61 additions and 58 deletions

View File

@ -11,6 +11,7 @@
- add vips_pipe_read_limit_set(), --vips-pipe-read-limit,
VIPS_PIPE_READ_LIMIT
- revise gifload to fix BACKGROUND and PREVIOUS dispose [alon-ne]
- add subsample_mode, deprecate no_subsample in jpegsave [Elad-Laufer]
31/1/19 started 8.9.2
- fix a deadlock with --vips-leak [DarthSim]

View File

@ -2,6 +2,8 @@
*
* 24/11/11
* - wrap a class around the jpeg writer
* 18/2/20 Elad-Laufer
* - add subsample_mode, deprecate no_subsample
*/
/*
@ -130,7 +132,9 @@ vips_foreign_save_jpeg_build( VipsObject *object )
* new code should use subsample_mode
*/
if( vips_object_argument_isset( object, "no_subsample" ) )
jpeg->subsample_mode = jpeg->no_subsample ? VIPS_FOREIGN_JPEG_SUBSAMPLE_OFF : VIPS_FOREIGN_JPEG_SUBSAMPLE_AUTO;
jpeg->subsample_mode = jpeg->no_subsample ?
VIPS_FOREIGN_JPEG_SUBSAMPLE_OFF :
VIPS_FOREIGN_JPEG_SUBSAMPLE_AUTO;
return( 0 );
}
@ -233,6 +237,7 @@ static void
vips_foreign_save_jpeg_init( VipsForeignSaveJpeg *jpeg )
{
jpeg->Q = 75;
jpeg->subsample_mode = VIPS_FOREIGN_JPEG_SUBSAMPLE_AUTO;
}
typedef struct _VipsForeignSaveJpegTarget {
@ -524,7 +529,7 @@ vips_foreign_save_jpeg_mime_init( VipsForeignSaveJpegMime *mime )
* * @optimize_coding: %gboolean, compute optimal Huffman coding tables
* * @interlace: %gboolean, write an interlaced (progressive) jpeg
* * @strip: %gboolean, remove all metadata from image
* * @no_subsample: %gboolean, disable chroma subsampling
* * @subsample_mode: #VipsForeignJpegSubsample, chroma subsampling mode
* * @trellis_quant: %gboolean, apply trellis quantisation to each 8x8 block
* * @overshoot_deringing: %gboolean, overshoot samples with extreme values
* * @optimize_scans: %gboolean, split DCT coefficients into separate scans
@ -552,8 +557,8 @@ vips_foreign_save_jpeg_mime_init( VipsForeignSaveJpegMime *mime )
* If @strip is set, no EXIF data, IPTC data, ICC profile or XMP metadata is
* written into the output file.
*
* If @no_subsample is set, chrominance subsampling is disabled. This will
* improve quality at the cost of larger file size. Useful for high Q factors.
* Chroma subsampling is normally automatically disabled for Q > 90. You can
* force the subsampling mode with @@subsample_mode.
*
* If @trellis_quant is set and the version of libjpeg supports it
* (e.g. mozjpeg >= 3.0), apply trellis quantisation to each 8x8 block.
@ -640,7 +645,7 @@ vips_jpegsave( VipsImage *in, const char *filename, ... )
* * @optimize_coding: %gboolean, compute optimal Huffman coding tables
* * @interlace: %gboolean, write an interlaced (progressive) jpeg
* * @strip: %gboolean, remove all metadata from image
* * @no_subsample: %gboolean, disable chroma subsampling
* * @subsample_mode: #VipsForeignJpegSubsample, chroma subsampling mode
* * @trellis_quant: %gboolean, apply trellis quantisation to each 8x8 block
* * @overshoot_deringing: %gboolean, overshoot samples with extreme values
* * @optimize_scans: %gboolean, split DCT coefficients into separate scans
@ -679,7 +684,7 @@ vips_jpegsave_target( VipsImage *in, VipsTarget *target, ... )
* * @optimize_coding: %gboolean, compute optimal Huffman coding tables
* * @interlace: %gboolean, write an interlaced (progressive) jpeg
* * @strip: %gboolean, remove all metadata from image
* * @no_subsample: %gboolean, disable chroma subsampling
* * @subsample_mode: #VipsForeignJpegSubsample, chroma subsampling mode
* * @trellis_quant: %gboolean, apply trellis quantisation to each 8x8 block
* * @overshoot_deringing: %gboolean, overshoot samples with extreme values
* * @optimize_scans: %gboolean, split DCT coefficients into separate scans
@ -735,7 +740,7 @@ vips_jpegsave_buffer( VipsImage *in, void **buf, size_t *len, ... )
* * @optimize_coding: %gboolean, compute optimal Huffman coding tables
* * @interlace: %gboolean, write an interlaced (progressive) jpeg
* * @strip: %gboolean, remove all metadata from image
* * @no_subsample: %gboolean, disable chroma subsampling
* * @subsample_mode: #VipsForeignJpegSubsample, chroma subsampling mode
* * @trellis_quant: %gboolean, apply trellis quantisation to each 8x8 block
* * @overshoot_deringing: %gboolean, overshoot samples with extreme values
* * @optimize_scans: %gboolean, split DCT coefficients into separate scans

View File

@ -92,6 +92,8 @@
* - ignore large XMP
* 14/10/19
* - revise for target IO
* 18/2/20 Elad-Laufer
* - add subsample_mode, deprecate no_subsample
*/
/*
@ -628,25 +630,16 @@ write_vips( Write *write, int qfac, const char *profile,
if( progressive )
jpeg_simple_progression( &write->cinfo );
switch ( subsample_mode ) {
case VIPS_FOREIGN_JPEG_SUBSAMPLE_ON:
break;
case VIPS_FOREIGN_JPEG_SUBSAMPLE_AUTO:
/* Turn off chroma subsampling. Follow IM and do it automatically for
* high Q.
*/
if( qfac < 90 )
break;
case VIPS_FOREIGN_JPEG_SUBSAMPLE_OFF:
default:
{
if( subsample_mode == VIPS_FOREIGN_JPEG_SUBSAMPLE_OFF ||
(subsample_mode == VIPS_FOREIGN_JPEG_SUBSAMPLE_AUTO &&
qfac >= 90) ) {
int i;
for( i = 0; i < in->Bands; i++ ) {
write->cinfo.comp_info[i].h_samp_factor = 1;
write->cinfo.comp_info[i].v_samp_factor = 1;
}
}
}
/* Don't write the APP0 JFIF headers if we are stripping.
*/

View File

@ -369,11 +369,14 @@ int vips_openslideload( const char *filename, VipsImage **out, ... )
* @VIPS_FOREIGN_JPEG_SUBSAMPLE_AUTO: default preset
* @VIPS_FOREIGN_JPEG_SUBSAMPLE_ON: always perform subsampling
* @VIPS_FOREIGN_JPEG_SUBSAMPLE_OFF: never perform subsampling
*
* Set jpeg subsampling mode.
*/
typedef enum {
VIPS_FOREIGN_JPEG_SUBSAMPLE_AUTO,
VIPS_FOREIGN_JPEG_SUBSAMPLE_ON,
VIPS_FOREIGN_JPEG_SUBSAMPLE_OFF
VIPS_FOREIGN_JPEG_SUBSAMPLE_OFF,
VIPS_FOREIGN_JPEG_SUBSAMPLE_LAST
} VipsForeignJpegSubsample;
int vips_jpegload( const char *filename, VipsImage **out, ... )

View File

@ -508,6 +508,7 @@ vips_foreign_jpeg_subsample_get_type( void )
{VIPS_FOREIGN_JPEG_SUBSAMPLE_AUTO, "VIPS_FOREIGN_JPEG_SUBSAMPLE_AUTO", "auto"},
{VIPS_FOREIGN_JPEG_SUBSAMPLE_ON, "VIPS_FOREIGN_JPEG_SUBSAMPLE_ON", "on"},
{VIPS_FOREIGN_JPEG_SUBSAMPLE_OFF, "VIPS_FOREIGN_JPEG_SUBSAMPLE_OFF", "off"},
{VIPS_FOREIGN_JPEG_SUBSAMPLE_LAST, "VIPS_FOREIGN_JPEG_SUBSAMPLE_LAST", "last"},
{0, NULL, NULL}
};