Commit Graph

1706 Commits

Author SHA1 Message Date
John Cupitt 675143807a fix vips_worker_work_unit gate name 2023-01-04 16:08:57 +00:00
John Cupitt 43a83fcd18 a little more dbg output 2023-01-04 12:08:05 +00:00
John Cupitt e2c2866fc6 tweak docs, add changelog notes
and an assert for semaphore_down_timeout

see https://github.com/libvips/libvips/pull/3253
2023-01-03 12:09:24 +00:00
Kleis Auke Wolthuizen 848a119faa
threadset: stop idle threads after a regular timeout (#3253)
* Add `vips_semaphore_down_timeout` to public API

In preparation for the next commit.

* threadset: stop idle threads after a regular timeout

In line with the previous behaviour of GLib's threadpool.

* threadset: fix a small memory leak

* threadset: ensure idle threads are freed on exit

GLib threads are spawned with `ref_count == 2`, this reference is
decreased during thread exit and associated resources are freed
during `g_thread_join()`. However, idle threads that are stopped
after a regular timeout are not joined. To fix this, decrease the
reference count during `vips_threadset_add()` and increase it just
before joining the thread with `g_thread_join()`.

See:
2d5d990c6a/glib/gthread.c (L522)
2d5d990c6a/glib/gthread-posix.c (L1287)

* Deprecate `vips_g_thread_join()` in favor of `g_thread_join()`

* nit: remove extra semicolon
2023-01-03 12:00:35 +00:00
John Cupitt 9419b3636f add missing vips_thread_isworker compat func
also bump to 8.14.1

see https://github.com/libvips/libvips/issues/3254

thanks remi
2023-01-02 11:57:05 +00:00
John Cupitt feae09e9cd make arrayjoin much faster with large arrays
arrayjoin was making a region on every input image during startup, and
repeating for each thread (!!) so large arrays could be very expensive
to join.

Instead, make input regions on demand, and computre set of required
input images rather than searching for them.

See https://github.com/libvips/libvips/discussions/3247
2022-12-29 20:50:22 +00:00
John Cupitt 96946001c6 revise comment 2022-12-22 18:10:52 +00:00
John Cupitt a4c1919d69 Merge branch '8.13' 2022-12-16 11:37:18 +00:00
John Cupitt caed71af04 emit "finish" at the end of targetcustom write
In 8.13 we deprecated target_finish() (it did not have an error return)
to target_end() (now has an error return).

This PR makes target_end() also emit the "finish" signal for
compatibility with the previous API. ruby-vips, for example, looks for
on_finish() to close files.

See https://github.com/libvips/ruby-vips/issues/351

Thanks lucaskanashiro
2022-12-16 11:32:16 +00:00
John Cupitt 697311bc9f typo 2022-11-28 10:29:47 +00:00
John Cupitt cbfbeb6e2d don't parse floats with scanf
since scanf uses the current locale, duh

see https://github.com/libvips/libvips/issues/3191
2022-11-28 08:51:13 +00:00
Kleis Auke Wolthuizen 4611651d90
nsgifload: avoid minimise after mapping (#3189)
* nsgifload: avoid minimise after mapping

Not reliable on Windows.

* nsgifload: prefer use of `VIPS_FREEF` macro

* Improve `test_descriptors.c`

* Only build `test_descriptors` when targeting Linux
2022-11-27 15:43:35 +00:00
John Cupitt e24cee4e22
WIP -- add simple bash completion support (#3131)
* add simple bash completion support

* add "completions" subdir to meson

* start extending completion to extra args

* file complete for every arg after 1

* add completion for enums, file, ints, doubles

* docs, try to improve directory completion

though dir completion is not working correctly, I'm not sure why
2022-11-13 18:57:14 +00:00
John Cupitt 976db37f84
Revised threading system (#3105)
* reimplement threadpool

just a set of threads that get recycled

"ninja test" passes and dzsave seems to work, though pytest fails for
some reason

* clean up threading code a bit

move base stuff into thread.c, so we have a simple

	thread -> threadset -> threadpool

layering

* start trying to revert g_threadpool

based on the original commit

* working!

nice low systime again

still need to repply cnages to threadpool.c since 80e0cc3d1

* reapply fixes from master

so threadpool.c is now up to date

* rename VipsThread as VipsWorker

a bit less confusing

* use a semaphore to count workers in a pool

* tidy up

* formatting

* dynamic threadpool sizing

based on counting the number of blocked threads in each pool

it works, but the improvement is not great :(

* add "concurrency" metadata item

so operators can hint threadpool size (dzsave especially)

* don't use thinstrip for small images

* add RGB mode to openslide

since flatten was taking 20% of CPU time for dzsave

* fix up rgb mode

now actually works

* make the tile buffer per thread

in the new openslideload rgb mode

* fix dynamic pool downsize

* mild refactoring

* fix the buffer system

oops, turned it off by mistake

* all done!

* revise changelog

* Update libvips/iofuncs/threadset.c

Co-authored-by: Kleis Auke Wolthuizen <github@kleisauke.nl>

* Update libvips/iofuncs/threadset.c

Co-authored-by: Kleis Auke Wolthuizen <github@kleisauke.nl>

* LSan: add libMagickCore to suppression file

* Revert "Remove mutex lock for VipsThreadStartFn"

This reverts commit 41440491.

* add VIPS_MAX_THREADS

to set a hard limit on the threadset size

* Revert "Revert "Remove mutex lock for VipsThreadStartFn""

This reverts commit 77e8520966ba79194fff3b4e648bbd295cd5c260.

* remove sslock from sink.c

* move fixed threadpool build to init

not first use

* add some doc comments

* revert test suite threshold change

* add a test for MAX_THREADS

and move the test tmp/ area into the builddir

* limit VIPS_MAX_THREADS to sane values

* use tabs rather than spaces

Co-authored-by: Kleis Auke Wolthuizen <github@kleisauke.nl>
2022-10-26 15:25:19 +01:00
Corentin Noël 5fcca56fe8
Introspection improvements (#3079)
* vala: Enhance the metadata to contain more symbols

* Enhance the introspection coverage

Always set data with destroy function as transfer full.
2022-10-06 17:28:33 +01:00
Kleis Auke Wolthuizen db96adfc00
Ensure `--vips-config` only prints build configuration (#3062)
Also, remove a remnant of Autotools.
2022-09-24 11:26:30 +01:00
Kleis Auke Wolthuizen 6d43755bfa
convi/reducev: initialize the sum with the addition (#3052)
* reducev: initialize the sum with the addition

Avoids an Orc opcode.

* convi: initialize the sum with the addition

Avoids an Orc opcode.

* vector: add comments to magic numbers
2022-09-17 14:18:15 +01:00
John Cupitt 0b3ab3a934 fix null string in buffer print
Some libvips header fields can be NULL, for example filename, and we
need to avoid null pointer deref on print.

See https://github.com/libvips/libvips/issues/3043
2022-09-11 14:29:12 +01:00
John Cupitt e37487ca2f fix null string in buffer print
Some libvips header fields can be NULL, for example filename, and we
need to avoid null pointer deref on print.

See https://github.com/libvips/libvips/issues/3043
2022-09-11 14:26:53 +01:00
John Cupitt 702ed8298f check for blocked operations on cache lookup
We could return an operation from cache even after the operatuion had
been blocked. This was harmless, but could cause confusion.

see https://github.com/kleisauke/wasm-vips/pull/24
2022-09-04 16:35:00 +01:00
John Cupitt 34c17fc3e8 don't minimise after sink_screen expose
We were minimising at the end of threadpool_run, but this was being
called for each sinkscreen render pass, so we were throwing away the
display cache.

Instead, minimise after sink, sink_memory and sink_disc.
2022-08-05 09:12:13 +01:00
Kleis Auke Wolthuizen 4d5622c217
Simplify `VIPS_CONFIG` definition (#2964) 2022-07-30 19:23:09 +01:00
Kleis Auke Wolthuizen 057703938e
Remove remnant of Autotools (#2950)
* Remove `glib-mkenums` autotools templates and generated files

Meson uses the `enumtypes.c.in` and `enumtypes.h.in` in
`libvips/include/vips` and doesn't use the pre-generated
files.

* Remove man files for no longer existing tools

+ update the `meson.build`.

* Remove Autotools section in `.gitignore`

* Remove `po/messages` left-over

* Remove `g-ir-scanner` entry point

No longer needed by Meson.

* Remove `glib-genmarshal` generated files

Meson doesn't use these pre-generated files.

* Remove Autotools specific Git attributes

* Remove no longer existing tools in `.gitignore`

* Remove Make specific things in `.gitignore`

* Rename COPYING to LICENSE

* Remove no longer needed `.gitignore` sections

Meson only supports out-of-tree builds. This assumes that the
build directory is ignored.

* Remove no longer needed `.editorconfig` sections
2022-07-27 10:56:56 +01:00
John Cupitt 95970d0f40 ignore TAGS 2022-07-27 09:11:01 +01:00
John Cupitt d3021c2775 Merge branch '8.13' 2022-07-27 09:09:12 +01:00
John Cupitt 538aa2a841
remove autotools (#2941)
* remove autotools

It seems to all work. I tested with gtk-doc enabled. I probably missed a
few things argh.

* oop, forgot m4/
2022-07-24 11:14:52 +01:00
Kleis Auke Wolthuizen a498680094
Update `glib-mkenums` templates (#2939)
* Avoid writing the full path in enumtypes.h

Helps reproducible builds, as build paths can vary between builds.

* Use g_intern_static_string() for enum/flags type names

We are emitting a static string, so use that shortcut function to
intern it, which will save one allocation.

* Use g_once_init_enter/leave to register enum/flags type names

This is the more modern way, and ensures thread-safety.
2022-07-22 15:33:40 +01:00
Kleis Auke Wolthuizen d546c81fa3
Fix `dzsave_target` for ZIP output (#2927) 2022-07-15 19:39:56 +01:00
John Cupitt 8a049e9dfc fix RGBA_ONLY with generic mono
1. Convert MULTIBAND uint/short/etc. as we convert uint8 images. They
   are probably just uint8 that have been cast up in format.

2. Don't check that the image interpretation is a supported colourspace
   before calling vips_colourspace() ... we want to fail with an error
   if it can't be converted, not silently accept the image.
2022-07-10 19:32:14 +01:00
John Cupitt d9f31be67d configure should add meson files to make dist
add meson.build etc. to EXTRA_DIST

see https://github.com/libvips/libvips/issues/2876
2022-06-20 15:04:33 +01:00
Kleis Auke Wolthuizen 7553f60aed
Minor cleanups (#2857)
- Remove `HAVE_LCMS` definition in favor of `HAVE_LCMS2`.
- Remove `HAVE_WINDOWS_H` definition in favor of `G_OS_WIN32`.
- Remove stray `vips_text_get_type` in `conversion.c`.
- Remove duplicated `unistd.h` include.
- Remove redundant `strcasecmp` definition, we use `g_ascii_strcasecmp` everywhere.
- Remove unnecessary header checks in `configure.ac` and `meson.build`.
- Ensure `unistd.h` include is guarded with `HAVE_UNISTD_H`.
- Fail early when `-Dfontconfig=enabled` and `pangoft2` is not found.
2022-06-12 12:22:36 +01:00
Kleis Auke Wolthuizen 1214f942f9
Prefer to use `flags |=` everywhere (#2854)
Use the bitwise OR assignment operator to ensure that derived
classes does not overwrite the flags from the base class. Also,
move the flags from `openslideload_source` to its base class.
2022-06-11 15:40:39 +01:00
John Cupitt c7baa4535a cleaner blocking code
thanks kleis!
2022-06-11 15:37:27 +01:00
John Cupitt 399fba2124 fix error in prev commit 2022-06-11 14:03:45 +01:00
John Cupitt 8bf90ed44e fix BLOCK_UNTRUSTED after previous commit 2022-06-11 12:38:43 +01:00
John Cupitt bd65ddda66 fix operation_block_set
kleis discovered that it needs a full class name, and found a missing
"*"
2022-06-11 11:41:03 +01:00
Kleis Auke Wolthuizen bae0342d95
Update C++ binding and function list (#2851)
* Update C++ binding and function list

Also, start with a capital letter in descriptions whenever possible.

* Ensure `dzsave_target` is generated
2022-06-10 14:43:44 +01:00
John Cupitt 2d0c6b364c improve scaling of SVG images
We were not scaling images with fixed absolute dimensions.
2022-06-06 12:08:43 +01:00
John Cupitt 111eef0049 lock progress to 100% on posteval
Because signals can be delayed, progress isn't always 100% in posteval.
Lock it to 100%.

See https://github.com/libvips/libvips/issues/2820
2022-05-23 19:27:40 +01:00
John Cupitt 111f1d11df improve the interpretation sanity checker
it was rejecting int LABS
2022-05-22 14:05:01 +01:00
John Cupitt fd495bcd0a fix typo in tatrgetcustom.c
see https://github.com/libvips/libvips/pull/2802#pullrequestreview-980832505
2022-05-21 17:30:55 +01:00
John Cupitt f8003bda67
Add tiffsave target (#2798)
* compiles, but untested

* works, but libtiff needs seek for write

next: add seek methods to target

* add target seek and read

seem to work

next: disc temps for disc output

* add libnsgif COPYING

oops, we were missing the COPYING file

see https://github.com/libvips/libvips/issues/2800

thanks mika-fischer

* tiffsave uses a disc temp if it can

* revise temp target rules

only make a disc temp if we are writing to a filesystem target

* add new target methods to targetcustom
2022-05-20 18:38:17 +01:00
John Cupitt 58b53506ff
add vips_target_end (#2802)
since finish did not return an error code

also make sure we don't call target_end from inside _dispose, since that
can't signal error either

see https://github.com/libvips/libvips/issues/2801
2022-05-20 16:38:04 +01:00
John Cupitt 5221df224f fix ssize_t / ssize_t confusion 2022-05-11 22:28:34 +01:00
John Cupitt 43db3985d0 try to always set the min stack size
since musl users often don't know about this

see https://github.com/libvips/libvips/issues/2761
2022-04-19 16:41:18 +01:00
John Cupitt 94d8a7d993 tried (and failed) to build against ubuntu nifti
the ubuntu cmake dev files for nifti seem to be broken, and I can't get meson
to add the dependency manually
2022-04-18 15:13:55 +01:00
Kleis Auke Wolthuizen 07edfe37b1
Improve symbol visibility (#2688)
* Improve symbol visibility

* Decorate required internal symbols with VIPS_API

* Remove a couple of stray header decls

* Incorporate review comment

- Ensure symbol visibility is also set on static libraries.
- Prefer to use `cc.has_function_attribute('visibility:hidden')`.

* Don't export internal deprecated symbols

* Move deprecated symbols to vips7compat.h

* `IM_FORMAT_H` -> `VIPS_FORMAT_H`

* Move `vips_window_ref` compat stub to `vips7compat.c`

* Disable deprecation warnings internally

* `vips_image_get_kill` -> `vips_image_iskilled`

* Ensure API compatibility

* Add missing include directives

* Move `vips__init` decl to vips7compat

* Move `vips__get_sizeof_vipsobject` to vips7compat

* Fix introspection build

* Fix 2 introspection warnings

* Ensure compatibility with vipsdisp

/usr/bin/ld: tilesource.o: in function `tile_source_new_from_source':
vipsdisp/tilesource.c:1627: undefined reference to `vips__region_no_ownership'
2022-04-16 10:58:55 +01:00
John Cupitt eba9ec0dd7
Add a way to disable less well tested operations (#2636)
* quick proposal

warn on startup if untrusted operations might run

use vips_block_untrusted_set() to block untrusted operations, set an env
var or make a file to stop the warning

* mark fits, nifti and svg as untrusted

* remove the annoying "untrusted" warning message

better to warn on the download page

leave vips_block_untrusted_set() since it's obviously useful

* separate UNTRUSTED and BLOCKED

* typos

* add VIPS_BLOCK_UNTRUSTED env var

* move BLOCK_UNTRUSTED after plugin load

obviously, ooops

* add a test, disable *magick

although *magick is fuzzed, it's probably safer to disable it in
untrusted environments

* mark some more operations as untrusted
2022-04-11 11:32:32 +01:00
John Cupitt 57cd94278a revise interpretation guesser
This patch pushes the new pyvips interpretation guess rules down into
libvips.

See https://github.com/libvips/pyvips/pull/316
2022-04-05 18:32:25 +01:00
Lovell Fuller 9228e50f46
vipsload: ensure resolution is positive (#2742) 2022-04-03 11:00:44 +01:00