Commit Graph

4606 Commits

Author SHA1 Message Date
James Zern
e2fecc22e1 dsp/lossless_enc.c: clear int sanitizer warnings
in TransformColorBlue; make new_blue an int to avoid:

implicit conversion from type 'int' of value 264 (32-bit, signed) to
type 'uint8_t' (aka 'unsigned char') changed the value to 8 (8-bit,
unsigned)

Bug: b/229626362
Change-Id: Ife276a59231075788396204e1a192f3b0c6d9e21
2022-08-08 17:34:01 -07:00
James Zern
129cf9e97e dsp/lossless.c: clear int sanitizer warnings
add explicit casts in calls to ColorTransformDelta()

clears warnings of the form:
implicit conversion from type 'uint8_t' (aka 'unsigned char') of value
254 (8-bit, unsigned) to type 'int8_t' (aka 'signed char') changed the
value to -2 (8-bit, signed)

Bug: b/229626362
Change-Id: Ic049ad9c9b5c6b669a1c943287f416533d6c873c
2022-08-08 17:34:01 -07:00
James Zern
ad7d1753c5 dsp/lossless_enc.c: clear int sanitizer warnings
add explicit casts in calls to ColorTransformDelta()

clears warnings of the form:
implicit conversion from type 'uint8_t' (aka 'unsigned char') of value
254 (8-bit, unsigned) to type 'int8_t' (aka 'signed char') changed the
value to -2 (8-bit, signed)

Bug: b/229626362
Change-Id: I40618209509508f56d8053f9daa29cf2e6999766
2022-08-08 17:34:00 -07:00
James Zern
5037220e55 VP8LSubtractGreenFromBlueAndRed_C: clear int sanitizer warnings
previously the types were changed to int to prevent unsigned overflow
warnings:
6ab496ed fix some 'unsigned integer overflow' warnings in ubsan

clears warnings of the form:
implicit conversion from type 'uint32_t' (aka 'unsigned int') of value
3724541952 (32-bit, unsigned) to type 'int' changed the value to
-570425344 (32-bit, signed)

implicit conversion from type 'int' of value -3361661 (32-bit, signed)
to type 'unsigned int' changed the value to 4291605635 (32-bit,
unsigned)

Bug: b/229626362
Change-Id: If1eb39c5dd7218d686c3c47fb7df72431b873be4
2022-08-08 17:34:00 -07:00
James Zern
2ee786c740 upsampling_sse2.c: clear int sanitizer warnings
clears warnings of the form:
src/dsp/upsampling_sse2.c:169:1: runtime error: implicit conversion from
type 'int' of value -16 (32-bit, signed) to type 'unsigned long' changed
the value to 18446744073709551600 (64-bit, unsigned)

Bug: b/229626362
Change-Id: I757d347808be5084e5fcf7c121a77d09812b743c
2022-08-08 17:34:00 -07:00
James Zern
4cc157d48a ParseOptionalChunks: clear int sanitizer warning
clears a warning of the form:
src/dec/webp_dec.c:182:62: runtime error: implicit conversion from type
'int' of value -2 (32-bit, signed) to type 'unsigned int' changed the
value to 4294967294 (32-bit, unsigned)

Bug: b/229626362
Change-Id: Ibf08f8bb9ec345381b51ca3872745368fca700c0
2022-08-08 17:34:00 -07:00
James Zern
892cf033b9 BuildHuffmanTable: clear int sanitizer warning
clears a warning of the form:
implicit conversion from type 'int' of value -1 (32-bit, signed) to type
'uint32_t' (aka 'unsigned int') changed the value to 4294967295 (32-bit,
unsigned)

Bug: b/229626362
Change-Id: I397fbd59bd3e6d787fcec1344b6230958b28d22c
2022-08-08 17:34:00 -07:00
James Zern
3a9a4d4589 VP8GetSigned: clear int sanitizer warnings
clears warnings of the form:
implicit conversion from type 'int32_t' (aka 'int') of value -1 (32-bit,
signed) to type 'unsigned int' changed the value to 4294967295 (32-bit,
unsigned)

