Commit Graph

4368 Commits

Author SHA1 Message Date
Maryla Ustarroz-Calonge
20ef48f05a Merge "sharpyuv: add support for 10/12/16 bit rgb and 10/12 bit yuv." into main 2022-05-24 11:05:08 +00:00
Maryla
93c5437115 sharpyuv: add support for 10/12/16 bit rgb and 10/12 bit yuv.
10bit+ input is truncated to 10bits for now.

Change-Id: I7ac00ca54c623d94c76ccd8954418e11095997d2
2022-05-23 20:48:44 +02:00
James Zern
53cf2b4997 normalize WebPValidatePicture declaration w/definition
quiets a warning under visual studio:
src\enc\picture_enc.c(48) : warning C4028: formal parameter 1 different
from declaration

Change-Id: Ic3affbbb0e22ac8c43fa183e13506eee72e180dc
2022-05-17 09:46:51 -07:00
Maryla
d3006f4b96 sharpyuv: slightly improve precision
- Remove SHALF constant so that we get back the original value when
  calling UpScale then downscale with rounding
- Make the linear->gamma precomputed table bigger (8 bits rather than 5)
- Round values in kLinearToGammaTabS

Change-Id: Ic9634d32cf93de321d2f6e9e4cad7f156d8d07df
2022-05-17 10:36:44 +02:00
James Zern
ea967098a4 Merge changes Ia01bd397,Ibf3771af into main
* changes:
  Add an internal WebPValidatePicture.
  Some renamings for consistency.
2022-05-16 17:49:04 +00:00
James Zern
11bc8410bd Merge changes I2d317c4b,I9e77f6db into main
* changes:
  webp-lossless-bitstream-spec,cosmetics: normalize range syntax
  webp-lossless-bitstream-spec,cosmetics: fix code typo
2022-05-16 17:17:22 +00:00
Vincent Rabaud
30453ea4e6 Add an internal WebPValidatePicture.
Change-Id: Ia01bd3975f7bd0d47eb0a1764807baed16f0d268
2022-05-16 17:37:20 +02:00
Vincent Rabaud
6c43219a5f Some renamings for consistency.
- pic->picture in public header
- match implementation to declaration in PictureImport, WebPPictureRescale, WebpBlendAlpha

Change-Id: Ibf3771af22d671bba6fd657684add618c6f32978
2022-05-16 17:33:49 +02:00
James Zern
4f59fa7390 update .mailmap
Change-Id: I246d84d735bc0efada544a9051ddcb3c3a7ceabf
2022-05-14 20:57:41 -07:00
James Zern
e74f8a62b2 webp-lossless-bitstream-spec,cosmetics: normalize range syntax
[N, M] -> [N..M] the latter is more common in this doc

Bug: webp:551
Change-Id: I2d317c4b8bb31d313123e981f93cd1feb346a98a
2022-05-14 20:51:43 -07:00
James Zern
5a709ec0d7 webp-lossless-bitstream-spec,cosmetics: fix code typo
code_lengths -> code_length_code_lengths
after:
86f94ee0 Update lossless spec with Huffman codes.

Bug: webp:551
Change-Id: I9e77f6db0fca6fe8294cb31a3015e723050094b5
2022-05-14 20:51:34 -07:00
James Zern
a2093acc4b webp-lossless-bitstream-spec: add amendment note
for recent changes to color transform, simple code length code, image
structure and details of decoding prefix codes

Bug: webp:551
Change-Id: I36a4d1ee3e25b8a56f5d926f4770374ace99bc2f
2022-05-13 18:50:55 -07:00
James Zern
86c669303a webp-lossless-bitstream-spec: fix BNF
color cache info precedes the meta huffman info

Bug: webp:551
Change-Id: Ibb69b4ffad6bff5693015be3fe6c600c53fd06c0
2022-05-13 18:41:30 -07:00
James Zern
232f22da5a webp-lossless-bitstream-spec: fix 'simple code' snippet
based on https://crbug.com/webp/551#c3 & https://crbug.com/webp/551#c4

