Commit Graph

582 Commits

Author SHA1 Message Date
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 cb1927e1b7 make C and vector path for composite match
one was <, one was <= for HARD_LIGHT
no effect on result, but it's better if they are consistent
2022-06-03 16:15:51 +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 55b857d446 revise cast asserts
since we allow casting between formats ofthe same size with shift enabled

fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=45016&q=libvips&can=2
2022-04-03 15:32:25 +01:00
John Cupitt a77a1071a2 fix a crash with empty image arrays in bandjoin
see https://github.com/libvips/pyvips/pull/310
2022-03-24 22:38:03 +00: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
John Cupitt c5f2fea8bf fix a gcc warning with clang pragmas 2022-02-22 10:06:43 +00:00
John Cupitt 82a8df2a1f fix some more small introspection warnings 2022-02-15 10:10:21 +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
John Cupitt 257d84108e fix some more introspection warnings 2022-02-15 09:48:01 +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
John Cupitt edf63dfeeb fix insert
We were not detecting the shortcut cases for insert correctly, thanks
chreru.

See https://github.com/libvips/libvips/issues/2548
2021-11-21 14:50:55 +00:00
John Cupitt 6f081de0a0 add minimise to insert
This patch makes "insert" issue minimise signals for inputs in sequential
mode. This can drop memory use in some programs, for example:

```python

import sys
import random
import pyvips

image = pyvips.Image.black(20000, 20000)

for filename in sys.argv[2:]:
    tile = pyvips.Image.new_from_file(filename, access='sequential')
    x = random.randint(0, image.width - tile.width)
    y = random.randint(0, image.height - tile.height)
    image = image.insert(tile, x, y)

image.write_to_file(sys.argv[1])
```

Before this patch:

```
$ for i in {0..1000}; do cp ~/pics/k2.jpg $i.jpg; done
$ /usr/bin/time -f %M:%e ../manyjoin.py ../x.jpg *.jpg
5456256:4.34
```

With this patch:

```
$ /usr/bin/time -f %M:%e ../manyjoin.py ../x.jpg *.jpg
2475324:3.38
```
2021-11-05 12:14:50 +00:00
John Cupitt 41e92b9ada tiny arrayjoin polish 2021-11-05 10:09:16 +00:00
John Cupitt 778ff7fce5 wider margin for arrayjoin minimise
This patch makes arrayjoin leave a bigger margin off the end of each
input image. This can help some loaders which have large output caches.

