Commit Graph

1706 Commits

Author SHA1 Message Date
John Cupitt 801111a2fa better dint rules
We had some special cases coded for dhint inheritance, but they could
fail in some edge cases. Revert to something simpler and more
predictable.

see https://github.com/libvips/libvips/issues/1810
2020-09-08 13:50:14 +01:00
John Cupitt 99423649b9 start sinkscreen thread on first use
we were starting the sinkscreen background thread during vips_init() --
instead, start it on first use

see https://github.com/libvips/libvips/issues/1792
2020-08-28 17:46:23 +01:00
Kyle Schwarz b372fde637 Add parameter name for unused image 2020-08-02 11:04:10 -04:00
Kyle Schwarz 292dc9da4b Remove redundant part of comment 2020-08-02 10:20:44 -04:00
Kyle Schwarz 81920963b1 Remove cast in free() call 2020-08-02 10:19:47 -04:00
Kyle Schwarz fe815ff587 Add C++ bindings for new_from_memory_steal()
new_from_memory_steal() will create a new image with the input
buffer and will "move" the data into the image. The buffer is then
managed by the image, and will be freed when it goes out of scope.
2020-08-01 21:58:14 -04:00
John Cupitt 58b6d73a70 deprecate vips_popen()
it didn't work well on win, and we no longer use it anyway
2020-07-27 15:21:59 +01:00
John Cupitt e44b781971 revise gifnsload.c for source API 2020-07-07 15:50:44 +01:00
Kleis Auke Wolthuizen b84e87b6d2 Improve --vips-config output 2020-07-07 13:57:25 +02:00
Kleis Auke Wolthuizen e91997052b Out-of-source support for autogen.sh 2020-07-07 12:16:43 +02:00
Kleis Auke Wolthuizen fb61f0fa44 Define ENABLE_DEPRECATED in config.h
Do not check for VIPS_ENABLE_DEPRECATED as it could
come from an earlier version of libvips.
2020-07-07 12:16:43 +02:00
John Cupitt 5117c1a980 remove mode_t from headers
it seems to fail with MSVC.