Bug: webp:551
Change-Id: I4bcc19643b0bdda999247e9c3457d6954a49e35f
2022-05-13 18:41:20 -07:00
James Zern
44dd765def webp-lossless-bitstream-spec: fix ColorTransform impl
and the corresponding InverseTransform(); the operations were swapped.
The forward transform subtracts the deltas, the inverse adds them.

Bug: webp:551
Change-Id: Ieb90a24f843cee7cdfe46cbb15ec7d716ca9d269
2022-05-13 18:33:16 -07:00
James Zern
7a7e33e977 webp-lossless-bitstream-spec: fix TR-pixel right border note
the value of the TR-pixel on the right border is the leftmost pixel on
the current row, not the previous one

Bug: webp:551
Change-Id: I157e8c16ce43a9f52c36aa880be1be3bef19c063
2022-05-13 16:48:23 -07:00
vrabaud@google.com
86f94ee010 Update lossless spec with Huffman codes.
Bug: webp:551
Change-Id: I28b57c8e87a8023b727fe8359c2e2809cf92752d
2022-05-13 16:42:00 -07:00
James Zern
a3927cc800 sharpyuv.c,cosmetics: fix indent
+ a few typos in sharpyuv_csp.c

Change-Id: I34b208d10d7808b42afb39b0618fb2e5d76633eb
2022-05-11 11:53:25 -07:00
Vincent Rabaud
6c45cef7ff Make sure the stride has a minimum value in the importer.
Bug: webp:569
Change-Id: Ia48d064dbb10e7179ae3da04ca8d769d1c447276
2022-05-10 10:18:46 +02:00
Maryla
0c8b0e67a4 sharpyuv: cleanup/cosmetic changes
Remove unused constants.
Use ALL_CAPS for defines and kCamelCase for static const values.
Change some defines into static constants if they are not used in array sizes.

Change-Id: I036b0f99215fd0414a33f099bd6b809ff8ee4541
2022-05-09 15:10:14 +02:00
James Zern
dc3841e077 {histogram,predictor}_enc: quiet int -> float warnings
after:
a19a25bb Replace doubles by floats in lossless misc cost estimations.

Change-Id: Idc5888b40ce5b591b72c6e51a188a9ab8c5d9823
2022-04-20 10:10:27 -07:00
Vincent Rabaud
a19a25bb03 Replace doubles by floats in lossless misc cost estimations.
Doubles are slower and use more RAM for no benefit.

Change-Id: I05b313576f9b33388c7c39d7fed8de84170c3753
2022-04-17 21:07:54 +02:00
Vincent Rabaud
42888f6c7c Add an option to enable static builds.
The build is not fully static but enough for certain usage.

Change-Id: I269fa40f332365873634b12ac54fd3c36beefd66
2022-04-12 17:50:19 +02:00
James Zern
7efcf3cc26 Merge "Fix typo in color constants: Marix -> Matrix" into main 2022-04-12 05:08:08 +00:00
Frank Barchard
8f4b5c62b7 Fix typo in color constants: Marix -> Matrix
Change-Id: Ia5dc8b37ea7ddbb3dba923e24ef07633edb822eb
2022-04-11 14:54:43 -07:00
James Zern
90084d84f9 Merge "demux,IsValidExtendedFormat: remove unused variable" into main 2022-04-11 20:29:24 +00:00
James Zern
ed643f619d Merge changes I452d2485,Ic6d75475 into main
* changes:
  SharpYuvComputeConversionMatrix: quiet int->float warnings
  Makefile.vc: add sharpyuv_csp.obj to SHARPYUV_OBJS
2022-04-11 18:54:25 +00:00
Maryla
8fa053d134 Rename SharpYUV to SharpYuv for consistency.
Change-Id: I21df96b4c8f8fa97bfd2ac9c806c7e5119b55691
2022-04-11 11:55:10 +02:00
James Zern
99a8756201 SharpYuvComputeConversionMatrix: quiet int->float warnings
under some versions of visual studio:
sharpyuv\sharpyuv_csp.c(43): warning C4244: '=': conversion from 'int' to
'float', possible loss of data
sharpyuv\sharpyuv_csp.c(35): warning C4244: 'initializing': conversion from
'int' to 'float', possible loss of data