Bug: b/229626362
Change-Id: I956671d4fee482c97c67bbe94032a97da49b0f6d
2022-08-08 17:34:00 -07:00
James Zern
704a3d0a1f dsp/lossless.c: quiet int sanitizer warnings
in calls to Clip255(); given the current implementation's use of a
logical shift the parameter is left as uint32_t and explicit casts are
added

clears warnings of the form:
src/dsp/lossless.c:52:18: runtime error: implicit conversion
from type 'int' of value -2 (32-bit, signed) to type 'uint32_t' (aka
'unsigned int') changed the value to 4294967294 (32-bit, unsigned)

Bug: b/229626362
Change-Id: If8a7f145c2d7e62e572e221da36b04281ed5c9bf
2022-08-08 17:30:45 -07:00
James Zern
1a6c109c99 WebPPictureHasTransparency: add missing pointer check
in the case of use_argb, alpha_offset may be non-zero which would cause
the null pointer check in CheckNonOpaque to pass

fixes a potential crash with invalid width/height set or an integer
sanitizer warning when passing a zeroed picture:
src/enc/picture_csp_enc.c:73:57: runtime error: applying non-zero offset
3 to null pointer

Change-Id: I9d499bba12c65ad5c65d8f9f3c8ee9298ac6081a
2022-08-08 16:45:20 -07:00
James Zern
c626e7d544 cwebp: fix WebPPictureHasTransparency call
when near_lossless is < 100; previously the zeroed 'picture' would be
passed in the check rather than the original picture. this would result
in alpha never been kept in the decode.

