Compare commits

..

36 Commits
1.0.3 ... 1.1.0

Author SHA1 Message Date
50f60add5c Fix OOB write in BuildHuffmanTable.
First, BuildHuffmanTable is called to check if the data is valid.
If it is and the table is not big enough, more memory is allocated.

This will make sure that valid (but unoptimized because of unbalanced
codes) streams are still decodable.

Bug: chromium:1479274
Change-Id: I31c36dbf3aa78d35ecf38706b50464fd3d375741
(cherry picked from commit 902bc91903)
(cherry picked from commit 2af26267cd)
2023-09-07 15:40:16 -07:00
5df85e9c0b EncodeAlphaInternal: clear result->bw on error
This avoids a double free should the function fail prior to
VP8BitWriterInit() and a previous trial result's buffer carried over.
Previously in ApplyFiltersAndEncode() trial.bw (with a previous
iteration's buffer) would be freed, followed by best.bw pointing to the
same buffer.

Since:
187d379d add a fallback to ALPHA_NO_COMPRESSION

In addition, check the return value of VP8BitWriterInit() in this
function.

Bug: webp:603
Change-Id: Ic258381ee26c8c16bc211d157c8153831c8c6910
(cherry picked from commit a486d800b6)
2023-02-28 00:26:34 +00:00
89e226a3c7 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
(cherry picked from commit e3cfafaf71)
(cherry picked from commit 20ef03ee35)
2022-04-06 21:55:27 -07:00
4d0964cd0c 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
(cherry picked from commit a828a59b49)
(cherry picked from commit dd80bb4343)
2022-04-06 21:50:21 -07:00
5d805f7205 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
(cherry picked from commit fe153fae98)
(cherry picked from commit ddd65f0d19)
2022-04-06 21:50:21 -07:00
b14eba6497 alpha_processing_neon.c: fix 0x01... typo
one instance was overlong leading to a int64->uint32 conversion warning

Change-Id: I56d5ab75d89960c79293f62cd489d7ab519bbc34
(cherry picked from commit 03d1219055)
2022-03-08 19:37:04 +00:00
9183ff2ef9 alpha_processing_neon.c: fix Dispatch/ExtractAlpha_NEON
the trailing width % 8 bytes would clear the upper bytes of
alpha_mask as they're done one at a time

since:
49d0280d NEON: implement several alpha-processing functions

Change-Id: Iff76c0af3094597285a6aa6ed032b345f9856aae
(cherry picked from commit 924e7ca654)
2022-03-03 18:06:24 +00:00
68d52453cd Fix lossless encoding for MIPS.
Bug: webp:558
Change-Id: I3d3ddb64ed26a8d8ff5664664c5f20f6eadfeb4f
(cherry picked from commit e4cbcdd2b5)
2022-03-02 02:56:13 +00:00
d7844e9762 update ChangeLog
BUG=webp:441

Change-Id: Ib401d468c677b9e598ffcec6535a846bf2456a4f
2019-12-21 05:37:43 -08:00
7f0064361a Makefile.vc: fix webp_quality.exe link
when building a dll based libwebp include the dsp private symbols that
WebPUnmultiplyARGB requires

Change-Id: I7cf7da0b20d6cf6740219c8562380926a0abd93c
(cherry picked from commit cf047e8347)
2019-12-20 16:29:22 -05:00
c074c65368 update NEWS
BUG=webp:441

Change-Id: I8586b004e28b92d8c3c146f681bc9765f8a1f361
2019-12-18 00:06:50 -08:00
30f0955160 bump version to 1.1.0
libwebp{,decoder} - 1.1.0
libwebp libtool - 8.0.1
libwebpdecoder libtool - 4.0.1

mux - 1.1.0
libtool - 3.5.0

demux - 1.1.0
libtool - 2.6.0 (no code change)

BUG=webp:441

Change-Id: I458940f407515e0d95d20bbfd670ee29255c12eb
2019-12-18 00:06:50 -08:00
a76694a1d6 update AUTHORS
BUG=webp:441

Change-Id: I844f1e4b5c32219a1e54de0c57a73822f93c7755
2019-12-18 00:06:50 -08:00
6e3ef7b326 extras: fix WEBP_SWAP_16BIT_CSP check
this is defined to 0 by dsp.h if it wasn't defined previously, since:
47178dbd extras: add WebPUnmultiplyARGB() convenience function

Change-Id: If4dd48360a95b2786410670cff5ac655227fb6dd
2019-12-18 07:15:53 +00:00
47178dbd45 extras: add WebPUnmultiplyARGB() convenience function
This is useful for converting associated to unassociated.

Change-Id: I0e6d16ec63cb5514a0f945c14a54e0d01e1fab0a
2019-12-17 17:36:37 -08:00
22cbae33e5 idec_dec: fix 0 offset of NULL pointer
in RemapMemBuffer() and AppendToMemBuffer()

BUG=chromium:1028716,chromium:1027136

Change-Id: Ibc321d233b6207be3cb5cef4d9e8a60498e32457
2019-12-14 17:14:30 -08:00
290dd0b426 muxread: fix 0 offset of NULL pointer
BUG=chromium:1028620,chromium:1027409

Change-Id: I2b5527a223a03161afbf39c297c4646954a91fbc
2019-12-14 12:57:39 -08:00
0df474ac9e Merge "lossless_(enc_|)sse2: avoid offsetting a NULL pointer" 2019-12-13 22:04:44 +00:00
c6b75a1966 lossless_(enc_|)sse2: avoid offsetting a NULL pointer
PredictorSub0_SSE2 doesn't use 'upper' (neither does
VP8LPredictorsSub_C[0]); just pass NULL when dealing with trailing
pixels to avoid undefined behavior when offsetting a NULL pointer

BUG=chromium:1026858,oss-fuzz:19430

Change-Id: I08be8899ed2e34f26aaee34defe68dbd0fe216d3
2019-12-13 18:33:10 +00:00
295e5e3801 fix UBSAN warning
"applying non-zero offset 2044 to null pointer"

  Fixes chromium bug #19447

Change-Id: I530ae27dc64e92ed0018f36469264c448329e042
2019-12-13 13:26:16 +00:00
e2575e05cb DC8_NEON,aarch64: use vaddv
results in one fewer instruction for both DC8uv_NEON and
DC8uvNoLeft_NEON

Change-Id: Ia4e6f4dbc070079cdc2496a698bd4b34198ea164
2019-12-06 09:38:48 -08:00
b0e09e346f dec_neon: Fix build failure under some toolchains
some toolchains may implement vcreate_u64 as an assignment to a vector
causing a type mismatch:
 invalid conversion between vector type 'uint64x1_t' (vector of 1
'uint64_t' value) and integer type 'unsigned int' of different size
  const uint64x1_t LKJI____ = vcreate_u64(L | (K << 8) | (J << 16) | (I << 24));
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Change-Id: I5c7b0076ad66d4b3fcdcb7ee9f59bbaa6f19b783
2019-12-06 00:06:44 -08:00
cf0e903c89 dsp/lossless: Fix non gcc ARM builds
The workaround for GCC ARM must not be applied when another toolchain
(like MSVC) is used for the build.

Change-Id: I11ec4558902063ccb085d3f435e24b3a60739dd5
2019-11-27 15:05:08 +01:00
bb7bc40b6d Remove ubsan errors.
'upper' could be NULL and it would be increased.
But that is for predictor zero that does not use 'upper'.

Change-Id: Icd4ae6792cc55ea021b4f828c3dbdb5f03e120d8
2019-11-06 14:08:14 +01:00
78881b769c CMake: fix GLUT library link
use GLUT_LIBRARIES instead of GLUT::GLUT

Change-Id: I92af90e09e00b01bd050ebeb8e9003b14c7dc144
2019-10-23 16:25:39 +02:00
9f750f7a06 cmake: fix BUILD_SHARED_LIBS build on mac
add some missing dependencies and convert utility libraries to
static only libraries to avoid creating unnecessary shared object
libraries which may fail to link due to missing symbols.

Change-Id: Iaa91a3d97fa5af6ada4b2a851cc7fc2879d871da
2019-10-22 14:42:30 -07:00
17850e74ce libwebp: Remove char-subscripts warning in pnmdec.c
Change-Id: I7a771e17fca0ba8a49a816b48cc477ad7a03a435
2019-10-16 17:58:30 +02:00
2fa2552db1 Merge "Expose WebPMalloc() in addition to WebPFree()" 2019-10-16 05:48:18 +00:00
a4df4aae73 Expose WebPMalloc() in addition to WebPFree()
and use it at various places, including for WebPData.

This is an API change!

Change-Id: Ic041323a1179c465292a4f981a86c4c34635d243
2019-10-15 23:19:50 +02:00
853ea3d846 imageio/tiff: Return error before allocating bad tile size
Change-Id: I5820b808e25beeda0fd4e755b62da0caabe48d8d
2019-10-15 10:44:17 +02:00
af650c0bd2 Fix a Wxor-used-as-pow false positive
Since people seem to write "2 ^ X" hoping that it means "1 << X", clang
recently added a warning for this pattern.

It incorrectly fires on this file. To suppress it, restructure the code
to be less clever. (Alternatively we could use "xor" instead of "^" or
write "0x2" instead of "2" but both seem worse.)

No intended behavior change.

Bug: chromium:995200
Change-Id: I64744345be5f5a8cd1f4aaeaf0982da239b378a7
2019-09-04 23:35:46 -07:00
601ef17cf6 libwebp.py: update to swig 3.0.12
fixes use with python 3

Change-Id: I4035c1c93e9f6551dd2e7e57da7d4ffd42ca06ce
2019-08-31 19:20:58 -07:00
0e48d889eb bugfix: last alpha rows were incorrectly decoded
sometimes, the last rows of the alpha plane contain more than NUM_ARGB_CACHE_ROWS
rows to process. But ExtractAlphaRows() was repeatedly calling ApplyInverseTransforms()
without updating the dec->last_row_ field, which is the starting row used as starting
point.

Fix would consist of either updating correctly dec->last_row_ before calling
ApplyInverseTransforms(). Or pass the starting row explicitly, which is simpler.

BUG=webp:439

Change-Id: Id99f2c28662d02b2b866cb79e666050be9d59e04
2019-08-30 14:13:28 +02:00
24d2ccb4e0 webp: Fix imageio ReadPNM() TUPLTYPE
It was colliding with "DEPTH" header value so ignoring "TUPLTYPE"
except for unhandled types.

Change-Id: I3c69cb6a81c5369e64b59d50567cd7fbc1756d57
2019-07-30 09:22:29 +02:00
fab8f9cfcf cosmetics: normalize '*' association
we associate '*' with types rather than variables

Change-Id: Id93ed65272a8a88e604278693e3850649639e9b6
2019-07-26 01:04:09 -07:00
94138e0e0d update .gitignore
anim_dump, webpinfo, vwebp_sdl

Change-Id: I66043c9c296fae2319ec9b0acf3031543cb070bd
2019-07-13 00:52:46 -07:00
59 changed files with 397 additions and 236 deletions

3
.gitignore vendored
View File

@ -20,9 +20,11 @@
Makefile Makefile
Makefile.in Makefile.in
examples/anim_diff examples/anim_diff
examples/anim_dump
examples/[cdv]webp examples/[cdv]webp
examples/gif2webp examples/gif2webp
examples/img2webp examples/img2webp
examples/webpinfo
examples/webpmux examples/webpmux
src/webp/config.h* src/webp/config.h*
src/webp/stamp-h1 src/webp/stamp-h1
@ -38,4 +40,5 @@ cmake_install.cmake
.gradle .gradle
/build /build
extras/get_disto extras/get_disto
extras/vwebp_sdl
extras/webp_quality extras/webp_quality

View File

@ -2,6 +2,7 @@ Contributors:
- Aidan O'Loan (aidanol at gmail dot com) - Aidan O'Loan (aidanol at gmail dot com)
- Alan Browning (browning at google dot com) - Alan Browning (browning at google dot com)
- Charles Munger (clm at google dot com) - Charles Munger (clm at google dot com)
- Cheng Yi (cyi at google dot com)
- Christian Duvivier (cduvivier at google dot com) - Christian Duvivier (cduvivier at google dot com)
- Djordje Pesut (djordje dot pesut at imgtec dot com) - Djordje Pesut (djordje dot pesut at imgtec dot com)
- Hui Su (huisu at google dot com) - Hui Su (huisu at google dot com)
@ -21,6 +22,7 @@ Contributors:
- Mislav Bradac (mislavm at google dot com) - Mislav Bradac (mislavm at google dot com)
- Nico Weber (thakis at chromium dot org) - Nico Weber (thakis at chromium dot org)
- Noel Chromium (noel at chromium dot org) - Noel Chromium (noel at chromium dot org)
- Oliver Wolff (oliver dot wolff at qt dot io)
- Owen Rodley (orodley at google dot com) - Owen Rodley (orodley at google dot com)
- Parag Salasakar (img dot mips1 at gmail dot com) - Parag Salasakar (img dot mips1 at gmail dot com)
- Pascal Massimino (pascal dot massimino at gmail dot com) - Pascal Massimino (pascal dot massimino at gmail dot com)

View File

