Merge branch 'libvipsd-master'
This commit is contained in:
commit
b31523b470
@ -19,6 +19,7 @@
|
||||
- flood fill could stop half-way for some very complex shapes
|
||||
- better handling of unaligned reads in multipage tiffs [petoor]
|
||||
- mark old --delete option to vipsthumbnail as deprecated [UweOhse]
|
||||
- png save with a bad ICC profile just gives a warning
|
||||
|
||||
24/4/20 started 8.9.3
|
||||
- better iiif tile naming [IllyaMoskvin]
|
||||
|
@ -126,10 +126,11 @@ G_DEFINE_TYPE( VipsCast, vips_cast, VIPS_TYPE_CONVERSION );
|
||||
#define CAST_SHORT( X ) VIPS_CLIP( SHRT_MIN, (X), SHRT_MAX )
|
||||
|
||||
/* We know the source cannot be the same as the dest, so we will only use
|
||||
* CAST_UINT() for an INT source, and vice versa.
|
||||
* CAST_UINT() for an INT source, and vice versa. We don't need to clip to
|
||||
* INT_MAX, since float->int does that for us.
|
||||
*/
|
||||
#define CAST_UINT( X ) VIPS_MAX( 0, (X) )
|
||||
#define CAST_INT( X ) VIPS_MIN( (X), INT_MAX )
|
||||
#define CAST_INT( X ) (X)
|
||||
|
||||
/* Rightshift an integer type, ie. sizeof(ITYPE) > sizeof(OTYPE).
|
||||
*/
|
||||
@ -222,7 +223,7 @@ G_DEFINE_TYPE( VipsCast, vips_cast, VIPS_TYPE_CONVERSION );
|
||||
OTYPE * restrict q = (OTYPE *) out; \
|
||||
\
|
||||
for( x = 0; x < sz; x++ ) \
|
||||
q[x] = p[x]; \
|
||||
q[x] = CAST( p[x] ); \
|
||||
}
|
||||
|
||||
/* Cast complex types to an int type. Just take the real part.
|
||||
@ -232,7 +233,7 @@ G_DEFINE_TYPE( VipsCast, vips_cast, VIPS_TYPE_CONVERSION );
|
||||
OTYPE * restrict q = (OTYPE *) out; \
|
||||
\
|
||||
for( x = 0; x < sz; x++ ) { \
|
||||
q[x] = p[0]; \
|
||||
q[x] = CAST( p[0] ); \
|
||||
p += 2; \
|
||||
} \
|
||||
}
|
||||
|
@ -77,6 +77,8 @@
|
||||
* - restart after minimise
|
||||
* 14/10/19
|
||||
* - revise for connection IO
|
||||
* 11/5/20
|
||||
* - only warn for saving bad profiles, don't fail
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -1047,10 +1049,28 @@ write_vips( Write *write,
|
||||
"of ICC profile\n", length );
|
||||
#endif /*DEBUG*/
|
||||
|
||||
/* We need to ignore any errors from png_set_iCCP()
|
||||
* since we want to drop incompatible profiles rather
|
||||
* than simply failing.
|
||||
*/
|
||||
if( setjmp( png_jmpbuf( write->pPng ) ) ) {
|
||||
/* Silent ignore of error.
|
||||
*/
|
||||
g_warning( "bad ICC profile not saved" );
|
||||
}
|
||||
else {
|
||||
/* This will jump back to the line above on
|
||||
* error.
|
||||
*/
|
||||
png_set_iCCP( write->pPng, write->pInfo, "icc",
|
||||
PNG_COMPRESSION_TYPE_BASE,
|
||||
(void *) data, length );
|
||||
}
|
||||
|
||||
/* And restore the setjmp.
|
||||
*/
|
||||
if( setjmp( png_jmpbuf( write->pPng ) ) )
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
if( vips_image_get_typeof( in, VIPS_META_XMP_NAME ) ) {
|
||||
|
@ -101,19 +101,19 @@ vips_reduce_get_points( VipsKernel kernel, double shrink )
|
||||
return( 1 );
|
||||
|
||||
case VIPS_KERNEL_LINEAR:
|
||||
return( rint( 2 * shrink ) + 1 );
|
||||
return( 2 * rint( shrink ) + 1 );
|
||||
|
||||
case VIPS_KERNEL_CUBIC:
|
||||
case VIPS_KERNEL_MITCHELL:
|
||||
return( rint( 4 * shrink ) + 1 );
|
||||
return( 2 * rint( 2 * shrink ) + 1 );
|
||||
|
||||
case VIPS_KERNEL_LANCZOS2:
|
||||
/* Needs to be in sync with calculate_coefficients_lanczos().
|
||||
*/
|
||||
return( rint( 2 * 2 * shrink ) + 1 );
|
||||
return( 2 * rint( 2 * shrink ) + 1 );
|
||||
|
||||
case VIPS_KERNEL_LANCZOS3:
|
||||
return( rint( 2 * 3 * shrink ) + 1 );
|
||||
return( 2 * rint( 3 * shrink ) + 1 );
|
||||
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
|
@ -321,14 +321,15 @@ calculate_coefficients_triangle( double *c,
|
||||
{
|
||||
/* Needs to be in sync with vips_reduce_get_points().
|
||||
*/
|
||||
const int n_points = rint( 2 * shrink ) + 1;
|
||||
const int n_points = 2 * rint( shrink ) + 1;
|
||||
const double half = x + n_points / 2.0 - 1;
|
||||
|
||||
int i;
|
||||
double sum;
|
||||
|
||||
sum = 0;
|
||||
for( i = 0; i < n_points; i++ ) {
|
||||
double xp = (i - (shrink - 0.5) - x) / shrink;
|
||||
const double xp = (i - half) / shrink;
|
||||
|
||||
double l;
|
||||
|
||||
@ -358,14 +359,15 @@ calculate_coefficients_cubic( double *c,
|
||||
{
|
||||
/* Needs to be in sync with vips_reduce_get_points().
|
||||
*/
|
||||
const int n_points = rint( 4 * shrink ) + 1;
|
||||
const int n_points = 2 * rint( 2 * shrink ) + 1;
|
||||
const double half = x + n_points / 2.0 - 1;
|
||||
|
||||
int i;
|
||||
double sum;
|
||||
|
||||
sum = 0;
|
||||
for( i = 0; i < n_points; i++ ) {
|
||||
const double xp = (i - (2 * shrink - 1) - x) / shrink;
|
||||
const double xp = (i - half) / shrink;
|
||||
const double axp = VIPS_FABS( xp );
|
||||
const double axp2 = axp * axp;
|
||||
const double axp3 = axp2 * axp;
|
||||
@ -406,14 +408,15 @@ calculate_coefficients_lanczos( double *c,
|
||||
{
|
||||
/* Needs to be in sync with vips_reduce_get_points().
|
||||
*/
|
||||
const int n_points = rint( 2 * a * shrink ) + 1;
|
||||
const int n_points = 2 * rint( a * shrink ) + 1;
|
||||
const double half = x + n_points / 2.0 - 1;
|
||||
|
||||
int i;
|
||||
double sum;
|
||||
|
||||
sum = 0;
|
||||
for( i = 0; i < n_points; i++ ) {
|
||||
double xp = (i - (n_points - 2) / 2 - x) / shrink;
|
||||
double xp = (i - half) / shrink;
|
||||
|
||||
double l;
|
||||
|
||||
|
@ -1238,8 +1238,11 @@ vips_thumbnail_buffer_init( VipsThumbnailBuffer *buffer )
|
||||
* * @import_profile: %gchararray, fallback import ICC profile
|
||||
* * @export_profile: %gchararray, export ICC profile
|
||||
* * @intent: #VipsIntent, rendering intent
|
||||
* * @option_string: %gchararray, extra loader options
|
||||
*
|
||||
* Exacty as vips_thumbnail(), but read from a memory buffer.
|
||||
* Exacty as vips_thumbnail(), but read from a memory buffer. One extra
|
||||
* optional argument, @option_string, lets you pass options to the underlying
|
||||
* loader.
|
||||
*
|
||||
* See also: vips_thumbnail().
|
||||
*
|
||||
@ -1414,8 +1417,11 @@ vips_thumbnail_source_init( VipsThumbnailSource *source )
|
||||
* * @import_profile: %gchararray, fallback import ICC profile
|
||||
* * @export_profile: %gchararray, export ICC profile
|
||||
* * @intent: #VipsIntent, rendering intent
|
||||
* * @option_string: %gchararray, extra loader options
|
||||
*
|
||||
* Exactly as vips_thumbnail(), but read from a source.
|
||||
* Exacty as vips_thumbnail(), but read from a source. One extra
|
||||
* optional argument, @option_string, lets you pass options to the underlying
|
||||
* loader.
|
||||
*
|
||||
* See also: vips_thumbnail().
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user