Merge branch 'libvipsd-master'

This commit is contained in:
elad laufer 2020-05-12 13:03:31 +03:00
commit b31523b470
6 changed files with 50 additions and 19 deletions

View File

@ -19,6 +19,7 @@
- flood fill could stop half-way for some very complex shapes - flood fill could stop half-way for some very complex shapes
- better handling of unaligned reads in multipage tiffs [petoor] - better handling of unaligned reads in multipage tiffs [petoor]
- mark old --delete option to vipsthumbnail as deprecated [UweOhse] - 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 24/4/20 started 8.9.3
- better iiif tile naming [IllyaMoskvin] - better iiif tile naming [IllyaMoskvin]

View File

@ -126,10 +126,11 @@ G_DEFINE_TYPE( VipsCast, vips_cast, VIPS_TYPE_CONVERSION );
#define CAST_SHORT( X ) VIPS_CLIP( SHRT_MIN, (X), SHRT_MAX ) #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 /* 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_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). /* 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; \ OTYPE * restrict q = (OTYPE *) out; \
\ \
for( x = 0; x < sz; x++ ) \ 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. /* 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; \ OTYPE * restrict q = (OTYPE *) out; \
\ \
for( x = 0; x < sz; x++ ) { \ for( x = 0; x < sz; x++ ) { \
q[x] = p[0]; \ q[x] = CAST( p[0] ); \
p += 2; \ p += 2; \
} \ } \
} }

View File

@ -77,6 +77,8 @@
* - restart after minimise * - restart after minimise
* 14/10/19 * 14/10/19
* - revise for connection IO * - 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 ); "of ICC profile\n", length );
#endif /*DEBUG*/ #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_set_iCCP( write->pPng, write->pInfo, "icc",
PNG_COMPRESSION_TYPE_BASE, PNG_COMPRESSION_TYPE_BASE,
(void *) data, length ); (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 ) ) { if( vips_image_get_typeof( in, VIPS_META_XMP_NAME ) ) {

View File

@ -101,19 +101,19 @@ vips_reduce_get_points( VipsKernel kernel, double shrink )
return( 1 ); return( 1 );
case VIPS_KERNEL_LINEAR: case VIPS_KERNEL_LINEAR:
return( rint( 2 * shrink ) + 1 ); return( 2 * rint( shrink ) + 1 );
case VIPS_KERNEL_CUBIC: case VIPS_KERNEL_CUBIC:
case VIPS_KERNEL_MITCHELL: case VIPS_KERNEL_MITCHELL:
return( rint( 4 * shrink ) + 1 ); return( 2 * rint( 2 * shrink ) + 1 );
case VIPS_KERNEL_LANCZOS2: case VIPS_KERNEL_LANCZOS2:
/* Needs to be in sync with calculate_coefficients_lanczos(). /* 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: case VIPS_KERNEL_LANCZOS3:
return( rint( 2 * 3 * shrink ) + 1 ); return( 2 * rint( 3 * shrink ) + 1 );
default: default:
g_assert_not_reached(); g_assert_not_reached();

View File

@ -321,14 +321,15 @@ calculate_coefficients_triangle( double *c,
{ {
/* Needs to be in sync with vips_reduce_get_points(). /* 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; int i;
double sum; double sum;
sum = 0; sum = 0;
for( i = 0; i < n_points; i++ ) { for( i = 0; i < n_points; i++ ) {
double xp = (i - (shrink - 0.5) - x) / shrink; const double xp = (i - half) / shrink;
double l; double l;
@ -358,14 +359,15 @@ calculate_coefficients_cubic( double *c,
{ {
/* Needs to be in sync with vips_reduce_get_points(). /* 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; int i;
double sum; double sum;
sum = 0; sum = 0;
for( i = 0; i < n_points; i++ ) { 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 axp = VIPS_FABS( xp );
const double axp2 = axp * axp; const double axp2 = axp * axp;
const double axp3 = axp2 * 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(). /* 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; int i;
double sum; double sum;
sum = 0; sum = 0;
for( i = 0; i < n_points; i++ ) { for( i = 0; i < n_points; i++ ) {
double xp = (i - (n_points - 2) / 2 - x) / shrink; double xp = (i - half) / shrink;
double l; double l;

View File

@ -1238,8 +1238,11 @@ vips_thumbnail_buffer_init( VipsThumbnailBuffer *buffer )
* * @import_profile: %gchararray, fallback import ICC profile * * @import_profile: %gchararray, fallback import ICC profile
* * @export_profile: %gchararray, export ICC profile * * @export_profile: %gchararray, export ICC profile
* * @intent: #VipsIntent, rendering intent * * @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(). * See also: vips_thumbnail().
* *
@ -1414,8 +1417,11 @@ vips_thumbnail_source_init( VipsThumbnailSource *source )
* * @import_profile: %gchararray, fallback import ICC profile * * @import_profile: %gchararray, fallback import ICC profile
* * @export_profile: %gchararray, export ICC profile * * @export_profile: %gchararray, export ICC profile
* * @intent: #VipsIntent, rendering intent * * @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(). * See also: vips_thumbnail().
* *