See https://github.com/libvips/libvips/issues/2440
2021-11-04 17:17:17 +00:00
Kleis Auke Wolthuizen 1044dd46eb
Move vips__ink_to_vector and im__vector_to_ink to compat (#2488)
It was only used by getpoint in vips8, which is simpler to inline.
2021-10-20 13:00:01 +01:00
John Cupitt 5e7e914b06 hide some setup loops from --vips-progress
see https://github.com/libvips/libvips/issues/2450
2021-10-19 16:19:20 +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
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 f8c2a36746 arrayjoin signalling minimise also frees memory
By making the sequential line cache non-persistent, and only minimising
when the read point is well past the image.

On large arrayjoin operations, this saves many GB of memory.

See https://github.com/kleisauke/net-vips/issues/135
2021-09-06 23:14:36 +01:00
John Cupitt a20cd4cdc1 minimise arrayjoin inputs during processing
arrayjoin with a sequential pipeline will now minimise inputs when they
are no longer being used. This drops the number of open file handles
needed to construct large arrays.

Sadly, memory savings are minimal.

see https://github.com/kleisauke/net-vips/issues/135
2021-09-06 20:22:29 +01:00
John Cupitt 99724e6097 safer stop-early logic in tilecache
Don't actually stop the tilecache loop early, since that could deadlock,
instead just stop fetching from the pipeline.

see https://github.com/libvips/libvips/pull/2424
2021-09-05 12:55:52 +01:00
John Cupitt e7889ff8e1 stop cache tile generation early on error
We didn't stop tile calculation as early as we could on error.

See https://github.com/libvips/libvips/pull/2424
2021-09-05 12:46:11 +01: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 dca526405e revise old comment 2021-05-25 14:06:47 +01:00
John Cupitt 6ab30ca732 Merge branch '8.10' 2021-03-23 23:18:48 +00:00
Kleis Auke Wolthuizen 305714c978 Move max_band_vec to first position 2021-03-23 16:47:53 +01:00
Kleis Auke Wolthuizen e7faebf6af Tell the compiler that v4f is aligned
It's guaranteed that this is now aligned on a 16-byte boundary.
2021-03-20 11:33:37 +01:00
Kleis Auke Wolthuizen 5ef9c84f97 Use cross-platform functions for allocating aligned memory
A malloc library is expected to provide a better implementation.
2021-03-15 11:10:16 +01:00
Kleis Auke Wolthuizen a55513a194 Ensure max_band vector is aligned on a 16-byte boundary
See https://github.com/mstorsjo/llvm-mingw/issues/190
2021-03-12 14:27:19 +01:00
John Cupitt 2e56828053 Merge branch '8.10' 2021-03-06 11:47:02 +00:00
John Cupitt 0623a05f48 remove vips_recip()
it wasn't really necessary, and it was rather slow
2021-03-05 20:19:05 +00:00
John Cupitt 0407c365d1 better again 2021-02-27 20:47:29 +00:00
John Cupitt d3ccadf212 revise unpremultiply, again
We were not detecting division by zero carefully enough, nor clipping
the alpha range sufficiently in unpremultiply.

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

also see https://github.com/libvips/libvips/pull/1675 for another
difficult test case
2021-02-27 15:16:25 +00:00
John Cupitt 3c60e9de60 start tinkering 2021-02-24 14:48:50 +00:00
John Cupitt 25db7849e7 Merge branch '8.10' 2020-12-09 15:19:18 +00:00
John Cupitt 3996f3279b fix range clips for casts to and from int
Fix two bugs:

- clip in casts from int32 and uint32 could overflow -- do these as gint64 now

- clip in casts from float to int could overflow since float32 can't
  represent the full range of int32 without losing precision -- do these
  as double

And add some more tests.

Thanks ewelot.

see https://github.com/libvips/libvips/issues/1922
2020-12-09 15:14:59 +00:00
John Cupitt 630270095d fix compiler warning 2020-11-10 11:00:21 +00:00
John Cupitt b42a542858 only remove main image (ifd0) orientation tag
we were stripping all orientation tags on autorot

see https://github.com/libvips/libvips/issues/1865
2020-10-24 12:42:50 +01:00
John Cupitt caa1cb9d9b improve docs for arrayjoin
see https://github.com/libvips/pyvips/issues/202
2020-08-24 17:42:33 +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 c9af99c2f7 add CMYK as a compositing space
might work!
2020-06-27 12:08:25 +01:00
John Cupitt dbae22ab58 revise unpremultiply
We were clipping alpha very aggressively. With over- and under-shoot
ringing on edges, this could introduce extra fringes.

see https://github.com/libvips/libvips/pull/1675
2020-06-08 18:47:28 +01:00
John Cupitt 981d5c4b16 revise autorot system
- deprecate vips_autorot_get_angle() since orientation is no longer a
simple rotate
- add vips_image_get_orientation() and vips_image_get_orientation_swap()
- revise tiff and jpeg loader autorotate to just call vips_autorot(),
but only if necessary
- revise thumbnail autorotate too
2020-06-06 17:25:46 +01:00
elad laufer b31523b470 Merge branch 'libvipsd-master' 2020-05-12 13:03:31 +03:00
Elad Laufer b05cf39df8
Handle mirroring in autorot (#8)
* handle mirroring in autorot
* added tests for autorot
2020-05-12 13:01:48 +03:00
John Cupitt 2265ad70a3 revise cast again
fixes saturated cast to integer
2020-05-11 11:42:12 +01:00
Kleis Auke Wolthuizen 7fecd79b0a Fix two compiler warnings 2020-05-01 09:46:26 +02:00
John Cupitt 1ef3594be1 autorot was not removing the orientation tag
We were writing the wrong image to the output.

See https://github.com/libvips/ruby-vips/issues/226
2020-04-16 14:04:19 +01:00