Change-Id: I452d24857b43b8a80fae0f339163b4b3965f2d9f
2022-04-09 11:07:09 -07:00
James Zern
deb426becc Makefile.vc: add sharpyuv_csp.obj to SHARPYUV_OBJS
missed in:
01a05de1a libsharpyuv: add colorspace utilities

Change-Id: Ic6d754757a54dc098d5c761f03480a3766d60db6
2022-04-09 11:06:17 -07:00
brianpl@google.com
779597d443 demux,IsValidExtendedFormat: remove unused variable
quiets -Wunused-but-set-variable

frame_count has been unused in this function since:
ab714b8a demux, Frame: remove is_fragment_ field

Change-Id: Ie6afda915c6b82736e05e7490eba0165c3dd37e4
2022-04-08 15:28:05 -07:00
Maryla Ustarroz-Calonge
40e8aa57f8 Merge "libsharpyuv: add colorspace utilities" into main 2022-04-08 09:06:23 +00:00
Maryla
01a05de1a7 libsharpyuv: add colorspace utilities
Change-Id: I620c8593dc81f39e747de5ed354332adb7278bed
2022-04-08 10:07:22 +02:00
James Zern
2de4b05a56 Merge changes Id9890a60,I376d81e6,I1c958838 into main
* changes:
  GetBackwardReferences: fail on alloc error
  BackwardReferencesHashChainDistanceOnly: fix segfault on OOM
  VP8LEncodeStream: fix segfault on OOM
2022-04-06 20:04:25 +00:00
James Zern
b8bca81fb6 Merge "configure.ac: use LT_INIT if available" into main 2022-04-05 16:47:37 +00:00
Pascal Massimino
e8e77b9c47 Merge changes I479bc487,I39864691,I5d486c2c,I186d13be into main
* changes:
  mux{edit,internal}: fix leaks on error
  ExUtilInitCommandLineArguments: fix leak on error
  anim_util: fix leaks on error
  gif2webp: fix segfault on OOM
2022-04-05 05:51:53 +00:00
James Zern
7e7d5d503a Merge ".gitignore: add Android Studio & VS code dirs" into main 2022-04-04 22:27:07 +00:00
James Zern
10c5084842 normalize label indent
1 space is most common in the source; this fixes some mixed cases within
lossless files, likely from clang-format

Change-Id: I504206d5bf418781d4131ee73570ecee4e0a69a1
2022-04-04 12:47:41 -07:00
James Zern
89f774e61d mux{edit,internal}: fix leaks on error
several calls to ChunkSetHead() were unchecked, causing the chunk to
leak should the call fail due to OOM

Tested:
for i in `seq 1 1125`; do
  export MALLOC_FAIL_AT=$i
  ./examples/gif2webp gif_file
  ./examples/gif2webp -mixed gif_file
done
for i in `seq 1 171`; do
  export MALLOC_FAIL_AT=$i
  ./examples/img2webp jpeg_file -o /dev/null
  ./examples/img2webp -mixed jpeg_file -o /dev/null
done

Change-Id: I479bc487f61b493e5ce033872d353007055c172a
2022-04-04 11:26:25 -07:00
James Zern
2d3293ad76 ExUtilInitCommandLineArguments: fix leak on error
argv_data would leak if the argv_ allocation failed or the MAX_ARGC cap
was hit

Tested:
for i in `seq 1 171`; do
  export MALLOC_FAIL_AT=$i
  ./examples/img2webp jpeg_file -o /dev/null
  ./examples/img2webp -mixed jpeg_file -o /dev/null
done

Change-Id: I39864691e96d5456f324d95a3653bba0f6d6a7be
2022-04-04 11:26:25 -07:00
James Zern
ec34fd7023 anim_util: fix leaks on error
in ReadAnimatedWebP() & ReadAnimatedGIF() when AllocateFrames() fails
due to OOM

