Commit Graph

1683 Commits

Author SHA1 Message Date
John Cupitt 8c668303f8 improve the pixel rng
see https://github.com/libvips/libvips/issues/2642
2022-02-02 18:15:26 +00:00
John Cupitt 260b2ddf92
Fix read from pipe with variable chunk sizes
free the header cache only once it's exhausted
2022-01-24 11:27:22 +00:00
John Cupitt 65d84d1cbe fix a crash with 0 length vectors 2021-12-16 10:45:10 +00:00
John Cupitt cd80b5ae94 note win fd change in changelog 2021-12-06 13:58:46 +00:00
Lovell Fuller b28ee777ab
Windows: don't set create time for invalid/stream fd (#2571) 2021-12-06 13:52:02 +00:00
John Cupitt 80f2581e0c expand the docs for vips_shutdown()
see https://github.com/libvips/libvips/discussions/2540
2021-11-16 10:56:43 +00:00
John Cupitt 3488c6b410 reorder hyperbolic enums to fix an ABI break 2021-11-03 17:57:42 +00:00
Heshy Roskes d8c04011ea
Add hyperbolic functions (#2508)
* add hyperbolic functions
* add hyperbolic function tests
* changelog
* add inverse hyperbolic functions for old compilers
2021-11-02 15:05:37 +00:00
Kleis Auke Wolthuizen fc92290bb9
Try the new target API first in `VImage::write_to_buffer` (#2511)
Needed after PR #2499.
2021-11-02 13:36:27 +00:00
John Cupitt 0c70f3dc7d
add fail-on : better control over loader error handling (#2360)
Instead of a simple fail/don't-fail boolean switch, add fail-on, an enum which sets the sensitivity of loaders to errors. 

There's a new sensitivity level which tries to detect truncated images, but ignores other types of error.
2021-10-31 14:13:18 +00:00
Kleis Auke Wolthuizen a5bdcd77e0
Include vips.h before checking for G_OS_WIN32 (#2502)
Since this definition originates from GLib, it is necessary to
include vips/vips.h prior to using it.
2021-10-29 11:05:21 +01:00
Kleis Auke Wolthuizen 2d6d2e7c0d
Drop the operation cache before leak checking (#2503) 2021-10-29 11:03:28 +01:00
John Cupitt 47383b5bfc
tell buffer and target savers the file format (#2499)
tell buffer and target savers the file format

Currently, buffer and target savers are not told the format they should
write.

This is usually OK (the JPEG saver already knows it should write JPEG),
but some savers can write several formats, and these currently need an
extra parameter.

For example:

```ruby
buf = x.write_to_buffer ".bmp", format: "bmp"
```

The first ".bmp" gets libvips to pick magicksave, the second
`format:` param is necessary to tell magicksave to write BMP.

This patch adds stub subclasses so that the savers know the exact format. It also improves PPM save.
2021-10-28 18:57:24 +01:00
John Cupitt e815e8ad95
Move the filemode ifdefs to a private header (#2498)
The filemode ifdefs had grown to 30 lines of code duplicated in four
source files. Move to a single copy in a private header (not part of the
public API).
2021-10-27 11:37:51 +01:00
Kleis Auke Wolthuizen 5d6e9851ba
Ensure newly created file descriptors are non-inheritable (#2497)
* Cleanup unused defines

* win32: do not inherit open file handles in child processes

`O_NOINHERIT` and the `N` flag of `fopen` is available in all
supported Windows versions.

* unix: ensure any open file handles are closed on exec

`O_CLOEXEC` is available since Linux 2.6.23 and is ignored on
earlier versions. `e` flag of `fopen` is available since glibc 2.7.
2021-10-26 12:20:03 +01:00
John Cupitt 13285c7cfc Merge branch 'master' of https://github.com/indus/libvips into indus-master 2021-10-20 18:41:39 +01:00
Kleis Auke Wolthuizen 8a1e1eda34
Prefer g_malloc over vips_malloc in vips_blob_copy (#2489)
The use of vips_malloc is not necessary here and could potentially
be slower since it uses g_malloc0 (i.e. calloc).
2021-10-20 14:22:00 +01:00
John Cupitt 0f3193b7f2
Add iiif3 (#2483)
* add iiif3 support to dzsave

some small things have changed from v2
2021-10-19 14:18:40 +01:00
John Cupitt e1a7063999
move make_resident into modules loading (#2434)
since all libvips modules can't be unloaded
2021-10-14 15:49:22 +01:00
John Cupitt f6281284a1 fix VipsSource and named pipes
We used to assume (in several places) that any source with a filename was
seekable. This patch adds a is_file test, and makes all the loaders use it.

see https://github.com/libvips/libvips/issues/2467
2021-10-08 12:20:24 +01:00
John Cupitt 1584d0d917 fix comment typo 2021-09-18 14:40:59 +01:00
John Cupitt 024244bfbc don't free global_lcol on shutdown
since we need to be able to call things like error_buf after shutdown in
leak testing
2021-09-18 14:04:05 +01:00
John Cupitt b96ed28903 update docs for vips_shutdown() use
Since we have a new policy.
2021-09-17 19:09:07 +01:00
John Cupitt af61d375bc
experiment with removing shutdown from atexit (#2439)
remove shutdown from atexit

Because atexit() can be called at almost any point during process termination,
including after worker threads have been force-quit, we can't use it for
cleanup.

New policy: use vips_shutdown() explicitly if you need to clean up,
though it's optional. Only use atexit() for leak checking.
2021-09-17 19:02:53 +01:00
John Cupitt b221830b5a better memory debug output 2021-09-16 15:46:35 +01:00
John Cupitt 7e8af07c66
Fix flatten clip (#2432)
* fic gtk-doc typenames in cgif

* fix flatten clipping

flatten could produce out of range values if max_alpha was less than
the limit of the numeric range of the format

https://github.com/libvips/libvips/issues/2431
2021-09-13 11:23:02 +01:00
John Cupitt cfd9dc3f01 try to handle mmap failing in source
Some filesystems have mmap disabled. Make vips_source_map() fall back to
read if mmap fails.

See https://github.com/libvips/libvips/discussions/2415
2021-09-08 09:24:36 +01:00
John Cupitt 579bdff012 more debug in source.c 2021-09-06 20:26:43 +01:00
John Cupitt 307d24eea7 Merge branch '8.11' 2021-08-30 14:02:28 +01:00
John Cupitt b62287a792 check .v enums more carefully 2021-08-30 14:02:03 +01:00
Lovell Fuller bd8093ab71 Handle error values when guessing interpretation (#2421) 2021-08-30 12:30:55 +01:00
Lovell Fuller 4aaed60573 Ensure VIPS_CODING_ERROR is handled for vips images (#2420) 2021-08-30 12:30:43 +01:00
Lovell Fuller 01c39d0774
Ensure VIPS_CODING_ERROR is handled for vips images (#2420) 2021-08-29 20:16:31 +01:00
Lovell Fuller 30897e8e36
Handle error values when guessing interpretation (#2421) 2021-08-29 20:15:24 +01:00
John Cupitt b493b16e54 Merge branch '8.11' 2021-07-16 10:23:19 +01:00
John Cupitt 6946c3b9d9 start up threadpool later
might help php and ruby web frameworks

see eg. https://github.com/libvips/php-vips-ext/issues/42
2021-07-14 20:21:38 +01:00
John Cupitt 6dd6fafa2a Merge branch '8.11' 2021-07-03 11:47:26 +01:00
John Cupitt 70182e4eac don't load modules if they are built in
Only load modules if libvips has been built as a set of modules.
Otherwise can can end up loading operations twice.
2021-07-03 11:14:58 +01:00
John Cupitt d14d5eed25 Merge branch '8.11' 2021-07-02 17:20:21 +01:00
John Cupitt 951e900a32 fix libdir directory guessing on windows 2021-07-02 17:18:46 +01:00
John Cupitt ec1d1abf50 Merge branch '8.11' 2021-07-02 12:35:24 +01:00
John Cupitt d07dee8b0c better libdir guessing
take the lib directory name (eg. "lib64" etc.) from the configure
time libdir
2021-07-02 11:50:34 +01:00
Remi Collet c7f7fc52e8 use /lib64 instead of /lib when needed 2021-06-29 17:35:33 +01:00
John Cupitt ea5972055f Merge branch '8.11' 2021-06-28 20:33:51 +01:00
John Cupitt 067d603182 oop typo 2021-06-23 12:26:21 +01:00
John Cupitt 706c2a112d Merge branch '8.11' 2021-06-23 12:25:43 +01:00
John Cupitt 40a04fdbc1 improve startup info 2021-06-22 18:39:41 +01:00
John Cupitt eeb64b6968 change init prefix fallback order
Use the configure time prefix second rather than going straight to
search. This should help ruby-vips on homebrew.
2021-06-22 18:09:57 +01:00
John Cupitt 1cd4b848e7 enable info output earlier 2021-06-22 15:38:54 +01:00
John Cupitt b9034bf731 more startup debug output
if VIPS_INFO is set
2021-06-22 15:28:21 +01:00
Keim, Stefan f75f698ab4 Add atan2 to math2 2021-06-18 11:14:02 +02:00
Remi Collet ea48b6a482 use /lib64 instead of /lib when needed 2021-06-15 15:17:35 +02:00
John Cupitt e96fc955bc comment reason for thread_execute revert 2021-06-07 14:30:21 +01:00
John Cupitt 939437d56e Merge commit '4c263a36e9e728b5ab5cc1f4f3cafe5738a6b6e7' into 8.11 2021-06-07 14:26:58 +01:00
Kleis Auke Wolthuizen 4c263a36e9 Don't run sinkscreen thread in threadpool
Since threads on Windows can be terminated prior to the execution
of the atexit registered functions (i.e. vips_shutdown), causing
a surprising deadlock. This thread is never recycled, so it should
be fine.

Reverts commit d1b4d12388 partially.
2021-06-07 14:39:47 +02:00
John Cupitt f39e2e271d don't invalidate in sinkscreen
it was called from a bg thread and could race when under heavy load, eg.
vipsdisp displaying animated jpg images
2021-06-06 16:53:00 +01:00
John Cupitt 3870baef33 free argv0 a little later 2021-06-01 19:02:41 +01:00
John Cupitt 43efbde995
Merge pull request #2276 from okft/master
Clean up more resources in vips_shutdown
2021-06-01 19:00:06 +01:00
GOUJON Évan 3015bb4eeb Clean up more resources in vips_shutdown 2021-06-01 19:32:59 +02:00
John Cupitt eca400e953 don't set g_set_prgname()
this should be set in the app layer, not by libraries
2021-06-01 10:29:54 +01:00
GOUJON Évan 3e9da95b84 Clean up more resources in vips_shutdown 2021-05-31 19:13:57 +02:00
John Cupitt 889ca96648 allow 10,000 frame GIFs
the old limit was 1,000, which was a little low
2021-05-25 14:08:19 +01:00
Kleis Auke Wolthuizen 1562ba695a Ensure compatibility with Cygwin
G_PLATFORM_WIN32 is no longer defined for Cygwin.
2021-05-17 11:54:46 +02:00
John Cupitt f637206e8d move vips_threadpool_push to internal API
and rename as vips__thread_execute()
2021-05-17 08:42:39 +01:00
John Cupitt dac75219b2 fix warning on 32-bit platforms 2021-05-16 17:47:04 +01:00
John Cupitt d577b18e69 oop, dropped a comment 2021-05-11 18:10:54 +01:00
John Cupitt eef3f9568d revise threadpool comments and docs 2021-05-11 10:23:05 +01:00
John Cupitt 7391418d09 revise comment 2021-05-08 20:15:10 +01:00
John Cupitt 6d9308d93c fix a couple of compiler warnings 2021-05-08 19:51:01 +01:00
John Cupitt 98946e5e15
Merge pull request #2235 from kleisauke/reuse-threads
Reuse threads by using the thread pool of GLib (#2038)
2021-05-08 18:52:04 +01:00
akash-akya e39142bab2 Update doc for vips_image_get_string 2021-05-05 18:23:11 +05:30
Kleis Auke Wolthuizen 83575e347a Use gatomicrefcount in sinkscreen 2021-05-03 13:21:45 +02:00
Kleis Auke Wolthuizen 060ab7c7a2 Free the calculated pixel buffer cache early
Since threads can be reused, we need to free the
calculated pixel buffer cache early (i.e. during
vips_thread_shutdown).

This (partially) reverts commit 1a915db.
2021-05-03 13:21:45 +02:00
Kleis Auke Wolthuizen 91a143e5c9 Swap g_private_set with g_private_replace where possible
There's a possibility that the old GDestroyNotify
handler is not called when threads are being reused.
2021-05-03 13:21:45 +02:00
Kleis Auke Wolthuizen d1b4d12388 Move sink_disc and sink_screen threads to threadpool
And deprecate the vips_g_thread_new and vips_g_thread_join
functions.
2021-05-03 13:21:45 +02:00
Kleis Auke Wolthuizen 4144049174 Remove mutex lock for VipsThreadStartFn
vips_{avg,deviate,hough,max,min,stats} are the only arithmetic functions
that do not require a mutex on the _start and/or _stop function. All
other arithmetic functions still needs this, so move it to sink instead.
2021-05-03 13:21:45 +02:00
Kleis Auke Wolthuizen 80e0cc3d12 Reuse threads by using GLib's threadpool 2021-05-03 13:21:45 +02:00
John Cupitt edcdf8af70 rebase add-jp2ktiff on master 2021-04-26 15:16:20 +01:00
Kleis Auke Wolthuizen 5c54d13701 Support `G_MODULE_SUFFIX` as suffix for modules
In addition to the `.plg` suffix, which is still present for
backwards compatibility reasons.
2021-04-22 12:28:37 +02:00
Kleis Auke Wolthuizen a63d37fc9b Initial support for dynamic loadable modules with GModule 2021-04-22 12:28:37 +02:00
Kleis Auke Wolthuizen 2735b71292 Simplify preprocessor directives 2021-04-22 12:04:05 +02:00
John Cupitt f74d6c795d Merge branch 'master' into add-libnsgif 2021-03-07 14:37:14 +00:00
Kleis Auke Wolthuizen 3ed50e0427 Cleanup configure.ac and #ifdef's 2021-03-06 15:47:07 +01:00
John Cupitt 799f720c13 Merge branch 'master' into add-libnsgif 2021-02-27 23:57:14 +00:00
Lovell Fuller 117dbd888a Set minimum glib dependency version of 2.40 (March 2014) 2021-02-24 21:59:21 +00:00
John Cupitt fee6a8a52b fix int overflow in vips_region_copy
this could cause crashes with very wide images, see:

https://github.com/libvips/libvips/issues/1989
2021-02-22 10:02:03 +00:00
John Cupitt 8dc2db9789 add gif background colour as metadata 2021-02-20 04:52:02 +00:00
John Cupitt 1f4f975e7d make leak test exit with an error code
and run the libvips leak test in CI
2021-02-08 11:25:56 +00:00
John Cupitt 8d95f9db2b tiny fixes 2021-02-05 16:56:44 +00:00
John Cupitt a7acdf567c source rewind reenables sniff mode
so you can rewind most sources after reading (though not pipes)
2021-01-21 14:30:46 +00:00
Lovell Fuller 3ad7363104 heifsave: add option to control subsample_mode
Defaults to no subsampling when Q>90 for consistency with jpegsave.

Deprecate VipsForeignJpegSubsample enum, replace with more generic
VipsForeignSubsample.
2021-01-13 10:01:34 +00:00
John Cupitt 1ca20dbddd make vips format detection a little more robust 2021-01-02 19:07:00 +00:00
John Cupitt df3b80fa40 add vipssave_target() 2021-01-02 15:49:32 +00:00
John Cupitt e23f0c58f6 finish up ginputstream source 2020-12-29 16:08:45 +00:00
John Cupitt 0c53d05598 free attr result 2020-12-28 22:03:03 +00:00
John Cupitt f368c0add9 try to get the path for the stream 2020-12-28 18:26:02 +00:00
John Cupitt aa6046d728 remove debug line 2020-12-28 15:20:14 +00:00
John Cupitt 98be88bf80 add sourceginput
This is a source which wraps a GInputStream. You can use this to eg.
efficiently load a PNG file from a GFile object.
2020-12-28 15:14:36 +00:00
John Cupitt eeb0fb3ac1 Merge branch '8.10' 2020-12-22 12:56:32 +00:00
Kleis Auke Wolthuizen e437805fc1 Move descriptor test to vips_source_seek_real
Since subclasses could override the seek method without setting the file descriptor.
2020-12-22 13:34:14 +01:00