Commit Graph

324 Commits

Author SHA1 Message Date
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
John Cupitt 57d1d86885 avoid a harmless out of bounds read
in UCS table building
2019-08-29 15:42:05 +01:00
John Cupitt f8bdc00866 void /0 in Yxy2XYZ
Now sets 0 rather than inf.
2019-08-29 14:20:30 +01:00
John Cupitt 3e89944bf9 remove a pointless optimisation from rad2float
Some old rad code could cause a read beyond end of buffer.
2019-08-27 09:23:16 +01:00
John Cupitt cdee0feb93 Merge branch '8.8' 2019-08-09 10:12:55 +01:00
John Cupitt d2d63f4ac4 revise profile_load
seems to work!
2019-08-08 13:23:28 +01:00
John Cupitt 9cc72ea1c1 msvc dies with string literals larger than 64kb
use arrays instead of tseing literals

generates the literals, profile_load.c needs to be adjusted still
2019-08-08 11:29:39 +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 d2a9a20a78 fix thumbnail regression with cmyk in and out
56d98f3ef0 broke cmyk->cymk thumbnails
2019-04-23 17:09:20 +01:00
John Cupitt 691383c2b8 better rejection of broken embedded profiles
icc_import and _transform now test the embedded profile more carefully.
It must now be a valid profile and must be compatible with the image.

see https://github.com/libvips/libvips/issues/1286
2019-04-17 16:19:38 +01: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
Lovell Fuller 97a98bcb7d Ensure once is invoked once, prevent profile use-after-free 2019-01-25 11:33:40 +00:00
John Cupitt c24e47e3a8 fix profile attach on colour output
some dead code needed removing

https://github.com/libvips/libvips/issues/1194#issuecomment-455164899
2019-01-17 16:36:25 +00:00
John Cupitt 1824c64c06 break >80 char line 2019-01-17 08:59:14 +00:00
Lovell Fuller a264f812ac Ensure ICC profile data is freed after use 2019-01-16 21:49:47 +00:00
John Cupitt a7122d7a85 revise XYZ2CMYK fallback path
better epsilon detect, add a test
2019-01-16 21:02:01 +00:00
John Cupitt a67f92b8d9 reformat in vips style 2019-01-16 20:18:09 +00:00