int works fine, and is what g_open() uses.
2020-07-04 18:28:44 +01:00
John Cupitt d6c4d23d6c Merge branch 'master' into add-libnsgif 2020-07-03 02:24:09 +01:00
John Cupitt e728e5638d
Merge pull request #1697 from kleisauke/wasm-function-pointers
Support for use in WASM environments (#192)
2020-07-03 02:09:39 +01:00
John Cupitt 207d40f640 better leak test output 2020-07-02 14:15:58 +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 345fee4917 Merge branch 'master' into add-libnsgif 2020-06-29 23:07:13 +01:00
John Cupitt e3a500204a
Merge pull request #1593 from kleisauke/disable-deprecated
Fix for --disable-deprecated (#1273)
2020-06-28 11:07:56 +01:00
John Cupitt aba15122d5 reduce default cache size
Now 100 operations by default.
2020-06-28 09:52:58 +01:00
Kleis Auke Wolthuizen 8abcae3abc Avoid using vips7 symbols 2020-06-18 14:21:43 +02:00
Kleis Auke Wolthuizen 230d2acfea Disable IM_* environment variables when --disable-deprecated 2020-06-18 14:15:37 +02:00
John Cupitt 8c19e07ae3 add --vips-config flag
so "vips --vips-config" now displays:

```
$ vips --vips-config
native win32: no, native OS X: no, open files in binary mode: no, ...
```
2020-06-12 17:30:57 +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
John Cupitt cff84f4606 add subifd pyr support to thumbnail
thumbnail can spot subifd pyramids and load lower levels if necessary
2020-06-02 12:53:36 +01:00
John Cupitt 383be359e8
Merge pull request #1626 from kleisauke/remove-varargs-open
Remove use of varargs in vips_*_open
2020-04-30 14:02:37 +01:00
Kleis Auke Wolthuizen cdf0269871 Ensure vips__temp_name creates unique filenames
There was a possible chance that vips__temp_name could generate the
same filename twice if it is called concurrently.

This commit ensures that the serial increment is an atomic operation,
similar to #1211.
2020-04-27 15:27:33 +02:00
Kleis Auke Wolthuizen 6fc2015783 Remove use of varargs in vips_*_open
This matches the declaration of g_open and helps tools (such as ASan) when
running on non-native platforms.
2020-04-27 11:56:32 +02:00
John Cupitt 9ea91810bb revise docs for _inplace
We call vips_image_inplace() automatically now, so there's no need for
clients to use this.

see https://github.com/libvips/libvips/issues/1610
2020-04-16 12:09:07 +01:00
John Cupitt 168db157bf more dbg output 2020-04-15 17:21:41 +01:00
John Cupitt 8ba31844d6 fix a race in startup
We were creating a background thread before creating the semaphore that held
the thread. This could sometimes segv under a debugger.
2020-04-15 16:53:58 +01:00
John Cupitt 8840bc8a14 better render init stops a race
when running inside some versions of gdb
2020-04-02 14:23:06 +01:00
Lovell Fuller 3ca21ee2e8 Increase minimum glib-2.0 dependency to v2.15 (released March 2012) 2020-03-26 19:13:21 +00:00
John Cupitt e9c47200dc
Merge pull request #1591 from kleisauke/get-language-names
Only call g_get_language_names when GLib < 2.48.1
2020-03-24 17:05:49 +00:00
Kleis Auke Wolthuizen ceacd0bab9 s/count/af_count/
Thanks lovell!
2020-03-24 12:55:07 +01:00
Kleis Auke Wolthuizen 4911928412 Only call g_get_language_names when GLib < 2.48.1
The thread-safety problem was fixed in GLib 2.48.1.

See: https://bugzilla.gnome.org/show_bug.cgi?id=748474
2020-03-24 11:14:47 +01:00
Kleis Auke Wolthuizen af21838fab Use g_get_num_processors() when GLib >= 2.48.1
Also backport the patch from https://bugzilla.gnome.org/show_bug.cgi?id=748530
2020-03-24 11:11:46 +01:00
John Cupitt 834234c23c add `all` smartcrop mode
So you can crop to fill as well as crop to fit.

see https://github.com/libvips/libvips/issues/1583
2020-03-19 18:57:40 +00:00
John Cupitt d4f12a9999 move VipsGInputStream to public API
Since we will need it for pdfload as well.
2020-03-11 17:17:45 +00:00
John Cupitt a592d99bb2 add dir detector
useful for blocking open for read of directories
2020-03-06 18:05:16 +00:00
John Cupitt d13c0a69fd Merge branch 'master' of github.com:libvips/libvips 2020-03-06 13:05:38 +00:00
John Cupitt 6117310c18 improve file open error handling
better behaviour if you try to open a directory as an image
2020-03-05 15:30:37 +00:00
John Cupitt 68f766b482 Merge branch '8.9' 2020-03-05 15:03:00 +00:00
John Cupitt b3a7929247 detect read errors in sniff correctly
we has a signed/unsigned mixup :(
2020-03-05 15:02:16 +00:00
John Cupitt 9ef8b55218 better handling of short files in vips7 compat
the sniffer could read beyond the end of the file sometimes
2020-03-04 17:38:41 +00:00
John Cupitt ce240b1ca2 revise matrixload for source API 2020-02-22 15:02:12 +00:00
John Cupitt d68e02a3c4 Merge branch 'revise-csvload' 2020-02-21 18:23:13 +00:00
John Cupitt 71c15958ed new csvload seems to work 2020-02-21 16:04:29 +00:00
John Cupitt 0a23bf3578 revise formatting, add docs
fix up some formatting from https://github.com/libvips/libvips/pull/1552

plus some other small changes
2020-02-18 17:37:56 +00:00
elad laufer d2b794ec35 - use a single enum and switch that replaces no_subsample, force_subsample 2020-02-17 11:29:57 +02:00
alon-ne f88dab9ccd
Fix gif dispose handling for DISPOSE_BACKGROUND and DISPOSE_PREVIOUS
- Add 'scratch' field to gif that holds temporary 'scratch buffer' used for rendering frames
- For DISPOSE_BACKGROUND: Set background color to transparent instead of 0
- For DISPOSE_BACKGROUND: Write background pixels into scratch after rendering current frame, so it will be used in next frame
- For DISPOSE_PREVIOUS: Save frames that are not disposed into 'previous' field in gif, when DISPOSE_PREVIOUS is specified start with that previous frame. see http://webreference.com/content/studio/disposal.html
- Add "ANIMEXTS1.0" to Application Extension parser
- Graphic Control Extension parser refactor
- Compare file contents to expected images for animated gifs in foreign tests
2020-02-06 17:36:13 +02:00
John Cupitt f866799474 move pipe read limit to gint64
We had a mix of size_t and gint64. Just use gint64 everywhere.
2020-02-05 14:42:03 +00:00
John Cupitt 862e1ae214 add VIPS_LEAK env var 2020-02-03 17:01:57 +00:00
John Cupitt cf5cad2b3e make pipe read limit configurable
We had a 1gb limit on the amount of data we would read from a pipe
before giving up.

This patch adds vips_pipe_read_limit_set() and makes this limit
configurable.

See: https://github.com/libvips/libvips/issues/1540
2020-02-03 16:57:10 +00:00
John Cupitt 46da95f30f Merge branch '8.9' 2020-01-31 16:00:22 +00:00
John Cupitt e4db74746a fix a deadlock with --vips-leak
We were usingh a global lock for metadata changes, but some functions
triggered from callbacks in the metadata hash table could also attempt
to acquire the same mutex, leading to deadlock.

This patch gives metadata change it's own lock. Thanks DarthSim.

See https://github.com/libvips/libvips/issues/1542
2020-01-31 15:25:05 +00:00
John Cupitt 4aeedd9711 add "nearest" region shrink 2020-01-30 16:53:18 +00:00
John Cupitt 165a3a3855 Merge branch '8.9' 2020-01-28 13:36:46 +00:00
John Cupitt f8c7f9dac9 interpret \ as an escape char in break_token
So:

	vips_break_token( "hello\ world", " " )

Sees a single token, `"hello world"`.

This means you can now do things like:

	$ vips arrayjoin "k\ 2.jpg" x.png

Where "k 2.jpg" is a filename containing a space.

See https://github.com/libvips/libvips/issues/1493
2020-01-26 13:59:04 +00:00
John Cupitt c14d7c254b add max and min to region_shrink
Add max and min to region_shrink. Useful with tiffsave and dzsave when
the image is (for example) line art. Thanks rgluskin.

See: https://github.com/libvips/libvips/issues/1490
2020-01-24 17:55:11 +00:00
John Cupitt fda5e5c402 lock for metadata changes
Another attempt at fixing crashes on metadata chenage in highly threaded
applications.

Global lock around set, remove and copy metadata. This is crude, but
simple, the performance impact should be small, and ought to resolve the
problem.

We'll do something better for the next version.

see https://github.com/lovell/sharp/issues/1986
2020-01-21 08:29:59 +00:00
John Cupitt 3862b636e4 remove some dbg code
accidentally left in, thanks Kleis
2020-01-10 05:03:48 +00:00
John Cupitt 51fc2ff64e don't use new source API for new_from_file etc.
We were attempting to load images in new_from_file using the new source
API first, then only falling back to the file loaders if that failed.

However, this meant that we did not respect the priority ordering on
loaders, so openslide iamges (for example) were being loaded by the tiff
loader.
2020-01-09 14:47:14 +00:00
John Cupitt b2334d8d62 Merge branch 'rename-stream' 2020-01-01 12:06:22 +00:00
Denis Fondras 837ca2e044
Fix crash on backward memcpy()
In some environment, building fails because of backward memcpy().
2019-12-30 18:29:36 +01:00
John Cupitt 3847f71c54 rename bufis as well 2019-12-30 16:57:19 +00:00
John Cupitt 96cdc5ef01 revise docs for source / target 2019-12-30 16:28:39 +00:00
John Cupitt 63d54e5df2 final code cleanups after stream -> source rename 2019-12-30 14:23:51 +00:00
John Cupitt 119dd2cb72 pytest passes again after stream -> source/target 2019-12-29 23:08:33 +00:00
John Cupitt 4c5873809f experiment with renaming stream
rename as VipsConnection, VipsSource, VipsTarget etc.

see https://github.com/libvips/libvips/issues/1494#issuecomment-569498619

renamed with this script:

```

set -e

edit() {
        sed -i -E "$1" rename
}

for i in $*; do
        cp $i rename

        edit s/VIPS_STREAMOU/VIPS_TARGET_CUSTOM/g
        edit s/VIPS_STREAMO/VIPS_TARGET/g
        edit s/VIPS_STREAMIU/VIPS_SOURCE_CUSTOM/g
        edit s/VIPS_STREAMI/VIPS_SOURCE/g
        edit s/VIPS_STREAM/VIPS_CONNECTION/g

        edit s/vips_streamou/vips_target_custom/g
        edit s/vips_streamo/vips_target/g
        edit s/vips_streamiu/vips_source_custom/g
        edit s/vips_streami/vips_source/g
        edit s/vips_stream/vips_connection/g

        edit s/VipsStreamou/VipsTargetCustom/g
        edit s/VipsStreamo/VipsTarget/g
        edit s/VipsStreamiu/VipsSourceCustom/g
        edit s/VipsStreami/VipsSource/g
        edit s/VipsStream/VipsConnection/g

        # eg. VIPS_TYPE_STREAM or VIPS_IS_STREAM
        edit "s/VIPS_([A-Z]+)_STREAMOU/VIPS_\1_TARGET_CUSTOM/g"
        edit "s/VIPS_([A-Z]+)_STREAMO/VIPS_\1_TARGET/g"
        edit "s/VIPS_([A-Z]+)_STREAMIU/VIPS_\1_SOURCE_CUSTOM/g"
        edit "s/VIPS_([A-Z]+)_STREAMI/VIPS_\1_SOURCE/g"
        edit "s/VIPS_([A-Z]+)_STREAM/VIPS_\1_CONNECTION/g"

        edit s/streamou/target_custom/g
        edit s/streamo/target/g
        edit s/streamiu/source_custom/g
        edit s/streami/source/g

        # various identifiers which also change
        edit s/is_a_stream/is_a_source/g
        edit s/find_load_stream/find_load_source/g
        edit s/find_save_stream/find_save_target/g
        edit s/new_from_stream/new_from_source/g
        edit s/write_to_stream/write_to_target/g
        edit s/vips_thumbnail_stream/vips_thumbnail_source/g

        # eg. vips_webpload_stream
        edit "s/vips_([a-z]+)load_stream/vips_\1load_source/g"

        # eg. vips_webpsave_stream
        edit "s/vips_([a-z]+)save_stream/vips_\1save_target/g"

        mv rename $i
done
```
2019-12-29 21:40:21 +00:00
John Cupitt c65e399c48 win32 patches
see https://github.com/libvips/libvips/issues/1494#issuecomment-569495472
2019-12-29 12:19:58 +00:00
John Cupitt 9c6bfc7462 better error handling in vips__seek
Now that we are using the poxis API on win32, we don't need to check
GetLastError()
2019-12-28 12:54:44 +00:00
John Cupitt 32d3ba2a50 fix vips__ftruncate
We'd forgotton to update this for the new vips__seek return.

See https://github.com/libvips/libvips/issues/1494#issuecomment-569413267
2019-12-28 12:47:50 +00:00
John Cupitt d89df1661a revise doc comments in bufis 2019-12-26 12:25:19 +00:00
John Cupitt e43cba116a swap recursion for iteration in skip_whitespace
and avoid a stack overflow, see

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19701
2019-12-26 11:22:33 +00:00
John Cupitt 0c217efdf3 fix compiler warning 2019-12-22 15:04:07 +00:00
John Cupitt 0429a0080e swap ssize_t for gint64 where possible
Some versions of the Windows headers define ssize_t as unsigned. This
patch removes (where possible) use of ssize_t inside libvips, esp. in
the new stream API.

See https://github.com/libvips/libvips/issues/1494#issuecomment-568254731
2019-12-22 13:45:45 +00: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 b964deb482 fix SANITY checks in streami.c
they had bitrotted a bit
2019-12-21 14:12:59 +00:00
John Cupitt 8030d7b926 fix map of custom seekable streams
We failed for seekable custom streams.

See https://github.com/libvips/libvips/issues/1494#issuecomment-567190830
2019-12-20 12:44:56 +00:00
John Cupitt 53dac98b55 larger seq cache
Make the seq cache 50% larger to allow for rounding with some image
widths, tile sizes and thread numbers.

See https://github.com/libvips/libvips/issues/1494#issuecomment-567190830
2019-12-19 15:26:10 +00:00
John Cupitt 4616cf1f5c small changes to the gif-loop fix
see https://github.com/libvips/libvips/pull/1362
2019-12-18 18:09:30 +00:00
John Cupitt 7906c128cd better error messages on save
The stream savers were polluting the error log.
2019-12-18 17:50:19 +00:00
John Cupitt c0c07ea003 fix invalidate tagging
The new tagging system was unreffing the wrong operation.

See https://github.com/libvips/libvips/issues/1494#issuecomment-565200939
2019-12-18 14:32:30 +00:00
John Cupitt 1fd3b478e1 always check memory area length
vips_image_new_from_memory() allowed you to use length == 0 to mean
"don't check memory length". This was part of some very old vips7
compatibility.

The ppm loader could pass length == 0 if header size was equal to file
size, bypassing the length check.
2019-12-14 05:13:44 +00:00
John Cupitt e236f19f97 add fallbacks to new_from_stream
If the stream-based loaders fail, vips_image_new_from_stream() now falls
back to the old file and buffer loaders.

The file and buffer loaders already try the stream loaders first.
2019-12-10 17:19:12 +00:00
John Cupitt 56090c6fa7 fix another compiler warning 2019-12-08 14:16:52 +00:00
John Cupitt dd4b2e9c23 fix some clang warnings 2019-12-08 13:08:38 +00:00
John Cupitt d10c870a32 fix for no seek handler defined
We need to use the emitv signal emit function to be able to set a default value.
2019-12-06 16:58:01 +00:00
John Cupitt a50405c1f7 fix some run-time errors from clang
Travis is now running with some amount of run-time checking enabled and
it spotted a couple of harmless things.
2019-12-05 14:14:27 +00:00
John Cupitt a382359e65 don't test features in unminimise
This was circular: test features needed an unminimised stream, but
unminimise used to test features.
2019-12-05 10:35:15 +00:00
John Cupitt 4dbbc2d415 more dbg code 2019-12-04 17:40:49 +00:00
John Cupitt ec7aa1d6b6 delay testing stream properties until we have to
This makes stream object creation simpler: you don't need to have
everything set up before build occurs, so you can attach signal handlers
for read and seek later.
2019-12-04 16:46:00 +00:00
John Cupitt ae7aaea077 doc polish 2019-12-01 15:29:28 +00:00
John Cupitt 43fff7b10d fix map of input streams
The logic was a bit wonky. Thanks Kleis.

See https://github.com/kleisauke/net-vips/issues/33#issuecomment-559971456
2019-11-30 19:13:26 +00:00
John Cupitt 163b0165d7
Merge pull request #1483 from libvips/check-metadata-changes
block metadata changes on shared images
2019-11-30 17:37:20 +00:00
John Cupitt d88ce970b7 make operation cache invalidation advisory
This patch makes operation cache invalidate advisory rather than
immediate. Operations set a mark on cache entries meaning "this entry is
no longer valid", then the entry is removed next time the operation
is looked up.

This breaks the loop (now the cache can remove operations, but operations
can't remove cache entries), so it should be safer (I think). Everything
is inside a mutex, at least.

see https://github.com/libvips/libvips/issues/1484
2019-11-28 17:41:35 +00:00
John Cupitt acd9101037 always copy before exif_update
During write, we often call vips__exif_update(). This updates the exif
block from the other image metadata prior to save.

Always copy the image before calling this.

See https://github.com/lovell/sharp/issues/1986
2019-11-28 14:45:02 +00:00
John Cupitt 20cee5d041 block metadata changes on shared images
If images are shared (ref count > 1), block changes to the set of
metadata items on the image. These can cause crashes in highly threaded
programs.

See https://github.com/lovell/sharp/issues/1986
2019-11-28 09:59:30 +00:00
John Cupitt 1a2a4a41f1 remove dbg code now travis is fixed 2019-11-27 22:20:33 +00:00
John Cupitt 5d25e2d850 more travis tweaks 2019-11-27 20:27:40 +00:00
John Cupitt 9f6ea7b799 more dbg code to help travis 2019-11-27 20:09:04 +00:00
John Cupitt b003b36d7a Merge branch '8.8' 2019-11-27 15:30:33 +00:00
John Cupitt 0bc49a485e remove use of realpath
It won't work on linux systems with grsec.
2019-11-27 15:14:42 +00:00
John Cupitt 14859f9862 polish comments 2019-11-25 20:50:27 +00:00
John Cupitt 3d770f8ec9 add a little more debugging 2019-11-24 06:46:08 +00:00
John Cupitt 562da3e5ab rename new_from_filename as new_from_file
So VipsStreami matches VipsImage. Same for new_to_filename.
2019-11-22 17:13:20 +00:00
John Cupitt 91b0703921 add VipsStreamou
An output stream subclass you can easily connect to other destinations.
2019-11-21 17:54:10 +00:00
John Cupitt 6423721951 set defaut values for streamiu signals
In case no user signals are attached. Remove some dbg code.
2019-11-21 16:32:36 +00:00
John Cupitt 857aafc8c2 add VipsStreamiu
a streami subclass (u for user?) with actions signals you can connect to
to provide implementations of read and seek
2019-11-21 16:22:43 +00:00
John Cupitt 73985463fd more dbuf->streamo conversion 2019-11-19 13:20:05 +00:00
John Cupitt a129cef9dd add streamo_steal
and start converting some old dbuf code
2019-11-19 06:47:24 +00:00
John Cupitt 73dd7eebe5 move streamiw inside svgload
since that's the only place it is used
2019-11-18 15:07:37 +00:00
John Cupitt 09325600ee rename VipsStreamib as VipsBufis
The VipsStreamib (stream input buffered) was misleading -- it was
implemented on top of VipsStreami, but was not a subclass.

Rename as VipsBufis (buffered input stream). It's a silly name, but
easy to remember and reflects the purpose better,
2019-11-18 13:09:04 +00:00
John Cupitt 9a3842919a add mmap ppm input 2019-11-15 15:56:28 +00:00
John Cupitt 5f4b995551 make ppm load sequential
it used to load the entire image, or mmap it
2019-11-15 15:15:25 +00:00
John Cupitt 17b994419b move ppm save into the class
no separate save function now
2019-11-15 10:23:45 +00:00
John Cupitt c1a027c8d7 ppm load uses streams 2019-11-14 12:57:39 +00:00
John Cupitt 3bbadc0198 revise streamo, ppm save uses it
streamo is simpler, and has a fast putc.
2019-11-13 17:50:02 +00:00
John Cupitt 7aec350f1c old load/save funcs now use stream API
new_from_file / new_from_buffer and write_to_file / write_to_buffer
use the stream API if they can.
2019-11-13 16:39:47 +00:00
John Cupitt 55024c71ce
Merge branch 'master' into add-stream-object 2019-11-12 14:08:02 +00:00
John Cupitt 3ba0b285d4 switch to GDateTime 2019-11-11 15:14:04 +00:00
John Cupitt f5a4f41edf rename VipsStream* variables
The convention is now:

	VipStreami *streami;

We had `input` in many places, a left-over from the old VipStreamInput
name.
2019-11-11 09:09:34 +00:00
John Cupitt 998b5eea45 fix svgload sniff
by adding vips_streami_sniff_at_most()
2019-11-11 07:53:36 +00:00
John Cupitt 441f61f3ff svgload from a stream 2019-11-10 17:23:28 +00:00
Kleis Auke Wolthuizen 41c08b0ffb Add svgload_stream to the descriptors test
Seems to work!
2019-11-10 12:32:18 +01:00
John Cupitt f499cefb0e add iiif layout to dzsave 2019-11-09 20:40:39 +00:00
Kleis Auke Wolthuizen 609fdb4fb6 WiP: Add svgload_stream
TODO: Should we `#ifdef HAVE_RSVG` the VipsStreamiw class?
2019-11-09 18:19:54 +01:00
John Cupitt ce4729c92b fix radload from pipe 2019-11-08 17:39:25 +00:00
John Cupitt 53f73881f7 rename streamo constructors
Was vips_streamo_new_from_filename(), renamed as
vips_streamo_new_to_filename(). Same for descriptor and memory.
2019-11-07 16:20:12 +00:00
John Cupitt 4cf8246312 remove some dbg code 2019-11-07 07:29:44 +00:00
John Cupitt 04280fd837 test for orc 0.4.31
the version that should start working again, hopefully
2019-11-06 23:22:17 +00:00
John Cupitt c383614c28 more cleaning up 2019-11-06 21:34:42 +00:00
John Cupitt ca5816a62c fix webp new from buffer 2019-11-06 20:37:23 +00:00
John Cupitt d992f09dfa fix webp from pipe 2019-11-06 18:23:28 +00:00
John Cupitt 3d344b4b5f add Kleis's patches
and add minimise support to radiance load
2019-11-06 17:04:13 +00:00
John Cupitt edca486f19 revise buffered input
rad load works now
2019-11-06 16:35:19 +00:00
John Cupitt de94a725aa fix up streamib a bit more
radiance load is almost working
2019-11-04 17:52:43 +00:00
John Cupitt 6d3b53174d reworking rad load 2019-11-04 10:21:31 +00:00
John Cupitt 35d661c307 make streamib a wrapper rather than a subclass
makes integration with the rest of foreign simpler
2019-11-02 16:50:59 +00:00
John Cupitt 37049af140 buffered input compiles 2019-11-01 23:24:48 +00:00
John Cupitt 805da46670 more buffered input tweaking 2019-11-01 12:57:48 +00:00
John Cupitt ca5d75f7ec start coding buffered input 2019-10-31 20:38:21 +00:00
John Cupitt 1ea58f6edb start adding buffered input 2019-10-30 17:34:04 +00:00
John Cupitt 855c420a9c add a sanity limit to pipes
so unbounded pipes can't fill memory
2019-10-30 03:25:29 +00:00
John Cupitt 7321927361 update to GDateTime 2019-10-29 20:31:43 +00:00
John Cupitt 23663e8a88 add formatted output streams
you can printf() to output streams, implemented radiance stream write as
a test
2019-10-29 17:43:51 +00:00
John Cupitt 40d679f299 fix lseek() wrapper error handling 2019-10-28 13:02:36 +00:00
John Cupitt ed6b26fcb1 paste in various fixes from Kleis 2019-10-28 08:51:47 +00:00
John Cupitt ba0100eb13 revise decode/unminimise use 2019-10-28 05:04:04 +00:00
John Cupitt cbbd4ae6dd seems to work!
just a bit more cleaning up needed ...
2019-10-27 18:19:43 +00:00
John Cupitt b7ad0da20c more reworking 2019-10-24 14:14:52 +01:00
John Cupitt 0e29e1c41e start reworking again 2019-10-24 10:57:52 +01:00
John Cupitt af8a3bfee7 fix stream buffer load 2019-10-23 18:47:57 +01:00
John Cupitt bdb5e39efa just the test suite now 2019-10-23 14:51:29 +01:00
John Cupitt a9a0dfee0f mostly works now
but

	cat k2.jpg | vips copy stdin x.jpg

still fails
2019-10-23 13:01:09 +01:00
John Cupitt e27d6448b1 fix debug build 2019-10-22 23:07:17 +01:00
John Cupitt 60ce52512c builds
now needs testing
2019-10-22 17:37:05 +01:00
John Cupitt ee3270f8e9 more refactoring 2019-10-22 11:08:54 +01:00
John Cupitt 72cbaa9ea3 more revision 2019-10-21 15:04:30 +01:00
John Cupitt d49e816641 start cleaning up 2019-10-21 10:57:20 +01:00
John Cupitt 4a311a5cdd Revert "start splitting up stream class"
This reverts commit 7756b8da71.
2019-10-18 18:00:23 +01:00
John Cupitt 7756b8da71 start splitting up stream class 2019-10-18 15:33:26 +01:00
John Cupitt f99f3d3f57 revise seek() behaviour
fuzz tests fail though ... we need to split StreamInput up
2019-10-17 17:18:45 +01:00
John Cupitt 696ff2b24a fix up jpeg load
and revise descriptor test
2019-10-17 13:16:12 +01:00
John Cupitt fb2ab23e26 start adding TIFF stream load
streams now have a seek() vfunc
2019-10-16 18:28:46 +01:00
John Cupitt 98410042ac add webpload stream
webp uses the new VipsStreamInput mmap interface
2019-10-15 15:46:37 +01:00
John Cupitt 5a788b89cf add mmap input sources
falls back to read() if no mmap
2019-10-15 14:04:47 +01:00
John Cupitt 28daeb1a8a start adding mmap input to stream 2019-10-15 10:09:24 +01:00
John Cupitt 88aa1bca86 polish png read 2019-10-15 08:33:48 +01:00
John Cupitt 1bdadeed61 add png stream load 2019-10-14 18:03:45 +01:00
John Cupitt f6d247627f incorporate revision comments from @kleisauke
Thanks!
2019-10-14 12:18:40 +01:00
John Cupitt 9ea5e902b6 test descriptor properties 2019-10-14 12:02:59 +01:00
John Cupitt c01c3b9100 add minimise support to VipsStreamInput 2019-10-14 10:46:17 +01:00
John Cupitt 6f0002c023 add plumbing for stream minimise
and ::finish becomes a vfunc
2019-10-13 20:59:02 +01:00
John Cupitt 5f6911d516 add thumbnail_stream
this works:

	$ cat k2.jpg | vips thumbnail_stream [descriptor=0] x.jpg 200
	$ vipsheader x.jpg
	temp-0: 141x200 uchar, 3 bands, srgb, jpegload
2019-10-12 17:37:31 +01:00
John Cupitt 4d3f66fe33 add stdout write
this now works:

	$ vips invert k2.jpg .jpg | vips invert stdin x.jpg

"stdin" means read from stdin, ".jpg" means write to stdout in JPG
format
2019-10-12 14:12:01 +01:00
John Cupitt a2d57180b1 jpg stream output passes tests 2019-10-12 13:11:22 +01:00
John Cupitt d991b73ac5 jpegsave_stream mostly done
$ vips jpegsave_buffer x.jpg

doesn't work though -- need to rethink how output blobs are made
2019-10-11 18:17:42 +01:00
John Cupitt 20cb0da247 test suite passes
with all jpegload coming via VipsStreamInput
2019-10-11 14:03:10 +01:00
John Cupitt 6c1d7db31b remove old jpeg load stuff
it's just stream now

works on buffer, but seems to fail on

	vipsheader йцук.jpg

curiously
2019-10-11 09:43:12 +01:00
John Cupitt ad822109d4 input works
this works now:

	cat k2.jpg | vips invert - x.jpg

output next
2019-10-11 07:51:43 +01:00
John Cupitt 442720a0a1 add magic "-" stdin filename
this almost works!

$ vips invert - x.jpg < k2.jpg
2019-10-11 05:38:58 +01:00
John Cupitt 3a2bebdffb jpegload_stream registers 2019-10-10 22:02:39 +01:00
John Cupitt 387cafa738 add jpegload_stream 2019-10-10 20:42:39 +01:00
John Cupitt 0307184050 new input stream done
needs testing ... also needs minimise support, and sniffing
2019-10-09 17:42:06 +01:00
John Cupitt 372bbc8020 paste stream.c back in
revise stream.h, implement it next
2019-10-08 17:52:30 +01:00
Lovell Fuller 02c42fdeba Silence a couple of GCC compiler warnings 2019-09-20 17:08:25 +01:00
John Cupitt fe4ec6d11a save int arrays to vips files
and fix a tiny memleak in loadgifns
2019-09-18 18:06:33 +01:00
John Cupitt efdf33f3de add vips_error_buffer_copy()
Add vips_error_buffer_copy() to fix a race in error buffer fetch.

See https://github.com/libvips/libvips/issues/1423

Thanks @dineshkannaa
2019-09-12 09:49:49 +01:00
John Cupitt f09bd91f69 allow vips_init(NULL)
gave an assert error before
2019-09-05 14:28:19 +01:00
John Cupitt 349e76bb85 Merge branch '8.8' 2019-08-29 15:30:20 +01:00
John Cupitt 3161de3b52 verify bands/format for coded vips images
WHen loading a vips image with Coding set, make sure that Bands and
BandFmt are correct.
2019-08-29 15:28:55 +01:00
John Cupitt 848df69a9c better enum validation in vips load 2019-08-27 13:05:58 +01:00
John Cupitt 0895d120d8 better enum validation in vips load 2019-08-27 10:49:37 +01:00
John Cupitt 77de39320a Merge branch '8.8' 2019-08-24 11:21:48 +01:00
John Cupitt 038409093f clip coding and interpretation on image read
They could be out of bounds enums. This used not to matter, but we use
them more now, so out of bounds values can cause coredumps.
2019-08-24 11:20:45 +01:00
John Cupitt 19a80e4efb Merge branch '8.8' 2019-08-21 17:37:16 +01:00
John Cupitt b5e8e99746 fix a read-one-byte-beyond issue in jpeg load
libvips could harmlessly read beyond the end of a string with a crafted jpg
file
2019-08-21 17:17:54 +01:00
John Cupitt ccea473b0e fix logic for page_height and n_pages getters 2019-08-09 15:46:56 +01:00
John Cupitt 5649f6d865 update for "make dist" 2019-08-06 15:33:40 +01:00
John Cupitt 98f3bf78a5 fix doc spelling of "optimise" 2019-08-06 14:46:43 +01:00
Oscar Mira 45de60e571 skip large images in the fuzzers not in the lib
This reverts commit 0accdf858b.
2019-08-02 17:56:33 +02:00
John Cupitt 0accdf858b band large image during fuzzing
Large images cause a lot of uninteresting OOMs and timeouts during
fuzzing. Ban them.
2019-08-02 10:53:32 +01:00
John Cupitt 834acad825 fix << on signed int warnings
<< on a negative number is undefined behaviour in C, and will trigger
fuzzer warnings.
2019-08-02 05:35:18 +01:00
John Cupitt 6a75776272 Merge branch 'loader-minimise-experiment' 2019-07-28 17:23:01 +01:00
John Cupitt 0e5447e537 final cleanup 2019-07-28 17:15:54 +01:00
John Cupitt 01a82646a1 experiment with minimise in insert
try minimising sub after we've passed it
2019-07-27 13:40:18 +01:00
John Cupitt 67ad303d43 add VIPS_PROFILE env var to enable profiling 2019-07-19 16:04:07 +01:00
John Cupitt 52ee3b083f add webp and zstd support to tiffsave
needs some tests still
2019-07-08 10:39:44 +01:00
John Cupitt 3871369d3e Merge branch 'master' into deftomat-master 2019-07-06 14:50:40 +01:00
John Cupitt 515bf68f46 reformatting for vips2webp
- move a couple of small functions inline for simplicity
- mark "gif-delay" as deprecated
- minor reformatting
2019-07-06 13:37:33 +01:00
John Cupitt 4a2c80043d
Merge pull request #1360 from lovell/heifsave-expose-compression
heifsave: expose compression option
2019-07-03 13:34:08 +01:00
Lovell Fuller 42f9f78c86 heifsave: expose compression option
improve error messaging, add further suffixes
2019-07-03 13:07:58 +01:00
John Cupitt 2aef873fcd add vips_image_get/set_array_int() 2019-06-20 11:32:47 +01:00
John Cupitt 8a98bea063 fix vipsthumbnail for pyr tiff files
thumbnail was not testing pyramidal tiff images for pyramidness correctly.

see https://github.com/libvips/libvips/issues/1297
2019-06-19 17:56:09 +01:00
John Cupitt 65c41ef7a5 fix a couple of clang compiler warnings 2019-06-15 17:35:46 +01:00
John Cupitt 75e69cc1e5 disable Orc if CET is on
If we are building with -fcf-protection (run-time checking of
indirect jumps) then Orc won't work. Make sure it's off.

Orc may support -fcf-protection in the future, but does not in June 2019.

https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html#index-fcf-protection
https://gitlab.freedesktop.org/gstreamer/orc/issues/17

see https://github.com/libvips/libvips/issues/1006#issuecomment-501802550
2019-06-14 14:22:00 +01:00
John Cupitt ad98222073 better behaviour for vips_region_fetch()
we weren't clipping the fetch area against region valid, so in some
cases we could return many more pixels than expected

see https://github.com/libvips/pyvips/issues/103
2019-06-09 20:38:13 +01:00
John Cupitt 81861baee9 add note to docs in vips_init() 2019-05-30 19:46:05 +01:00
John Cupitt 5855321638 improve realpath() compat on older libc
older libc didn't allow a NULL for the second param
2019-05-24 15:24:18 +01:00
John Cupitt 3921e63561 fix vips image writes of more than 2gb
With very wide images and huge numbers of threads, it was possible to
trigger an int overflow in write_vips().

Thanks @erdmann

See https://github.com/libvips/libvips/issues/1306
2019-05-07 13:56:52 +01:00
John Cupitt efadb5dc42 fix thumbnail shrink-on-load
we had the alignment check in the wrong place
2019-04-27 22:33:20 +01:00
John Cupitt 3245dd301b Merge branch 'master' into szi-associated 2019-04-25 17:25:32 +01:00
John Cupitt 8b71d0179c Merge branch 'master' into revise-thumbnail 2019-04-23 20:27:30 +01:00
John Cupitt 56d98f3ef0 thumbnail no longer needs to import cmyk
since colourspace knows about cmyk now
2019-04-23 11:35:13 +01:00
John Cupitt 12bc5fbbe3 revise set_stacksize() once more
so we g_info() if we change it
2019-04-23 10:12:08 +01:00
John Cupitt 76aca0370f revise set_stacksize() again 2019-04-23 10:01:35 +01:00
Abdul Chaudhry c6b9015799
fixes set_stacksize 2019-04-22 09:09:05 -07:00
John Cupitt 7e4ebb3a94 fix stacksize on glibc
- need to define _GNU_SOURCE for glibc to get pthread_setattr_default_np()
- don't warn if we already have enough stack
- reformat to libvips standard
- add note to docs

see: https://github.com/libvips/libvips/pull/1291
2019-04-20 12:07:27 +01:00
Abdul Chaudhry 25bfad1306
provide an option to set the default stack size on linux 2019-04-19 08:59:45 -07:00
John Cupitt 827d8bca7e fix make dist 2019-04-11 18:20:39 +01:00
John Cupitt 6ea7085116 missing ! on vips_dbuf_write_amp() 2019-04-11 17:14:24 +01:00
John Cupitt 080ab87d37 Merge branch 'master' into HEAD 2019-04-11 16:18:39 +01:00
John Cupitt 91d0e7e3d0 move kill mechanism to public API
the vips_image_set_kill() system was internal. Move it to the public
API.

See eg.:

https://github.com/kleisauke/net-vips/issues/31
2019-04-06 16:53:42 +01:00
John Cupitt 640994b64a fix a possible segv writing images to buffers
if write failed, vips_image_write_to_buffer() could segv

thanks @dbouron !

see https://github.com/libvips/libvips/issues/1248
2019-03-20 17:32:44 +00:00
John Cupitt 18c12fd66d remove some old sanity-checks
regions can have null generate now
2019-03-20 16:28:22 +00:00
John Cupitt af0dc5265f use glib's b64 encode/decode, if available
see https://github.com/libvips/libvips/issues/1263
2019-03-20 13:51:41 +00:00
John Cupitt d7f9ad8b41 improve base64 encode
- better data source too large check
- could write up to three bytes too far in worst case
- remove dead base64.h
- add an assert for overflow

see https://github.com/libvips/libvips/issues/1263
2019-03-20 12:50:44 +00:00
John Cupitt a663a1bb1c add vips_region_fetch() etc.
to help ML applications ... they let us generate lots of small rectangular
areas of images very quickly
2019-03-12 16:00:24 +00:00
John Cupitt 29d33b2753 start work on toilet-roll thumbnails again 2019-03-02 22:13:55 +00:00
John Cupitt 15ee957ea9 Merge branch 'master' into revise-thumbnail 2019-03-02 22:06:23 +00:00
John Cupitt 33d90b5e26 only enable sanity checks in debug mode
We had a couple of sanity checks always on. As a result, libvips could
get slow for large pipelines.

Move them into g_assert().
2019-03-01 13:01:08 +00:00
John Cupitt e27c290856 glib version change 2019-02-27 14:24:17 +00:00
John Cupitt a05a2cb52d mild refactoring of threadpool
clean up and simplify after https://github.com/libvips/libvips/pull/1240
2019-02-27 14:23:43 +00:00
John Cupitt 3324ed8a2f
Merge pull request #1240 from jtorresfabra/fix_hidden_threapool_leak
Fix for hidden leaks in ThreadPool
2019-02-27 13:41:17 +00:00
jtorresfabra 8c8affab7f ThreadPool was allocating memory for threads and pools locally to the image object. As that image could not be freed from cache, for each sink operation done for that image the code was creating new pools and threads without freeing the previous one. SO the more number of threads and the more operations the bigger the hidden leak was. The fix just creates the objects not locally to that image, and also free them in its destroy functions 2019-02-27 13:01:45 +01:00
John Cupitt 27195cc92c add vips_foreign_get_suffixes()
Add vips_foreign_get_suffixes(), get an array of all the filename suffixes that
libvips recognises.

See https://github.com/libvips/ruby-vips/issues/186
2019-02-23 13:50:10 +00:00
John Cupitt 4af242b599 fix travis compiler warnings
- older libpng don't have consts decls for some set/get funcs
- use g_ascii_strcasecmp() on program text strings (instead of strcasecmp)
2019-02-20 12:49:59 +00:00
John Cupitt cf860b27fa start working over thumbnail to support anim 2019-02-19 17:27:23 +00:00
John Cupitt dcba364efa Merge branch 'zero-mem-on-malloc' 2019-01-18 11:31:11 +00:00