Merge branch 'master' of github.com:libvips/libvips

This commit is contained in:
John Cupitt 2022-02-27 13:43:13 +00:00
commit 7d1956974e
14 changed files with 34 additions and 26 deletions

View File

@ -75,7 +75,7 @@ G_DEFINE_TYPE( VipsLabQ2sRGB, vips_LabQ2sRGB, VIPS_TYPE_COLOUR_CODE );
* *
* There's an extra element at the end to let us do a +1 for interpolation. * There's an extra element at the end to let us do a +1 for interpolation.
*/ */
int vips_Y2v_8[256 + 1]; static int vips_Y2v_8[256 + 1];
/* 8-bit sRGB -> linear lut. /* 8-bit sRGB -> linear lut.
*/ */
@ -85,7 +85,7 @@ float vips_v2Y_8[256];
* *
* There's an extra element at the end to let us do a +1 for interpolation. * There's an extra element at the end to let us do a +1 for interpolation.
*/ */
int vips_Y2v_16[65536 + 1]; static int vips_Y2v_16[65536 + 1];
/* 16-bit sRGB -> linear lut. /* 16-bit sRGB -> linear lut.
*/ */

View File

@ -69,7 +69,7 @@
*/ */
#define QUANT_ELEMENTS (100000) #define QUANT_ELEMENTS (100000)
float cbrt_table[QUANT_ELEMENTS]; static float cbrt_table[QUANT_ELEMENTS];
typedef struct _VipsXYZ2Lab { typedef struct _VipsXYZ2Lab {
VipsColourTransform parent_instance; VipsColourTransform parent_instance;

View File

@ -206,7 +206,7 @@ vips_col_dE00( float L1, float a1, float b1,
/* Find the difference between two buffers of LAB data. /* Find the difference between two buffers of LAB data.
*/ */
void static void
vips_dE00_line( VipsColour *colour, vips_dE00_line( VipsColour *colour,
VipsPel *out, VipsPel **in, int width ) VipsPel *out, VipsPel **in, int width )
{ {

View File

@ -208,9 +208,7 @@ void vips__pythagoras_line( VipsColour *colour,
/* Colour tables for Y<->v conversion. Call vips_col_make_tables_RGB_8() and /* Colour tables for Y<->v conversion. Call vips_col_make_tables_RGB_8() and
* vips_col_make_tables_RGB_16() before use to initialize. * vips_col_make_tables_RGB_16() before use to initialize.
*/ */
extern int vips_Y2v_8[256 + 1];
extern float vips_v2Y_8[256]; extern float vips_v2Y_8[256];
extern int vips_Y2v_16[65536 + 1];
extern float vips_v2Y_16[65536]; extern float vips_v2Y_16[65536];
void vips_col_make_tables_RGB_8( void ); void vips_col_make_tables_RGB_8( void );

View File

@ -1177,7 +1177,7 @@ static char *scan_property_names[][2] = {
/* Make the xml we write to scan-properties.xml in szi write. /* Make the xml we write to scan-properties.xml in szi write.
* Free with g_free(). * Free with g_free().
*/ */
char * static char *
build_scan_properties( VipsImage *image ) build_scan_properties( VipsImage *image )
{ {
VipsDbuf dbuf; VipsDbuf dbuf;

View File

@ -176,10 +176,14 @@ typedef struct heif_error (*libheif_metadata_fn)( struct heif_context *,
const struct heif_image_handle *, const struct heif_image_handle *,
const void *, int ); const void *, int );
struct _VipsForeignSaveHeifMetadata { /* String-based metadata fields we add.
const char *name; */
libheif_metadata_fn saver; typedef struct _VipsForeignSaveHeifMetadata {
} libheif_metadata[] = { const char *name; /* as understood by libvips */
libheif_metadata_fn saver; /* as understood by libheif */
} VipsForeignSaveHeifMetadata;
static VipsForeignSaveHeifMetadata libheif_metadata[] = {
{ VIPS_META_EXIF_NAME, heif_context_add_exif_metadata }, { VIPS_META_EXIF_NAME, heif_context_add_exif_metadata },
{ VIPS_META_XMP_NAME, heif_context_add_XMP_metadata } { VIPS_META_XMP_NAME, heif_context_add_XMP_metadata }
}; };

View File

@ -63,6 +63,7 @@ typedef struct _VipsDbuf {
void vips_dbuf_destroy( VipsDbuf *dbuf ); void vips_dbuf_destroy( VipsDbuf *dbuf );
void vips_dbuf_init( VipsDbuf *dbuf ); void vips_dbuf_init( VipsDbuf *dbuf );
gboolean vips_dbuf_minimum_size( VipsDbuf *dbuf, size_t size );
gboolean vips_dbuf_allocate( VipsDbuf *dbuf, size_t size ); gboolean vips_dbuf_allocate( VipsDbuf *dbuf, size_t size );
size_t vips_dbuf_read( VipsDbuf *dbuf, unsigned char *data, size_t size ); size_t vips_dbuf_read( VipsDbuf *dbuf, unsigned char *data, size_t size );
unsigned char *vips_dbuf_get_write( VipsDbuf *dbuf, size_t *size ); unsigned char *vips_dbuf_get_write( VipsDbuf *dbuf, size_t *size );

View File

@ -816,6 +816,8 @@ typedef enum {
int vips_dzsave( VipsImage *in, const char *name, ... ) int vips_dzsave( VipsImage *in, const char *name, ... )
__attribute__((sentinel)); __attribute__((sentinel));
int vips_dzsave_buffer( VipsImage *in, void **buf, size_t *len, ... )
__attribute__((sentinel));
/** /**
* VipsForeignHeifCompression: * VipsForeignHeifCompression:

View File

@ -1381,7 +1381,7 @@ vips_image_written( VipsImage *image )
return( result ); return( result );
} }
void static void
vips_image_invalidate( VipsImage *image ) vips_image_invalidate( VipsImage *image )
{ {
VIPS_DEBUG_MSG( "vips_image_invalidate: %p\n", image ); VIPS_DEBUG_MSG( "vips_image_invalidate: %p\n", image );
@ -1421,7 +1421,7 @@ vips_image_invalidate_all( VipsImage *image )
(VipsSListMap2Fn) vips_image_invalidate_all_cb, NULL, NULL ); (VipsSListMap2Fn) vips_image_invalidate_all_cb, NULL, NULL );
} }
void static void
vips_image_minimise( VipsImage *image ) vips_image_minimise( VipsImage *image )
{ {
VIPS_DEBUG_MSG( "vips_image_minimise: %p\n", image ); VIPS_DEBUG_MSG( "vips_image_minimise: %p\n", image );
@ -1681,7 +1681,7 @@ vips_image_set_kill( VipsImage *image, gboolean kill )
/* Fills the given buffer with a temporary filename. /* Fills the given buffer with a temporary filename.
* Assuming that "int" might be 64 Bit wide a buffer size of 26 suffices. * Assuming that "int" might be 64 Bit wide a buffer size of 26 suffices.
*/ */
void static void
vips_image_temp_name( char *name, int size ) vips_image_temp_name( char *name, int size )
{ {
static int global_serial = 0; static int global_serial = 0;

View File

@ -179,7 +179,7 @@ vips_area_free_cb( void *mem, VipsArea *area )
return( 0 ); return( 0 );
} }
void static void
vips_area_free( VipsArea *area ) vips_area_free( VipsArea *area )
{ {
if( area->free_fn && if( area->free_fn &&

View File

@ -69,7 +69,7 @@
*/ */
gboolean vips__vector_enabled = TRUE; gboolean vips__vector_enabled = TRUE;
void static void
vips_vector_error( VipsVector *vector ) vips_vector_error( VipsVector *vector )
{ {
#ifdef HAVE_ORC #ifdef HAVE_ORC

View File

@ -277,7 +277,7 @@ vips_window_new( VipsImage *im, int top, int height )
if( !(window = VIPS_NEW( NULL, VipsWindow )) ) if( !(window = VIPS_NEW( NULL, VipsWindow )) )
return( NULL ); return( NULL );
window->ref_count = 1; window->ref_count = 0;
window->im = im; window->im = im;
window->top = 0; window->top = 0;
window->height = 0; window->height = 0;
@ -290,6 +290,7 @@ vips_window_new( VipsImage *im, int top, int height )
vips_window_free( window ); vips_window_free( window );
return( NULL ); return( NULL );
} }
window->ref_count = 1;
#ifdef DEBUG #ifdef DEBUG
printf( "** vips_window_new: window top = %d, height = %d (%p)\n", printf( "** vips_window_new: window top = %d, height = %d (%p)\n",

View File

@ -373,7 +373,7 @@ vips_interpolate_nearest_init( VipsInterpolateNearest *nearest )
#endif /*DEBUG*/ #endif /*DEBUG*/
} }
VipsInterpolate * static VipsInterpolate *
vips_interpolate_nearest_new( void ) vips_interpolate_nearest_new( void )
{ {
return( VIPS_INTERPOLATE( vips_object_new( return( VIPS_INTERPOLATE( vips_object_new(

View File

@ -152,7 +152,7 @@ if fftw_dep.found()
cfg_var.set('HAVE_FFTW', '1') cfg_var.set('HAVE_FFTW', '1')
endif endif
# We can simplify this when requiring meson>=0.60.0 # TODO: simplify this when requiring meson>=0.60.0
magick_dep = dependency(get_option('magick-package'), required: false) magick_dep = dependency(get_option('magick-package'), required: false)
if not magick_dep.found() if not magick_dep.found()
# very old versions called it "ImageMagick" # very old versions called it "ImageMagick"
@ -270,10 +270,10 @@ endif
# - it's sometimes called "spng.pc", sometimes "libspng.pc", we must search for # - it's sometimes called "spng.pc", sometimes "libspng.pc", we must search for
# both # both
# - we need 0.7+ for PNG write support # - we need 0.7+ for PNG write support
# - simplify this when requiring meson>=0.60.0 # TODO: simplify this when requiring meson>=0.60.0
spng_dep = dependency('libspng', version: '>=0.7', required: get_option('spng')) spng_dep = dependency('spng', version: '>=0.7', required: false)
if not spng_dep.found() if not spng_dep.found()
spng_dep = dependency('spng', version: '>=0.7', required: get_option('spng')) spng_dep = dependency('libspng', version: '>=0.7', required: get_option('spng'))
endif endif
if not get_option('spng').disabled() and spng_dep.found() if not get_option('spng').disabled() and spng_dep.found()
libvips_deps += spng_dep libvips_deps += spng_dep
@ -297,7 +297,7 @@ endif
# libwebp ... target 0.6+ to reduce complication # libwebp ... target 0.6+ to reduce complication
# webp has the stuff for handling metadata in two separate libraries -- we # webp has the stuff for handling metadata in two separate libraries -- we
# insist on having both of them # insist on having both of them
libwebp_dep = dependency('libwebp', version: '>=0.6', required: get_option('png')) libwebp_dep = dependency('libwebp', version: '>=0.6', required: get_option('webp'))
if libwebp_dep.found() if libwebp_dep.found()
libvips_deps += libwebp_dep libvips_deps += libwebp_dep
libvips_deps += dependency('libwebpmux', version: '>=0.6') libvips_deps += dependency('libwebpmux', version: '>=0.6')
@ -465,11 +465,13 @@ elif libpoppler_dep.found() and cairo_dep.found()
cfg_var.set('HAVE_POPPLER', '1') cfg_var.set('HAVE_POPPLER', '1')
endif endif
libnifti_dep = cc.find_library('niftiio', has_headers: 'nifti1_io.h', required: false) # niftiio.pc is not always present, so fallback to CMake's find_package() functionally
# TODO: simplify this when requiring meson>=0.60.0
libnifti_dep = dependency('niftiio', required: false)
if not libnifti_dep.found() if not libnifti_dep.found()
libnifti_dep = dependency('NIFTI', method: 'cmake', modules: ['NIFTI'], required: get_option('nifti')) libnifti_dep = dependency('NIFTI', method: 'cmake', modules: ['NIFTI::niftiio'], required: get_option('nifti'))
endif endif
if libnifti_dep.found() if not get_option('nifti').disabled() and libnifti_dep.found()
libvips_deps += libnifti_dep libvips_deps += libnifti_dep
cfg_var.set('HAVE_NIFTI', '1') cfg_var.set('HAVE_NIFTI', '1')
endif endif