Commit Graph

2158 Commits

Author SHA1 Message Date
John Cupitt
a7e754162a
move tiff decompress outside lock (#2969)
* move tiff decompress outside lock

Most time in TIFF read is spent in decompression. If we move this
outside the lock, we can get a useful speedup.

This commit adds the machinery to move the lock to before decompress, so
jp2k decompression is now threaded.

Before:

```
$ vips copy wtc.jpg x.tif[tile,compression=jp2k]
$ time vips avg x.tif
117.249845
real	0m15.085s
user	0m16.155s
sys	0m0.109s
```

After:

```
$ time vips avg x.tif
117.249845
real	0m1.207s
user	0m18.384s
sys	0m0.369s
```

* start moving jpg decode outside the lock

* move jpeg decompress outside the lock

seems to work

* add some more tile size checks

double-check jpeg tile size before decode

* fix tiffload demand hinting

We were not setting the hint correctly in header load, and we were not
hinting smalltile for tiled TIFFs.
2022-09-03 13:10:58 +01:00
John Cupitt
9486110abb Merge branch '8.13' 2022-08-30 17:11:51 +01:00
Kleis Auke Wolthuizen
a19f326d19
dzsave: improve compatibility with libgsf < 1.14.29 (#3017)
* Implement `GsfOutfileStdio` by ourselves

* Add missing `->root` init

* Fix styling

* Update ChangeLog
2022-08-30 17:10:38 +01:00
John Cupitt
6a154ac9f2 add ".pnm" save
see https://github.com/libvips/libvips/issues/3016
2022-08-30 12:31:47 +01:00
John Cupitt
2e5e9fb755 set "magick-format" for IM7 load
see https://github.com/libvips/libvips/discussions/3011
2022-08-26 16:01:15 +01:00
John Cupitt
4df80b2e49 note GIF addition
see https://github.com/libvips/libvips/pull/2984
2022-08-15 12:16:07 +01:00
John Cupitt
0029b3c416 require libjxl 0.7+ 2022-08-14 17:32:40 +01:00
John Cupitt
332d3a9093 Merge branch '8.13' 2022-08-14 17:28:26 +01:00
John Cupitt
e88db2ceb4 fix jxl load rewind
Looks like there's no way to reset the decoder state, so we have to
remake it.
2022-08-14 17:27:13 +01:00
John Cupitt
b4bfaeb980 Merge branch '8.13' 2022-08-14 12:16:10 +01:00
John Cupitt
1989203985 fix low bitdepth PNG save of high bitdepth images
SOme combinations of high bitdepth images with low bitdepth PNG save could
produce incorrect images, for example saving a 16-bit fourier image as 1-bit.
2022-08-14 12:14:55 +01:00
John Cupitt
aa109f102d Merge branch '8.13' 2022-08-14 10:31:09 +01:00
John Cupitt
ca2796aa7f fix low-bitdepth spng save
There was a missing shift, thanks jeffska

See https://github.com/libvips/libvips/issues/2985
2022-08-14 10:26:24 +01:00
John Cupitt
c0637d9969 jp2ksave saves as jp2
Confusingly we previously saved jp2 images as a jpeg2000 codestream rather
than as a jp2 file.

See https://github.com/libvips/libvips/issues/2977
2022-08-11 16:49:40 +01:00
John Cupitt
29e80ca43f better 0 detection in unpremultiply
We were avoiding /0 by testing for alpha==0, however, this will still
allow very small values of alpha to generate +/- Inf. Instead, check for
abs(alpha)<epsilon.

Fixes some artifacts after unpremul.
2022-08-08 16:16:10 +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
John Cupitt
7e961b4671 Merge branch '8.13' 2022-08-02 14:22:27 +01:00
John Cupitt
2c4c039056 add "unlimited" to jpegload
To disable DoS limits for JPEG loading. Adding API on a stable branch is
bad, but this fixes a regression, so I think it's necessary,
unfortunately.

See https://github.com/libvips/libvips/issues/2973
2022-08-02 13:50:09 +01:00
Kleis Auke Wolthuizen
a6fa62605c
Cherry-pick a couple of Meson improvements to 8.13 (#2968)
* add a summary table at the end of configure

Copied from the old autotools summary. Sample clipped from "meson setup":

```
Program python3 found: YES (/usr/bin/python3)
Configuring variables.sh using configuration
Message:

*Build options
  enable debug ......................: true
  enable deprecated .................: true
  enable modules ....................: true
  enable gtk-doc ....................: true
  enable doxygen ....................: false
  enable introspection ..............: true
  enable RAD load/save ..............: true
  enable Analyze7 load/save .........: true
  enable PPM load/save ..............: true
  enable GIF load ...................: true

*Optional external packages
  use fftw for FFTs .................: true
  accelerate loops with ORC .........: true
  ICC profile support with lcms .....: true
  zlib ..............................: true
  text rendering with pangocairo ....: true
  font file support with fontcongfig : true
  EXIF metadata support with libexif : true

*External image format libraries
  JPEG load/save with libjpeg .......: true
  JXL load/save with libjxl .........: false
  JPEG2000 load/save with openjpeg ..: true
  PNG load/save with libspng ........: false
  PNG load/save with libpng .........: true
  selected quantisation package .....: imagequant
  TIFF load/save with libtiff .......: true
  image pyramid save with libgsf ....: true
  HEIC/AVIF load/save with libheif ..: true
  WebP load/save with libwebp .......: true
  PDF load with PDFium ..............: false
  PDF load with poppler-glib ........: true
  SVG load with librsvg .............: true
  EXR load/save with openexr ........: true
  OpenSlide load ....................: true
  Matlab load with libmatio .........: true
  NIfTI load/save with niftiio ......: true
  FITS load/save with cfitsio .......: true
  GIF save with cgif ................: true
  selected Magick package ...........: MagickCore
  Magick load/save ..................: true

Build targets in project: 53
...
```

* Meson: improve summary table (#2943)

* Meson: improve summary table

* Fix typo

* Remove redundant whitespace

* Fix libpng fall-back when build with `-Dspng=disabled` (#2955)

* Meson: simplify dynamic module handling (#2956)

* Deduplicate `--vips-config` with the build summary (#2957)

* Deduplicate `--vips-config` with the build summary

* Ensure output is identical

Helps parses.

* Fix summary when build with `-Dnifti=disabled` (#2963)

* Update ChangeLog

Co-authored-by: John Cupitt <jcupitt@gmail.com>
2022-07-31 10:09:00 +01:00
John Cupitt
8c71424e9a version bump
and changelog update
2022-07-30 12:37:30 +01:00
John Cupitt
5e93ac43ac bump 8.13 version 2022-07-26 12:20:43 +01:00
Lovell Fuller
1bf1a32f2c
pngsave: Change default row filter from 'all' to 'none' (#2929)
as this is usually faster and produces a smaller file size
2022-07-15 19:20:42 +01:00
John Cupitt
26f8b8a249 vips_block_untrusted_set was named wrongly 2022-06-10 18:08:27 +01:00
John Cupitt
6260a37136
add libjxl ICC and scRGB support (#2815)
* add ICC and scRGB support

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

* final polish
2022-05-28 13:55:45 +01:00
Daniel Löbl
ed79cfba7e
magicksave: Add bitdepth option (#2819)
* flag to save bmp with bitdepth 1

* magicksave: add bitdepth option

* update comments

* update documentation

* revised based on review comments

Co-authored-by: Thomas Barton <thomasryanbarton@gmail.com>
2022-05-27 11:41:01 +01:00
Daniel Löbl
f26f0b09b8
cgifsave: reuse global palette, if possible (#2797)
* save GIF palette as metadata

... if there are no local colour tables.

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

* cgifsave: reuse global palette, if possible

* add reuse_palette parameter

* add reoptimise parameter and reuse palette by default

* attach global palette even if local palettes are present

* add check for presence of use-lct

* Revert "add check for presence of use-lct"

This reverts commit cd0f14e45e8bed8f108ee9666e2569c6355f17eb.

* Revert "attach global palette even if local palettes are present"

This reverts commit 4085b9e14b73c8990e9653ccc6f90477c2a43032.

* move global palette quantization to cgif_build

* rename member variable gct

* update comments

* improve error handling

* update documentation

Co-authored-by: John Cupitt <jcupitt@gmail.com>
2022-05-23 13:01:26 +01:00
John Cupitt
3d0912ea68 Merge branch '8.12' 2022-05-21 09:53:37 +01:00
John Cupitt
6e80364e0a fix jxl compat break
note in changelog

see https://github.com/libvips/libvips/pull/2813
2022-05-21 09:52:58 +01:00
Daniel Löbl
7f8e059dc6
webpsave: add parameter for mixed encoding (#2810)
* webpsave: add mixed parameter

* update changelog

* update webpsave documentation
2022-05-20 18:47:18 +01:00
John Cupitt
a9d64bea54
add dzsave to a target (#2718)
* start adding dzsave to a target

made a thing for gsf to write to a target

* fix stray tabs in dzsave

* fix dzsave write to "."

Early versions of libgsf did not support writing to ".", so we had an ugly
workaround, but this should now be OK.

Fixing this ought to make write to target simple

* dzsave_target compiles

no idea if it works though

* seems to work now

creates stray 0 length files though, very odd

* fix stray files from dzsave

next: save to buffer is returning null

* fix buffer flush in dzsave

all tests pass!

* update changelog
2022-05-20 18:38:46 +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
683e8d9b6f small changelog polish 2022-05-16 14:59:16 +01:00
John Cupitt
dd9f42269f Merge branch '8.12' 2022-05-11 22:31:13 +01:00
John Cupitt
36cc50500b update changelog for ssize_t fix 2022-05-11 22:30:42 +01:00
John Cupitt
cdcafbc4c5 add changelog notes
and linewrap for 80 column limit
2022-05-07 12:51:58 +01:00
John Cupitt
f06c9f3bcf add fail-on to thumbnail
see https://github.com/libvips/libvips/discussions/2781
2022-04-28 09:08: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
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
39e75e07a2 deprecate "properties", register ".szi" as a suff 2022-03-29 17:50:48 +01:00
John Cupitt
168d7652c2 Merge branch '8.12' 2022-03-11 16:25:11 +00:00
John Cupitt
f0eb493643 fix thumbnail with cmyk output
see https://github.com/libvips/php-vips/issues/138

thanks AdamGaskins
2022-03-11 16:21:12 +00:00
John Cupitt
f65b615a17 minor nsgifload revisions
- add note to changelog
- remove dead code
- improve debug output
- track current page number

see https://github.com/libvips/libvips/pull/2699
2022-03-03 11:49:13 +00:00
John Cupitt
3b6072437d add new param to gifsave docs
also note in changelog and revise layout for 80 columns

see https://github.com/libvips/libvips/pull/2628
2022-02-28 16:38:02 +00:00
John Cupitt
3073ee90b7
Improve edge handling for mapim (#2681)
* almost there

* smol changes

* getting close now

segv on the test suite, annoyingly

* argh still not quite thert

* phew
2022-02-28 09:12:09 +00:00
shado23
3a45d6e842 Add support for regions in the C++ API 2022-02-25 16:19:44 +01:00
John Cupitt
5ff96da873 add note on heifload unlimited to changelog 2022-02-23 10:35:46 +00:00
John Cupitt
e985e23c09
add HDR support to heif load/save (#2596)
* heifload done, doing save

* finish save, add tests, docs
2022-02-18 11:16:15 +00:00
John Cupitt
f6dafd6fc6 update changelog for intospection fixes
and default on, since there are now so few warnings
2022-02-15 10:59:11 +00:00
John Cupitt
896cad6a7a
Add spngsave (#2536)
* quick hack

won't even compile

* works!

at a basic level, anyway

* start wiring up metadata

* metadata done

* add spng interlaced save

* start adding index support

* fix palette save

* Update libvips/foreign/spngsave.c

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

* start adding low bit depth write

* add a warning for low bitdepth write

* small fixes

* add 1/2/4 bit write

adapted from the vips2tiff bit packer

* small polish

* note spngsave in changelog

* Update libvips/foreign/spngsave.c

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

* Update libvips/foreign/spngsave.c

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

* revise 8 and 16-bit PNG write rules

* cleanup

* remove unnecessary palette filter optimisation

since libspng already does this

* add xres/yres rounding

thanks klies

he commit message for your changes. Lines starting

* look for spng.pc and libspng.pc

It can be called either, frustratingly.

* fix PACKAGES_USED for spng .pc changes

Co-authored-by: Kleis Auke Wolthuizen <github@kleisauke.nl>
2022-02-11 16:30:23 +00:00