Commit Graph

340 Commits

Author SHA1 Message Date
sergiotarxz 7532223d3a Adding debug line. 2023-01-21 16:42:26 +01:00
John Cupitt 3d29daf553 block use of RGB profiles with CMYK images
Detect and block a common error.

See https://github.com/libvips/libvips/issues/3139
2022-11-03 14:18:38 +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
John Cupitt 1297f2c6d7
add suport for N colour ICC profiles (#3046)
* seems to export to cmyk+2 correctly

We'll need something fancier for import.

* more hacking

* Revert "more hacking"

This reverts commit fcdad5b491fc4d5a1750388947e42d1e98b1d9d7.

* generalise to many colour export

Should work up to 12 colour profiles (all that lcms supports).

* support import with N-colour profiles
2022-10-19 09:19:18 +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
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
Lovell Fuller c1f6995256
Pass close-on-exec flag to lcms for non-Windows OS (#2816)
This ensures child processes do not inherit open file descriptors
and will close a small but long-standing bug reported against
sharp over five years ago.

The change to lcms2 to support this is backwards compatible so
the flag will be ignored by existing versions.

The fopen 'e' flag will soon be part of the POSIX standard, and
is already supported in Linux and BSD. macOS currently ignores
it but will add support soon. Only Windows has a problem with it,
hence the ifdef wrapper.
2022-05-21 17:28:40 +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 d58b3410c4 tiny perf improvement 2022-03-28 12:35:25 +01:00
Kleis Auke Wolthuizen 0337c09700
Cleanup gettext handling (#2695)
Use GLib's i18n support instead of copying and pasting that
logic into its own header. This deprecates the vips/intl.h
header in favour of glib/gi18n.h.
2022-02-27 15:27:28 +00:00
Kleis Auke Wolthuizen 50a74ceeec
Mark some functions and variables as static (#2691)
These are only used in the same file, and not exported.
2022-02-27 13:41:39 +00:00
Corentin Noël 69bf2be12b
Enhance the introspection support by fixing annotations (#2657)
Also refine the .metadata file
2022-02-15 10:54:40 +00:00
John Cupitt 362adae8c6
Revert "Enhance the introspection support by fixing annotations (#2655)" (#2656)
This reverts commit 47796dcda0.
2022-02-15 10:08:07 +00:00
Corentin Noël 47796dcda0
Enhance the introspection support by fixing annotations (#2655)
* Ensure that double asterisk characters are only used for gtk-doc comments

This triggers warnings when parsing the files with the introspection scanner
and gtk-doc

* Enhance the introspection support by fixing annotations

Also refine the .metadata file

Co-authored-by: John Cupitt <jcupitt@gmail.com>
2022-02-15 09:54:32 +00:00
Corentin Noël 02901436d4
Add meson build system (#2637)
Allows to use the Meson build system to build the project.
2022-02-08 15:19:36 +00:00
Kleis Auke Wolthuizen 5ab66e16e1
Fix UBSan errors (#1948)
* Ensure UBSan exits with a non-zero code on error

* Avoid misaligned member access in mosaic_fuzzer

* Add missing VIPS_CLIP in scRGB2sRGB/scRGB2BW

* Fix UBSan error in flatten

By using saturated casts for the int types (copied from vips_cast).

* CI: ensure fuzzer log is printed on error

* Avoid UB in heifload

* Revert flatten change

I could no longer reproduce this with clang 12 locally.

* Indentation fixes [skip ci]
2021-09-12 13:14:24 +01:00
John Cupitt 9d186c9cd4 Merge branch '8.11' 2021-08-14 18:17:11 +01:00
Kleis Auke Wolthuizen 1611afee7e
Fix a few -Wstrict-aliasing=1 warnings (#2380) 2021-08-07 18:11:36 +01:00
John Cupitt 5fff62576e more dbg output 2021-06-30 17:22:35 +01:00
John Cupitt 7e5312f626 more dbg code 2021-06-30 14:30:02 +01:00
John Cupitt 6a0e5c26db Merge branch 'master' into improve-detection-of-bad-profiles 2021-04-24 18:29:22 +01:00
John Cupitt 4abcbc7a2e try to improve the error message 2021-04-24 18:23:27 +01:00
John Cupitt a046f26095 better falling back on profile load
This patch makes the icc operations fall back to the built-in profiles more
gracefully.
2021-04-24 17:44:25 +01:00
John Cupitt 693bc3ccbf
Merge branch 'master' into add-black-point-compensation 2021-04-19 18:53:35 +01:00
John Cupitt db22eb4d4f add p3.icm to makefile.am
and fix make dist
2021-04-08 10:53:15 +01:00
Lovell Fuller d56a47829b colour: add a fallback for the increasingly-common P3 profile
Uses the CC0-licensed 'magic' compatibility profile from
https://github.com/saucecontrol/Compact-ICC-Profiles#display-p3
2021-04-07 21:44:33 +01:00
John Cupitt 005360dba7 add support for lcms black point compensation
Add a --black-point-compensation flag.

See https://github.com/libvips/libvips/discussions/2169
2021-03-29 12:41:02 +01:00
John Cupitt 8cddba44ab Merge branch 'master' into improve-detection-of-bad-profiles 2021-03-06 11:47:53 +00:00
John Cupitt b995a6d244 move the nsgif source into the tree
and remove the old giflib loader
2021-02-28 12:20:05 +00:00
Lovell Fuller 40c4b93ee5 Compress fallback profiles with zlib
Reduces binary size by 580KB, ~17% at -O2
2021-02-26 19:18:49 +00:00
John Cupitt 03dac2a2df detect bad profiles during profile load
and add some extra dbg to print profile properties

see https://github.com/libvips/libvips/issues/1956
2021-01-08 14:19:32 +00:00
Kleis Auke Wolthuizen 7cda6e5957 Switch VIPS_FCLIP to VIPS_CLIP in vips_scRGB2{BW,sRGB} 2020-12-29 13:02:08 +01:00
John Cupitt d203a3fb89 small comment improvements 2020-07-21 18:03:45 +01:00
John Cupitt c4d093b01f
Merge pull request #1735 from lovell/perf-scrgb-to-rgb
Performance: improve scRGB to sRGB conversion by ~8%
2020-07-21 17:58:12 +01:00
Lovell Fuller e508ea6511 Performance: improve scRGB to sRGB conversion by ~8%
- Remove unnecessary isinf checks as values are clipped
- Remove any ignored out-of-gamut tracking
2020-07-21 14:36:57 +01:00
Lovell Fuller 3659655750 Performance: improve XYZ to LAB conversion by ~15%
- VIPS_CLIP is faster than fmin/fmax based library calls
- Cast to int to ensure the cubed root LUT is not referenced by NaN
2020-07-21 14:21:27 +01:00
John Cupitt e82b1689c7
Revert "Performance: improve XYZ to LAB conversion by ~15%" 2020-07-21 11:00:35 +01:00
John Cupitt ef6ad7f4bb
Merge pull request #1729 from lovell/perf-lab-clip
Performance: improve XYZ to LAB conversion by ~15%
2020-07-20 13:36:03 +01:00
Lovell Fuller 4aaa39502b Improve performance of conversion to LAB by ~15% 2020-07-19 21:20:21 +01:00
Lovell Fuller a7357c5757 Perf: improve conversion to LCH by ~30%, avoid costly atan2 2020-07-19 15:29:03 +01:00
Kleis Auke Wolthuizen 9246094033 Fix function pointer cast issues
It is undefined behavior in C and C++ to cast a function pointer
to another type and call it that way. This does work in most native
platforms, however, despite it being UB, but in WASM it can fail.

See:
https://emscripten.org/docs/porting/guidelines/function_pointer_issues.html
2020-06-30 13:35:41 +02:00
John Cupitt 72b73e069e Merge branch 'master' of github.com:libvips/libvips 2020-06-13 10:29:58 +01:00
John Cupitt e9b1f538db
Revert "Add BT.709 ICC profile and use for HEIF "nclx"" 2020-06-13 04:10:13 +01:00
John Cupitt 99f495a5ed Merge branch 'master' of github.com:libvips/libvips 2020-06-13 03:55:31 +01:00
John Cupitt dfb714e8fe minor reformat 2020-06-13 03:51:40 +01:00
Lovell Fuller fc20a7a654 Add bt709 ICC profile, use for heif 'nclx' 2020-06-12 20:20:25 +01:00
John Cupitt e48f45187b make RGB and sRGB synonmous
We had a half-baked idea that RGB could mean generic RGB space and sRGB
would mean strict sRGB interpretation.

Unfortunately, this did not work well in practice. For example,
`icc_transform("srgb")` would tag the result as RGB rather than sRGB
(the converter didn't know it was writing sRGB pixels, it just saw
conversion to RGB with an ICC profile), and then later stages would do
unnecessary icc_imports, or worse, fail.

This patch makes RGB and sRGB strict synonyms. If you want to treat an
RGB image as something other than sRGB, you'll need to do it by hand
with the icc_ functions.

See

https://github.com/libvips/pyvips/issues/144

46212e92b1 (r34904985)

https://github.com/libvips/libvips/issues/1494
2019-12-22 11:40:09 +00:00
John Cupitt ceb2db513d Merge branch '8.8' 2019-11-11 18:05:57 +00:00
John Cupitt d4bd8c4c0b fix make dist for 8.8.3 2019-09-16 16:59:52 +01:00