@ -349,20 +349,21 @@ if(WEBP_BUILD_ANIM_UTILS
parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "EXAMPLEUTIL_SRCS" parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "EXAMPLEUTIL_SRCS"
"example_util_[^ ]*") "example_util_[^ ]*")
list(APPEND EXAMPLEUTIL_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/examples/stopwatch.h) list(APPEND EXAMPLEUTIL_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/examples/stopwatch.h)
add_library(exampleutil ${EXAMPLEUTIL_SRCS}) add_library(exampleutil STATIC ${EXAMPLEUTIL_SRCS})
target_link_libraries(exampleutil imageioutil)
target_include_directories( target_include_directories(
exampleutil exampleutil
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>) PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>)
parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/imageio "IMAGEIOUTILS_SRCS" parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/imageio "IMAGEIOUTILS_SRCS"
"imageio_util_[^ ]*") "imageio_util_[^ ]*")
add_library(imageioutil ${IMAGEIOUTILS_SRCS}) add_library(imageioutil STATIC ${IMAGEIOUTILS_SRCS})
target_link_libraries(imageioutil webp) target_link_libraries(imageioutil webp)
# Image-decoding utility library. # Image-decoding utility library.
parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/imageio "IMAGEDEC_SRCS" parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/imageio "IMAGEDEC_SRCS"
"imagedec_[^ ]*") "imagedec_[^ ]*")
add_library(imagedec ${IMAGEDEC_SRCS}) add_library(imagedec STATIC ${IMAGEDEC_SRCS})
target_link_libraries(imagedec target_link_libraries(imagedec
imageioutil imageioutil
webpdemux webpdemux
@ -372,8 +373,8 @@ if(WEBP_BUILD_ANIM_UTILS
# Image-encoding utility library. # Image-encoding utility library.
parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/imageio "IMAGEENC_SRCS" parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/imageio "IMAGEENC_SRCS"
"imageenc_[^ ]*") "imageenc_[^ ]*")
add_library(imageenc ${IMAGEENC_SRCS}) add_library(imageenc STATIC ${IMAGEENC_SRCS})
target_link_libraries(imageenc webp) target_link_libraries(imageenc imageioutil webp)
set_property(TARGET exampleutil set_property(TARGET exampleutil
imageioutil imageioutil
@ -466,12 +467,12 @@ if(WEBP_BUILD_VWEBP)
target_link_libraries(vwebp target_link_libraries(vwebp
${OPENGL_LIBRARIES} ${OPENGL_LIBRARIES}
exampleutil exampleutil
GLUT::GLUT ${GLUT_glut_LIBRARY}
imageioutil imageioutil
webp webp
webpdemux) webpdemux)
target_include_directories(vwebp target_include_directories(vwebp
PRIVATE GLUT::GLUT PRIVATE ${GLUT_INCLUDE_DIR}
${CMAKE_CURRENT_BINARY_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/src
${OPENGL_INCLUDE_DIR}) ${OPENGL_INCLUDE_DIR})
install(TARGETS vwebp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS vwebp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
@ -524,7 +525,9 @@ if(WEBP_BUILD_EXTRAS)
# webp_quality # webp_quality
add_executable(webp_quality ${WEBP_QUALITY_SRCS} ${WEBP_EXTRAS_SRCS}) add_executable(webp_quality ${WEBP_QUALITY_SRCS} ${WEBP_EXTRAS_SRCS})
target_link_libraries(webp_quality exampleutil imagedec) target_link_libraries(webp_quality exampleutil imagedec)
target_include_directories(webp_quality PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(webp_quality
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR})
install(TARGETS webp_quality RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS webp_quality RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
# vwebp_sdl # vwebp_sdl

View File

@ -1,3 +1,31 @@
7f006436 Makefile.vc: fix webp_quality.exe link
c074c653 update NEWS
30f09551 bump version to 1.1.0
a76694a1 update AUTHORS
6e3ef7b3 extras: fix WEBP_SWAP_16BIT_CSP check
47178dbd extras: add WebPUnmultiplyARGB() convenience function
22cbae33 idec_dec: fix 0 offset of NULL pointer
290dd0b4 muxread: fix 0 offset of NULL pointer
0df474ac Merge "lossless_(enc_|)sse2: avoid offsetting a NULL pointer"
c6b75a19 lossless_(enc_|)sse2: avoid offsetting a NULL pointer
295e5e38 fix UBSAN warning
e2575e05 DC8_NEON,aarch64: use vaddv
b0e09e34 dec_neon: Fix build failure under some toolchains
cf0e903c dsp/lossless: Fix non gcc ARM builds
bb7bc40b Remove ubsan errors.
78881b76 CMake: fix GLUT library link
9f750f7a cmake: fix BUILD_SHARED_LIBS build on mac
17850e74 libwebp: Remove char-subscripts warning in pnmdec.c
2fa2552d Merge "Expose WebPMalloc() in addition to WebPFree()"
a4df4aae Expose WebPMalloc() in addition to WebPFree()
853ea3d8 imageio/tiff: Return error before allocating bad tile size
af650c0b Fix a Wxor-used-as-pow false positive
601ef17c libwebp.py: update to swig 3.0.12
0e48d889 bugfix: last alpha rows were incorrectly decoded
24d2ccb4 webp: Fix imageio ReadPNM() TUPLTYPE
fab8f9cf cosmetics: normalize '*' association
94138e0e update .gitignore
0fe1a89d update ChangeLog (tag: v1.0.3-rc1, tag: v1.0.3)
2ad0916d update NEWS 2ad0916d update NEWS
1287362b bump version to 1.0.3 1287362b bump version to 1.0.3
7b968cc2 update AUTHORS 7b968cc2 update AUTHORS

View File

@ -391,7 +391,13 @@ $(DIRBIN)\get_disto.exe: $(IMAGEIO_DEC_OBJS) $(IMAGEIO_UTIL_OBJS)
$(DIRBIN)\get_disto.exe: $(LIBWEBPDEMUX) $(LIBWEBP) $(DIRBIN)\get_disto.exe: $(LIBWEBPDEMUX) $(LIBWEBP)
$(DIRBIN)\webp_quality.exe: $(DIROBJ)\extras\webp_quality.obj $(DIRBIN)\webp_quality.exe: $(DIROBJ)\extras\webp_quality.obj
$(DIRBIN)\webp_quality.exe: $(IMAGEIO_UTIL_OBJS) $(DIRBIN)\webp_quality.exe: $(IMAGEIO_UTIL_OBJS)
$(DIRBIN)\webp_quality.exe: $(EXTRAS_OBJS) $(LIBWEBP) $(DIRBIN)\webp_quality.exe: $(EXTRAS_OBJS)
# EXTRA_OBJS requires private symbols from dsp. Explicitly add those when
# building libwebp as a dll.
!IF "$(DLLBUILD)" == "TRUE"
$(DIRBIN)\webp_quality.exe: $(DSP_DEC_OBJS)
!ENDIF
$(DIRBIN)\webp_quality.exe: $(LIBWEBP)
$(DIRBIN)\webpinfo.exe: $(DIROBJ)\examples\webpinfo.obj $(DIRBIN)\webpinfo.exe: $(DIROBJ)\examples\webpinfo.obj
$(DIRBIN)\webpinfo.exe: $(IMAGEIO_DEC_OBJS) $(DIRBIN)\webpinfo.exe: $(IMAGEIO_DEC_OBJS)
$(DIRBIN)\webpinfo.exe: $(EX_UTIL_OBJS) $(IMAGEIO_UTIL_OBJS) $(DIRBIN)\webpinfo.exe: $(EX_UTIL_OBJS) $(IMAGEIO_UTIL_OBJS)

11
NEWS
View File

@ -1,3 +1,14 @@
- 12/18/2019: version 1.1.0
* API changes:
- libwebp:
WebPMalloc (issue #442)
- extras:
WebPUnmultiplyARGB
* alpha decode fix (issue #439)
* toolchain updates and bug fixes
(chromium: #1026858, #1027136, #1027409, #1028620, #1028716, #995200)
(oss-fuzz: #19430, #19447)
- 7/4/2019: version 1.0.3 - 7/4/2019: version 1.0.3
This is a binary compatible release. This is a binary compatible release.
* resize fixes for Nx1 sizes and the addition of non-opaque alpha values for * resize fixes for Nx1 sizes and the addition of non-opaque alpha values for

2
README
View File

@ -4,7 +4,7 @@
\__\__/\____/\_____/__/ ____ ___ \__\__/\____/\_____/__/ ____ ___
/ _/ / \ \ / _ \/ _/ / _/ / \ \ / _ \/ _/
/ \_/ / / \ \ __/ \__ / \_/ / / \ \ __/ \__
\____/____/\_____/_____/____/v1.0.3 \____/____/\_____/_____/____/v1.1.0
Description: Description:
============ ============

View File

@ -1,7 +1,7 @@
 __ __ ____ ____ ____ __ __ _ __ __  __ __ ____ ____ ____ __ __ _ __ __
/ \\/ \/ _ \/ _ \/ _ \/ \ \/ \___/_ / _\ / \\/ \/ _ \/ _ \/ _ \/ \ \/ \___/_ / _\
\ / __/ _ \ __/ / / (_/ /__ \ / __/ _ \ __/ / / (_/ /__
\__\__/\_____/_____/__/ \__//_/\_____/__/___/v1.0.3 \__\__/\_____/_____/__/ \__//_/\_____/__/___/v1.1.0
Description: Description:

View File

@ -1,4 +1,4 @@
AC_INIT([libwebp], [1.0.3], AC_INIT([libwebp], [1.1.0],
[https://bugs.chromium.org/p/webp],, [https://bugs.chromium.org/p/webp],,
[http://developers.google.com/speed/webp]) [http://developers.google.com/speed/webp])
AC_CANONICAL_HOST AC_CANONICAL_HOST

View File

@ -60,15 +60,15 @@ static int AllocateFrames(AnimatedImage* const image, uint32_t num_frames) {
!CheckSizeForOverflow(total_frame_size)) { !CheckSizeForOverflow(total_frame_size)) {
return 0; return 0;
} }
mem = (uint8_t*)malloc((size_t)total_size); mem = (uint8_t*)WebPMalloc((size_t)total_size);
frames = (DecodedFrame*)malloc((size_t)total_frame_size); frames = (DecodedFrame*)WebPMalloc((size_t)total_frame_size);
if (mem == NULL || frames == NULL) { if (mem == NULL || frames == NULL) {
free(mem); WebPFree(mem);
free(frames); WebPFree(frames);
return 0; return 0;
} }
free(image->raw_mem); WebPFree(image->raw_mem);
image->num_frames = num_frames; image->num_frames = num_frames;
image->frames = frames; image->frames = frames;
for (i = 0; i < num_frames; ++i) { for (i = 0; i < num_frames; ++i) {
@ -82,8 +82,8 @@ static int AllocateFrames(AnimatedImage* const image, uint32_t num_frames) {
void ClearAnimatedImage(AnimatedImage* const image) { void ClearAnimatedImage(AnimatedImage* const image) {
if (image != NULL) { if (image != NULL) {
free(image->raw_mem); WebPFree(image->raw_mem);
free(image->frames); WebPFree(image->frames);
image->num_frames = 0; image->num_frames = 0;
image->frames = NULL; image->frames = NULL;
image->raw_mem = NULL; image->raw_mem = NULL;
@ -165,7 +165,7 @@ static int DumpFrame(const char filename[], const char dump_folder[],
base_name = (base_name == NULL) ? (const W_CHAR*)filename : base_name + 1; base_name = (base_name == NULL) ? (const W_CHAR*)filename : base_name + 1;
max_len = WSTRLEN(dump_folder) + 1 + WSTRLEN(base_name) max_len = WSTRLEN(dump_folder) + 1 + WSTRLEN(base_name)
+ strlen("_frame_") + strlen(".pam") + 8; + strlen("_frame_") + strlen(".pam") + 8;
file_name = (W_CHAR*)malloc(max_len * sizeof(*file_name)); file_name = (W_CHAR*)WebPMalloc(max_len * sizeof(*file_name));
if (file_name == NULL) goto End; if (file_name == NULL) goto End;
if (WSNPRINTF(file_name, max_len, "%s/%s_frame_%d.pam", if (WSNPRINTF(file_name, max_len, "%s/%s_frame_%d.pam",
@ -197,7 +197,7 @@ static int DumpFrame(const char filename[], const char dump_folder[],
ok = 1; ok = 1;
End: End:
if (f != NULL) fclose(f); if (f != NULL) fclose(f);
free(file_name); WebPFree(file_name);
return ok; return ok;
} }

View File

@ -128,7 +128,8 @@ static int ReadPicture(const char* const filename, WebPPicture* const pic,
static void AllocExtraInfo(WebPPicture* const pic) { static void AllocExtraInfo(WebPPicture* const pic) {
const int mb_w = (pic->width + 15) / 16; const int mb_w = (pic->width + 15) / 16;
const int mb_h = (pic->height + 15) / 16; const int mb_h = (pic->height + 15) / 16;
pic->extra_info = (uint8_t*)malloc(mb_w * mb_h * sizeof(*pic->extra_info)); pic->extra_info =
(uint8_t*)WebPMalloc(mb_w * mb_h * sizeof(*pic->extra_info));
} }
static void PrintByteCount(const int bytes[4], int total_size, static void PrintByteCount(const int bytes[4], int total_size,
@ -640,10 +641,10 @@ static const char* const kErrorMessages[VP8_ENC_ERROR_LAST] = {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int main(int argc, const char *argv[]) { int main(int argc, const char* argv[]) {
int return_value = -1; int return_value = -1;
const char *in_file = NULL, *out_file = NULL, *dump_file = NULL; const char* in_file = NULL, *out_file = NULL, *dump_file = NULL;
FILE *out = NULL; FILE* out = NULL;
int c; int c;
int short_output = 0; int short_output = 0;
int quiet = 0; int quiet = 0;
@ -1168,7 +1169,7 @@ int main(int argc, const char *argv[]) {
Error: Error:
WebPMemoryWriterClear(&memory_writer); WebPMemoryWriterClear(&memory_writer);
free(picture.extra_info); WebPFree(picture.extra_info);
MetadataFree(&metadata); MetadataFree(&metadata);
WebPPictureFree(&picture); WebPPictureFree(&picture);
WebPPictureFree(&original_picture); WebPPictureFree(&original_picture);

View File

@ -132,7 +132,7 @@ static uint8_t* AllocateExternalBuffer(WebPDecoderConfig* config,
format == RGB_565) ? 2 format == RGB_565) ? 2
: 4; : 4;
uint32_t stride = bpp * w + 7; // <- just for exercising uint32_t stride = bpp * w + 7; // <- just for exercising
external_buffer = (uint8_t*)malloc(stride * h); external_buffer = (uint8_t*)WebPMalloc(stride * h);
if (external_buffer == NULL) return NULL; if (external_buffer == NULL) return NULL;
output_buffer->u.RGBA.stride = stride; output_buffer->u.RGBA.stride = stride;
output_buffer->u.RGBA.size = stride * h; output_buffer->u.RGBA.size = stride * h;
@ -145,7 +145,7 @@ static uint8_t* AllocateExternalBuffer(WebPDecoderConfig* config,
uint32_t total_size = stride * h * (has_alpha ? 2 : 1) uint32_t total_size = stride * h * (has_alpha ? 2 : 1)
+ 2 * uv_stride * (h + 1) / 2; + 2 * uv_stride * (h + 1) / 2;
assert(format >= YUV && format <= YUVA); assert(format >= YUV && format <= YUVA);
external_buffer = (uint8_t*)malloc(total_size); external_buffer = (uint8_t*)WebPMalloc(total_size);
if (external_buffer == NULL) return NULL; if (external_buffer == NULL) return NULL;
tmp = external_buffer; tmp = external_buffer;
output_buffer->u.YUVA.y = tmp; output_buffer->u.YUVA.y = tmp;
@ -176,10 +176,10 @@ static uint8_t* AllocateExternalBuffer(WebPDecoderConfig* config,
return external_buffer; return external_buffer;
} }
int main(int argc, const char *argv[]) { int main(int argc, const char* argv[]) {
int ok = 0; int ok = 0;
const char *in_file = NULL; const char* in_file = NULL;
const char *out_file = NULL; const char* out_file = NULL;
WebPDecoderConfig config; WebPDecoderConfig config;
WebPDecBuffer* const output_buffer = &config.output; WebPDecBuffer* const output_buffer = &config.output;
@ -412,8 +412,8 @@ int main(int argc, const char *argv[]) {
} }
Exit: Exit:
WebPFreeDecBuffer(output_buffer); WebPFreeDecBuffer(output_buffer);
free((void*)external_buffer); WebPFree((void*)external_buffer);
free((void*)data); WebPFree((void*)data);
FREE_WARGV_AND_RETURN(ok ? 0 : -1); FREE_WARGV_AND_RETURN(ok ? 0 : -1);
} }

View File

@ -75,7 +75,7 @@ static void ResetCommandLineArguments(int argc, const char* argv[],
void ExUtilDeleteCommandLineArguments(CommandLineArguments* const args) { void ExUtilDeleteCommandLineArguments(CommandLineArguments* const args) {
if (args != NULL) { if (args != NULL) {
if (args->own_argv_) { if (args->own_argv_) {
free((void*)args->argv_); WebPFree((void*)args->argv_);
WebPDataClear(&args->argv_data_); WebPDataClear(&args->argv_data_);
} }
ResetCommandLineArguments(0, NULL, args); ResetCommandLineArguments(0, NULL, args);
@ -102,7 +102,7 @@ int ExUtilInitCommandLineArguments(int argc, const char* argv[],
return 0; return 0;
} }
args->own_argv_ = 1; args->own_argv_ = 1;
args->argv_ = (const char**)malloc(MAX_ARGC * sizeof(*args->argv_)); args->argv_ = (const char**)WebPMalloc(MAX_ARGC * sizeof(*args->argv_));
if (args->argv_ == NULL) return 0; if (args->argv_ == NULL) return 0;
argc = 0; argc = 0;

View File

@ -96,12 +96,12 @@ static void Help(void) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int main(int argc, const char *argv[]) { int main(int argc, const char* argv[]) {
int verbose = 0; int verbose = 0;
int gif_error = GIF_ERROR; int gif_error = GIF_ERROR;
WebPMuxError err = WEBP_MUX_OK; WebPMuxError err = WEBP_MUX_OK;
int ok = 0; int ok = 0;
const W_CHAR *in_file = NULL, *out_file = NULL; const W_CHAR* in_file = NULL, *out_file = NULL;
GifFileType* gif = NULL; GifFileType* gif = NULL;
int frame_duration = 0; int frame_duration = 0;
int frame_timestamp = 0; int frame_timestamp = 0;
@ -379,7 +379,7 @@ int main(int argc, const char *argv[]) {
} }
case EXTENSION_RECORD_TYPE: { case EXTENSION_RECORD_TYPE: {
int extension; int extension;
GifByteType *data = NULL; GifByteType* data = NULL;
if (DGifGetExtension(gif, &extension, &data) == GIF_ERROR) { if (DGifGetExtension(gif, &extension, &data) == GIF_ERROR) {
goto End; goto End;
} }
@ -593,7 +593,7 @@ int main(int argc, const char *argv[]) {
#else // !WEBP_HAVE_GIF #else // !WEBP_HAVE_GIF
int main(int argc, const char *argv[]) { int main(int argc, const char* argv[]) {
fprintf(stderr, "GIF support not enabled in %s.\n", argv[0]); fprintf(stderr, "GIF support not enabled in %s.\n", argv[0]);
(void)argc; (void)argc;
return 0; return 0;

View File

@ -137,7 +137,7 @@ int GIFReadFrame(GifFileType* const gif, int transparent_index,
} }
dst = sub_image.argb; dst = sub_image.argb;
tmp = (uint8_t*)malloc(rect.width * sizeof(*tmp)); tmp = (uint8_t*)WebPMalloc(rect.width * sizeof(*tmp));
if (tmp == NULL) goto End; if (tmp == NULL) goto End;
if (image_desc->Interlace) { // Interlaced image. if (image_desc->Interlace) { // Interlaced image.
@ -168,7 +168,7 @@ int GIFReadFrame(GifFileType* const gif, int transparent_index,
End: End:
if (!ok) picture->error_code = sub_image.error_code; if (!ok) picture->error_code = sub_image.error_code;
WebPPictureFree(&sub_image); WebPPictureFree(&sub_image);
free(tmp); WebPFree(tmp);
return ok; return ok;
} }

View File

@ -479,7 +479,7 @@ static void Help(void) {
" 'q' / 'Q' / ESC .... quit\n"); " 'q' / 'Q' / ESC .... quit\n");
} }
int main(int argc, char *argv[]) { int main(int argc, char* argv[]) {
int c; int c;
WebPDecoderConfig* const config = &kParams.config; WebPDecoderConfig* const config = &kParams.config;
WebPIterator* const curr = &kParams.curr_frame; WebPIterator* const curr = &kParams.curr_frame;
@ -630,7 +630,7 @@ int main(int argc, char *argv[]) {
#else // !WEBP_HAVE_GL #else // !WEBP_HAVE_GL
int main(int argc, const char *argv[]) { int main(int argc, const char* argv[]) {
fprintf(stderr, "OpenGL support not enabled in %s.\n", argv[0]); fprintf(stderr, "OpenGL support not enabled in %s.\n", argv[0]);
(void)argc; (void)argc;
return 0; return 0;

View File

@ -1045,7 +1045,7 @@ static int Process(const Config* config) {
int* durations = NULL; int* durations = NULL;
WebPMux* new_mux = DuplicateMuxHeader(mux); WebPMux* new_mux = DuplicateMuxHeader(mux);
if (new_mux == NULL) goto Err2; if (new_mux == NULL) goto Err2;
durations = (int*)malloc((size_t)num_frames * sizeof(*durations)); durations = (int*)WebPMalloc((size_t)num_frames * sizeof(*durations));
if (durations == NULL) goto Err2; if (durations == NULL) goto Err2;
for (i = 0; i < num_frames; ++i) durations[i] = -1; for (i = 0; i < num_frames; ++i) durations[i] = -1;
@ -1103,7 +1103,7 @@ static int Process(const Config* config) {
new_mux = NULL; new_mux = NULL;
Err3: Err3:
free(durations); WebPFree(durations);
WebPMuxDelete(new_mux); WebPMuxDelete(new_mux);
if (!ok) goto Err2; if (!ok) goto Err2;
} }

View File

@ -12,13 +12,14 @@
#include "extras/extras.h" #include "extras/extras.h"
#include "webp/format_constants.h" #include "webp/format_constants.h"
#include "src/dsp/dsp.h"
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#define XTRA_MAJ_VERSION 1 #define XTRA_MAJ_VERSION 1
#define XTRA_MIN_VERSION 0 #define XTRA_MIN_VERSION 1
#define XTRA_REV_VERSION 3 #define XTRA_REV_VERSION 0
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -57,7 +58,7 @@ int WebPImportRGB565(const uint8_t* rgb565, WebPPicture* pic) {
for (y = 0; y < pic->height; ++y) { for (y = 0; y < pic->height; ++y) {
const int width = pic->width; const int width = pic->width;
for (x = 0; x < width; ++x) { for (x = 0; x < width; ++x) {
#ifdef WEBP_SWAP_16BIT_CSP #if defined(WEBP_SWAP_16BIT_CSP) && (WEBP_SWAP_16BIT_CSP == 1)
const uint32_t rg = rgb565[2 * x + 1]; const uint32_t rg = rgb565[2 * x + 1];
const uint32_t gb = rgb565[2 * x + 0]; const uint32_t gb = rgb565[2 * x + 0];
#else #else
@ -90,7 +91,7 @@ int WebPImportRGB4444(const uint8_t* rgb4444, WebPPicture* pic) {
for (y = 0; y < pic->height; ++y) { for (y = 0; y < pic->height; ++y) {
const int width = pic->width; const int width = pic->width;
for (x = 0; x < width; ++x) { for (x = 0; x < width; ++x) {
#ifdef WEBP_SWAP_16BIT_CSP #if defined(WEBP_SWAP_16BIT_CSP) && (WEBP_SWAP_16BIT_CSP == 1)
const uint32_t rg = rgb4444[2 * x + 1]; const uint32_t rg = rgb4444[2 * x + 1];
const uint32_t ba = rgb4444[2 * x + 0]; const uint32_t ba = rgb4444[2 * x + 0];
#else #else
@ -144,3 +145,18 @@ int WebPImportColorMappedARGB(const uint8_t* indexed, int indexed_stride,
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int WebPUnmultiplyARGB(WebPPicture* pic) {
int y;
uint32_t* dst;
if (pic == NULL || pic->use_argb != 1 || pic->argb == NULL) return 0;
WebPInitAlphaProcessing();
dst = pic->argb;
for (y = 0; y < pic->height; ++y) {
WebPMultARGBRow(dst, pic->width, /*inverse=*/1);
dst += pic->argb_stride;
}
return 1;
}
//------------------------------------------------------------------------------

View File

@ -19,7 +19,7 @@ extern "C" {
#include "webp/encode.h" #include "webp/encode.h"
#define WEBP_EXTRAS_ABI_VERSION 0x0001 // MAJOR(8b) + MINOR(8b) #define WEBP_EXTRAS_ABI_VERSION 0x0002 // MAJOR(8b) + MINOR(8b)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -51,6 +51,13 @@ WebPImportColorMappedARGB(const uint8_t* indexed, int indexed_stride,
const uint32_t palette[], int palette_size, const uint32_t palette[], int palette_size,
WebPPicture* pic); WebPPicture* pic);
// Convert the ARGB content of 'pic' from associated to unassociated.
// 'pic' can be for instance the result of calling of some WebPPictureImportXXX
// functions, with pic->use_argb set to 'true'. It is assumed (and not checked)
// that the pre-multiplied r/g/b values as less or equal than the alpha value.
// Return false in case of error (invalid parameter, ...).
WEBP_EXTERN int WebPUnmultiplyARGB(WebPPicture* pic);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Parse a bitstream, search for VP8 (lossy) header and report a // Parse a bitstream, search for VP8 (lossy) header and report a

View File

@ -226,7 +226,7 @@ static void Help(void) {
" Also handles PNG, JPG and TIFF files, in addition to WebP.\n"); " Also handles PNG, JPG and TIFF files, in addition to WebP.\n");
} }
int main(int argc, const char *argv[]) { int main(int argc, const char* argv[]) {
WebPPicture pic1, pic2; WebPPicture pic1, pic2;
size_t size1 = 0, size2 = 0; size_t size1 = 0, size2 = 0;
int ret = 1; int ret = 1;

View File

@ -92,7 +92,7 @@ int main(int argc, char* argv[]) {
#else // !WEBP_HAVE_SDL #else // !WEBP_HAVE_SDL
int main(int argc, const char *argv[]) { int main(int argc, const char* argv[]) {
fprintf(stderr, "SDL support not enabled in %s.\n", argv[0]); fprintf(stderr, "SDL support not enabled in %s.\n", argv[0]);
(void)argc; (void)argc;
return 0; return 0;

View File

@ -15,7 +15,7 @@
#include "imageio/imageio_util.h" #include "imageio/imageio_util.h"
#include "../examples/unicode.h" #include "../examples/unicode.h"
int main(int argc, const char *argv[]) { int main(int argc, const char* argv[]) {
int c; int c;
int quiet = 0; int quiet = 0;
int ok = 1; int ok = 1;

View File

@ -26,7 +26,7 @@ typedef enum {
DEPTH_FLAG = 1 << 2, DEPTH_FLAG = 1 << 2,
MAXVAL_FLAG = 1 << 3, MAXVAL_FLAG = 1 << 3,
TUPLE_FLAG = 1 << 4, TUPLE_FLAG = 1 << 4,
ALL_NEEDED_FLAGS = 0x1f ALL_NEEDED_FLAGS = WIDTH_FLAG | HEIGHT_FLAG | DEPTH_FLAG | MAXVAL_FLAG
} PNMFlags; } PNMFlags;
typedef struct { typedef struct {
@ -74,6 +74,7 @@ static size_t ReadPAMFields(PNMInfo* const info, size_t off) {
char out[MAX_LINE_SIZE + 1]; char out[MAX_LINE_SIZE + 1];
size_t out_size; size_t out_size;
int tmp; int tmp;
int expected_depth = -1;
assert(info != NULL); assert(info != NULL);
while (1) { while (1) {
off = ReadLine(info->data, off, info->data_size, out, &out_size); off = ReadLine(info->data, off, info->data_size, out, &out_size);
@ -95,13 +96,13 @@ static size_t ReadPAMFields(PNMInfo* const info, size_t off) {
info->seen_flags |= MAXVAL_FLAG; info->seen_flags |= MAXVAL_FLAG;
info->max_value = tmp; info->max_value = tmp;
} else if (!strcmp(out, "TUPLTYPE RGB_ALPHA")) { } else if (!strcmp(out, "TUPLTYPE RGB_ALPHA")) {
info->bytes_per_px = 4; expected_depth = 4;
info->seen_flags |= TUPLE_FLAG; info->seen_flags |= TUPLE_FLAG;
} else if (!strcmp(out, "TUPLTYPE RGB")) { } else if (!strcmp(out, "TUPLTYPE RGB")) {
info->bytes_per_px = 3; expected_depth = 3;
info->seen_flags |= TUPLE_FLAG; info->seen_flags |= TUPLE_FLAG;
} else if (!strcmp(out, "TUPLTYPE GRAYSCALE")) { } else if (!strcmp(out, "TUPLTYPE GRAYSCALE")) {
info->bytes_per_px = 1; expected_depth = 1;
info->seen_flags |= TUPLE_FLAG; info->seen_flags |= TUPLE_FLAG;
} else if (!strcmp(out, "ENDHDR")) { } else if (!strcmp(out, "ENDHDR")) {
break; break;
@ -110,23 +111,24 @@ static size_t ReadPAMFields(PNMInfo* const info, size_t off) {
int i; int i;
if (out_size > 20) sprintf(out + 20 - strlen(kEllipsis), kEllipsis); if (out_size > 20) sprintf(out + 20 - strlen(kEllipsis), kEllipsis);
for (i = 0; i < (int)strlen(out); ++i) { for (i = 0; i < (int)strlen(out); ++i) {
if (!isprint(out[i])) out[i] = ' '; // isprint() might trigger a "char-subscripts" warning if given a char.
if (!isprint((int)out[i])) out[i] = ' ';
} }
fprintf(stderr, "PAM header error: unrecognized entry [%s]\n", out); fprintf(stderr, "PAM header error: unrecognized entry [%s]\n", out);
return 0; return 0;
} }
} }
if (!(info->seen_flags & TUPLE_FLAG)) { if (!(info->seen_flags & ALL_NEEDED_FLAGS)) {
if (info->depth > 0 && info->depth <= 4 && info->depth != 2) { fprintf(stderr, "PAM header error: missing tags%s%s%s%s\n",
info->seen_flags |= TUPLE_FLAG; (info->seen_flags & WIDTH_FLAG) ? "" : " WIDTH",
info->bytes_per_px = info->depth * (info->max_value > 255 ? 2 : 1); (info->seen_flags & HEIGHT_FLAG) ? "" : " HEIGHT",
} else { (info->seen_flags & DEPTH_FLAG) ? "" : " DEPTH",
fprintf(stderr, "PAM: invalid bitdepth (%d).\n", info->depth); (info->seen_flags & MAXVAL_FLAG) ? "" : " MAXVAL");
return 0; return 0;
}
} }
if (info->seen_flags != ALL_NEEDED_FLAGS) { if (expected_depth != -1 && info->depth != expected_depth) {
fprintf(stderr, "PAM: incomplete header.\n"); fprintf(stderr, "PAM header error: expected DEPTH %d but got DEPTH %d\n",
expected_depth, info->depth);
return 0; return 0;
} }
return off; return off;
@ -160,16 +162,15 @@ static size_t ReadHeader(PNMInfo* const info) {
// finish initializing missing fields // finish initializing missing fields
info->depth = (info->type == 5) ? 1 : 3; info->depth = (info->type == 5) ? 1 : 3;
info->bytes_per_px = info->depth * (info->max_value > 255 ? 2 : 1);
} }
// perform some basic numerical validation // perform some basic numerical validation
if (info->width <= 0 || info->height <= 0 || if (info->width <= 0 || info->height <= 0 ||
info->type <= 0 || info->type >= 9 || info->type <= 0 || info->type >= 9 ||
info->depth <= 0 || info->depth == 2 || info->depth > 4 || info->depth <= 0 || info->depth == 2 || info->depth > 4 ||
info->bytes_per_px < info->depth ||
info->max_value <= 0 || info->max_value >= 65536) { info->max_value <= 0 || info->max_value >= 65536) {
return 0; return 0;
} }
info->bytes_per_px = info->depth * (info->max_value > 255 ? 2 : 1);
return off; return off;
} }

View File

@ -156,7 +156,7 @@ int ReadTIFF(const uint8_t* const data, size_t data_size,
Metadata* const metadata) { Metadata* const metadata) {
MyData my_data = { data, (toff_t)data_size, 0 }; MyData my_data = { data, (toff_t)data_size, 0 };
TIFF* tif; TIFF* tif;
uint32_t width, height; uint32_t image_width, image_height, tile_width, tile_height;
uint16_t samples_per_px = 0; uint16_t samples_per_px = 0;
uint16_t extra_samples = 0; uint16_t extra_samples = 0;
uint16_t* extra_samples_ptr = NULL; uint16_t* extra_samples_ptr = NULL;
@ -189,15 +189,25 @@ int ReadTIFF(const uint8_t* const data, size_t data_size,
} }
if (samples_per_px < 3 || samples_per_px > 4) goto End; // not supported if (samples_per_px < 3 || samples_per_px > 4) goto End; // not supported
if (!(TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &width) && if (!(TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &image_width) &&
TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &height))) { TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &image_height))) {
fprintf(stderr, "Error! Cannot retrieve TIFF image dimensions.\n"); fprintf(stderr, "Error! Cannot retrieve TIFF image dimensions.\n");
goto End; goto End;
} }
if (!ImgIoUtilCheckSizeArgumentsOverflow((uint64_t)width * height, if (!ImgIoUtilCheckSizeArgumentsOverflow((uint64_t)image_width * image_height,
sizeof(*raster))) { sizeof(*raster))) {
goto End; goto End;
} }
// According to spec, a tile can be bigger than the image. However it should
// be a multiple of 16 and not way too large, so check that it's not more than
// twice the image size, for dimensions above some arbitrary minimum 32.
if ((TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tile_width) &&
tile_width > 32 && tile_width / 2 > image_width) ||
(TIFFGetField(tif, TIFFTAG_TILELENGTH, &tile_height) &&
tile_height > 32 && tile_height / 2 > image_height)) {
fprintf(stderr, "Error! TIFF tile dimensions are too big.\n");
goto End;
}
if (samples_per_px > 3 && !TIFFGetField(tif, TIFFTAG_EXTRASAMPLES, if (samples_per_px > 3 && !TIFFGetField(tif, TIFFTAG_EXTRASAMPLES,
&extra_samples, &extra_samples_ptr)) { &extra_samples, &extra_samples_ptr)) {
fprintf(stderr, "Error! Cannot retrieve TIFF ExtraSamples info.\n"); fprintf(stderr, "Error! Cannot retrieve TIFF ExtraSamples info.\n");
@ -205,27 +215,28 @@ int ReadTIFF(const uint8_t* const data, size_t data_size,
} }
// _Tiffmalloc uses a signed type for size. // _Tiffmalloc uses a signed type for size.
alloc_size = (int64_t)((uint64_t)width * height * sizeof(*raster)); alloc_size =
(int64_t)((uint64_t)image_width * image_height * sizeof(*raster));
if (alloc_size < 0 || alloc_size != (tsize_t)alloc_size) goto End; if (alloc_size < 0 || alloc_size != (tsize_t)alloc_size) goto End;
raster = (uint32*)_TIFFmalloc((tsize_t)alloc_size); raster = (uint32*)_TIFFmalloc((tsize_t)alloc_size);
if (raster != NULL) { if (raster != NULL) {
if (TIFFReadRGBAImageOriented(tif, width, height, raster, if (TIFFReadRGBAImageOriented(tif, image_width, image_height, raster,
ORIENTATION_TOPLEFT, 1)) { ORIENTATION_TOPLEFT, 1)) {
const int stride = width * sizeof(*raster); const int stride = image_width * sizeof(*raster);
pic->width = width; pic->width = image_width;
pic->height = height; pic->height = image_height;
// TIFF data is ABGR // TIFF data is ABGR
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
TIFFSwabArrayOfLong(raster, width * height); TIFFSwabArrayOfLong(raster, image_width * image_height);
#endif #endif
// if we have an alpha channel, we must un-multiply from rgbA to RGBA // if we have an alpha channel, we must un-multiply from rgbA to RGBA
if (extra_samples == 1 && extra_samples_ptr != NULL && if (extra_samples == 1 && extra_samples_ptr != NULL &&
extra_samples_ptr[0] == EXTRASAMPLE_ASSOCALPHA) { extra_samples_ptr[0] == EXTRASAMPLE_ASSOCALPHA) {
uint32_t y; uint32_t y;
uint8_t* tmp = (uint8_t*)raster; uint8_t* tmp = (uint8_t*)raster;
for (y = 0; y < height; ++y) { for (y = 0; y < image_height; ++y) {
MultARGBRow(tmp, width); MultARGBRow(tmp, image_width);
tmp += stride; tmp += stride;
} }
} }

View File

@ -36,7 +36,7 @@ libwebp_la_LIBADD += utils/libwebputils.la
# other than the ones listed on the command line, i.e., after linking, it will # other than the ones listed on the command line, i.e., after linking, it will
# not have unresolved symbols. Some platforms (Windows among them) require all # not have unresolved symbols. Some platforms (Windows among them) require all
# symbols in shared libraries to be resolved at library creation. # symbols in shared libraries to be resolved at library creation.
libwebp_la_LDFLAGS = -no-undefined -version-info 7:5:0 libwebp_la_LDFLAGS = -no-undefined -version-info 8:0:1
libwebpincludedir = $(includedir)/webp libwebpincludedir = $(includedir)/webp
pkgconfig_DATA = libwebp.pc pkgconfig_DATA = libwebp.pc
@ -48,7 +48,7 @@ if BUILD_LIBWEBPDECODER
libwebpdecoder_la_LIBADD += dsp/libwebpdspdecode.la libwebpdecoder_la_LIBADD += dsp/libwebpdspdecode.la
libwebpdecoder_la_LIBADD += utils/libwebputilsdecode.la libwebpdecoder_la_LIBADD += utils/libwebputilsdecode.la
libwebpdecoder_la_LDFLAGS = -no-undefined -version-info 3:5:0 libwebpdecoder_la_LDFLAGS = -no-undefined -version-info 4:0:1
pkgconfig_DATA += libwebpdecoder.pc pkgconfig_DATA += libwebpdecoder.pc
endif endif

View File

@ -732,7 +732,7 @@ static int AllocateMemory(VP8Decoder* const dec) {
mem += f_info_size; mem += f_info_size;
dec->thread_ctx_.id_ = 0; dec->thread_ctx_.id_ = 0;
dec->thread_ctx_.f_info_ = dec->f_info_; dec->thread_ctx_.f_info_ = dec->f_info_;
if (dec->mt_method_ > 0) { if (dec->filter_type_ > 0 && dec->mt_method_ > 0) {
// secondary cache line. The deblocking process need to make use of the // secondary cache line. The deblocking process need to make use of the
// filtering strength from previous macroblock row, while the new ones // filtering strength from previous macroblock row, while the new ones
// are being decoded in parallel. We'll just swap the pointers. // are being decoded in parallel. We'll just swap the pointers.

View File

@ -166,9 +166,11 @@ static int AppendToMemBuffer(WebPIDecoder* const idec,
VP8Decoder* const dec = (VP8Decoder*)idec->dec_; VP8Decoder* const dec = (VP8Decoder*)idec->dec_;
MemBuffer* const mem = &idec->mem_; MemBuffer* const mem = &idec->mem_;
const int need_compressed_alpha = NeedCompressedAlpha(idec); const int need_compressed_alpha = NeedCompressedAlpha(idec);
const uint8_t* const old_start = mem->buf_ + mem->start_; const uint8_t* const old_start =
(mem->buf_ == NULL) ? NULL : mem->buf_ + mem->start_;
const uint8_t* const old_base = const uint8_t* const old_base =
need_compressed_alpha ? dec->alpha_data_ : old_start; need_compressed_alpha ? dec->alpha_data_ : old_start;
assert(mem->buf_ != NULL || mem->start_ == 0);
assert(mem->mode_ == MEM_MODE_APPEND); assert(mem->mode_ == MEM_MODE_APPEND);
if (data_size > MAX_CHUNK_PAYLOAD) { if (data_size > MAX_CHUNK_PAYLOAD) {
// security safeguard: trying to allocate more than what the format // security safeguard: trying to allocate more than what the format
@ -184,7 +186,7 @@ static int AppendToMemBuffer(WebPIDecoder* const idec,
uint8_t* const new_buf = uint8_t* const new_buf =
(uint8_t*)WebPSafeMalloc(extra_size, sizeof(*new_buf)); (uint8_t*)WebPSafeMalloc(extra_size, sizeof(*new_buf));
if (new_buf == NULL) return 0; if (new_buf == NULL) return 0;
memcpy(new_buf, old_base, current_size); if (old_base != NULL) memcpy(new_buf, old_base, current_size);
WebPSafeFree(mem->buf_); WebPSafeFree(mem->buf_);
mem->buf_ = new_buf; mem->buf_ = new_buf;
mem->buf_size_ = (size_t)extra_size; mem->buf_size_ = (size_t)extra_size;
@ -192,6 +194,7 @@ static int AppendToMemBuffer(WebPIDecoder* const idec,
mem->end_ = current_size; mem->end_ = current_size;
} }
assert(mem->buf_ != NULL);
memcpy(mem->buf_ + mem->end_, data, data_size); memcpy(mem->buf_ + mem->end_, data, data_size);
mem->end_ += data_size; mem->end_ += data_size;
assert(mem->end_ <= mem->buf_size_); assert(mem->end_ <= mem->buf_size_);
@ -204,7 +207,9 @@ static int RemapMemBuffer(WebPIDecoder* const idec,
const uint8_t* const data, size_t data_size) { const uint8_t* const data, size_t data_size) {
MemBuffer* const mem = &idec->mem_; MemBuffer* const mem = &idec->mem_;
const uint8_t* const old_buf = mem->buf_; const uint8_t* const old_buf = mem->buf_;
const uint8_t* const old_start = old_buf + mem->start_; const uint8_t* const old_start =
(old_buf == NULL) ? NULL : old_buf + mem->start_;
assert(old_buf != NULL || mem->start_ == 0);
assert(mem->mode_ == MEM_MODE_MAP); assert(mem->mode_ == MEM_MODE_MAP);
if (data_size < mem->buf_size_) return 0; // can't remap to a shorter buffer! if (data_size < mem->buf_size_) return 0; // can't remap to a shorter buffer!

View File

@ -31,8 +31,8 @@ extern "C" {
// version numbers // version numbers
#define DEC_MAJ_VERSION 1 #define DEC_MAJ_VERSION 1
#define DEC_MIN_VERSION 0 #define DEC_MIN_VERSION 1
#define DEC_REV_VERSION 3 #define DEC_REV_VERSION 0
// YUV-cache parameters. Cache is 32-bytes wide (= one cacheline). // YUV-cache parameters. Cache is 32-bytes wide (= one cacheline).
// Constraints are: We need to store one 16x16 block of luma samples (y), // Constraints are: We need to store one 16x16 block of luma samples (y),

View File

@ -37,7 +37,7 @@ struct VP8LTransform {
int bits_; // subsampling bits defining transform window. int bits_; // subsampling bits defining transform window.
int xsize_; // transform window X index. int xsize_; // transform window X index.
int ysize_; // transform window Y index. int ysize_; // transform window Y index.
uint32_t *data_; // transform data. uint32_t* data_; // transform data.
}; };
typedef struct { typedef struct {
@ -48,9 +48,9 @@ typedef struct {
int huffman_mask_; int huffman_mask_;
int huffman_subsample_bits_; int huffman_subsample_bits_;
int huffman_xsize_; int huffman_xsize_;
uint32_t *huffman_image_; uint32_t* huffman_image_;
int num_htree_groups_; int num_htree_groups_;
HTreeGroup *htree_groups_; HTreeGroup* htree_groups_;
HuffmanTables huffman_tables_; HuffmanTables huffman_tables_;
} VP8LMetadata; } VP8LMetadata;
@ -58,13 +58,13 @@ typedef struct VP8LDecoder VP8LDecoder;
struct VP8LDecoder { struct VP8LDecoder {
VP8StatusCode status_; VP8StatusCode status_;
VP8LDecodeState state_; VP8LDecodeState state_;
VP8Io *io_; VP8Io* io_;
const WebPDecBuffer *output_; // shortcut to io->opaque->output const WebPDecBuffer* output_; // shortcut to io->opaque->output
uint32_t *pixels_; // Internal data: either uint8_t* for alpha uint32_t* pixels_; // Internal data: either uint8_t* for alpha
// or uint32_t* for BGRA. // or uint32_t* for BGRA.
uint32_t *argb_cache_; // Scratch buffer for temporary BGRA storage. uint32_t* argb_cache_; // Scratch buffer for temporary BGRA storage.
VP8LBitReader br_; VP8LBitReader br_;
int incremental_; // if true, incremental decoding is expected int incremental_; // if true, incremental decoding is expected
@ -86,8 +86,8 @@ struct VP8LDecoder {
// or'd bitset storing the transforms types. // or'd bitset storing the transforms types.
uint32_t transforms_seen_; uint32_t transforms_seen_;
uint8_t *rescaler_memory; // Working memory for rescaling work. uint8_t* rescaler_memory; // Working memory for rescaling work.
WebPRescaler *rescaler; // Common rescaler for all channels. WebPRescaler* rescaler; // Common rescaler for all channels.
}; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@ -24,8 +24,8 @@
#include "src/webp/format_constants.h" #include "src/webp/format_constants.h"
#define DMUX_MAJ_VERSION 1 #define DMUX_MAJ_VERSION 1
#define DMUX_MIN_VERSION 0 #define DMUX_MIN_VERSION 1
#define DMUX_REV_VERSION 3 #define DMUX_REV_VERSION 0
typedef struct { typedef struct {
size_t start_; // start location of the data size_t start_; // start location of the data

View File

@ -6,8 +6,8 @@
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,3 FILEVERSION 1,0,1,0
PRODUCTVERSION 1,0,0,3 PRODUCTVERSION 1,0,1,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -24,12 +24,12 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Google, Inc." VALUE "CompanyName", "Google, Inc."
VALUE "FileDescription", "libwebpdemux DLL" VALUE "FileDescription", "libwebpdemux DLL"
VALUE "FileVersion", "1.0.3" VALUE "FileVersion", "1.1.0"
VALUE "InternalName", "libwebpdemux.dll" VALUE "InternalName", "libwebpdemux.dll"
VALUE "LegalCopyright", "Copyright (C) 2019" VALUE "LegalCopyright", "Copyright (C) 2019"
VALUE "OriginalFilename", "libwebpdemux.dll" VALUE "OriginalFilename", "libwebpdemux.dll"
VALUE "ProductName", "WebP Image Demuxer" VALUE "ProductName", "WebP Image Demuxer"
VALUE "ProductVersion", "1.0.3" VALUE "ProductVersion", "1.1.0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -1361,7 +1361,8 @@ static void RD4_NEON(uint8_t* dst) { // Down-right
const uint32_t J = dst[-1 + 1 * BPS]; const uint32_t J = dst[-1 + 1 * BPS];
const uint32_t K = dst[-1 + 2 * BPS]; const uint32_t K = dst[-1 + 2 * BPS];
const uint32_t L = dst[-1 + 3 * BPS]; const uint32_t L = dst[-1 + 3 * BPS];
const uint64x1_t LKJI____ = vcreate_u64(L | (K << 8) | (J << 16) | (I << 24)); const uint64x1_t LKJI____ =
vcreate_u64((uint64_t)L | (K << 8) | (J << 16) | (I << 24));
const uint64x1_t LKJIXABC = vorr_u64(LKJI____, ____XABC); const uint64x1_t LKJIXABC = vorr_u64(LKJI____, ____XABC);
const uint8x8_t KJIXABC_ = vreinterpret_u8_u64(vshr_n_u64(LKJIXABC, 8)); const uint8x8_t KJIXABC_ = vreinterpret_u8_u64(vshr_n_u64(LKJIXABC, 8));
const uint8x8_t JIXABC__ = vreinterpret_u8_u64(vshr_n_u64(LKJIXABC, 16)); const uint8x8_t JIXABC__ = vreinterpret_u8_u64(vshr_n_u64(LKJIXABC, 16));
@ -1427,10 +1428,16 @@ static WEBP_INLINE void DC8_NEON(uint8_t* dst, int do_top, int do_left) {
if (do_top) { if (do_top) {
const uint8x8_t A = vld1_u8(dst - BPS); // top row const uint8x8_t A = vld1_u8(dst - BPS); // top row
#if defined(__aarch64__)
const uint16x8_t B = vmovl_u8(A);
const uint16_t p2 = vaddvq_u16(B);
sum_top = vdupq_n_u16(p2);
#else
const uint16x4_t p0 = vpaddl_u8(A); // cascading summation of the top const uint16x4_t p0 = vpaddl_u8(A); // cascading summation of the top
const uint16x4_t p1 = vpadd_u16(p0, p0); const uint16x4_t p1 = vpadd_u16(p0, p0);
const uint16x4_t p2 = vpadd_u16(p1, p1); const uint16x4_t p2 = vpadd_u16(p1, p1);
sum_top = vcombine_u16(p2, p2); sum_top = vcombine_u16(p2, p2);
#endif
} }
if (do_left) { if (do_left) {

View File

@ -246,9 +246,9 @@ extern VP8Fdct VP8FTransform2; // performs two transforms at a time
extern VP8WHT VP8FTransformWHT; extern VP8WHT VP8FTransformWHT;
// Predictions // Predictions
// *dst is the destination block. *top and *left can be NULL. // *dst is the destination block. *top and *left can be NULL.
typedef void (*VP8IntraPreds)(uint8_t *dst, const uint8_t* left, typedef void (*VP8IntraPreds)(uint8_t* dst, const uint8_t* left,
const uint8_t* top); const uint8_t* top);
typedef void (*VP8Intra4Preds)(uint8_t *dst, const uint8_t* top); typedef void (*VP8Intra4Preds)(uint8_t* dst, const uint8_t* top);
extern VP8Intra4Preds VP8EncPredLuma4; extern VP8Intra4Preds VP8EncPredLuma4;
extern VP8IntraPreds VP8EncPredLuma16; extern VP8IntraPreds VP8EncPredLuma16;
extern VP8IntraPreds VP8EncPredChroma8; extern VP8IntraPreds VP8EncPredChroma8;

View File

@ -81,7 +81,7 @@ static WEBP_INLINE uint32_t ClampedAddSubtractHalf(uint32_t c0, uint32_t c1,
// gcc <= 4.9 on ARM generates incorrect code in Select() when Sub3() is // gcc <= 4.9 on ARM generates incorrect code in Select() when Sub3() is
// inlined. // inlined.
#if defined(__arm__) && LOCAL_GCC_VERSION <= 0x409 #if defined(__arm__) && defined(__GNUC__) && LOCAL_GCC_VERSION <= 0x409
# define LOCAL_INLINE __attribute__ ((noinline)) # define LOCAL_INLINE __attribute__ ((noinline))
#else #else
# define LOCAL_INLINE WEBP_INLINE # define LOCAL_INLINE WEBP_INLINE
@ -167,15 +167,20 @@ static uint32_t Predictor13_C(uint32_t left, const uint32_t* const top) {
return pred; return pred;
} }
GENERATE_PREDICTOR_ADD(Predictor0_C, PredictorAdd0_C) static void PredictorAdd0_C(const uint32_t* in, const uint32_t* upper,
int num_pixels, uint32_t* out) {
int x;
(void)upper;
for (x = 0; x < num_pixels; ++x) out[x] = VP8LAddPixels(in[x], ARGB_BLACK);
}
static void PredictorAdd1_C(const uint32_t* in, const uint32_t* upper, static void PredictorAdd1_C(const uint32_t* in, const uint32_t* upper,
int num_pixels, uint32_t* out) { int num_pixels, uint32_t* out) {
int i; int i;
uint32_t left = out[-1]; uint32_t left = out[-1];
(void)upper;
for (i = 0; i < num_pixels; ++i) { for (i = 0; i < num_pixels; ++i) {
out[i] = left = VP8LAddPixels(in[i], left); out[i] = left = VP8LAddPixels(in[i], left);
} }
(void)upper;
} }
GENERATE_PREDICTOR_ADD(Predictor2_C, PredictorAdd2_C) GENERATE_PREDICTOR_ADD(Predictor2_C, PredictorAdd2_C)
GENERATE_PREDICTOR_ADD(Predictor3_C, PredictorAdd3_C) GENERATE_PREDICTOR_ADD(Predictor3_C, PredictorAdd3_C)

View File

@ -177,6 +177,7 @@ uint32_t VP8LSubPixels(uint32_t a, uint32_t b) {
static void PREDICTOR_ADD(const uint32_t* in, const uint32_t* upper, \ static void PREDICTOR_ADD(const uint32_t* in, const uint32_t* upper, \
int num_pixels, uint32_t* out) { \ int num_pixels, uint32_t* out) { \
int x; \ int x; \
assert(upper != NULL); \
for (x = 0; x < num_pixels; ++x) { \ for (x = 0; x < num_pixels; ++x) { \
const uint32_t pred = (PREDICTOR)(out[x - 1], upper + x); \ const uint32_t pred = (PREDICTOR)(out[x - 1], upper + x); \
out[x] = VP8LAddPixels(in[x], pred); \ out[x] = VP8LAddPixels(in[x], pred); \
@ -189,6 +190,7 @@ static void PREDICTOR_ADD(const uint32_t* in, const uint32_t* upper, \
static void PREDICTOR_SUB(const uint32_t* in, const uint32_t* upper, \ static void PREDICTOR_SUB(const uint32_t* in, const uint32_t* upper, \
int num_pixels, uint32_t* out) { \ int num_pixels, uint32_t* out) { \
int x; \ int x; \
assert(upper != NULL); \
for (x = 0; x < num_pixels; ++x) { \ for (x = 0; x < num_pixels; ++x) { \
const uint32_t pred = (PREDICTOR)(in[x - 1], upper + x); \ const uint32_t pred = (PREDICTOR)(in[x - 1], upper + x); \
out[x] = VP8LSubPixels(in[x], pred); \ out[x] = VP8LSubPixels(in[x], pred); \

View File

@ -455,8 +455,9 @@ static void PredictorSub0_SSE2(const uint32_t* in, const uint32_t* upper,
_mm_storeu_si128((__m128i*)&out[i], res); _mm_storeu_si128((__m128i*)&out[i], res);
} }
if (i != num_pixels) { if (i != num_pixels) {
VP8LPredictorsSub_C[0](in + i, upper + i, num_pixels - i, out + i); VP8LPredictorsSub_C[0](in + i, NULL, num_pixels - i, out + i);
} }
(void)upper;
} }
#define GENERATE_PREDICTOR_1(X, IN) \ #define GENERATE_PREDICTOR_1(X, IN) \

View File

@ -191,8 +191,9 @@ static void PredictorAdd0_SSE2(const uint32_t* in, const uint32_t* upper,
_mm_storeu_si128((__m128i*)&out[i], res); _mm_storeu_si128((__m128i*)&out[i], res);
} }
if (i != num_pixels) { if (i != num_pixels) {
VP8LPredictorsAdd_C[0](in + i, upper + i, num_pixels - i, out + i); VP8LPredictorsAdd_C[0](in + i, NULL, num_pixels - i, out + i);
} }
(void)upper;
} }
// Predictor1: left. // Predictor1: left.

View File

@ -576,9 +576,9 @@ static void FUNC_NAME(const uint8_t* top_y, const uint8_t* bot_y, \
const uint32_t l_uv = ((cur_u[0]) | ((cur_v[0]) << 16)); \ const uint32_t l_uv = ((cur_u[0]) | ((cur_v[0]) << 16)); \
const uint32_t uv0 = (3 * tl_uv + l_uv + 0x00020002u) >> 2; \ const uint32_t uv0 = (3 * tl_uv + l_uv + 0x00020002u) >> 2; \
const uint8_t* ptop_y = &top_y[1]; \ const uint8_t* ptop_y = &top_y[1]; \
uint8_t *ptop_dst = top_dst + XSTEP; \ uint8_t* ptop_dst = top_dst + XSTEP; \
const uint8_t* pbot_y = &bot_y[1]; \ const uint8_t* pbot_y = &bot_y[1]; \
uint8_t *pbot_dst = bot_dst + XSTEP; \ uint8_t* pbot_dst = bot_dst + XSTEP; \
\ \
FUNC(top_y[0], uv0 & 0xff, (uv0 >> 16), top_dst); \ FUNC(top_y[0], uv0 & 0xff, (uv0 >> 16), top_dst); \
if (bot_y != NULL) { \ if (bot_y != NULL) { \

View File

@ -58,8 +58,8 @@
} while (0) } while (0)
// Turn the macro into a function for reducing code-size when non-critical // Turn the macro into a function for reducing code-size when non-critical
static void Upsample16Pixels_NEON(const uint8_t *r1, const uint8_t *r2, static void Upsample16Pixels_NEON(const uint8_t* r1, const uint8_t* r2,
uint8_t *out) { uint8_t* out) {
UPSAMPLE_16PIXELS(r1, r2, out); UPSAMPLE_16PIXELS(r1, r2, out);
} }
@ -190,14 +190,14 @@ static const int16_t kCoeffs1[4] = { 19077, 26149, 6419, 13320 };
} }
#define NEON_UPSAMPLE_FUNC(FUNC_NAME, FMT, XSTEP) \ #define NEON_UPSAMPLE_FUNC(FUNC_NAME, FMT, XSTEP) \
static void FUNC_NAME(const uint8_t *top_y, const uint8_t *bottom_y, \ static void FUNC_NAME(const uint8_t* top_y, const uint8_t* bottom_y, \
const uint8_t *top_u, const uint8_t *top_v, \ const uint8_t* top_u, const uint8_t* top_v, \
const uint8_t *cur_u, const uint8_t *cur_v, \ const uint8_t* cur_u, const uint8_t* cur_v, \
uint8_t *top_dst, uint8_t *bottom_dst, int len) { \ uint8_t* top_dst, uint8_t* bottom_dst, int len) { \
int block; \ int block; \
/* 16 byte aligned array to cache reconstructed u and v */ \ /* 16 byte aligned array to cache reconstructed u and v */ \
uint8_t uv_buf[2 * 32 + 15]; \ uint8_t uv_buf[2 * 32 + 15]; \
uint8_t *const r_uv = (uint8_t*)((uintptr_t)(uv_buf + 15) & ~15); \ uint8_t* const r_uv = (uint8_t*)((uintptr_t)(uv_buf + 15) & ~15); \
const int uv_len = (len + 1) >> 1; \ const int uv_len = (len + 1) >> 1; \
/* 9 pixels must be read-able for each block */ \ /* 9 pixels must be read-able for each block */ \
const int num_blocks = (uv_len - 1) >> 3; \ const int num_blocks = (uv_len - 1) >> 3; \

View File

@ -641,7 +641,7 @@ static void HistogramAnalyzeEntropyBin(VP8LHistogramSet* const image_histo,
// Merges some histograms with same bin_id together if it's advantageous. // Merges some histograms with same bin_id together if it's advantageous.
// Sets the remaining histograms to NULL. // Sets the remaining histograms to NULL.
static void HistogramCombineEntropyBin(VP8LHistogramSet* const image_histo, static void HistogramCombineEntropyBin(VP8LHistogramSet* const image_histo,
int *num_used, int* num_used,
const uint16_t* const clusters, const uint16_t* const clusters,
uint16_t* const cluster_mappings, uint16_t* const cluster_mappings,
VP8LHistogram* cur_combo, VP8LHistogram* cur_combo,

View File

@ -29,11 +29,15 @@
#define USE_INVERSE_ALPHA_TABLE #define USE_INVERSE_ALPHA_TABLE
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
#define ALPHA_OFFSET 0 // uint32_t 0xff000000 is 0xff,00,00,00 in memory // uint32_t 0xff000000 is 0xff,00,00,00 in memory
#define CHANNEL_OFFSET(i) (i)
#else #else
#define ALPHA_OFFSET 3 // uint32_t 0xff000000 is 0x00,00,00,ff in memory // uint32_t 0xff000000 is 0x00,00,00,ff in memory
#define CHANNEL_OFFSET(i) (3-(i))
#endif #endif
#define ALPHA_OFFSET CHANNEL_OFFSET(0)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Detection of non-trivial transparency // Detection of non-trivial transparency
@ -997,10 +1001,10 @@ static int PictureARGBToYUVA(WebPPicture* picture, WebPEncCSP colorspace,
return WebPEncodingSetError(picture, VP8_ENC_ERROR_INVALID_CONFIGURATION); return WebPEncodingSetError(picture, VP8_ENC_ERROR_INVALID_CONFIGURATION);
} else { } else {
const uint8_t* const argb = (const uint8_t*)picture->argb; const uint8_t* const argb = (const uint8_t*)picture->argb;
const uint8_t* const a = argb + (0 ^ ALPHA_OFFSET); const uint8_t* const a = argb + CHANNEL_OFFSET(0);
const uint8_t* const r = argb + (1 ^ ALPHA_OFFSET); const uint8_t* const r = argb + CHANNEL_OFFSET(1);
const uint8_t* const g = argb + (2 ^ ALPHA_OFFSET); const uint8_t* const g = argb + CHANNEL_OFFSET(2);
const uint8_t* const b = argb + (3 ^ ALPHA_OFFSET); const uint8_t* const b = argb + CHANNEL_OFFSET(3);
picture->colorspace = WEBP_YUV420; picture->colorspace = WEBP_YUV420;
return ImportYUVAFromRGBA(r, g, b, a, 4, 4 * picture->argb_stride, return ImportYUVAFromRGBA(r, g, b, a, 4, 4 * picture->argb_stride,
@ -1050,7 +1054,7 @@ int WebPPictureYUVAToARGB(WebPPicture* picture) {
const int height = picture->height; const int height = picture->height;
const int argb_stride = 4 * picture->argb_stride; const int argb_stride = 4 * picture->argb_stride;
uint8_t* dst = (uint8_t*)picture->argb; uint8_t* dst = (uint8_t*)picture->argb;
const uint8_t *cur_u = picture->u, *cur_v = picture->v, *cur_y = picture->y; const uint8_t* cur_u = picture->u, *cur_v = picture->v, *cur_y = picture->y;
WebPUpsampleLinePairFunc upsample = WebPUpsampleLinePairFunc upsample =
WebPGetLinePairConverter(ALPHA_OFFSET > 0); WebPGetLinePairConverter(ALPHA_OFFSET > 0);

View File

@ -31,8 +31,8 @@ extern "C" {
// version numbers // version numbers
#define ENC_MAJ_VERSION 1 #define ENC_MAJ_VERSION 1
#define ENC_MIN_VERSION 0 #define ENC_MIN_VERSION 1
#define ENC_REV_VERSION 3 #define ENC_REV_VERSION 0
enum { MAX_LF_LEVELS = 64, // Maximum loop filter level enum { MAX_LF_LEVELS = 64, // Maximum loop filter level
MAX_VARIABLE_LEVEL = 67, // last (inclusive) level with variable cost MAX_VARIABLE_LEVEL = 67, // last (inclusive) level with variable cost
@ -249,7 +249,7 @@ typedef struct {
int percent0_; // saved initial progress percent int percent0_; // saved initial progress percent
DError left_derr_; // left error diffusion (u/v) DError left_derr_; // left error diffusion (u/v)
DError *top_derr_; // top diffusion error - NULL if disabled DError* top_derr_; // top diffusion error - NULL if disabled
uint8_t* y_left_; // left luma samples (addressable from index -1 to 15). uint8_t* y_left_; // left luma samples (addressable from index -1 to 15).
uint8_t* u_left_; // left u samples (addressable from index -1 to 7) uint8_t* u_left_; // left u samples (addressable from index -1 to 7)

View File

@ -6,8 +6,8 @@
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,3 FILEVERSION 1,0,1,0
PRODUCTVERSION 1,0,0,3 PRODUCTVERSION 1,0,1,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -24,12 +24,12 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Google, Inc." VALUE "CompanyName", "Google, Inc."
VALUE "FileDescription", "libwebp DLL" VALUE "FileDescription", "libwebp DLL"
VALUE "FileVersion", "1.0.3" VALUE "FileVersion", "1.1.0"
VALUE "InternalName", "libwebp.dll" VALUE "InternalName", "libwebp.dll"
VALUE "LegalCopyright", "Copyright (C) 2019" VALUE "LegalCopyright", "Copyright (C) 2019"
VALUE "OriginalFilename", "libwebp.dll" VALUE "OriginalFilename", "libwebp.dll"
VALUE "ProductName", "WebP Image Codec" VALUE "ProductName", "WebP Image Codec"
VALUE "ProductVersion", "1.0.3" VALUE "ProductVersion", "1.1.0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -6,8 +6,8 @@
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,3 FILEVERSION 1,0,1,0
PRODUCTVERSION 1,0,0,3 PRODUCTVERSION 1,0,1,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -24,12 +24,12 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Google, Inc." VALUE "CompanyName", "Google, Inc."
VALUE "FileDescription", "libwebpdecoder DLL" VALUE "FileDescription", "libwebpdecoder DLL"
VALUE "FileVersion", "1.0.3" VALUE "FileVersion", "1.1.0"
VALUE "InternalName", "libwebpdecoder.dll" VALUE "InternalName", "libwebpdecoder.dll"
VALUE "LegalCopyright", "Copyright (C) 2019" VALUE "LegalCopyright", "Copyright (C) 2019"
VALUE "OriginalFilename", "libwebpdecoder.dll" VALUE "OriginalFilename", "libwebpdecoder.dll"
VALUE "ProductName", "WebP Image Decoder" VALUE "ProductName", "WebP Image Decoder"
VALUE "ProductVersion", "1.0.3" VALUE "ProductVersion", "1.1.0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -17,6 +17,6 @@ noinst_HEADERS =
noinst_HEADERS += ../webp/format_constants.h noinst_HEADERS += ../webp/format_constants.h
libwebpmux_la_LIBADD = ../libwebp.la libwebpmux_la_LIBADD = ../libwebp.la
libwebpmux_la_LDFLAGS = -no-undefined -version-info 3:4:0 -lm libwebpmux_la_LDFLAGS = -no-undefined -version-info 3:5:0 -lm
libwebpmuxincludedir = $(includedir)/webp libwebpmuxincludedir = $(includedir)/webp
pkgconfig_DATA = libwebpmux.pc pkgconfig_DATA = libwebpmux.pc

View File

@ -6,8 +6,8 @@
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,3 FILEVERSION 1,0,1,0
PRODUCTVERSION 1,0,0,3 PRODUCTVERSION 1,0,1,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -24,12 +24,12 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Google, Inc." VALUE "CompanyName", "Google, Inc."
VALUE "FileDescription", "libwebpmux DLL" VALUE "FileDescription", "libwebpmux DLL"
VALUE "FileVersion", "1.0.3" VALUE "FileVersion", "1.1.0"
VALUE "InternalName", "libwebpmux.dll" VALUE "InternalName", "libwebpmux.dll"
VALUE "LegalCopyright", "Copyright (C) 2019" VALUE "LegalCopyright", "Copyright (C) 2019"
VALUE "OriginalFilename", "libwebpmux.dll" VALUE "OriginalFilename", "libwebpmux.dll"
VALUE "ProductName", "WebP Image Muxer" VALUE "ProductName", "WebP Image Muxer"
VALUE "ProductVersion", "1.0.3" VALUE "ProductVersion", "1.1.0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -28,8 +28,8 @@ extern "C" {
// Defines and constants. // Defines and constants.
#define MUX_MAJ_VERSION 1 #define MUX_MAJ_VERSION 1
#define MUX_MIN_VERSION 0 #define MUX_MIN_VERSION 1
#define MUX_REV_VERSION 3 #define MUX_REV_VERSION 0
// Chunk object. // Chunk object.
typedef struct WebPChunk WebPChunk; typedef struct WebPChunk WebPChunk;

View File

@ -100,7 +100,7 @@ static int MuxImageParse(const WebPChunk* const chunk, int copy_data,
WebPMuxImage* const wpi) { WebPMuxImage* const wpi) {
const uint8_t* bytes = chunk->data_.bytes; const uint8_t* bytes = chunk->data_.bytes;
size_t size = chunk->data_.size; size_t size = chunk->data_.size;
const uint8_t* const last = bytes + size; const uint8_t* const last = (bytes == NULL) ? NULL : bytes + size;
WebPChunk subchunk; WebPChunk subchunk;
size_t subchunk_size; size_t subchunk_size;
WebPChunk** unknown_chunk_list = &wpi->unknown_; WebPChunk** unknown_chunk_list = &wpi->unknown_;

View File

@ -26,7 +26,7 @@ extern "C" {
// Main color cache struct. // Main color cache struct.
typedef struct { typedef struct {
uint32_t *colors_; // color entries uint32_t* colors_; // color entries
int hash_shift_; // Hash shift: 32 - hash_bits_. int hash_shift_; // Hash shift: 32 - hash_bits_.
int hash_bits_; int hash_bits_;
} VP8LColorCache; } VP8LColorCache;

View File

@ -73,7 +73,7 @@ typedef struct {
#endif #endif
static int pthread_create(pthread_t* const thread, const void* attr, static int pthread_create(pthread_t* const thread, const void* attr,
unsigned int (__stdcall *start)(void*), void* arg) { unsigned int (__stdcall* start)(void*), void* arg) {
(void)attr; (void)attr;
#ifdef USE_CREATE_THREAD #ifdef USE_CREATE_THREAD
*thread = CreateThread(NULL, /* lpThreadAttributes */ *thread = CreateThread(NULL, /* lpThreadAttributes */

View File

@ -216,9 +216,14 @@ void WebPSafeFree(void* const ptr) {
free(ptr); free(ptr);
} }
// Public API function. // Public API functions.
void* WebPMalloc(size_t size) {
return WebPSafeMalloc(1, size);
}
void WebPFree(void* ptr) { void WebPFree(void* ptr) {
free(ptr); WebPSafeFree(ptr);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@ -20,7 +20,7 @@
extern "C" { extern "C" {
#endif #endif
#define WEBP_DECODER_ABI_VERSION 0x0208 // MAJOR(8b) + MINOR(8b) #define WEBP_DECODER_ABI_VERSION 0x0209 // MAJOR(8b) + MINOR(8b)
// Note: forward declaring enumerations is not allowed in (strict) C and C++, // Note: forward declaring enumerations is not allowed in (strict) C and C++,
// the types are left here for reference. // the types are left here for reference.
@ -91,9 +91,6 @@ WEBP_EXTERN uint8_t* WebPDecodeYUV(const uint8_t* data, size_t data_size,
uint8_t** u, uint8_t** v, uint8_t** u, uint8_t** v,
int* stride, int* uv_stride); int* stride, int* uv_stride);
// Releases memory returned by the WebPDecode*() functions above.
WEBP_EXTERN void WebPFree(void* ptr);
// These five functions are variants of the above ones, that decode the image // These five functions are variants of the above ones, that decode the image
// directly into a pre-allocated buffer 'output_buffer'. The maximum storage // directly into a pre-allocated buffer 'output_buffer'. The maximum storage
// available in this buffer is indicated by 'output_buffer_size'. If this // available in this buffer is indicated by 'output_buffer_size'. If this

View File

@ -20,7 +20,7 @@
extern "C" { extern "C" {
#endif #endif
#define WEBP_ENCODER_ABI_VERSION 0x020e // MAJOR(8b) + MINOR(8b) #define WEBP_ENCODER_ABI_VERSION 0x020f // MAJOR(8b) + MINOR(8b)
// Note: forward declaring enumerations is not allowed in (strict) C and C++, // Note: forward declaring enumerations is not allowed in (strict) C and C++,
// the types are left here for reference. // the types are left here for reference.
@ -79,9 +79,6 @@ WEBP_EXTERN size_t WebPEncodeLosslessBGRA(const uint8_t* bgra,
int width, int height, int stride, int width, int height, int stride,
uint8_t** output); uint8_t** output);
// Releases memory returned by the WebPEncode*() functions above.
WEBP_EXTERN void WebPFree(void* ptr);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Coding parameters // Coding parameters
@ -306,7 +303,7 @@ struct WebPPicture {
// YUV input (mostly used for input to lossy compression) // YUV input (mostly used for input to lossy compression)
WebPEncCSP colorspace; // colorspace: should be YUV420 for now (=Y'CbCr). WebPEncCSP colorspace; // colorspace: should be YUV420 for now (=Y'CbCr).
int width, height; // dimensions (less or equal to WEBP_MAX_DIMENSION) int width, height; // dimensions (less or equal to WEBP_MAX_DIMENSION)
uint8_t *y, *u, *v; // pointers to luma/chroma planes. uint8_t* y, *u, *v; // pointers to luma/chroma planes.
int y_stride, uv_stride; // luma/chroma strides. int y_stride, uv_stride; // luma/chroma strides.
uint8_t* a; // pointer to the alpha plane uint8_t* a; // pointer to the alpha plane
int a_stride; // stride of the alpha plane int a_stride; // stride of the alpha plane
@ -350,7 +347,7 @@ struct WebPPicture {
uint32_t pad3[3]; // padding for later use uint32_t pad3[3]; // padding for later use
// Unused for now // Unused for now
uint8_t *pad4, *pad5; uint8_t* pad4, *pad5;
uint32_t pad6[8]; // padding for later use uint32_t pad6[8]; // padding for later use
// PRIVATE FIELDS // PRIVATE FIELDS

View File

@ -57,7 +57,7 @@ extern "C" {
WebPMuxGetChunk(mux, "ICCP", &icc_profile); WebPMuxGetChunk(mux, "ICCP", &icc_profile);
// ... (Consume icc_data). // ... (Consume icc_data).
WebPMuxDelete(mux); WebPMuxDelete(mux);
free(data); WebPFree(data);
*/ */
// Note: forward declaring enumerations is not allowed in (strict) C and C++, // Note: forward declaring enumerations is not allowed in (strict) C and C++,
@ -245,7 +245,7 @@ WEBP_EXTERN WebPMuxError WebPMuxPushFrame(
WebPMux* mux, const WebPMuxFrameInfo* frame, int copy_data); WebPMux* mux, const WebPMuxFrameInfo* frame, int copy_data);
// Gets the nth frame from the mux object. // Gets the nth frame from the mux object.
// The content of 'frame->bitstream' is allocated using malloc(), and NOT // The content of 'frame->bitstream' is allocated using WebPMalloc(), and NOT
// owned by the 'mux' object. It MUST be deallocated by the caller by calling // owned by the 'mux' object. It MUST be deallocated by the caller by calling
// WebPDataClear(). // WebPDataClear().
// nth=0 has a special meaning - last position. // nth=0 has a special meaning - last position.
@ -376,10 +376,10 @@ WEBP_EXTERN WebPMuxError WebPMuxNumChunks(const WebPMux* mux,
// Assembles all chunks in WebP RIFF format and returns in 'assembled_data'. // Assembles all chunks in WebP RIFF format and returns in 'assembled_data'.
// This function also validates the mux object. // This function also validates the mux object.
// Note: The content of 'assembled_data' will be ignored and overwritten. // Note: The content of 'assembled_data' will be ignored and overwritten.
// Also, the content of 'assembled_data' is allocated using malloc(), and NOT // Also, the content of 'assembled_data' is allocated using WebPMalloc(), and
// owned by the 'mux' object. It MUST be deallocated by the caller by calling // NOT owned by the 'mux' object. It MUST be deallocated by the caller by
// WebPDataClear(). It's always safe to call WebPDataClear() upon return, // calling WebPDataClear(). It's always safe to call WebPDataClear() upon
// even in case of error. // return, even in case of error.
// Parameters: // Parameters:
// mux - (in/out) object whose chunks are to be assembled // mux - (in/out) object whose chunks are to be assembled
// assembled_data - (out) assembled WebP data // assembled_data - (out) assembled WebP data

View File

@ -14,7 +14,6 @@
#ifndef WEBP_WEBP_MUX_TYPES_H_ #ifndef WEBP_WEBP_MUX_TYPES_H_
#define WEBP_WEBP_MUX_TYPES_H_ #define WEBP_WEBP_MUX_TYPES_H_
#include <stdlib.h> // free()
#include <string.h> // memset() #include <string.h> // memset()
#include "./types.h" #include "./types.h"
@ -56,6 +55,7 @@ typedef enum WebPMuxAnimBlend {
// Data type used to describe 'raw' data, e.g., chunk data // Data type used to describe 'raw' data, e.g., chunk data
// (ICC profile, metadata) and WebP compressed image data. // (ICC profile, metadata) and WebP compressed image data.
// 'bytes' memory must be allocated using WebPMalloc() and such.
struct WebPData { struct WebPData {
const uint8_t* bytes; const uint8_t* bytes;
size_t size; size_t size;
@ -68,11 +68,11 @@ static WEBP_INLINE void WebPDataInit(WebPData* webp_data) {
} }
} }
// Clears the contents of the 'webp_data' object by calling free(). Does not // Clears the contents of the 'webp_data' object by calling WebPFree().
// deallocate the object itself. // Does not deallocate the object itself.
static WEBP_INLINE void WebPDataClear(WebPData* webp_data) { static WEBP_INLINE void WebPDataClear(WebPData* webp_data) {
if (webp_data != NULL) { if (webp_data != NULL) {
free((void*)webp_data->bytes); WebPFree((void*)webp_data->bytes);
WebPDataInit(webp_data); WebPDataInit(webp_data);
} }
} }
@ -83,7 +83,7 @@ static WEBP_INLINE int WebPDataCopy(const WebPData* src, WebPData* dst) {
if (src == NULL || dst == NULL) return 0; if (src == NULL || dst == NULL) return 0;
WebPDataInit(dst); WebPDataInit(dst);
if (src->bytes != NULL && src->size != 0) { if (src->bytes != NULL && src->size != 0) {
dst->bytes = (uint8_t*)malloc(src->size); dst->bytes = (uint8_t*)WebPMalloc(src->size);
if (dst->bytes == NULL) return 0; if (dst->bytes == NULL) return 0;
memcpy((void*)dst->bytes, src->bytes, src->size); memcpy((void*)dst->bytes, src->bytes, src->size);
dst->size = src->size; dst->size = src->size;

View File

@ -7,7 +7,7 @@
// be found in the AUTHORS file in the root of the source tree. // be found in the AUTHORS file in the root of the source tree.
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// Common types // Common types + memory wrappers
// //
// Author: Skal (pascal.massimino@gmail.com) // Author: Skal (pascal.massimino@gmail.com)
@ -49,4 +49,20 @@ typedef long long int int64_t;
// Macro to check ABI compatibility (same major revision number) // Macro to check ABI compatibility (same major revision number)
#define WEBP_ABI_IS_INCOMPATIBLE(a, b) (((a) >> 8) != ((b) >> 8)) #define WEBP_ABI_IS_INCOMPATIBLE(a, b) (((a) >> 8) != ((b) >> 8))
#ifdef __cplusplus
extern "C" {
#endif
// Allocates 'size' bytes of memory. Returns NULL upon error. Memory
// must be deallocated by calling WebPFree(). This function is made available
// by the core 'libwebp' library.
WEBP_EXTERN void* WebPMalloc(size_t size);
// Releases memory returned by the WebPDecode*() functions (from decode.h).
WEBP_EXTERN void WebPFree(void* ptr);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // WEBP_WEBP_TYPES_H_ #endif // WEBP_WEBP_TYPES_H_

View File

@ -1,14 +1,9 @@
# Lint as: python2, python3
# This file was automatically generated by SWIG (http://www.swig.org). # This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.10 # Version 3.0.12
# #
# Do not make changes to this file unless you know what you are doing--modify # Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead. # the SWIG interface file instead.
from sys import version_info as _swig_python_version_info from sys import version_info as _swig_python_version_info
if _swig_python_version_info >= (2, 7, 0): if _swig_python_version_info >= (2, 7, 0):
def swig_import_helper(): def swig_import_helper():
@ -31,17 +26,18 @@ elif _swig_python_version_info >= (2, 6, 0):
except ImportError: except ImportError:
import _libwebp import _libwebp
return _libwebp return _libwebp
if fp is not None: try:
try: _mod = imp.load_module('_libwebp', fp, pathname, description)
_mod = imp.load_module('_libwebp', fp, pathname, description) finally:
finally: if fp is not None:
fp.close() fp.close()
return _mod return _mod
_libwebp = swig_import_helper() _libwebp = swig_import_helper()
del swig_import_helper del swig_import_helper
else: else:
import _libwebp import _libwebp
del _swig_python_version_info del _swig_python_version_info
try: try:
_swig_property = property _swig_property = property
except NameError: except NameError:

View File

@ -32,6 +32,9 @@
#ifdef SWIGPYTHON #ifdef SWIGPYTHON
%module(package="com.google.webp") libwebp %module(package="com.google.webp") libwebp
%begin %{
#define SWIG_PYTHON_STRICT_BYTE_CHAR
%}
#else #else
%module libwebp %module libwebp
#endif /* SWIGPYTHON */ #endif /* SWIGPYTHON */

View File

@ -1,6 +1,6 @@
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org). * This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.10 * Version 3.0.12
* *
* This file is not intended to be easily readable and contains a number of * This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make * coding conventions designed to improve portability and efficiency. Do not make
@ -8,6 +8,9 @@
* interface file instead. * interface file instead.
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
#define SWIG_PYTHON_STRICT_BYTE_CHAR
#ifndef SWIGPYTHON #ifndef SWIGPYTHON
#define SWIGPYTHON #define SWIGPYTHON
@ -749,6 +752,7 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
#define PyInt_FromSize_t(x) PyLong_FromSize_t(x) #define PyInt_FromSize_t(x) PyLong_FromSize_t(x)
#define PyString_Check(name) PyBytes_Check(name) #define PyString_Check(name) PyBytes_Check(name)
#define PyString_FromString(x) PyUnicode_FromString(x) #define PyString_FromString(x) PyUnicode_FromString(x)
#define PyString_FromStringAndSize(x, y) PyBytes_FromStringAndSize(x, y)
#define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) #define PyString_Format(fmt, args) PyUnicode_Format(fmt, args)
#define PyString_AsString(str) PyBytes_AsString(str) #define PyString_AsString(str) PyBytes_AsString(str)
#define PyString_Size(str) PyBytes_Size(str) #define PyString_Size(str) PyBytes_Size(str)
@ -952,6 +956,7 @@ typedef destructor freefunc;
#if PY_VERSION_HEX < 0x03020000 #if PY_VERSION_HEX < 0x03020000
#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name) #define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
#define Py_hash_t long
#endif #endif
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
@ -1607,6 +1612,14 @@ SwigPyObject_repr(SwigPyObject *v, PyObject *args)
return repr; return repr;
} }
/* We need a version taking two PyObject* parameters so it's a valid
* PyCFunction to use in swigobject_methods[]. */
SWIGRUNTIME PyObject *
SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
{
return SwigPyObject_repr((SwigPyObject*)v);
}
SWIGRUNTIME int SWIGRUNTIME int
SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w)
{ {
@ -1736,11 +1749,7 @@ SwigPyObject_append(PyObject* v, PyObject* next)
} }
SWIGRUNTIME PyObject* SWIGRUNTIME PyObject*
#ifdef METH_NOARGS
SwigPyObject_next(PyObject* v)
#else
SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
#endif
{ {
SwigPyObject *sobj = (SwigPyObject *) v; SwigPyObject *sobj = (SwigPyObject *) v;
if (sobj->next) { if (sobj->next) {
@ -1775,6 +1784,20 @@ SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
return SWIG_Py_Void(); return SWIG_Py_Void();
} }
#ifdef METH_NOARGS
static PyObject*
SwigPyObject_disown2(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
{
return SwigPyObject_disown(v);
}
static PyObject*
SwigPyObject_acquire2(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
{
return SwigPyObject_acquire(v);
}
#endif
SWIGINTERN PyObject* SWIGINTERN PyObject*
SwigPyObject_own(PyObject *v, PyObject *args) SwigPyObject_own(PyObject *v, PyObject *args)
{ {
@ -1815,12 +1838,12 @@ SwigPyObject_own(PyObject *v, PyObject *args)
#ifdef METH_O #ifdef METH_O
static PyMethodDef static PyMethodDef
swigobject_methods[] = { swigobject_methods[] = {
{(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, {(char *)"disown", (PyCFunction)SwigPyObject_disown2, METH_NOARGS, (char *)"releases ownership of the pointer"},
{(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"acquires ownership of the pointer"}, {(char *)"acquire", (PyCFunction)SwigPyObject_acquire2,METH_NOARGS, (char *)"acquires ownership of the pointer"},
{(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
{(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"},
{(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"},
{(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"}, {(char *)"__repr__",(PyCFunction)SwigPyObject_repr2, METH_NOARGS, (char *)"returns object representation"},
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
#else #else
@ -1831,7 +1854,7 @@ swigobject_methods[] = {
{(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
{(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"},
{(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"},
{(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"}, {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"},
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
#endif #endif
@ -1900,7 +1923,6 @@ SwigPyObject_TypeOnce(void) {
static int type_init = 0; static int type_init = 0;
if (!type_init) { if (!type_init) {
const PyTypeObject tmp = { const PyTypeObject tmp = {
/* PyObject header changed in Python 3 */
#if PY_VERSION_HEX >= 0x03000000 #if PY_VERSION_HEX >= 0x03000000
PyVarObject_HEAD_INIT(NULL, 0) PyVarObject_HEAD_INIT(NULL, 0)
#else #else
@ -1919,7 +1941,7 @@ SwigPyObject_TypeOnce(void) {
#endif #endif
(setattrfunc)0, /* tp_setattr */ (setattrfunc)0, /* tp_setattr */
#if PY_VERSION_HEX >= 0x03000000 #if PY_VERSION_HEX >= 0x03000000
0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */
#else #else
(cmpfunc)SwigPyObject_compare, /* tp_compare */ (cmpfunc)SwigPyObject_compare, /* tp_compare */
#endif #endif
@ -2092,7 +2114,6 @@ SwigPyPacked_TypeOnce(void) {
static int type_init = 0; static int type_init = 0;
if (!type_init) { if (!type_init) {
const PyTypeObject tmp = { const PyTypeObject tmp = {
/* PyObject header changed in Python 3 */
#if PY_VERSION_HEX>=0x03000000 #if PY_VERSION_HEX>=0x03000000
PyVarObject_HEAD_INIT(NULL, 0) PyVarObject_HEAD_INIT(NULL, 0)
#else #else
@ -3011,7 +3032,7 @@ static swig_module_info swig_module = {swig_types, 3, 0, 0, 0, 0};
#endif #endif
#define SWIG_name "_libwebp" #define SWIG_name "_libwebp"
#define SWIGVERSION 0x030010 #define SWIGVERSION 0x030012
#define SWIG_VERSION SWIGVERSION #define SWIG_VERSION SWIGVERSION
@ -3086,7 +3107,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
if (*alloc == SWIG_NEWOBJ) if (*alloc == SWIG_NEWOBJ)
#endif #endif
{ {
*cptr = (char *)memcpy((char *)malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1)); *cptr = (char *)memcpy(malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1));
*alloc = SWIG_NEWOBJ; *alloc = SWIG_NEWOBJ;
} else { } else {
*cptr = cstr; *cptr = cstr;
@ -3124,7 +3145,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
if (PyString_AsStringAndSize(obj, &cstr, &len) != -1) { if (PyString_AsStringAndSize(obj, &cstr, &len) != -1) {
if (cptr) { if (cptr) {
if (alloc) *alloc = SWIG_NEWOBJ; if (alloc) *alloc = SWIG_NEWOBJ;
*cptr = (char *)memcpy((char *)malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1)); *cptr = (char *)memcpy(malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1));
} }
if (psize) *psize = len + 1; if (psize) *psize = len + 1;
@ -3161,7 +3182,7 @@ SWIG_AsVal_double (PyObject *obj, double *val)
return SWIG_OK; return SWIG_OK;
#if PY_VERSION_HEX < 0x03000000 #if PY_VERSION_HEX < 0x03000000
} else if (PyInt_Check(obj)) { } else if (PyInt_Check(obj)) {
if (val) *val = PyInt_AsLong(obj); if (val) *val = (double) PyInt_AsLong(obj);
return SWIG_OK; return SWIG_OK;
#endif #endif
} else if (PyLong_Check(obj)) { } else if (PyLong_Check(obj)) {
@ -3324,6 +3345,8 @@ SWIG_AsVal_unsigned_SS_long_SS_long (PyObject *obj, unsigned long long *val)
const double mant_max = 1LL << DBL_MANT_DIG; const double mant_max = 1LL << DBL_MANT_DIG;
double d; double d;
res = SWIG_AsVal_double (obj,&d); res = SWIG_AsVal_double (obj,&d);
if (SWIG_IsOK(res) && !SWIG_CanCastAsInteger(&d, 0, mant_max))
return SWIG_OverflowError;
if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, mant_max)) { if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, mant_max)) {
if (val) *val = (unsigned long long)(d); if (val) *val = (unsigned long long)(d);
return SWIG_AddCast(res); return SWIG_AddCast(res);
@ -3547,11 +3570,25 @@ SWIG_AsVal_int (PyObject * obj, int *val)
/* Getting isfinite working pre C99 across multiple platforms is non-trivial. Users can provide SWIG_isfinite on older platforms. */ /* Getting isfinite working pre C99 across multiple platforms is non-trivial. Users can provide SWIG_isfinite on older platforms. */
#ifndef SWIG_isfinite #ifndef SWIG_isfinite
/* isfinite() is a macro for C99, but a function in namespace std for C++11. */ /* isfinite() is a macro for C99 */
# if defined(isfinite) # if defined(isfinite)
# define SWIG_isfinite(X) (isfinite(X)) # define SWIG_isfinite(X) (isfinite(X))
# elif defined __cplusplus && __cplusplus >= 201103L # elif defined __cplusplus && __cplusplus >= 201103L
# define SWIG_isfinite(X) (std::isfinite(X)) /* Use a template so that this works whether isfinite() is std::isfinite() or
* in the global namespace. The reality seems to vary between compiler
* versions.
*
* Make sure namespace std exists to avoid compiler warnings.
*
* extern "C++" is required as this fragment can end up inside an extern "C" { } block
*/
namespace std { }
extern "C++" template<typename T>
inline int SWIG_isfinite_func(T x) {
using namespace std;
return isfinite(x);
}
# define SWIG_isfinite(X) (SWIG_isfinite_func(X))
# elif defined(_MSC_VER) # elif defined(_MSC_VER)
# define SWIG_isfinite(X) (_finite(X)) # define SWIG_isfinite(X) (_finite(X))
# elif defined(__sun) && defined(__SVR4) # elif defined(__sun) && defined(__SVR4)
@ -4851,23 +4888,23 @@ fail:
static PyMethodDef SwigMethods[] = { static PyMethodDef SwigMethods[] = {
{ (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL}, { "SWIG_PyInstanceMethod_New", SWIG_PyInstanceMethod_New, METH_O, NULL},
{ (char *)"WebPGetDecoderVersion", _wrap_WebPGetDecoderVersion, METH_VARARGS, (char *)"WebPGetDecoderVersion() -> int"}, { "WebPGetDecoderVersion", _wrap_WebPGetDecoderVersion, METH_VARARGS, (char *)"WebPGetDecoderVersion() -> int"},
{ (char *)"WebPGetInfo", _wrap_WebPGetInfo, METH_VARARGS, (char *)"WebPGetInfo(uint8_t data) -> (width, height)"}, { "WebPGetInfo", _wrap_WebPGetInfo, METH_VARARGS, (char *)"WebPGetInfo(uint8_t data) -> (width, height)"},
{ (char *)"WebPDecodeRGB", _wrap_WebPDecodeRGB, METH_VARARGS, (char *)"WebPDecodeRGB(uint8_t data) -> (rgb, width, height)"}, { "WebPDecodeRGB", _wrap_WebPDecodeRGB, METH_VARARGS, (char *)"WebPDecodeRGB(uint8_t data) -> (rgb, width, height)"},
{ (char *)"WebPDecodeRGBA", _wrap_WebPDecodeRGBA, METH_VARARGS, (char *)"WebPDecodeRGBA(uint8_t data) -> (rgb, width, height)"}, { "WebPDecodeRGBA", _wrap_WebPDecodeRGBA, METH_VARARGS, (char *)"WebPDecodeRGBA(uint8_t data) -> (rgb, width, height)"},
{ (char *)"WebPDecodeARGB", _wrap_WebPDecodeARGB, METH_VARARGS, (char *)"WebPDecodeARGB(uint8_t data) -> (rgb, width, height)"}, { "WebPDecodeARGB", _wrap_WebPDecodeARGB, METH_VARARGS, (char *)"WebPDecodeARGB(uint8_t data) -> (rgb, width, height)"},
{ (char *)"WebPDecodeBGR", _wrap_WebPDecodeBGR, METH_VARARGS, (char *)"WebPDecodeBGR(uint8_t data) -> (rgb, width, height)"}, { "WebPDecodeBGR", _wrap_WebPDecodeBGR, METH_VARARGS, (char *)"WebPDecodeBGR(uint8_t data) -> (rgb, width, height)"},
{ (char *)"WebPDecodeBGRA", _wrap_WebPDecodeBGRA, METH_VARARGS, (char *)"WebPDecodeBGRA(uint8_t data) -> (rgb, width, height)"}, { "WebPDecodeBGRA", _wrap_WebPDecodeBGRA, METH_VARARGS, (char *)"WebPDecodeBGRA(uint8_t data) -> (rgb, width, height)"},
{ (char *)"WebPGetEncoderVersion", _wrap_WebPGetEncoderVersion, METH_VARARGS, (char *)"WebPGetEncoderVersion() -> int"}, { "WebPGetEncoderVersion", _wrap_WebPGetEncoderVersion, METH_VARARGS, (char *)"WebPGetEncoderVersion() -> int"},
{ (char *)"wrap_WebPEncodeRGB", _wrap_wrap_WebPEncodeRGB, METH_VARARGS, (char *)"private, do not call directly."}, { "wrap_WebPEncodeRGB", _wrap_wrap_WebPEncodeRGB, METH_VARARGS, (char *)"private, do not call directly."},
{ (char *)"wrap_WebPEncodeBGR", _wrap_wrap_WebPEncodeBGR, METH_VARARGS, (char *)"private, do not call directly."}, { "wrap_WebPEncodeBGR", _wrap_wrap_WebPEncodeBGR, METH_VARARGS, (char *)"private, do not call directly."},
{ (char *)"wrap_WebPEncodeRGBA", _wrap_wrap_WebPEncodeRGBA, METH_VARARGS, (char *)"private, do not call directly."}, { "wrap_WebPEncodeRGBA", _wrap_wrap_WebPEncodeRGBA, METH_VARARGS, (char *)"private, do not call directly."},
{ (char *)"wrap_WebPEncodeBGRA", _wrap_wrap_WebPEncodeBGRA, METH_VARARGS, (char *)"private, do not call directly."}, { "wrap_WebPEncodeBGRA", _wrap_wrap_WebPEncodeBGRA, METH_VARARGS, (char *)"private, do not call directly."},
{ (char *)"wrap_WebPEncodeLosslessRGB", _wrap_wrap_WebPEncodeLosslessRGB, METH_VARARGS, (char *)"private, do not call directly."}, { "wrap_WebPEncodeLosslessRGB", _wrap_wrap_WebPEncodeLosslessRGB, METH_VARARGS, (char *)"private, do not call directly."},
{ (char *)"wrap_WebPEncodeLosslessBGR", _wrap_wrap_WebPEncodeLosslessBGR, METH_VARARGS, (char *)"private, do not call directly."}, { "wrap_WebPEncodeLosslessBGR", _wrap_wrap_WebPEncodeLosslessBGR, METH_VARARGS, (char *)"private, do not call directly."},
{ (char *)"wrap_WebPEncodeLosslessRGBA", _wrap_wrap_WebPEncodeLosslessRGBA, METH_VARARGS, (char *)"private, do not call directly."}, { "wrap_WebPEncodeLosslessRGBA", _wrap_wrap_WebPEncodeLosslessRGBA, METH_VARARGS, (char *)"private, do not call directly."},
{ (char *)"wrap_WebPEncodeLosslessBGRA", _wrap_wrap_WebPEncodeLosslessBGRA, METH_VARARGS, (char *)"private, do not call directly."}, { "wrap_WebPEncodeLosslessBGRA", _wrap_wrap_WebPEncodeLosslessBGRA, METH_VARARGS, (char *)"private, do not call directly."},
{ NULL, NULL, 0, NULL } { NULL, NULL, 0, NULL }
}; };
@ -5271,7 +5308,6 @@ extern "C" {
static int type_init = 0; static int type_init = 0;
if (!type_init) { if (!type_init) {
const PyTypeObject tmp = { const PyTypeObject tmp = {
/* PyObject header changed in Python 3 */
#if PY_VERSION_HEX >= 0x03000000 #if PY_VERSION_HEX >= 0x03000000
PyVarObject_HEAD_INIT(NULL, 0) PyVarObject_HEAD_INIT(NULL, 0)
#else #else
@ -5433,9 +5469,9 @@ extern "C" {
char *ndoc = (char*)malloc(ldoc + lptr + 10); char *ndoc = (char*)malloc(ldoc + lptr + 10);
if (ndoc) { if (ndoc) {
char *buff = ndoc; char *buff = ndoc;
strncpy(buff, methods[i].ml_doc, ldoc); memcpy(buff, methods[i].ml_doc, ldoc);
buff += ldoc; buff += ldoc;
strncpy(buff, "swig_ptr: ", 10); memcpy(buff, "swig_ptr: ", 10);
buff += 10; buff += 10;
SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
methods[i].ml_doc = ndoc; methods[i].ml_doc = ndoc;
@ -5497,19 +5533,19 @@ SWIG_init(void) {
(char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL (char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL
}; };
static SwigPyGetSet thisown_getset_closure = { static SwigPyGetSet thisown_getset_closure = {
(PyCFunction) SwigPyObject_own, SwigPyObject_own,
(PyCFunction) SwigPyObject_own SwigPyObject_own
}; };
static PyGetSetDef thisown_getset_def = { static PyGetSetDef thisown_getset_def = {
(char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure
}; };
PyObject *metatype_args;
PyTypeObject *builtin_pytype; PyTypeObject *builtin_pytype;
int builtin_base_count; int builtin_base_count;
swig_type_info *builtin_basetype; swig_type_info *builtin_basetype;
PyObject *tuple; PyObject *tuple;
PyGetSetDescrObject *static_getset; PyGetSetDescrObject *static_getset;
PyTypeObject *metatype; PyTypeObject *metatype;
PyTypeObject *swigpyobject;
SwigPyClientData *cd; SwigPyClientData *cd;
PyObject *public_interface, *public_symbol; PyObject *public_interface, *public_symbol;
PyObject *this_descr; PyObject *this_descr;
@ -5524,14 +5560,9 @@ SWIG_init(void) {
(void)static_getset; (void)static_getset;
(void)self; (void)self;
/* metatype is used to implement static member variables. */ /* Metaclass is used to implement static member variables */
metatype_args = Py_BuildValue("(s(O){})", "SwigPyObjectType", &PyType_Type); metatype = SwigPyObjectType();
assert(metatype_args);
metatype = (PyTypeObject *) PyType_Type.tp_call((PyObject *) &PyType_Type, metatype_args, NULL);
assert(metatype); assert(metatype);
Py_DECREF(metatype_args);
metatype->tp_setattro = (setattrofunc) &SwigPyObjectType_setattro;
assert(PyType_Ready(metatype) >= 0);
#endif #endif
/* Fix SwigMethods to carry the callback ptrs when needed */ /* Fix SwigMethods to carry the callback ptrs when needed */
@ -5549,13 +5580,15 @@ SWIG_init(void) {
SWIG_InitializeModule(0); SWIG_InitializeModule(0);
#ifdef SWIGPYTHON_BUILTIN #ifdef SWIGPYTHON_BUILTIN
swigpyobject = SwigPyObject_TypeOnce();
SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject"); SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject");
assert(SwigPyObject_stype); assert(SwigPyObject_stype);
cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; cd = (SwigPyClientData*) SwigPyObject_stype->clientdata;
if (!cd) { if (!cd) {
SwigPyObject_stype->clientdata = &SwigPyObject_clientdata; SwigPyObject_stype->clientdata = &SwigPyObject_clientdata;
SwigPyObject_clientdata.pytype = SwigPyObject_TypeOnce(); SwigPyObject_clientdata.pytype = swigpyobject;
} else if (SwigPyObject_TypeOnce()->tp_basicsize != cd->pytype->tp_basicsize) { } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) {
PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules."); PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules.");
# if PY_VERSION_HEX >= 0x03000000 # if PY_VERSION_HEX >= 0x03000000
return NULL; return NULL;