Change-Id: I6af3aef7de2d672e044025d975d8180b12d5fa40
2022-08-08 16:42:00 -07:00
James Zern
866e349cef libwebp-1.2.4
- 8/4/2022: version 1.2.4
   This is a binary compatible release.
   * restore CMake libwebpmux target name for compatibility with 1.2.2 (#575)
   * fix lossless crunch mode encoding with WEBP_REDUCE_SIZE
     (chromium: #1345547, #1345595, #1345772, #1345804)
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEaw5rcJdt4wPt8vYB+cPWvbgjK10FAmLtz8MACgkQ+cPWvbgj
 K10v/A//R+sAs759jvKryQGJYDweXMKqbHbWWdkNbluX4FoitQH44Wy+YPecMrr2
 En3vSJWM50Bb8UvscvO+FoCI3x6DhgniEC7VbRnx43sSHioyd1K6XYBp+Q8Ksj6n
 qpdslDsjzpwj4uAKrDnTmdBr9CdSK8qxlXvgskqtWBwRnlePetRWXFSWO3ke7JKa
 d+SeLxboGgsZ+zjoWSqK+f7LCOEPGEkJk/JP3xOwn9K+FusLP2YMDhVw5Q78rWfh
 qNCamsM0SUFN9hfHp0/0FQvHO0B+c8BtB/hh5hjctZt7j5O+fQC+KAmiStnB2B3f
 CVjilU3ajnVH2VD4SYcsfHCVEV8hM+fHHjTgvnHh7jtz3wlokfcidMW9F1JujLZu
 M4FnD6XbJXERfitKx9lEzJ1h9RbChvrl84waU8Tkx/GboNIvHUQF5kROlOjXz3BL
 t+nkuNywxcb5RPph17OhYXT9MqPwGVHctrVG5DaAn+QjSKcxa65k03CFtZclD4Xm
 V8ozMwtKXiRZBqJRPwg7iYvnUOHixS3p+6p3OsUyjKelJEOLFfo1Z1vv7JvnXsmo
 xpvyetWnfWCnzzdMglahCVDu3ENVrjmNGV5g4wMTgDCcF0g/++M+7Yv/NfHNz0DX
 Y0uppjsXYUwNaq8Q3GpveQcpeZNrGpHRZQ88PsZkLxoNDn+hWHo=
 =BQmU
 -----END PGP SIGNATURE-----

Merge tag 'v1.2.4'

libwebp-1.2.4

- 8/4/2022: version 1.2.4
  This is a binary compatible release.
  * restore CMake libwebpmux target name for compatibility with 1.2.2 (#575)
  * fix lossless crunch mode encoding with WEBP_REDUCE_SIZE
    (chromium: #1345547, #1345595, #1345772, #1345804)

* tag 'v1.2.4':
  update ChangeLog
  update NEWS
  bump version to 1.2.4
  lossless: fix crunch mode w/WEBP_REDUCE_SIZE
  CMakeLists.txt: correct libwebpmux name in WebPConfig.cmake
  Revert "cmake: fix webpmux lib name for cmake linking"

Bug: webp:579
Change-Id: I7e1aa268d1ea9c1f3b38334cff2681e177bbdf36
2022-08-08 15:47:16 -07:00
Maryla Ustarroz-Calonge
c170df3830 Merge "Create libsharpyuv.a in makefile.unix." into main 2022-08-08 09:22:55 +00:00
Maryla
9d7ff74a55 Create libsharpyuv.a in makefile.unix.
Add libsharpyuv dependency to fuzzer makefile.

Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=49778

Change-Id: Ib03219de33a97c3d7b13d0daffbee2035f2a3bde
2022-08-08 09:40:34 +02:00
James Zern
0d1f12546b update ChangeLog
Change-Id: Ie649805f89f4b483c70462d1aafef01e4dff7bc2
2022-08-05 16:49:26 -07:00
James Zern
fcbc2d78ab Merge "doc/*.txt: restrict code to 69 columns" into main 2022-08-05 22:03:51 +00:00
James Zern
4ad0e1895e Merge "webp-container-spec.txt: normalize fourcc spelling" into main 2022-08-05 22:03:09 +00:00
James Zern
980d24884c update NEWS
Bug: webp:579
Change-Id: I5cc91d6711a1b2feb3dd2d0cd13befee881fe85a
2022-08-04 22:02:45 -07:00
James Zern
9fde812779 bump version to 1.2.4
libwebp{,decoder} - 1.2.4
libwebp libtool - 8.5.1
libwebpdecoder libtool - 4.5.1

mux - 1.2.4
libtool - 3.10.0

demux - 1.2.4
libtool - 2.11.0

Bug: webp:579
Change-Id: I5fae4184ac6fe4b9c719856080020fd107f18b7f
2022-08-04 22:02:35 -07:00
James Zern
7a0a9935ed doc/*.txt: restrict code to 69 columns
some renderers may limit output to 72 and use a 3 space indent; this
avoids overflowing into the margin

Change-Id: Iaf4e8b71be27ef00fccd1d82b79bf96c01040f10
2022-08-04 19:35:24 -07:00
James Zern
c040a615b1 webp-container-spec.txt: normalize fourcc spelling
fourcc -> FourCC as it's defined in the terminology

Change-Id: I49e3a5aaba525b295701d8aac7b1700c4003ca77
2022-08-04 11:47:22 -07:00
James Zern
aff1c546ef dsp,x86: normalize types w/_mm_cvtsi128_si32 calls
fixes integer sanitizer warnings of the form:
implicit conversion from type 'int' of value -2122283647 (32-bit,
signed) to type 'uint32_t' (aka 'unsigned int') changed the value to
2172683649 (32-bit, unsigned)

implicit conversion from type 'uint32_t' (aka 'unsigned int') of value
3724541952 (32-bit, unsigned) to type 'int' changed the value to
-570425344 (32-bit, signed)

Bug: b/229626362
Change-Id: I79f68e3e2fcab7cc0402477d2e88d629348c9ff4
2022-08-04 11:26:23 -07:00
James Zern
ab540ae0c5 dsp,x86: normalize types w/_mm_cvtsi32_si128 calls
fixes integer sanitizer warnings of the form:
implicit conversion from type 'uint32_t' (aka 'unsigned int') of value
3724541952 (32-bit, unsigned) to type 'int' changed the value to
-570425344 (32-bit, signed)

Bug: b/229626362
Change-Id: Ie4d599aba88226e4e047250464ac37ca11d2cd3b
2022-08-04 11:26:23 -07:00
James Zern
8980362eed dsp,x86: normalize types w/_mm_set* calls (2)
missed in:
83539239 (origin/main, main) dsp,x86: normalize types w/_mm_set* calls

fixes integer sanitizer warnings of the form:
implicit conversion from type 'uint32_t' (aka 'unsigned int') of value
4292337446 (32-bit, unsigned) to type 'int' changed the value to
-2629850 (32-bit, signed)
runtime error: implicit conversion from type
'uint8_t' (aka 'unsigned char') of value 128 (8-bit, unsigned) to type
'char' changed the value to -128 (8-bit, signed)

Bug: b/229626362
Change-Id: Ie904da8ded26725b4e0a9b82cc0679234f0a5388
2022-08-04 11:26:23 -07:00
James Zern
e626925cef lossless: fix crunch mode w/WEBP_REDUCE_SIZE
WEBP_REDUCE_SIZE was introduced to bring down the library size by
removing cropping and scaling support. Previously WebPPictureView() was
only used with these two, but in
  ec178f2c Add progress hook granularity in lossless
an additional use was added in VP8LEncodeStream() when extra side
configurations are used in crunch mode (-mt, quality == 100 & method ==
6 or quality >= 75 & method == 5 with a palette present currently).

WebPPictureView() and, for coherency, WebPPictureIsView() are
restored in this configuration to avoid affecting the general encode
path.

Previously WebPPictureView() was assumed to always succeed in these
cases which could result in crashes with WEBP_REDUCE_SIZE defined.

Bug: chromium:1345547
Bug: chromium:1345595
Bug: chromium:1345772
Bug: chromium:1345804
Change-Id: Ifecde36a726a434510478a764514b1469942c684
(cherry picked from commit 84163d9d02)
2022-08-03 23:57:12 +00:00
James Zern
835392393b dsp,x86: normalize types w/_mm_set* calls
fixes integer sanitizer warnings of the form:
runtime error: implicit conversion from type 'unsigned int' of value
4294967295 (32-bit, unsigned) to type 'int' changed the value to -1
(32-bit, signed)
runtime error: implicit conversion from type
'uint8_t' (aka 'unsigned char') of value 128 (8-bit, unsigned) to type
'char' changed the value to -128 (8-bit, signed)

Bug: b/229626362
Change-Id: I6be3c40407cf7a27b79d31ee32d3829ecb78ed66
2022-08-03 16:50:46 -07:00
James Zern
8a4576ce26 webp-container-spec.txt: replace &amp; with &
this conversion is handled by markdown processors

Change-Id: Ic679e40fcea577784deb8b455911bf1f201f2011
2022-08-03 11:12:23 -07:00
James Zern
db87088162 Merge "webp-container-spec.txt: make reserved 0 values a MUST" into main 2022-08-03 18:07:16 +00:00
James Zern
01d7d378d1 webp-lossless-bitstream-spec: number all sections
this makes the structure more consistent

Change-Id: Ie6c8b42506be73e565cfc4d39108eb4d8c038003
2022-08-02 19:03:51 -07:00
James Zern
337cf69f58 webp-lossless-bitstream-spec: mv Nomenclature after Intro
Change-Id: I3337513e48a8e604b154d91993bd7ff84d6c55ad
2022-08-02 18:50:59 -07:00
James Zern
79be856e6e Merge changes I7111d1f7,I872cd62c into main
* changes:
  libwebp.pc: add libsharpyuv to requires
  libsharpyuv: add pkg-config file
2022-08-03 01:43:10 +00:00
James Zern
5b87983ad0 webp-container-spec.txt: make reserved 0 values a MUST
these were intended as an extension point, but in this version of the
spec they're not defined. if they ever were used leaving them as SHOULD
could result in a source of incompatibility.

Change-Id: I1376ab7abe7d955ae335106f2faebc217dac77cd
2022-08-02 15:14:11 -07:00
James Zern
bd9391232d Merge changes I7a25b1a6,I51b2c2a0,I87d0cbcf,I6ec60af6,I0a3fe9dc into main
* changes:
  webp-container-spec.txt: clarify some SHOULDs
  webp-container-spec.txt: move ChunkHeader to terminology
  webp-container-spec.txt: clarify 'VP8 '/'XMP ' fourccs
  webp-container-spec.txt: rightsize table entries
  webp-container-spec.txt: update 'key words' text
2022-08-02 22:13:07 +00:00
Christopher Degawa
04764b56a0
libwebp.pc: add libsharpyuv to requires
Signed-off-by: Christopher Degawa <ccom@randomderp.com>
Change-Id: I7111d1f7738dad566dc74fc11be99ff92e11c50b
2022-08-02 15:58:49 -05:00
Christopher Degawa
7deee8103e
libsharpyuv: add pkg-config file
Signed-off-by: Christopher Degawa <ccom@randomderp.com>
Change-Id: I872cd62ccdf096044c7921afda8289849d141531
2022-08-02 15:46:19 -05:00
James Zern
1a64a7e649 webp-container-spec.txt: clarify some SHOULDs
for compatibility SHOULDs are left as is with some additional
description given of behavior if the recommendation is ignored.

Change-Id: I7a25b1a6fd9f9594390c30fce3af5ca17c3158c0
2022-08-02 13:12:27 -07:00
James Zern
bec2c88a11 webp-container-spec.txt: move ChunkHeader to terminology
this avoids presenting it in the description of a chunk where it could
appear it was defining an element of the diagram

Change-Id: I51b2c2a0dcecb4fc130711ad37c884a434920ecd
2022-08-02 12:46:53 -07:00
James Zern
c9359332a3 webp-container-spec.txt: clarify 'VP8 '/'XMP ' fourccs
Note the fourth character is an ASCII space to avoid confusion.
Also update the FourCC definition to mention that they're case
sensitive.

Change-Id: I87d0cbcf06e7c25bf2b33419b4c8c891adb82a8a
2022-08-01 18:51:35 -07:00
James Zern
70fe3063a5 webp-container-spec.txt: rightsize table entries
Use the correct number of lines for fixed width entries like
ChunkHeader(). ':' is used instead of '|' for variable length entries.

Bug: webp:546
Change-Id: I6ec60af674c0777d5ea6ae99c8aa3c7854ddd9f9
Fixed: webp:546
2022-08-01 18:49:43 -07:00
James Zern
ddbf3f3f2a webp-container-spec.txt: update 'key words' text
RFC 2119 was updated by RFC 8174; use the text from there

+ change INFORMATIVE to informative to avoid confusion with the key
  words in the RFCs

Change-Id: I0a3fe9dc48d284e7ac95633896ffb855ecd1a229
2022-08-01 18:42:21 -07:00
James Zern
c151e95bdc utils.h,WEBP_ALIGN: make bitmask unsigned
this fixes runtime warnings with clang -fsanitize=integer when using the
WEBP_ALIGN_CST constant in WEBP_ALIGN:
implicit conversion from type 'int' of value -32 (32-bit, signed) to
type 'unsigned int' changed the value to 4294967264 (32-bit, unsigned)

Bug: b/229626362
Change-Id: I524d80e620b9869de4e6d322b7de6ffa1ec8657f
2022-08-01 13:44:29 -07:00
James Zern
748e92bbb9 add WebPInt32ToMem
and use it in calls containing _mm_cvtsi32_si128; this calls
WebPUint32ToMem, but corrects the type to avoid runtime warnings with
clang -fsanitize=integer of the form:

implicit conversion from type 'int' of value -1904123502 (32-bit,
signed) to type 'uint32_t' (aka 'unsigned int') changed the value to
2390843794 (32-bit, unsigned)

Bug: b/229626362
Change-Id: I20545e822d8045fa44f688241879206055a0a148
2022-08-01 13:44:20 -07:00
Maryla Ustarroz-Calonge
3fe15b6773 Merge "Build libsharpyuv as a full installable library." into main 2022-08-01 13:10:09 +00:00
James Zern
4f402f34a1 add WebPMemToInt32
and use it with calls to _mm_cvtsi32_si128 and _mm_set_epi32; this calls
WebPMemToUint32, but corrects the type to avoid runtime warnings with
clang -fsanitize=integer of the form:

implicit conversion from type 'uint32_t' (aka 'unsigned int') of value
2155905152 (32-bit, unsigned) to type 'int' changed the value to
-2139062144 (32-bit, signed)

Bug: b/229626362
Change-Id: I50101ba2b46dfaa852f02d46830f3511c80b02d9
2022-07-28 22:10:22 -07:00
Maryla
a3b68c195e Build libsharpyuv as a full installable library.
Headers are installed in a "sharpyuv" subdirectory of the webp
dir, e.g. /usr/local/include/webp/sharpyuv/
Remove unnecessary dependency from sharpyuv to webp/types.h

Add SHARPYUV_EXTERN so that only symbols meant to be public
are exported.

Sharpyuv users can use the library with:

find_package(WebP)
if(TARGET WebP::sharpyuv)
  # ... use WebP::sharpyuv
endif()

Change-Id: I602a25521a135a2edc39d6587610484fe6447ec5
2022-07-28 12:31:59 +00:00
James Zern
b4994eaa6d CMake: set rpath for shared objects
this ensures the correct library is loaded when the install path is not
in the default search path; this matches the behavior of
autoconf/libtool

Change-Id: I7eaa458c353cbdb7f0a1f782a879c59662a5de79
2022-07-25 16:48:00 -07:00
James Zern
94cd711779 Merge "CMake: fix dylib versioning" into main 2022-07-25 23:29:50 +00:00
Vincent Rabaud
e91451b69b Fix the lossless specs a bit more.
Bug: webp:551

Change-Id: I03f729f69d660f17e27cc601e91c703b241f1b83
2022-07-25 22:36:51 +02:00
James Zern
231bdfb762 CMake: fix dylib versioning
match the behavior of autoconf in generating the -compatibility_version
and -current_version options. these use current + 1 and revision:
  # Darwin ld doesn't like 0 for these options...
  func_arith $current + 1
  minor_current=$func_arith_result
  ...
  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"

this requires CMake >= 3.17 to set the MACHO_COMPATIBILITY_VERSION and
MACHO_CURRENT_VERSION properties:
https://cmake.org/cmake/help/latest/prop_tgt/MACHO_COMPATIBILITY_VERSION.html

based on the fix in libexpat:
https://github.com/libexpat/libexpat/issues/55

Bug: webp:576
Fixed: webp:576
Change-Id: Ibc3ab99449aa213fc8c2ca3ae06def648c61acbd
2022-07-22 11:39:18 -07:00
James Zern
bfad7ab589 CMakeLists.txt: correct libwebpmux name in WebPConfig.cmake
this fixes link errors when using ${WEBP_LIBRARIES} from
WebPConfig.cmake:
/usr/bin/ld: cannot find -llibwebpmux: No such file or directory
/usr/bin/ld: note to link with /tmp/install/lib/libwebpmux.a use
-l:libwebpmux.a or rename it to liblibwebpmux.a

previously mentioned in https://github.com/openwrt/packages/pull/16784

Bug: webp:575
Change-Id: I38b45cb102ef1086ed992178cd736f45acf10d35
2022-07-21 19:12:38 -07:00