Tested:
for i in `seq 1 278`; do
  export MALLOC_FAIL_AT=$i
  ./examples/anim_diff webp1 webp2
  ./examples/anim_diff gif1 gif2
done

Change-Id: I5d486c2c2982ae088e34a25d8e3e0188df1a9b51
2022-04-04 11:26:25 -07:00
James Zern
e471728754 gif2webp: fix segfault on OOM
previously calls to WebPPictureCopy() weren't checked, causing a crash
when the canvas copies were accessed later in the loop

Tested:
for i in `seq 1 1125`; do
  export MALLOC_FAIL_AT=$i
  ./examples/gif2webp gif_file
  ./examples/gif2webp -mixed gif_file
done

Change-Id: I186d13be0ec8f3b72b7d247a8482590c1b1be541
2022-04-04 11:26:12 -07:00
James Zern
e3cfafaf71 GetBackwardReferences: fail on alloc error
previously failures in the call to
VP8LBackwardReferencesTraceBackwards() would be ignored which, though it
wouldn't result in a crash, would produce non-deterministic output

Change-Id: Id9890a60883c3270ec75e968506d46eea32b76d4
2022-04-04 11:24:06 -07:00
James Zern
a828a59b49 BackwardReferencesHashChainDistanceOnly: fix segfault on OOM
change CostManager to calloc to avoid frees on undefined pointer
values in CostManagerClear() should the cost_model allocation succeed,
but the cost_manager allocation fail

since:
v0.5.0-93-g3e023c17 Speed-up BackwardReferencesHashChainDistanceOnly.

Tested:
for i in `seq 1 639`; do
  export MALLOC_FAIL_AT=$i
  ./examples/cwebp -m 6 -q 100 -lossless jpeg_file
done

Bug: webp:565
Change-Id: I376d81e6f41eb73529053e9e30c142b4b4f6b45b
2022-04-04 11:23:39 -07:00
James Zern
fe153fae98 VP8LEncodeStream: fix segfault on OOM
initialize bw_side before calling EncoderAnalyze() & EncoderInit() which
may fail; previously this would cause a free of an invalid pointer in
VP8LBitWriterWipeOut().

since at least:
v0.6.0-120-gf8c2ac15 Multi-thread the lossless cruncher.

Tested:
for i in `seq 1 639`; do
  export MALLOC_FAIL_AT=$i
  ./examples/cwebp -m 6 -q 100 -lossless jpeg_file
done

Bug: webp:565
Change-Id: I1c95883834b6e4b13aee890568ce3bad0f4266f0
2022-04-04 11:21:30 -07:00
James Zern
919acc0ef5 .gitignore: add Android Studio & VS code dirs
Change-Id: I0a8b8124f568df1a4e6bbf96e5a1144b2e7606a1
2022-04-04 10:28:06 -07:00
James Zern
efa0731b9d configure.ac: use LT_INIT if available
AC_PROG_LIBTOOL is deprecated. quiets a warning from autoconf 2.71:
configure.ac:12: warning: The macro `AC_PROG_LIBTOOL' is obsolete.

Change-Id: I3b131f5ee636a8df48057862e600759f25ad7289
2022-04-04 10:25:26 -07:00
James Zern
0957fd69ee tiffdec: add grayscale support
the file is always decoded to RGBA, so just the samples_per_px needed an
update

Bug: webp:563
Change-Id: I95d95c3b9e45dc8ecb2223f89f4ba791f0b21e8b
2022-03-31 21:43:29 -07:00
Maryla Ustarroz-Calonge
e685feef0c Merge "Make libsharpyuv self-contained by removing dependency on cpu.c" into main 2022-03-31 09:04:06 +00:00
Maryla
841960b670 Make libsharpyuv self-contained by removing dependency on cpu.c
Change-Id: I2edac1afa38bfddf2a91e7829e38425bd3519feb
2022-03-30 15:04:35 +02:00