mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-15 13:29:54 +02:00
Compare commits
50 Commits
v1.2.1-rc2
...
v1.2.2-rc2
Author | SHA1 | Date | |
---|---|---|---|
9195ea0538 | |||
4acae017bd | |||
883f063397 | |||
567e1f442b | |||
f084244d9f | |||
b217b4fff7 | |||
f035d2e40d | |||
7031946ad8 | |||
973390b618 | |||
abd6664fee | |||
5b7e79303a | |||
02ca04c348 | |||
e94716e27c | |||
c846efd888 | |||
b6f756e82b | |||
8f5cb4c18e | |||
8ea81561d2 | |||
6b1d18c362 | |||
3368d8768a | |||
f213abf620 | |||
50c97c301d | |||
2c206aaf96 | |||
96e3dfef26 | |||
0e0f74b7e3 | |||
35b7436a21 | |||
21d24b4c08 | |||
cdcf89020e | |||
dc683cdef5 | |||
0858494e96 | |||
c2cf6a93b0 | |||
df0e808fed | |||
676c57dba4 | |||
7bb7f7474e | |||
abcd1797a1 | |||
edaf08952d | |||
b96220636b | |||
e23cd5481c | |||
3875c7de07 | |||
1a8f0d45d3 | |||
934801604e | |||
45eaacc939 | |||
42592af875 | |||
e298e05f66 | |||
29148919e0 | |||
9ce5843dba | |||
d9191588ab | |||
c5bc36243a | |||
53b6f76209 | |||
d2caaba435 | |||
1fe3162541 |
1
.mailmap
1
.mailmap
@ -12,3 +12,4 @@ Tamar Levy <tamar.levy@intel.com>
|
||||
<qrczak@google.com> <qrczak>
|
||||
Hui Su <huisu@google.com>
|
||||
James Zern <jzern@google.com>
|
||||
Roberto Alanis <alanisbaez@google.com>
|
||||
|
441
.pylintrc
Normal file
441
.pylintrc
Normal file
@ -0,0 +1,441 @@
|
||||
# This Pylint rcfile contains a best-effort configuration to uphold the
|
||||
# best-practices and style described in the Google Python style guide:
|
||||
# https://google.github.io/styleguide/pyguide.html
|
||||
#
|
||||
# Its canonical open-source location is:
|
||||
# https://google.github.io/styleguide/pylintrc
|
||||
|
||||
[MASTER]
|
||||
|
||||
# Files or directories to be skipped. They should be base names, not paths.
|
||||
ignore=third_party
|
||||
|
||||
# Files or directories matching the regex patterns are skipped. The regex
|
||||
# matches against base names, not paths.
|
||||
ignore-patterns=
|
||||
|
||||
# Pickle collected data for later comparisons.
|
||||
persistent=no
|
||||
|
||||
# List of plugins (as comma separated values of python modules names) to load,
|
||||
# usually to register additional checkers.
|
||||
load-plugins=
|
||||
|
||||
# Use multiple processes to speed up Pylint.
|
||||
jobs=4
|
||||
|
||||
# Allow loading of arbitrary C extensions. Extensions are imported into the
|
||||
# active Python interpreter and may run arbitrary code.
|
||||
unsafe-load-any-extension=no
|
||||
|
||||
|
||||
[MESSAGES CONTROL]
|
||||
|
||||
# Only show warnings with the listed confidence levels. Leave empty to show
|
||||
# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED
|
||||
confidence=
|
||||
|
||||
# Enable the message, report, category or checker with the given id(s). You can
|
||||
# either give multiple identifier separated by comma (,) or put this option
|
||||
# multiple time (only on the command line, not in the configuration file where
|
||||
# it should appear only once). See also the "--disable" option for examples.
|
||||
#enable=
|
||||
|
||||
# Disable the message, report, category or checker with the given id(s). You
|
||||
# can either give multiple identifiers separated by comma (,) or put this
|
||||
# option multiple times (only on the command line, not in the configuration
|
||||
# file where it should appear only once).You can also use "--disable=all" to
|
||||
# disable everything first and then reenable specific checks. For example, if
|
||||
# you want to run only the similarities checker, you can use "--disable=all
|
||||
# --enable=similarities". If you want to run only the classes checker, but have
|
||||
# no Warning level messages displayed, use"--disable=all --enable=classes
|
||||
# --disable=W"
|
||||
disable=abstract-method,
|
||||
apply-builtin,
|
||||
arguments-differ,
|
||||
attribute-defined-outside-init,
|
||||
backtick,
|
||||
bad-option-value,
|
||||
basestring-builtin,
|
||||
buffer-builtin,
|
||||
c-extension-no-member,
|
||||
consider-using-enumerate,
|
||||
cmp-builtin,
|
||||
cmp-method,
|
||||
coerce-builtin,
|
||||
coerce-method,
|
||||
delslice-method,
|
||||
div-method,
|
||||
duplicate-code,
|
||||
eq-without-hash,
|
||||
execfile-builtin,
|
||||
file-builtin,
|
||||
filter-builtin-not-iterating,
|
||||
fixme,
|
||||
getslice-method,
|
||||
global-statement,
|
||||
hex-method,
|
||||
idiv-method,
|
||||
implicit-str-concat-in-sequence,
|
||||
import-error,
|
||||
import-self,
|
||||
import-star-module-level,
|
||||
inconsistent-return-statements,
|
||||
input-builtin,
|
||||
intern-builtin,
|
||||
invalid-str-codec,
|
||||
locally-disabled,
|
||||
long-builtin,
|
||||
long-suffix,
|
||||
map-builtin-not-iterating,
|
||||
misplaced-comparison-constant,
|
||||
missing-function-docstring,
|
||||
metaclass-assignment,
|
||||
next-method-called,
|
||||
next-method-defined,
|
||||
no-absolute-import,
|
||||
no-else-break,
|
||||
no-else-continue,
|
||||
no-else-raise,
|
||||
no-else-return,
|
||||
no-init, # added
|
||||
no-member,
|
||||
no-name-in-module,
|
||||
no-self-use,
|
||||
nonzero-method,
|
||||
oct-method,
|
||||
old-division,
|
||||
old-ne-operator,
|
||||
old-octal-literal,
|
||||
old-raise-syntax,
|
||||
parameter-unpacking,
|
||||
print-statement,
|
||||
raising-string,
|
||||
range-builtin-not-iterating,
|
||||
raw_input-builtin,
|
||||
rdiv-method,
|
||||
reduce-builtin,
|
||||
relative-import,
|
||||
reload-builtin,
|
||||
round-builtin,
|
||||
setslice-method,
|
||||
signature-differs,
|
||||
standarderror-builtin,
|
||||
suppressed-message,
|
||||
sys-max-int,
|
||||
too-few-public-methods,
|
||||
too-many-ancestors,
|
||||
too-many-arguments,
|
||||
too-many-boolean-expressions,
|
||||
too-many-branches,
|
||||
too-many-instance-attributes,
|
||||
too-many-locals,
|
||||
too-many-nested-blocks,
|
||||
too-many-public-methods,
|
||||
too-many-return-statements,
|
||||
too-many-statements,
|
||||
trailing-newlines,
|
||||
unichr-builtin,
|
||||
unicode-builtin,
|
||||
unnecessary-pass,
|
||||
unpacking-in-except,
|
||||
useless-else-on-loop,
|
||||
useless-object-inheritance,
|
||||
useless-suppression,
|
||||
using-cmp-argument,
|
||||
wrong-import-order,
|
||||
xrange-builtin,
|
||||
zip-builtin-not-iterating,
|
||||
|
||||
|
||||
[REPORTS]
|
||||
|
||||
# Set the output format. Available formats are text, parseable, colorized, msvs
|
||||
# (visual studio) and html. You can also give a reporter class, eg
|
||||
# mypackage.mymodule.MyReporterClass.
|
||||
output-format=text
|
||||
|
||||
# Put messages in a separate file for each module / package specified on the
|
||||
# command line instead of printing them on stdout. Reports (if any) will be
|
||||
# written in a file name "pylint_global.[txt|html]". This option is deprecated
|
||||
# and it will be removed in Pylint 2.0.
|
||||
files-output=no
|
||||
|
||||
# Tells whether to display a full report or only the messages
|
||||
reports=no
|
||||
|
||||
# Python expression which should return a note less than 10 (10 is the highest
|
||||
# note). You have access to the variables errors warning, statement which
|
||||
# respectively contain the number of errors / warnings messages and the total
|
||||
# number of statements analyzed. This is used by the global evaluation report
|
||||
# (RP0004).
|
||||
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
|
||||
|
||||
# Template used to display messages. This is a python new-style format string
|
||||
# used to format the message information. See doc for all details
|
||||
#msg-template=
|
||||
|
||||
|
||||
[BASIC]
|
||||
|
||||
# Good variable names which should always be accepted, separated by a comma
|
||||
good-names=main,_,PRESUBMIT
|
||||
|
||||
# Bad variable names which should always be refused, separated by a comma
|
||||
bad-names=
|
||||
|
||||
# Colon-delimited sets of names that determine each other's naming style when
|
||||
# the name regexes allow several styles.
|
||||
name-group=
|
||||
|
||||
# Include a hint for the correct naming format with invalid-name
|
||||
include-naming-hint=no
|
||||
|
||||
# List of decorators that produce properties, such as abc.abstractproperty. Add
|
||||
# to this list to register other decorators that produce valid properties.
|
||||
property-classes=abc.abstractproperty,cached_property.cached_property,cached_property.threaded_cached_property,cached_property.cached_property_with_ttl,cached_property.threaded_cached_property_with_ttl
|
||||
|
||||
# Regular expression matching correct function names
|
||||
function-rgx=^(?:(?P<exempt>setUp|tearDown|setUpModule|tearDownModule)|(?P<camel_case>_?[A-Z][a-zA-Z0-9]*)|(?P<snake_case>_?[a-z][a-z0-9_]*))$
|
||||
|
||||
# Regular expression matching correct variable names
|
||||
variable-rgx=^[a-z][a-z0-9_]*$
|
||||
|
||||
# Regular expression matching correct constant names
|
||||
const-rgx=^(_?[A-Z][A-Z0-9_]*|__[a-z0-9_]+__|_?[a-z][a-z0-9_]*)$
|
||||
|
||||
# Regular expression matching correct attribute names
|
||||
attr-rgx=^_{0,2}[a-z][a-z0-9_]*$
|
||||
|
||||
# Regular expression matching correct argument names
|
||||
argument-rgx=^[a-z][a-z0-9_]*$
|
||||
|
||||
# Regular expression matching correct class attribute names
|
||||
class-attribute-rgx=^(_?[A-Z][A-Z0-9_]*|__[a-z0-9_]+__|_?[a-z][a-z0-9_]*)$
|
||||
|
||||
# Regular expression matching correct inline iteration names
|
||||
inlinevar-rgx=^[a-z][a-z0-9_]*$
|
||||
|
||||
# Regular expression matching correct class names
|
||||
class-rgx=^_?[A-Z][a-zA-Z0-9]*$
|
||||
|
||||
# Regular expression matching correct module names
|
||||
module-rgx=^(_?[a-z][a-z0-9_]*|__init__)$
|
||||
|
||||
# Regular expression matching correct method names
|
||||
method-rgx=(?x)^(?:(?P<exempt>_[a-z0-9_]+__|runTest|setUp|tearDown|setUpTestCase|tearDownTestCase|setupSelf|tearDownClass|setUpClass|(test|assert)_*[A-Z0-9][a-zA-Z0-9_]*|next)|(?P<camel_case>_{0,2}[A-Z][a-zA-Z0-9_]*)|(?P<snake_case>_{0,2}[a-z][a-z0-9_]*))$
|
||||
|
||||
# Regular expression which should only match function or class names that do
|
||||
# not require a docstring.
|
||||
no-docstring-rgx=(__.*__|main|test.*|.*test|.*Test)$
|
||||
|
||||
# Minimum line length for functions/classes that require docstrings, shorter
|
||||
# ones are exempt.
|
||||
docstring-min-length=10
|
||||
|
||||
|
||||
[TYPECHECK]
|
||||
|
||||
# List of decorators that produce context managers, such as
|
||||
# contextlib.contextmanager. Add to this list to register other decorators that
|
||||
# produce valid context managers.
|
||||
contextmanager-decorators=contextlib.contextmanager,contextlib2.contextmanager
|
||||
|
||||
# Tells whether missing members accessed in mixin class should be ignored. A
|
||||
# mixin class is detected if its name ends with "mixin" (case insensitive).
|
||||
ignore-mixin-members=yes
|
||||
|
||||
# List of module names for which member attributes should not be checked
|
||||
# (useful for modules/projects where namespaces are manipulated during runtime
|
||||
# and thus existing member attributes cannot be deduced by static analysis. It
|
||||
# supports qualified module names, as well as Unix pattern matching.
|
||||
ignored-modules=
|
||||
|
||||
# List of class names for which member attributes should not be checked (useful
|
||||
# for classes with dynamically set attributes). This supports the use of
|
||||
# qualified names.
|
||||
ignored-classes=optparse.Values,thread._local,_thread._local
|
||||
|
||||
# List of members which are set dynamically and missed by pylint inference
|
||||
# system, and so shouldn't trigger E1101 when accessed. Python regular
|
||||
# expressions are accepted.
|
||||
generated-members=
|
||||
|
||||
|
||||
[FORMAT]
|
||||
|
||||
# Maximum number of characters on a single line.
|
||||
max-line-length=80
|
||||
|
||||
# TODO(https://github.com/PyCQA/pylint/issues/3352): Direct pylint to exempt
|
||||
# lines made too long by directives to pytype.
|
||||
|
||||
# Regexp for a line that is allowed to be longer than the limit.
|
||||
ignore-long-lines=(?x)(
|
||||
^\s*(\#\ )?<?https?://\S+>?$|
|
||||
^\s*(from\s+\S+\s+)?import\s+.+$)
|
||||
|
||||
# Allow the body of an if to be on the same line as the test if there is no
|
||||
# else.
|
||||
single-line-if-stmt=yes
|
||||
|
||||
# List of optional constructs for which whitespace checking is disabled. `dict-
|
||||
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
|
||||
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
|
||||
# `empty-line` allows space-only lines.
|
||||
no-space-check=
|
||||
|
||||
# Maximum number of lines in a module
|
||||
max-module-lines=99999
|
||||
|
||||
# String used as indentation unit. The internal Google style guide mandates 2
|
||||
# spaces. Google's externaly-published style guide says 4, consistent with
|
||||
# PEP 8. Here, we use 2 spaces, for conformity with many open-sourced Google
|
||||
# projects (like TensorFlow).
|
||||
indent-string=' '
|
||||
|
||||
# Number of spaces of indent required inside a hanging or continued line.
|
||||
indent-after-paren=4
|
||||
|
||||
# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
|
||||
expected-line-ending-format=
|
||||
|
||||
|
||||
[MISCELLANEOUS]
|
||||
|
||||
# List of note tags to take in consideration, separated by a comma.
|
||||
notes=TODO
|
||||
|
||||
|
||||
[STRING]
|
||||
|
||||
# This flag controls whether inconsistent-quotes generates a warning when the
|
||||
# character used as a quote delimiter is used inconsistently within a module.
|
||||
check-quote-consistency=yes
|
||||
|
||||
|
||||
[VARIABLES]
|
||||
|
||||
# Tells whether we should check for unused import in __init__ files.
|
||||
init-import=no
|
||||
|
||||
# A regular expression matching the name of dummy variables (i.e. expectedly
|
||||
# not used).
|
||||
dummy-variables-rgx=^\*{0,2}(_$|unused_|dummy_)
|
||||
|
||||
# List of additional names supposed to be defined in builtins. Remember that
|
||||
# you should avoid to define new builtins when possible.
|
||||
additional-builtins=
|
||||
|
||||
# List of strings which can identify a callback function by name. A callback
|
||||
# name must start or end with one of those strings.
|
||||
callbacks=cb_,_cb
|
||||
|
||||
# List of qualified module names which can have objects that can redefine
|
||||
# builtins.
|
||||
redefining-builtins-modules=six,six.moves,past.builtins,future.builtins,functools
|
||||
|
||||
|
||||
[LOGGING]
|
||||
|
||||
# Logging modules to check that the string format arguments are in logging
|
||||
# function parameter format
|
||||
logging-modules=logging,absl.logging,tensorflow.io.logging
|
||||
|
||||
|
||||
[SIMILARITIES]
|
||||
|
||||
# Minimum lines number of a similarity.
|
||||
min-similarity-lines=4
|
||||
|
||||
# Ignore comments when computing similarities.
|
||||
ignore-comments=yes
|
||||
|
||||
# Ignore docstrings when computing similarities.
|
||||
ignore-docstrings=yes
|
||||
|
||||
# Ignore imports when computing similarities.
|
||||
ignore-imports=no
|
||||
|
||||
|
||||
[SPELLING]
|
||||
|
||||
# Spelling dictionary name. Available dictionaries: none. To make it working
|
||||
# install python-enchant package.
|
||||
spelling-dict=
|
||||
|
||||
# List of comma separated words that should not be checked.
|
||||
spelling-ignore-words=
|
||||
|
||||
# A path to a file that contains private dictionary; one word per line.
|
||||
spelling-private-dict-file=
|
||||
|
||||
# Tells whether to store unknown words to indicated private dictionary in
|
||||
# --spelling-private-dict-file option instead of raising a message.
|
||||
spelling-store-unknown-words=no
|
||||
|
||||
|
||||
[IMPORTS]
|
||||
|
||||
# Deprecated modules which should not be used, separated by a comma
|
||||
deprecated-modules=regsub,
|
||||
TERMIOS,
|
||||
Bastion,
|
||||
rexec,
|
||||
sets
|
||||
|
||||
# Create a graph of every (i.e. internal and external) dependencies in the
|
||||
# given file (report RP0402 must not be disabled)
|
||||
import-graph=
|
||||
|
||||
# Create a graph of external dependencies in the given file (report RP0402 must
|
||||
# not be disabled)
|
||||
ext-import-graph=
|
||||
|
||||
# Create a graph of internal dependencies in the given file (report RP0402 must
|
||||
# not be disabled)
|
||||
int-import-graph=
|
||||
|
||||
# Force import order to recognize a module as part of the standard
|
||||
# compatibility libraries.
|
||||
known-standard-library=
|
||||
|
||||
# Force import order to recognize a module as part of a third party library.
|
||||
known-third-party=enchant, absl
|
||||
|
||||
# Analyse import fallback blocks. This can be used to support both Python 2 and
|
||||
# 3 compatible code, which means that the block might have code that exists
|
||||
# only in one or another interpreter, leading to false positives when analysed.
|
||||
analyse-fallback-blocks=no
|
||||
|
||||
|
||||
[CLASSES]
|
||||
|
||||
# List of method names used to declare (i.e. assign) instance attributes.
|
||||
defining-attr-methods=__init__,
|
||||
__new__,
|
||||
setUp
|
||||
|
||||
# List of member names, which should be excluded from the protected access
|
||||
# warning.
|
||||
exclude-protected=_asdict,
|
||||
_fields,
|
||||
_replace,
|
||||
_source,
|
||||
_make
|
||||
|
||||
# List of valid names for the first argument in a class method.
|
||||
valid-classmethod-first-arg=cls,
|
||||
class_
|
||||
|
||||
# List of valid names for the first argument in a metaclass class method.
|
||||
valid-metaclass-classmethod-first-arg=mcs
|
||||
|
||||
|
||||
[EXCEPTIONS]
|
||||
|
||||
# Exceptions that will emit a warning when being caught. Defaults to
|
||||
# "Exception"
|
||||
overgeneral-exceptions=StandardError,
|
||||
Exception,
|
||||
BaseException
|
2
.style.yapf
Normal file
2
.style.yapf
Normal file
@ -0,0 +1,2 @@
|
||||
[style]
|
||||
based_on_style = chromium
|
1
AUTHORS
1
AUTHORS
@ -32,6 +32,7 @@ Contributors:
|
||||
- Pascal Massimino (pascal dot massimino at gmail dot com)
|
||||
- Paweł Hajdan, Jr (phajdan dot jr at chromium dot org)
|
||||
- Pierre Joye (pierre dot php at gmail dot com)
|
||||
- Roberto Alanis (alanisbaez at google dot com)
|
||||
- Sam Clegg (sbc at chromium dot org)
|
||||
- Scott Hancher (seh at google dot com)
|
||||
- Scott LaVarnway (slavarnway at google dot com)
|
||||
|
@ -6,7 +6,7 @@
|
||||
# in the file PATENTS. All contributing project authors may
|
||||
# be found in the AUTHORS file in the root of the source tree.
|
||||
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
cmake_minimum_required(VERSION 3.7)
|
||||
|
||||
if(POLICY CMP0072)
|
||||
cmake_policy(SET CMP0072 NEW)
|
||||
@ -580,7 +580,6 @@ if(WEBP_BUILD_EXTRAS)
|
||||
target_link_libraries(get_disto imagedec)
|
||||
target_include_directories(get_disto
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
${CMAKE_CURRENT_BINARY_DIR}/src)
|
||||
|
||||
# webp_quality
|
||||
@ -597,7 +596,6 @@ if(WEBP_BUILD_EXTRAS)
|
||||
target_link_libraries(vwebp_sdl ${SDL_LIBRARY} imageioutil webp)
|
||||
target_include_directories(vwebp_sdl
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/src
|
||||
${SDL_INCLUDE_DIR})
|
||||
|
49
ChangeLog
49
ChangeLog
@ -1,4 +1,53 @@
|
||||
883f0633 man/img2webp.1: update date
|
||||
567e1f44 Reword img2webp synopsis command line
|
||||
f084244d anim_decode: fix alpha blending with big-endian
|
||||
b217b4ff webpinfo: fix fourcc comparison w/big-endian
|
||||
f035d2e4 update ChangeLog (tag: v1.2.2-rc1)
|
||||
7031946a update NEWS
|
||||
973390b6 bump version to 1.2.2
|
||||
abd6664f update AUTHORS
|
||||
5b7e7930 Merge "add missing USE_{MSA,NEON} checks in headers" into main
|
||||
02ca04c3 add missing USE_{MSA,NEON} checks in headers
|
||||
e94716e2 xcframeworkbuild.sh: place headers in a subdir
|
||||
c846efd8 patch-check: commit subject length check
|
||||
b6f756e8 update http links
|
||||
8f5cb4c1 update rfc links
|
||||
8ea81561 change VP8LPredictorFunc signature to avoid reading 'left'
|
||||
6b1d18c3 webpmux: fix the -bgcolor description
|
||||
3368d876 Merge "webpmux: add "-set bgcolor A,R,G,B"" into main
|
||||
f213abf6 webpinfo: print the number of warnings
|
||||
50c97c30 webpmux: add "-set bgcolor A,R,G,B"
|
||||
2c206aaf Remove CMakeLists.txt check in compile.sh
|
||||
96e3dfef Merge "infra/common.sh: add shard_should_run()" into main
|
||||
0e0f74b7 infra/common.sh: add shard_should_run()
|
||||
35b7436a Jenkins scripts port: update shell function comments
|
||||
21d24b4c webp-container-spec.txt: remove 'experimental' markers
|
||||
cdcf8902 Merge "Port Jenkins script: compile" into main
|
||||
dc683cde Jenkins scripts port: static analysis
|
||||
0858494e Port Jenkins script: compile
|
||||
c2cf6a93 Jenkins scripts port: android compilation
|
||||
df0e808f presubmit: Add pylint-2.7 and .pylintrc
|
||||
676c57db patch-check: shfmt
|
||||
7bb7f747 patch-check: Add shellcheck
|
||||
abcd1797 Reformat docstrings and imports
|
||||
edaf0895 Port Jenkins scripts: compile js
|
||||
b9622063 Set CheckPatchFormatted flags to fail on diffs
|
||||
e23cd548 dsp.h: enable NEON w/VS2019+ ARM64 targets
|
||||
3875c7de CMakeLists.txt: set minimum version to 3.7
|
||||
1a8f0d45 Have a hard-coded value for memset in TrellisQuantizeBlock.
|
||||
93480160 Speed up TrellisQuantizeBlock
|
||||
45eaacc9 Convert deprecated uint32 to uint32_t.
|
||||
42592af8 webp,cmake: Remove unnecessary include dirs
|
||||
e298e05f Add patch-check steps in PRESUBMIT.py
|
||||
29148919 Merge tag 'v1.2.1'
|
||||
9ce5843d update ChangeLog (tag: v1.2.1, origin/1.2.1)
|
||||
d9191588 fuzzer/*: normalize src/ includes
|
||||
c5bc3624 fuzzer/*: normalize src/ includes
|
||||
53b6f762 fix indent
|
||||
d2caaba4 fix indent
|
||||
731246ba update ChangeLog (tag: v1.2.1-rc2)
|
||||
d250f01d dsp/*: use WEBP_HAVE_* to determine Init availability
|
||||
1fe31625 dsp/*: use WEBP_HAVE_* to determine Init availability
|
||||
3a4d3ecd update NEWS
|
||||
b2bc8093 bump version to 1.2.1
|
||||
e542fc7a update AUTHORS
|
||||
|
8
NEWS
8
NEWS
@ -1,3 +1,11 @@
|
||||
- 1/11/2022: version 1.2.2
|
||||
This is a binary compatible release.
|
||||
* webpmux: add "-set bgcolor A,R,G,B"
|
||||
* add ARM64 NEON support for MSVC builds (#539)
|
||||
* fix duplicate include error in Xcode when using multiple XCFrameworks in a
|
||||
project (#542)
|
||||
* doc updates and bug fixes (#538, #544, #548, #550)
|
||||
|
||||
- 7/20/2021: version 1.2.1
|
||||
This is a binary compatible release.
|
||||
* minor lossless encoder improvements and x86 color conversion speed up
|
||||
|
214
PRESUBMIT.py
Normal file
214
PRESUBMIT.py
Normal file
@ -0,0 +1,214 @@
|
||||
# Copyright (c) 2021, Google Inc. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
#
|
||||
# * Neither the name of Google nor the names of its contributors may
|
||||
# be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
"""Top-level presubmit script for libwebp.
|
||||
|
||||
See https://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
|
||||
details on the presubmit API built into depot_tools.
|
||||
"""
|
||||
|
||||
import re
|
||||
import subprocess2
|
||||
|
||||
USE_PYTHON3 = True
|
||||
_BASH_INDENTATION = "2"
|
||||
_GIT_COMMIT_SUBJECT_LENGTH = 65
|
||||
_INCLUDE_BASH_FILES_ONLY = [r".*\.sh$"]
|
||||
_INCLUDE_MAN_FILES_ONLY = [r"man/.+\.1$"]
|
||||
_LIBWEBP_MAX_LINE_LENGTH = 80
|
||||
|
||||
|
||||
def _CheckCommitSubjectLength(input_api, output_api):
|
||||
"""Ensures commit's subject length is no longer than 65 chars."""
|
||||
name = "git-commit subject"
|
||||
cmd = ["git", "log", "-1", "--pretty=%s"]
|
||||
start = input_api.time.time()
|
||||
proc = subprocess2.Popen(
|
||||
cmd,
|
||||
stderr=subprocess2.PIPE,
|
||||
stdout=subprocess2.PIPE,
|
||||
universal_newlines=True)
|
||||
|
||||
stdout, _ = proc.communicate()
|
||||
duration = input_api.time.time() - start
|
||||
|
||||
if not re.match(r"^Revert",
|
||||
stdout) and (len(stdout) - 1) > _GIT_COMMIT_SUBJECT_LENGTH:
|
||||
failure_msg = (
|
||||
"The commit subject: %s is too long (%d chars)\n"
|
||||
"Try to keep this to 50 or less (up to 65 is permitted for "
|
||||
"non-reverts).\n"
|
||||
"https://www.git-scm.com/book/en/v2/Distributed-Git-Contributing-to-a-"
|
||||
"Project#_commit_guidelines") % (stdout, len(stdout) - 1)
|
||||
return output_api.PresubmitError("%s\n (%4.2fs) failed\n%s" %
|
||||
(name, duration, failure_msg))
|
||||
|
||||
return output_api.PresubmitResult("%s\n (%4.2fs) success" % (name, duration))
|
||||
|
||||
|
||||
def _GetFilesToSkip(input_api):
|
||||
return list(input_api.DEFAULT_FILES_TO_SKIP) + [
|
||||
r"swig/.*\.py$",
|
||||
r"\.pylintrc$",
|
||||
]
|
||||
|
||||
|
||||
def _RunManCmd(input_api, output_api, man_file):
|
||||
"""man command wrapper."""
|
||||
cmd = ["man", "--warnings", "-EUTF-8", "-l", "-Tutf8", "-Z", man_file]
|
||||
name = "Check %s file." % man_file
|
||||
start = input_api.time.time()
|
||||
output, _ = subprocess2.communicate(
|
||||
cmd, stdout=None, stderr=subprocess2.PIPE, universal_newlines=True)
|
||||
duration = input_api.time.time() - start
|
||||
if output[1]:
|
||||
return output_api.PresubmitError("%s\n%s (%4.2fs) failed\n%s" %
|
||||
(name, " ".join(cmd), duration, output[1]))
|
||||
return output_api.PresubmitResult("%s\n%s (%4.2fs)\n" %
|
||||
(name, " ".join(cmd), duration))
|
||||
|
||||
|
||||
def _RunShellCheckCmd(input_api, output_api, bash_file):
|
||||
"""shellcheck command wrapper."""
|
||||
cmd = ["shellcheck", "-x", "-oall", "-sbash", bash_file]
|
||||
name = "Check %s file." % bash_file
|
||||
start = input_api.time.time()
|
||||
output, rc = subprocess2.communicate(
|
||||
cmd, stdout=None, stderr=subprocess2.PIPE, universal_newlines=True)
|
||||
duration = input_api.time.time() - start
|
||||
if rc == 0:
|
||||
return output_api.PresubmitResult("%s\n%s (%4.2fs)\n" %
|
||||
(name, " ".join(cmd), duration))
|
||||
return output_api.PresubmitError("%s\n%s (%4.2fs) failed\n%s" %
|
||||
(name, " ".join(cmd), duration, output[1]))
|
||||
|
||||
|
||||
def _RunShfmtCheckCmd(input_api, output_api, bash_file):
|
||||
"""shfmt command wrapper."""
|
||||
cmd = [
|
||||
"shfmt", "-i", _BASH_INDENTATION, "-bn", "-ci", "-sr", "-kp", "-d",
|
||||
bash_file
|
||||
]
|
||||
name = "Check %s file." % bash_file
|
||||
start = input_api.time.time()
|
||||
output, rc = subprocess2.communicate(
|
||||
cmd, stdout=None, stderr=subprocess2.PIPE, universal_newlines=True)
|
||||
duration = input_api.time.time() - start
|
||||
if rc == 0:
|
||||
return output_api.PresubmitResult("%s\n%s (%4.2fs)\n" %
|
||||
(name, " ".join(cmd), duration))
|
||||
return output_api.PresubmitError("%s\n%s (%4.2fs) failed\n%s" %
|
||||
(name, " ".join(cmd), duration, output[1]))
|
||||
|
||||
|
||||
def _RunCmdOnCheckedFiles(input_api, output_api, run_cmd, files_to_check):
|
||||
"""Ensure that libwebp/ files are clean."""
|
||||
file_filter = lambda x: input_api.FilterSourceFile(
|
||||
x, files_to_check=files_to_check, files_to_skip=None)
|
||||
|
||||
affected_files = input_api.change.AffectedFiles(file_filter=file_filter)
|
||||
results = [
|
||||
run_cmd(input_api, output_api, f.AbsoluteLocalPath())
|
||||
for f in affected_files
|
||||
]
|
||||
return results
|
||||
|
||||
|
||||
def _CommonChecks(input_api, output_api):
|
||||
"""Ensures this patch does not have trailing spaces, extra EOLs,
|
||||
or long lines.
|
||||
"""
|
||||
results = []
|
||||
results.extend(
|
||||
input_api.canned_checks.CheckChangeHasNoCrAndHasOnlyOneEol(
|
||||
input_api, output_api))
|
||||
results.extend(
|
||||
input_api.canned_checks.CheckChangeHasNoTabs(input_api, output_api))
|
||||
results.extend(
|
||||
input_api.canned_checks.CheckChangeHasNoStrayWhitespace(
|
||||
input_api, output_api))
|
||||
results.append(_CheckCommitSubjectLength(input_api, output_api))
|
||||
|
||||
source_file_filter = lambda x: input_api.FilterSourceFile(
|
||||
x, files_to_skip=_GetFilesToSkip(input_api))
|
||||
results.extend(
|
||||
input_api.canned_checks.CheckLongLines(
|
||||
input_api,
|
||||
output_api,
|
||||
maxlen=_LIBWEBP_MAX_LINE_LENGTH,
|
||||
source_file_filter=source_file_filter))
|
||||
|
||||
results.extend(
|
||||
input_api.canned_checks.CheckPatchFormatted(
|
||||
input_api,
|
||||
output_api,
|
||||
check_clang_format=False,
|
||||
check_python=True,
|
||||
result_factory=output_api.PresubmitError))
|
||||
results.extend(
|
||||
_RunCmdOnCheckedFiles(input_api, output_api, _RunManCmd,
|
||||
_INCLUDE_MAN_FILES_ONLY))
|
||||
# Run pylint.
|
||||
results.extend(
|
||||
input_api.canned_checks.RunPylint(
|
||||
input_api,
|
||||
output_api,
|
||||
files_to_skip=_GetFilesToSkip(input_api),
|
||||
pylintrc=".pylintrc",
|
||||
version="2.7"))
|
||||
|
||||
# Binaries shellcheck and shfmt are not installed in depot_tools.
|
||||
# Installation is needed
|
||||
try:
|
||||
subprocess2.communicate(["shellcheck", "--version"])
|
||||
results.extend(
|
||||
_RunCmdOnCheckedFiles(input_api, output_api, _RunShellCheckCmd,
|
||||
_INCLUDE_BASH_FILES_ONLY))
|
||||
print("shfmt")
|
||||
subprocess2.communicate(["shfmt", "-version"])
|
||||
results.extend(
|
||||
_RunCmdOnCheckedFiles(input_api, output_api, _RunShfmtCheckCmd,
|
||||
_INCLUDE_BASH_FILES_ONLY))
|
||||
except OSError as os_error:
|
||||
results.append(
|
||||
output_api.PresubmitPromptWarning(
|
||||
"%s\nPlease install missing binaries locally." % os_error.args[0]))
|
||||
return results
|
||||
|
||||
|
||||
def CheckChangeOnUpload(input_api, output_api):
|
||||
results = []
|
||||
results.extend(_CommonChecks(input_api, output_api))
|
||||
return results
|
||||
|
||||
|
||||
def CheckChangeOnCommit(input_api, output_api):
|
||||
results = []
|
||||
results.extend(_CommonChecks(input_api, output_api))
|
||||
return results
|
16
README
16
README
@ -4,7 +4,7 @@
|
||||
\__\__/\____/\_____/__/ ____ ___
|
||||
/ _/ / \ \ / _ \/ _/
|
||||
/ \_/ / / \ \ __/ \__
|
||||
\____/____/\_____/_____/____/v1.2.1
|
||||
\____/____/\_____/_____/____/v1.2.2
|
||||
|
||||
Description:
|
||||
============
|
||||
@ -13,13 +13,13 @@ WebP codec: library to encode and decode images in WebP format. This package
|
||||
contains the library that can be used in other programs to add WebP support,
|
||||
as well as the command line tools 'cwebp' and 'dwebp'.
|
||||
|
||||
See http://developers.google.com/speed/webp
|
||||
See https://developers.google.com/speed/webp
|
||||
|
||||
The latest source tree is available at
|
||||
https://chromium.googlesource.com/webm/libwebp
|
||||
|
||||
It is released under the same license as the WebM project.
|
||||
See http://www.webmproject.org/license/software/ or the
|
||||
See https://www.webmproject.org/license/software/ or the
|
||||
"COPYING" file for details. An additional intellectual
|
||||
property rights grant can be found in the file PATENTS.
|
||||
|
||||
@ -436,8 +436,8 @@ Prerequisites:
|
||||
|
||||
2) (Optional) qcms (Quick Color Management System)
|
||||
i. Download qcms from Mozilla / Chromium:
|
||||
http://hg.mozilla.org/mozilla-central/file/0e7639e3bdfb/gfx/qcms
|
||||
http://src.chromium.org/viewvc/chrome/trunk/src/third_party/qcms
|
||||
https://hg.mozilla.org/mozilla-central/file/0e7639e3bdfb/gfx/qcms
|
||||
https://source.chromium.org/chromium/chromium/src/+/main:third_party/qcms/;drc=d4a2f8e1ed461d8fc05ed88d1ae2dc94c9773825
|
||||
ii. Build and archive the source files as libqcms.a / qcms.lib
|
||||
iii. Update makefile.unix / Makefile.vc
|
||||
a) Define WEBP_HAVE_QCMS
|
||||
@ -456,7 +456,7 @@ modes, etc.
|
||||
|
||||
Usage:
|
||||
|
||||
img2webp [file-level options] [image files...] [per-frame options...]
|
||||
img2webp [file_options] [[frame_options] frame_file]...
|
||||
|
||||
File-level options (only used at the start of compression):
|
||||
-min_size ............ minimize size
|
||||
@ -786,10 +786,10 @@ Bugs:
|
||||
Please report all bugs to the issue tracker:
|
||||
https://bugs.chromium.org/p/webp
|
||||
Patches welcome! See this page to get started:
|
||||
http://www.webmproject.org/code/contribute/submitting-patches/
|
||||
https://www.webmproject.org/code/contribute/submitting-patches/
|
||||
|
||||
Discuss:
|
||||
========
|
||||
|
||||
Email: webp-discuss@webmproject.org
|
||||
Web: http://groups.google.com/a/webmproject.org/group/webp-discuss
|
||||
Web: https://groups.google.com/a/webmproject.org/group/webp-discuss
|
||||
|
17
README.mux
17
README.mux
@ -1,7 +1,7 @@
|
||||
__ __ ____ ____ ____ __ __ _ __ __
|
||||
/ \\/ \/ _ \/ _ \/ _ \/ \ \/ \___/_ / _\
|
||||
\ / __/ _ \ __/ / / (_/ /__
|
||||
\__\__/\_____/_____/__/ \__//_/\_____/__/___/v1.2.1
|
||||
\__\__/\_____/_____/__/ \__//_/\_____/__/___/v1.2.2
|
||||
|
||||
|
||||
Description:
|
||||
@ -43,11 +43,12 @@ GET_OPTIONS:
|
||||
frame n get nth frame
|
||||
|
||||
SET_OPTIONS:
|
||||
Set color profile/metadata:
|
||||
loop LOOP_COUNT set the loop count
|
||||
icc file.icc set ICC profile
|
||||
exif file.exif set EXIF metadata
|
||||
xmp file.xmp set XMP metadata
|
||||
Set color profile/metadata/parameters:
|
||||
loop LOOP_COUNT set the loop count
|
||||
bgcolor BACKGROUND_COLOR set the animation background color
|
||||
icc file.icc set ICC profile
|
||||
exif file.exif set EXIF metadata
|
||||
xmp file.xmp set XMP metadata
|
||||
where: 'file.icc' contains the ICC profile to be set,
|
||||
'file.exif' contains the EXIF metadata to be set
|
||||
'file.xmp' contains the XMP metadata to be set
|
||||
@ -248,10 +249,10 @@ Bugs:
|
||||
Please report all bugs to the issue tracker:
|
||||
https://bugs.chromium.org/p/webp
|
||||
Patches welcome! See this page to get started:
|
||||
http://www.webmproject.org/code/contribute/submitting-patches/
|
||||
https://www.webmproject.org/code/contribute/submitting-patches/
|
||||
|
||||
Discuss:
|
||||
========
|
||||
|
||||
Email: webp-discuss@webmproject.org
|
||||
Web: http://groups.google.com/a/webmproject.org/group/webp-discuss
|
||||
Web: https://groups.google.com/a/webmproject.org/group/webp-discuss
|
||||
|
@ -1,6 +1,6 @@
|
||||
AC_INIT([libwebp], [1.2.1],
|
||||
AC_INIT([libwebp], [1.2.2],
|
||||
[https://bugs.chromium.org/p/webp],,
|
||||
[http://developers.google.com/speed/webp])
|
||||
[https://developers.google.com/speed/webp])
|
||||
AC_CANONICAL_HOST
|
||||
AC_PREREQ([2.60])
|
||||
AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
|
||||
|
@ -6,8 +6,8 @@ HTML generation requires kramdown [1], easily installed as a
|
||||
rubygem [2]. Rubygems installation should satisfy dependencies
|
||||
automatically.
|
||||
|
||||
[1]: http://kramdown.rubyforge.org/
|
||||
[2]: http://rubygems.org/
|
||||
[1]: https://kramdown.gettalong.org/
|
||||
[2]: https://rubygems.org/
|
||||
|
||||
HTML generation can then be done from the project root:
|
||||
|
||||
@ -26,4 +26,4 @@ $ kramdown doc/webp-lossless-bitstream-spec.txt --template \
|
||||
|
||||
Optimally, use kramdown 0.13.7 or newer if syntax highlighting desired.
|
||||
|
||||
[3]: http://coderay.rubychan.de/
|
||||
[3]: https://github.com/rubychan/coderay
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Although you may be viewing an alternate representation, this document
|
||||
is sourced in Markdown, a light-duty markup scheme, and is optimized for
|
||||
the [kramdown](http://kramdown.rubyforge.org/) transformer.
|
||||
the [kramdown](https://kramdown.gettalong.org/) transformer.
|
||||
|
||||
See the accompanying README. External link targets are referenced at the
|
||||
end of this file.
|
||||
@ -53,10 +53,6 @@ document are to be interpreted as described in [RFC 2119][].
|
||||
Bit numbering in chunk diagrams starts at `0` for the most significant bit
|
||||
('MSB 0') as described in [RFC 1166][].
|
||||
|
||||
**Note:** Out of the features mentioned above, lossy compression, lossless
|
||||
compression, transparency, metadata, color profile and animation are finalized
|
||||
and are to be considered stable.
|
||||
|
||||
Terminology & Basics
|
||||
------------------------
|
||||
|
||||
@ -269,7 +265,7 @@ An extended format file consists of:
|
||||
|
||||
* An optional 'XMP ' chunk with XMP metadata.
|
||||
|
||||
* An optional list of [unknown chunks](#unknown-chunks). _\[status: experimental\]_
|
||||
* An optional list of [unknown chunks](#unknown-chunks).
|
||||
|
||||
For a _still image_, the _image data_ consists of a single frame, which is made
|
||||
up of:
|
||||
@ -705,7 +701,7 @@ XMP Metadata: _Chunk Size_ bytes
|
||||
Additional guidance about handling metadata can be found in the
|
||||
Metadata Working Group's [Guidelines for Handling Metadata][metadata].
|
||||
|
||||
#### Unknown Chunks _\[status: experimental\]_
|
||||
#### Unknown Chunks
|
||||
|
||||
A RIFF chunk (described in [this](#terminology-amp-basics) section) whose _chunk
|
||||
tag_ is different from any of the chunks described in this document, is
|
||||
@ -815,9 +811,9 @@ RIFF/WEBP
|
||||
+- EXIF (metadata)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
[vp8spec]: http://tools.ietf.org/html/rfc6386
|
||||
[vp8spec]: https://datatracker.ietf.org/doc/html/rfc6386
|
||||
[webpllspec]: https://chromium.googlesource.com/webm/libwebp/+/HEAD/doc/webp-lossless-bitstream-spec.txt
|
||||
[iccspec]: http://www.color.org/icc_specs2.xalter
|
||||
[metadata]: http://www.metadataworkinggroup.org/pdf/mwg_guidance.pdf
|
||||
[rfc 1166]: http://tools.ietf.org/html/rfc1166
|
||||
[rfc 2119]: http://tools.ietf.org/html/rfc2119
|
||||
[iccspec]: https://www.color.org/icc_specs2.xalter
|
||||
[metadata]: https://web.archive.org/web/20180919181934/http://www.metadataworkinggroup.org/pdf/mwg_guidance.pdf
|
||||
[rfc 1166]: https://datatracker.ietf.org/doc/html/rfc1166
|
||||
[rfc 2119]: https://datatracker.ietf.org/doc/html/rfc2119
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Although you may be viewing an alternate representation, this document
|
||||
is sourced in Markdown, a light-duty markup scheme, and is optimized for
|
||||
the [kramdown](http://kramdown.rubyforge.org/) transformer.
|
||||
the [kramdown](https://kramdown.gettalong.org/) transformer.
|
||||
|
||||
See the accompanying README. External link targets are referenced at the
|
||||
end of this file.
|
||||
@ -1087,4 +1087,4 @@ A possible example sequence:
|
||||
<lz77-coded image>
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
[canonical_huff]: http://en.wikipedia.org/wiki/Canonical_Huffman_code
|
||||
[canonical_huff]: https://en.wikipedia.org/wiki/Canonical_Huffman_code
|
||||
|
@ -35,8 +35,7 @@
|
||||
|
||||
static void Help(void) {
|
||||
printf("Usage:\n\n");
|
||||
printf(" img2webp [file-level options] [image files...] "
|
||||
"[per-frame options...]\n");
|
||||
printf(" img2webp [file_options] [[frame_options] frame_file]...\n");
|
||||
printf("\n");
|
||||
|
||||
printf("File-level options (only used at the start of compression):\n");
|
||||
|
@ -41,6 +41,7 @@
|
||||
if (webp_info->show_diagnosis_) { \
|
||||
fprintf(stderr, "Warning: %s\n", MESSAGE); \
|
||||
} \
|
||||
++webp_info->num_warnings_; \
|
||||
} while (0)
|
||||
|
||||
static const char* const kFormats[3] = {
|
||||
@ -116,6 +117,7 @@ typedef struct WebPInfo {
|
||||
int is_processing_anim_frame_, seen_alpha_subchunk_, seen_image_subchunk_;
|
||||
// Print output control.
|
||||
int quiet_, show_diagnosis_, show_summary_;
|
||||
int num_warnings_;
|
||||
int parse_bitstream_;
|
||||
} WebPInfo;
|
||||
|
||||
@ -123,16 +125,16 @@ static void WebPInfoInit(WebPInfo* const webp_info) {
|
||||
memset(webp_info, 0, sizeof(*webp_info));
|
||||
}
|
||||
|
||||
static const char kWebPChunkTags[CHUNK_TYPES][4] = {
|
||||
{ 'V', 'P', '8', ' ' },
|
||||
{ 'V', 'P', '8', 'L' },
|
||||
{ 'V', 'P', '8', 'X' },
|
||||
{ 'A', 'L', 'P', 'H' },
|
||||
{ 'A', 'N', 'I', 'M' },
|
||||
{ 'A', 'N', 'M', 'F' },
|
||||
{ 'I', 'C', 'C', 'P' },
|
||||
{ 'E', 'X', 'I', 'F' },
|
||||
{ 'X', 'M', 'P', ' ' },
|
||||
static const uint32_t kWebPChunkTags[CHUNK_TYPES] = {
|
||||
MKFOURCC('V', 'P', '8', ' '),
|
||||
MKFOURCC('V', 'P', '8', 'L'),
|
||||
MKFOURCC('V', 'P', '8', 'X'),
|
||||
MKFOURCC('A', 'L', 'P', 'H'),
|
||||
MKFOURCC('A', 'N', 'I', 'M'),
|
||||
MKFOURCC('A', 'N', 'M', 'F'),
|
||||
MKFOURCC('I', 'C', 'C', 'P'),
|
||||
MKFOURCC('E', 'X', 'I', 'F'),
|
||||
MKFOURCC('X', 'M', 'P', ' '),
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -580,7 +582,7 @@ static WebPInfoStatus ParseAlphaHeader(const ChunkData* const chunk_data,
|
||||
// -----------------------------------------------------------------------------
|
||||
// Chunk parsing.
|
||||
|
||||
static WebPInfoStatus ParseRIFFHeader(const WebPInfo* const webp_info,
|
||||
static WebPInfoStatus ParseRIFFHeader(WebPInfo* const webp_info,
|
||||
MemBuffer* const mem) {
|
||||
const size_t min_size = RIFF_HEADER_SIZE + CHUNK_HEADER_SIZE;
|
||||
size_t riff_size;
|
||||
@ -642,7 +644,7 @@ static WebPInfoStatus ParseChunk(const WebPInfo* const webp_info,
|
||||
return WEBP_INFO_TRUNCATED_DATA;
|
||||
}
|
||||
for (i = 0; i < CHUNK_TYPES; ++i) {
|
||||
if (!memcmp(kWebPChunkTags[i], &fourcc, TAG_SIZE)) break;
|
||||
if (kWebPChunkTags[i] == fourcc) break;
|
||||
}
|
||||
chunk_data->offset_ = chunk_start_offset;
|
||||
chunk_data->size_ = chunk_size;
|
||||
@ -937,7 +939,13 @@ static WebPInfoStatus ProcessChunk(const ChunkData* const chunk_data,
|
||||
LOG_WARN(error_message);
|
||||
} else {
|
||||
if (!webp_info->quiet_) {
|
||||
const char* tag = kWebPChunkTags[chunk_data->id_];
|
||||
char tag[4];
|
||||
uint32_t fourcc = kWebPChunkTags[chunk_data->id_];
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
fourcc = (fourcc >> 24) | ((fourcc >> 8) & 0xff00) |
|
||||
((fourcc << 8) & 0xff0000) | (fourcc << 24);
|
||||
#endif
|
||||
memcpy(tag, &fourcc, sizeof(tag));
|
||||
printf("Chunk %c%c%c%c at offset %6d, length %6d\n",
|
||||
tag[0], tag[1], tag[2], tag[3], (int)chunk_data->offset_,
|
||||
(int)chunk_data->size_);
|
||||
@ -988,7 +996,7 @@ static WebPInfoStatus ProcessChunk(const ChunkData* const chunk_data,
|
||||
return status;
|
||||
}
|
||||
|
||||
static WebPInfoStatus Validate(const WebPInfo* const webp_info) {
|
||||
static WebPInfoStatus Validate(WebPInfo* const webp_info) {
|
||||
if (webp_info->num_frames_ < 1) {
|
||||
LOG_ERROR("No image/frame detected.");
|
||||
return WEBP_INFO_MISSING_DATA;
|
||||
@ -1093,16 +1101,14 @@ static WebPInfoStatus AnalyzeWebP(WebPInfo* const webp_info,
|
||||
} else {
|
||||
printf("Errors detected.\n");
|
||||
}
|
||||
if (webp_info->num_warnings_ > 0) {
|
||||
printf("There were %d warning(s).\n", webp_info->num_warnings_);
|
||||
}
|
||||
}
|
||||
return webp_info_status;
|
||||
}
|
||||
|
||||
static void HelpShort(void) {
|
||||
printf("Usage: webpinfo [options] in_files\n"
|
||||
"Try -longhelp for an exhaustive list of options.\n");
|
||||
}
|
||||
|
||||
static void HelpLong(void) {
|
||||
static void Help(void) {
|
||||
printf("Usage: webpinfo [options] in_files\n"
|
||||
"Note: there could be multiple input files;\n"
|
||||
" options must come before input files.\n"
|
||||
@ -1123,17 +1129,15 @@ int main(int argc, const char* argv[]) {
|
||||
INIT_WARGV(argc, argv);
|
||||
|
||||
if (argc == 1) {
|
||||
HelpShort();
|
||||
Help();
|
||||
FREE_WARGV_AND_RETURN(WEBP_INFO_OK);
|
||||
}
|
||||
|
||||
// Parse command-line input.
|
||||
for (c = 1; c < argc; ++c) {
|
||||
if (!strcmp(argv[c], "-h") || !strcmp(argv[c], "-help")) {
|
||||
HelpShort();
|
||||
FREE_WARGV_AND_RETURN(WEBP_INFO_OK);
|
||||
} else if (!strcmp(argv[c], "-H") || !strcmp(argv[c], "-longhelp")) {
|
||||
HelpLong();
|
||||
if (!strcmp(argv[c], "-h") || !strcmp(argv[c], "-help") ||
|
||||
!strcmp(argv[c], "-H") || !strcmp(argv[c], "-longhelp")) {
|
||||
Help();
|
||||
FREE_WARGV_AND_RETURN(WEBP_INFO_OK);
|
||||
} else if (!strcmp(argv[c], "-quiet")) {
|
||||
quiet = 1;
|
||||
@ -1154,7 +1158,7 @@ int main(int argc, const char* argv[]) {
|
||||
}
|
||||
|
||||
if (c == argc) {
|
||||
HelpShort();
|
||||
Help();
|
||||
FREE_WARGV_AND_RETURN(WEBP_INFO_INVALID_COMMAND);
|
||||
}
|
||||
|
||||
|
@ -99,6 +99,7 @@ typedef enum {
|
||||
FEATURE_ANMF,
|
||||
FEATURE_DURATION,
|
||||
FEATURE_LOOP,
|
||||
FEATURE_BGCOLOR,
|
||||
LAST_FEATURE
|
||||
} FeatureType;
|
||||
|
||||
@ -315,11 +316,12 @@ static void PrintHelp(void) {
|
||||
|
||||
printf("\n");
|
||||
printf("SET_OPTIONS:\n");
|
||||
printf(" Set color profile/metadata:\n");
|
||||
printf(" loop LOOP_COUNT set the loop count\n");
|
||||
printf(" icc file.icc set ICC profile\n");
|
||||
printf(" exif file.exif set EXIF metadata\n");
|
||||
printf(" xmp file.xmp set XMP metadata\n");
|
||||
printf(" Set color profile/metadata/parameters:\n");
|
||||
printf(" loop LOOP_COUNT set the loop count\n");
|
||||
printf(" bgcolor BACKGROUND_COLOR set the animation background color\n");
|
||||
printf(" icc file.icc set ICC profile\n");
|
||||
printf(" exif file.exif set EXIF metadata\n");
|
||||
printf(" xmp file.xmp set XMP metadata\n");
|
||||
printf(" where: 'file.icc' contains the ICC profile to be set,\n");
|
||||
printf(" 'file.exif' contains the EXIF metadata to be set\n");
|
||||
printf(" 'file.xmp' contains the XMP metadata to be set\n");
|
||||
@ -778,6 +780,13 @@ static int ParseCommandLine(Config* config, const W_CHAR** const unicode_argv) {
|
||||
arg->params_ = argv[i + 1];
|
||||
++feature_arg_index;
|
||||
i += 2;
|
||||
} else if (!strcmp(argv[i], "bgcolor") &&
|
||||
(config->action_type_ == ACTION_SET)) {
|
||||
CHECK_NUM_ARGS_AT_LEAST(2, ErrParse);
|
||||
config->type_ = FEATURE_BGCOLOR;
|
||||
arg->params_ = argv[i + 1];
|
||||
++feature_arg_index;
|
||||
i += 2;
|
||||
} else { // Assume input file.
|
||||
if (config->input_ == NULL) {
|
||||
config->input_ = wargv[i];
|
||||
@ -1053,6 +1062,30 @@ static int Process(const Config* config) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FEATURE_BGCOLOR: {
|
||||
WebPMuxAnimParams params = { 0xFFFFFFFF, 0 };
|
||||
uint32_t bgcolor;
|
||||
ok = ParseBgcolorArgs(config->args_[0].params_, &bgcolor);
|
||||
if (!ok) {
|
||||
ERROR_GOTO1("ERROR: Could not parse the background color.\n",
|
||||
Err2);
|
||||
}
|
||||
ok = CreateMux(config->input_, &mux);
|
||||
if (!ok) goto Err2;
|
||||
ok = (WebPMuxGetAnimationParams(mux, ¶ms) == WEBP_MUX_OK);
|
||||
if (!ok) {
|
||||
ERROR_GOTO1("ERROR: input file does not seem to be an animation.\n",
|
||||
Err2);
|
||||
}
|
||||
params.bgcolor = bgcolor;
|
||||
err = WebPMuxSetAnimationParams(mux, ¶ms);
|
||||
ok = (err == WEBP_MUX_OK);
|
||||
if (!ok) {
|
||||
ERROR_GOTO2("ERROR (%s): Could not set animation parameters.\n",
|
||||
ErrorString(err), Err2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
ERROR_GOTO1("ERROR: Invalid feature for action 'set'.\n", Err2);
|
||||
break;
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#define XTRA_MAJ_VERSION 1
|
||||
#define XTRA_MIN_VERSION 2
|
||||
#define XTRA_REV_VERSION 1
|
||||
#define XTRA_REV_VERSION 2
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
@ -79,7 +79,7 @@ int WebPWriteTIFF(FILE* fout, const struct WebPDecBuffer* const buffer);
|
||||
int WebPWriteAlphaPlane(FILE* fout, const struct WebPDecBuffer* const buffer);
|
||||
|
||||
// Save as YUV samples as PGM format (using IMC4 layout).
|
||||
// See: http://www.fourcc.org/yuv.php#IMC4.
|
||||
// See: https://www.fourcc.org/yuv.php#IMC4.
|
||||
// (very convenient format for viewing the samples, esp. for odd dimensions).
|
||||
int WebPWritePGM(FILE* fout, const struct WebPDecBuffer* const buffer);
|
||||
|
||||
|
@ -133,7 +133,7 @@ static const struct {
|
||||
MetadataPayload* const payload);
|
||||
size_t storage_offset;
|
||||
} kPNGMetadataMap[] = {
|
||||
// http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/PNG.html#TextualData
|
||||
// https://exiftool.org/TagNames/PNG.html#TextualData
|
||||
// See also: ExifTool on CPAN.
|
||||
{ "Raw profile type exif", ProcessRawProfile, METADATA_OFFSET(exif) },
|
||||
{ "Raw profile type xmp", ProcessRawProfile, METADATA_OFFSET(xmp) },
|
||||
|
@ -46,7 +46,7 @@ static int ExtractMetadataFromTIFF(TIFF* const tif, Metadata* const metadata) {
|
||||
(MetadataPayload*)((uint8_t*)metadata +
|
||||
kTIFFMetadataMap[i].storage_offset);
|
||||
void* tag_data;
|
||||
uint32 tag_data_len;
|
||||
uint32_t tag_data_len;
|
||||
|
||||
if (TIFFGetField(tif, kTIFFMetadataMap[i].tag, &tag_data_len, &tag_data) &&
|
||||
!MetadataCopy((const char*)tag_data, tag_data_len, payload)) {
|
||||
@ -230,7 +230,7 @@ int ReadTIFF(const uint8_t* const data, size_t data_size,
|
||||
alloc_size = (int64_t)(stride * image_height);
|
||||
if (alloc_size < 0 || alloc_size != (tsize_t)alloc_size) goto End;
|
||||
|
||||
raster = (uint32*)_TIFFmalloc((tsize_t)alloc_size);
|
||||
raster = (uint32_t*)_TIFFmalloc((tsize_t)alloc_size);
|
||||
if (raster != NULL) {
|
||||
if (TIFFReadRGBAImageOriented(tif, image_width, image_height, raster,
|
||||
ORIENTATION_TOPLEFT, 1)) {
|
||||
|
106
infra/common.sh
Normal file
106
infra/common.sh
Normal file
@ -0,0 +1,106 @@
|
||||
# Copyright (c) 2021, Google Inc. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
#
|
||||
# * Neither the name of Google nor the names of its contributors may
|
||||
# be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
log_err() {
|
||||
echo "[$(date +'%Y-%m-%dT%H:%M:%S%z')]: $*" >&2
|
||||
}
|
||||
|
||||
#######################################
|
||||
# Create build directory. Build directory will be deleted if it exists.
|
||||
# Arguments:
|
||||
# None.
|
||||
# Returns:
|
||||
# mkdir result.
|
||||
#######################################
|
||||
make_build_dir() {
|
||||
if [[ "$#" -ne 1 ]]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
local build_dir
|
||||
build_dir="$1"
|
||||
rm -rf "${build_dir}"
|
||||
mkdir -p "${build_dir}"
|
||||
}
|
||||
|
||||
#######################################
|
||||
# Cleanup files from the build directory.
|
||||
# Globals:
|
||||
# LIBWEBP_ROOT repository's root path.
|
||||
# Arguments:
|
||||
# $1 build directory.
|
||||
#######################################
|
||||
cleanup() {
|
||||
# $1 is not completely removed to allow for binary artifacts to be
|
||||
# extracted.
|
||||
find "${1:?"Build directory not defined"}" \
|
||||
\( -name "*.[ao]" -o -name "*.l[ao]" \) -exec rm -f {} +
|
||||
}
|
||||
|
||||
#######################################
|
||||
# Setup ccache for toolchain.
|
||||
# Globals:
|
||||
# PATH
|
||||
# Arguments:
|
||||
# None.
|
||||
#######################################
|
||||
setup_ccache() {
|
||||
if [[ -x "$(command -v ccache)" ]]; then
|
||||
export CCACHE_CPP2=yes
|
||||
export PATH="/usr/lib/ccache:${PATH}"
|
||||
fi
|
||||
}
|
||||
|
||||
#######################################
|
||||
# Detects whether test block should be run in the current test shard.
|
||||
# Globals:
|
||||
# TEST_TOTAL_SHARDS: Valid range: [1, N]. Defaults to 1.
|
||||
# TEST_SHARD_INDEX: Valid range: [0, TEST_TOTAL_SHARDS). Defaults to 0.
|
||||
# libwebp_test_id: current test number; incremented with each call.
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# true if the shard is active
|
||||
# false if the shard is inactive
|
||||
#######################################
|
||||
shard_should_run() {
|
||||
TEST_TOTAL_SHARDS=${TEST_TOTAL_SHARDS:=1}
|
||||
TEST_SHARD_INDEX=${TEST_SHARD_INDEX:=0}
|
||||
libwebp_test_id=${libwebp_test_id:=-1}
|
||||
: $((libwebp_test_id += 1))
|
||||
|
||||
if [[ "${TEST_SHARD_INDEX}" -lt 0 ||
|
||||
"${TEST_SHARD_INDEX}" -ge "${TEST_TOTAL_SHARDS}" ]]; then
|
||||
log_err "Invalid TEST_SHARD_INDEX (${TEST_SHARD_INDEX})!" \
|
||||
"Expected [0, ${TEST_TOTAL_SHARDS})."
|
||||
fi
|
||||
|
||||
[[ "$((libwebp_test_id % TEST_TOTAL_SHARDS))" -eq "${TEST_SHARD_INDEX}" ]]
|
||||
}
|
401
infra/compile.sh
Executable file
401
infra/compile.sh
Executable file
@ -0,0 +1,401 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2021, Google Inc. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
#
|
||||
# * Neither the name of Google nor the names of its contributors may
|
||||
# be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
set -xe
|
||||
LIBWEBP_ROOT="$(realpath "$(dirname "$0")/..")"
|
||||
WORKSPACE=${WORKSPACE:-"$(mktemp -d -t webp.XXX)"}
|
||||
|
||||
# shellcheck source=infra/common.sh
|
||||
source "${LIBWEBP_ROOT}/infra/common.sh"
|
||||
|
||||
usage() {
|
||||
cat << EOF
|
||||
Usage: compile.sh BUILD_TYPE TARGET
|
||||
Options:
|
||||
BUILD_TYPE supported build type: (shared, static, static-debug)
|
||||
TARGET supported target platforms:
|
||||
aarch64-linux-clang
|
||||
aarch64-linux-gnu
|
||||
arm-linux-gnueabi
|
||||
arm-neon-linux-gnueabi
|
||||
cmake
|
||||
cmake-aarch64
|
||||
cmake-arm
|
||||
cmake-clang
|
||||
disable-near-lossless
|
||||
disable-sse4.1
|
||||
disable-stats
|
||||
force-aligned-32
|
||||
force-aligned-64
|
||||
gradle
|
||||
i686-linux-asan
|
||||
i686-linux-clang
|
||||
i686-linux-gnu
|
||||
i686-w64-mingw32
|
||||
mips2el-linux-gnu
|
||||
mips32dspr2el-linux-gnu
|
||||
mips32eb-linux-gnu
|
||||
mips32el-linux-gnu
|
||||
mips32r2el-linux-gnu
|
||||
mips32r5el-linux-gnu
|
||||
mips64r2el-linux-gnu
|
||||
mips64r6el-linux-gnu
|
||||
native
|
||||
reduce-csp
|
||||
reduce-size
|
||||
reduce-size-disable-stats
|
||||
visibility-default-gnu
|
||||
visibility-hidden-clang
|
||||
visibility-hidden-gnu
|
||||
wasm
|
||||
x86_64-linux-clang
|
||||
x86_64-linux-gnu
|
||||
x86_64-linux-msan
|
||||
x86_64-w64-mingw32
|
||||
Environment variables:
|
||||
WORKSPACE directory where the build is done
|
||||
EOF
|
||||
}
|
||||
|
||||
################################################################################
|
||||
echo "Building libwebp in ${WORKSPACE}"
|
||||
|
||||
if [[ ! -d "${WORKSPACE}" ]]; then
|
||||
log_err "${WORKSPACE} directory does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BUILD_TYPE=${1:?"Build type not defined.$(
|
||||
echo
|
||||
usage
|
||||
)"}
|
||||
TARGET=${2:?"Target not defined.$(
|
||||
echo
|
||||
usage
|
||||
)"}
|
||||
readonly BUILD_DIR="${WORKSPACE}/build-${BUILD_TYPE}"
|
||||
|
||||
trap 'cleanup ${BUILD_DIR}' EXIT
|
||||
make_build_dir "${BUILD_DIR}"
|
||||
|
||||
config_flags=()
|
||||
case "${BUILD_TYPE}" in
|
||||
shared*) ;; # Valid BUILD_TYPE but no setup required
|
||||
static*) config_flags+=("--disable-shared") ;;
|
||||
experimental) config_flags+=("--enable-experimental") ;;
|
||||
*)
|
||||
log_err "Invalid BUILD_TYPE"
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if grep -m 1 -q "enable-asserts" "${LIBWEBP_ROOT}/configure.ac"; then
|
||||
config_flags+=("--enable-asserts")
|
||||
fi
|
||||
|
||||
case "${TARGET}" in
|
||||
aarch64-linux-clang)
|
||||
TARGET="aarch64-linux-gnu"
|
||||
CC="clang"
|
||||
CC="${CC} --target=aarch64-linux-gnu"
|
||||
export CC
|
||||
export CFLAGS="-isystem /usr/aarch64-linux-gnu/include"
|
||||
;;
|
||||
arm-linux-gnueabi)
|
||||
export CFLAGS="-O3 -march=armv7-a -mfloat-abi=softfp -ftree-vectorize"
|
||||
;;
|
||||
arm-neon-linux-gnueabi)
|
||||
TARGET="arm-linux-gnueabi"
|
||||
CFLAGS="-O3 -march=armv7-a -mfpu=neon -mfloat-abi=softfp -ftree-vectorize"
|
||||
export CFLAGS
|
||||
;;
|
||||
mips2el-linux-gnu)
|
||||
export CFLAGS="-EL -O2 -mips2"
|
||||
TARGET="mipsel-linux-gnu"
|
||||
;;
|
||||
mips32el-linux-gnu)
|
||||
export CFLAGS="-EL -O2 -mips32"
|
||||
TARGET="mipsel-linux-gnu"
|
||||
;;
|
||||
mips32r2el-linux-gnu)
|
||||
export CFLAGS="-EL -O2 -mips32r2"
|
||||
TARGET="mipsel-linux-gnu"
|
||||
;;
|
||||
mips32dspr2el-linux-gnu)
|
||||
export CFLAGS="-EL -O2 -mdspr2"
|
||||
TARGET="mipsel-linux-gnu"
|
||||
;;
|
||||
mips32r5el-linux-gnu)
|
||||
export CFLAGS="-EL -O2 -mips32r5 -mmsa"
|
||||
TARGET="mipsel-linux-gnu"
|
||||
;;
|
||||
mips32eb-linux-gnu)
|
||||
export CFLAGS="-EB -O2 -mips32"
|
||||
TARGET="mips-linux-gnu"
|
||||
;;
|
||||
mips64r2el-linux-gnu)
|
||||
export CFLAGS="-EL -O2 -mips64r2 -mabi=64"
|
||||
TARGET="mips64el-linux-gnuabi64"
|
||||
;;
|
||||
mips64r6el-linux-gnu)
|
||||
export CFLAGS="-EL -O2 -mips64r6 -mabi=64 -mmsa"
|
||||
TARGET="mips-img-linux-gnu"
|
||||
;;
|
||||
i686-linux-gnu)
|
||||
export CC="gcc -m32"
|
||||
;;
|
||||
i686-linux-clang)
|
||||
TARGET="i686-linux-gnu"
|
||||
export CC="clang -m32"
|
||||
;;
|
||||
i686-linux-asan)
|
||||
TARGET="i686-linux-gnu"
|
||||
export CC="clang -m32 -fsanitize=address"
|
||||
;;
|
||||
i686-linux-msan)
|
||||
TARGET="i686-linux-gnu"
|
||||
export CC="clang -m32 -fsanitize=memory"
|
||||
;;
|
||||
x86_64-linux-clang)
|
||||
TARGET="x86_64-linux-gnu"
|
||||
export CC=clang
|
||||
;;
|
||||
x86_64-linux-msan)
|
||||
TARGET="x86_64-linux-gnu"
|
||||
export CC="clang -fsanitize=memory"
|
||||
;;
|
||||
force-aligned-32)
|
||||
config_flags+=("--enable-aligned")
|
||||
TARGET="i686-linux-gnu"
|
||||
export CC="gcc -m32"
|
||||
;;
|
||||
force-aligned-64)
|
||||
config_flags+=("--enable-aligned")
|
||||
TARGET="x86_64-linux-gnu"
|
||||
;;
|
||||
visibility-default-*)
|
||||
export CFLAGS="-O2 -g -fvisibility=default"
|
||||
TARGET="x86_64-linux-gnu"
|
||||
;;
|
||||
visibility-hidden-*)
|
||||
export CFLAGS="-O2 -g -fvisibility=hidden"
|
||||
if [[ "${TARGET}" = "visibility-hidden-clang" ]]; then
|
||||
export CC=clang
|
||||
fi
|
||||
TARGET="x86_64-linux-gnu"
|
||||
;;
|
||||
disable-sse4.1)
|
||||
grep "${TARGET}" "${LIBWEBP_ROOT}/configure.ac" || exit 0
|
||||
config_flags+=("--${TARGET}")
|
||||
TARGET="x86_64-linux-gnu"
|
||||
;;
|
||||
disable-near-lossless)
|
||||
grep "${TARGET}" "${LIBWEBP_ROOT}/configure.ac" || exit 0
|
||||
config_flags+=("--${TARGET}")
|
||||
TARGET="x86_64-linux-gnu"
|
||||
;;
|
||||
disable-stats)
|
||||
git -C "${LIBWEBP_ROOT}" grep WEBP_DISABLE_STATS || exit 0
|
||||
export CFLAGS="-O2 -g -DWEBP_DISABLE_STATS"
|
||||
TARGET="x86_64-linux-gnu"
|
||||
;;
|
||||
reduce-size)
|
||||
git -C "${LIBWEBP_ROOT}" grep WEBP_REDUCE_SIZE || exit 0
|
||||
export CFLAGS="-O2 -g -DWEBP_REDUCE_SIZE"
|
||||
TARGET="x86_64-linux-gnu"
|
||||
;;
|
||||
reduce-size-disable-stats)
|
||||
git -C "${LIBWEBP_ROOT}" grep -e WEBP_DISABLE_STATS -e WEBP_REDUCE_SIZE \
|
||||
|| exit 0
|
||||
export CFLAGS="-O2 -g -DWEBP_DISABLE_STATS -DWEBP_REDUCE_SIZE"
|
||||
TARGET="x86_64-linux-gnu"
|
||||
;;
|
||||
reduce-csp)
|
||||
git -C "${LIBWEBP_ROOT}" grep WEBP_REDUCE_CSP || exit 0
|
||||
export CFLAGS="-O2 -g -DWEBP_REDUCE_CSP"
|
||||
TARGET="x86_64-linux-gnu"
|
||||
;;
|
||||
x86_64-linux-gnu | *mingw32 | aarch64*) ;; # Default target configuration
|
||||
# non-configure based builds
|
||||
native)
|
||||
setup_ccache
|
||||
# exercise makefile.unix then quit
|
||||
make -C "${LIBWEBP_ROOT}" -f makefile.unix -j all
|
||||
for tgt in extras examples/anim_diff; do
|
||||
grep -q -m 1 "${tgt}" "${LIBWEBP_ROOT}/makefile.unix" \
|
||||
&& make -C "${LIBWEBP_ROOT}" -f makefile.unix -j "${tgt}"
|
||||
done
|
||||
[[ -d "${LIBWEBP_ROOT}/tests/fuzzer" ]] \
|
||||
&& make -j -C "${LIBWEBP_ROOT}/tests/fuzzer" -f makefile.unix
|
||||
exit 0
|
||||
;;
|
||||
cmake*)
|
||||
setup_ccache
|
||||
# exercise cmake then quit
|
||||
opts=()
|
||||
case "${TARGET}" in
|
||||
cmake-clang)
|
||||
opts+=("-DCMAKE_C_COMPILER=clang")
|
||||
;;
|
||||
cmake-arm)
|
||||
opts+=("-DCMAKE_C_COMPILER=arm-linux-gnueabi-gcc")
|
||||
case "${GERRIT_BRANCH:-}" in
|
||||
portable-intrinsics | 0.6.1) exit 0 ;;
|
||||
*) ;; # Skip configuration
|
||||
esac
|
||||
;;
|
||||
cmake-aarch64)
|
||||
opts+=("-DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc")
|
||||
case "${GERRIT_BRANCH:-}" in
|
||||
portable-intrinsics | 0.6.1) exit 0 ;;
|
||||
*) ;; # Skip configuration
|
||||
esac
|
||||
;;
|
||||
*) ;; # Skip configuration
|
||||
esac
|
||||
case "${BUILD_TYPE}" in
|
||||
static*)
|
||||
opts+=("-DBUILD_SHARED_LIBS=OFF")
|
||||
;;
|
||||
experimental)
|
||||
opts+=("-DWEBP_EXPERIMENTAL_FEATURES=ON" "-DBUILD_SHARED_LIBS=ON")
|
||||
;;
|
||||
*)
|
||||
opts+=("-DBUILD_SHARED_LIBS=ON")
|
||||
;;
|
||||
esac
|
||||
case "${BUILD_TYPE}" in
|
||||
*debug) opts+=("-DCMAKE_BUILD_TYPE=Debug") ;;
|
||||
*) opts+=("-DCMAKE_BUILD_TYPE=RelWithDebInfo") ;;
|
||||
esac
|
||||
cd "${BUILD_DIR}"
|
||||
opts+=("-DWEBP_BUILD_CWEBP=ON" "-DWEBP_BUILD_DWEBP=ON")
|
||||
grep -m 1 -q WEBP_BUILD_GIF2WEBP "${LIBWEBP_ROOT}/CMakeLists.txt" \
|
||||
&& opts+=("-DWEBP_BUILD_GIF2WEBP=ON")
|
||||
grep -m 1 -q WEBP_BUILD_IMG2WEBP "${LIBWEBP_ROOT}/CMakeLists.txt" \
|
||||
&& opts+=("-DWEBP_BUILD_IMG2WEBP=ON")
|
||||
cmake "${opts[@]}" "${LIBWEBP_ROOT}"
|
||||
make VERBOSE=1 -j
|
||||
case "${BUILD_TYPE}" in
|
||||
static)
|
||||
mkdir -p examples
|
||||
cp [cd]webp examples
|
||||
;;
|
||||
*) ;; # Skip configuration.
|
||||
esac
|
||||
|
||||
grep "install" "${LIBWEBP_ROOT}/CMakeLists.txt" || exit 0
|
||||
|
||||
make DESTDIR="${BUILD_DIR}/webp-install" install/strip
|
||||
mkdir tmp
|
||||
cd tmp
|
||||
cat > CMakeLists.txt << EOF
|
||||
cmake_minimum_required(VERSION 2.8.7)
|
||||
|
||||
project(libwebp C)
|
||||
|
||||
find_package(WebP)
|
||||
if (NOT WebP_FOUND)
|
||||
message(FATAL_ERROR "WebP package not found")
|
||||
endif ()
|
||||
message("WebP_FOUND: \${WebP_FOUND}")
|
||||
message("WebP_INCLUDE_DIRS: \${WebP_INCLUDE_DIRS}")
|
||||
message("WebP_LIBRARIES: \${WebP_LIBRARIES}")
|
||||
message("WEBP_INCLUDE_DIRS: \${WEBP_INCLUDE_DIRS}")
|
||||
message("WEBP_LIBRARIES: \${WEBP_LIBRARIES}")
|
||||
EOF
|
||||
cmake . "${opts[@]}" \
|
||||
"-DCMAKE_PREFIX_PATH=${BUILD_DIR}/webp-install/usr/local"
|
||||
exit 0
|
||||
;;
|
||||
gradle)
|
||||
setup_ccache
|
||||
# exercise gradle then quit
|
||||
[[ -f "${LIBWEBP_ROOT}/gradlew" ]] || exit 0
|
||||
|
||||
cd "${BUILD_DIR}"
|
||||
# TODO -g / --gradle-user-home could be used if there's a race between jobs
|
||||
"${LIBWEBP_ROOT}/gradlew" -p "${LIBWEBP_ROOT}" buildAllExecutables
|
||||
exit 0
|
||||
;;
|
||||
wasm)
|
||||
grep -m 1 -q WEBP_ENABLE_WASM "${LIBWEBP_ROOT}/CMakeLists.txt" || exit 0
|
||||
opts+=("-DCMAKE_C_COMPILER=clang" "-DWEBP_ENABLE_WASM=ON")
|
||||
opts+=("-DWEBP_BUILD_CWEBP=ON" "-DWEBP_BUILD_DWEBP=ON")
|
||||
case "${BUILD_TYPE}" in
|
||||
*debug) opts+=("-DCMAKE_BUILD_TYPE=Debug") ;;
|
||||
*) opts+=("-DCMAKE_BUILD_TYPE=RelWithDebInfo") ;;
|
||||
esac
|
||||
cd "${BUILD_DIR}"
|
||||
cmake "${opts[@]}" "${LIBWEBP_ROOT}"
|
||||
make VERBOSE=1 -j
|
||||
mkdir examples
|
||||
case "${BUILD_TYPE}" in
|
||||
static)
|
||||
mkdir -p examples
|
||||
cp [cd]webp examples
|
||||
;;
|
||||
*) ;; # Skip configuration
|
||||
esac
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
log_err "Invalid TARGET"
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
case "${TARGET}" in
|
||||
*mingw32) ;; # Skip configuration
|
||||
*)
|
||||
case "${TARGET}-${CC}" in
|
||||
static-debug-gcc* | static-debug-)
|
||||
CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage -O0 -g"
|
||||
CXXFLAGS="${CXXFLAGS} -fprofile-arcs -ftest-coverage -O0 -g"
|
||||
export CFLAGS CXXFLAGS
|
||||
;;
|
||||
*) ;; # This case should not be reached.
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
setup_ccache
|
||||
|
||||
cd "${LIBWEBP_ROOT}"
|
||||
./autogen.sh
|
||||
|
||||
cd "${BUILD_DIR}"
|
||||
"${LIBWEBP_ROOT}/configure" \
|
||||
--host "${TARGET}" --build "$("${LIBWEBP_ROOT}/config.guess")" \
|
||||
--enable-everything "${config_flags[@]}"
|
||||
make -j V=1
|
224
infra/compile_android.sh
Executable file
224
infra/compile_android.sh
Executable file
@ -0,0 +1,224 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2021, Google Inc. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
#
|
||||
# * Neither the name of Google nor the names of its contributors may
|
||||
# be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
set -xe
|
||||
LIBWEBP_ROOT="$(realpath "$(dirname "$0")/..")"
|
||||
readonly LIBWEBP_ROOT
|
||||
readonly WORKSPACE=${WORKSPACE:-"$(mktemp -d -t webp.android.XXX)"}
|
||||
# shellcheck source=infra/common.sh
|
||||
source "${LIBWEBP_ROOT}/infra/common.sh"
|
||||
|
||||
usage() {
|
||||
cat << EOF
|
||||
Usage: $(basename "$0") BUILD_TYPE APP_ABI
|
||||
Options:
|
||||
BUILD_TYPE supported build types:
|
||||
static
|
||||
static-debug
|
||||
shared
|
||||
shared-debug
|
||||
APP_ABI supported application binary interfaces:
|
||||
armeabi-v7a
|
||||
arm64-v8a
|
||||
x86
|
||||
x86_64
|
||||
Environment variables:
|
||||
WORKSPACE directory where the build is done.
|
||||
ANDROID_NDK_DIR directory where the android ndk tools are.
|
||||
EOF
|
||||
}
|
||||
|
||||
################################################################################
|
||||
echo "Building libwebp for Android in ${WORKSPACE}"
|
||||
|
||||
if [[ ! -d "${WORKSPACE}" ]]; then
|
||||
log_err "${WORKSPACE} directory does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
readonly BUILD_TYPE=${1:?"BUILD_TYPE is not defined.$(
|
||||
echo
|
||||
usage
|
||||
)"}
|
||||
readonly APP_ABI=${2:?"APP_ABI not defined.$(
|
||||
echo
|
||||
usage
|
||||
)"}
|
||||
readonly ANDROID_NDK_DIR=${ANDROID_NDK_DIR:?"ANDROID_NDK_DIR is not defined.$(
|
||||
echo
|
||||
usage
|
||||
)"}
|
||||
readonly BUILD_DIR="${WORKSPACE}/build-${BUILD_TYPE}"
|
||||
readonly STANDALONE_ANDROID_DIR="${WORKSPACE}/android"
|
||||
|
||||
if [[ ! -x "${ANDROID_NDK_DIR}/ndk-build" ]]; then
|
||||
log_err "unable to find ndk-build in ANDROID_NDK_DIR: ${ANDROID_NDK_DIR}."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CFLAGS=
|
||||
LDFLAGS=
|
||||
opts=()
|
||||
case "${BUILD_TYPE}" in
|
||||
*debug)
|
||||
readonly APP_OPTIM="debug"
|
||||
CFLAGS="-O0 -g"
|
||||
opts+=("--enable-asserts")
|
||||
;;
|
||||
static* | shared*)
|
||||
readonly APP_OPTIM="release"
|
||||
CFLAGS="-O2 -g"
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
case "${BUILD_TYPE}" in
|
||||
shared*) readonly SHARED="1" ;;
|
||||
*)
|
||||
readonly SHARED="0"
|
||||
CFLAGS="${CFLAGS} -fPIE"
|
||||
LDFLAGS="${LDFLAGS} -Wl,-pie"
|
||||
opts+=("--disable-shared")
|
||||
;;
|
||||
esac
|
||||
|
||||
# Create a fresh build directory
|
||||
make_build_dir "${BUILD_DIR}"
|
||||
cd "${BUILD_DIR}"
|
||||
ln -s "${LIBWEBP_ROOT}" jni
|
||||
|
||||
"${ANDROID_NDK_DIR}/ndk-build" -j2 \
|
||||
APP_ABI="${APP_ABI}" \
|
||||
APP_OPTIM="${APP_OPTIM}" \
|
||||
ENABLE_SHARED="${SHARED}"
|
||||
|
||||
cd "${LIBWEBP_ROOT}"
|
||||
./autogen.sh
|
||||
|
||||
case "${APP_ABI}" in
|
||||
armeabi*) arch="arm" ;;
|
||||
arm64*) arch="arm64" ;;
|
||||
*) arch="${APP_ABI}" ;;
|
||||
esac
|
||||
# TODO(b/185520507): remove this and use the binaries from
|
||||
# toolchains/llvm/prebuilt/ directly.
|
||||
rm -rf "${STANDALONE_ANDROID_DIR}"
|
||||
"${ANDROID_NDK_DIR}/build/tools/make_standalone_toolchain.py" \
|
||||
--api 24 --arch "${arch}" --stl gnustl --install-dir \
|
||||
"${STANDALONE_ANDROID_DIR}"
|
||||
export PATH="${STANDALONE_ANDROID_DIR}/bin:${PATH}"
|
||||
|
||||
rm -rf "${BUILD_DIR}"
|
||||
make_build_dir "${BUILD_DIR}"
|
||||
cd "${BUILD_DIR}"
|
||||
|
||||
case "${arch}" in
|
||||
arm)
|
||||
host="arm-linux-androideabi"
|
||||
case "${APP_ABI}" in
|
||||
armeabi) ;;
|
||||
armeabi-v7a)
|
||||
CFLAGS="${CFLAGS} -march=armv7-a -mfpu=neon -mfloat-abi=softfp"
|
||||
;;
|
||||
*) ;; # No configuration needed
|
||||
esac
|
||||
;;
|
||||
arm64)
|
||||
host="aarch64-linux-android"
|
||||
;;
|
||||
x86)
|
||||
host="i686-linux-android"
|
||||
;;
|
||||
x86_64)
|
||||
host="x86_64-linux-android"
|
||||
;;
|
||||
*) ;; # Skip configuration
|
||||
esac
|
||||
|
||||
setup_ccache
|
||||
CC="clang"
|
||||
|
||||
"${LIBWEBP_ROOT}/configure" --host "${host}" --build \
|
||||
"$("${LIBWEBP_ROOT}/config.guess")" CC="${CC}" CFLAGS="${CFLAGS}" \
|
||||
LDFLAGS="${LDFLAGS}" "${opts[@]}"
|
||||
make -j
|
||||
|
||||
if [[ "${GERRIT_REFSPEC:-}" = "refs/heads/portable-intrinsics" ]] \
|
||||
|| [[ "${GERRIT_BRANCH:-}" = "portable-intrinsics" ]]; then
|
||||
cd "${WORKSPACE}"
|
||||
rm -rf build && mkdir build
|
||||
cd build
|
||||
standalone="${WORKSPACE}/android"
|
||||
cmake ../libwebp \
|
||||
-DWEBP_BUILD_DWEBP=1 \
|
||||
-DCMAKE_C_COMPILER="${standalone}/bin/clang" \
|
||||
-DCMAKE_PREFIX_PATH="${standalone}/sysroot/usr/lib" \
|
||||
-DCMAKE_C_FLAGS=-fPIE \
|
||||
-DCMAKE_EXE_LINKER_FLAGS=-Wl,-pie \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DWEBP_ENABLE_WASM=1
|
||||
make -j2
|
||||
|
||||
cd "${WORKSPACE}"
|
||||
make_build_dir "${BUILD_DIR}"
|
||||
cd "${BUILD_DIR}"
|
||||
case "${APP_ABI}" in
|
||||
armeabi-v7a | arm64*)
|
||||
cmake "${LIBWEBP_ROOT}" \
|
||||
-DWEBP_BUILD_DWEBP=1 \
|
||||
-DCMAKE_C_COMPILER="${standalone}/bin/clang" \
|
||||
-DCMAKE_PREFIX_PATH="${standalone}/sysroot/usr/lib" \
|
||||
-DCMAKE_C_FLAGS='-fPIE -DENABLE_NEON_BUILTIN_MULHI_INT16X8' \
|
||||
-DCMAKE_EXE_LINKER_FLAGS=-Wl,-pie \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DWEBP_ENABLE_WASM=1
|
||||
make -j2
|
||||
;;
|
||||
x86*)
|
||||
cmake "${LIBWEBP_ROOT}" \
|
||||
-DWEBP_BUILD_DWEBP=1 \
|
||||
-DCMAKE_C_COMPILER="${standalone}/bin/clang" \
|
||||
-DCMAKE_PREFIX_PATH="${standalone}/sysroot/usr/lib" \
|
||||
-DCMAKE_C_FLAGS='-fPIE -DENABLE_X86_BUILTIN_MULHI_INT16X8' \
|
||||
-DCMAKE_EXE_LINKER_FLAGS=-Wl,-pie \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DWEBP_ENABLE_WASM=1
|
||||
make -j2
|
||||
;;
|
||||
*)
|
||||
log_err "APP_ABI not supported."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
75
infra/compile_js.sh
Executable file
75
infra/compile_js.sh
Executable file
@ -0,0 +1,75 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2021, Google Inc. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
#
|
||||
# * Neither the name of Google nor the names of its contributors may
|
||||
# be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
set -ex
|
||||
|
||||
readonly WORKSPACE="${WORKSPACE:-"$(mktemp -d -t webp.js.XXX)"}"
|
||||
readonly BUILD_DIR="${WORKSPACE}/webp_js/"
|
||||
readonly LIBWEBP_ROOT="$(realpath "$(dirname "$0")/..")"
|
||||
|
||||
# shellcheck source=infra/common.sh
|
||||
source "${LIBWEBP_ROOT}/infra/common.sh"
|
||||
|
||||
usage() {
|
||||
cat << EOF
|
||||
Usage: $(basename "$0")
|
||||
Environment variables:
|
||||
WORKSPACE directory where the build is done
|
||||
EMSDK_DIR directory where emsdk is installed
|
||||
EOF
|
||||
}
|
||||
|
||||
[[ -d "${EMSDK_DIR:?Not defined}" ]] \
|
||||
|| (log_err "${EMSDK_DIR} is not a valid directory." && exit 1)
|
||||
|
||||
# shellcheck source=/opt/emsdk/emsdk_env.sh
|
||||
source "${EMSDK_DIR}/emsdk_env.sh"
|
||||
|
||||
readonly EMSCRIPTEN=${EMSCRIPTEN:-"${EMSDK}/upstream/emscripten"}
|
||||
readonly \
|
||||
EMSCRIPTEN_CMAKE_FILE="${EMSCRIPTEN}/cmake/Modules/Platform/Emscripten.cmake"
|
||||
make_build_dir "${BUILD_DIR}"
|
||||
|
||||
pushd "${BUILD_DIR}"
|
||||
opts=("-GUnix Makefiles" "-DWEBP_BUILD_WEBP_JS=ON")
|
||||
if [[ -z "$(command -v emcmake)" ]]; then
|
||||
opts+=("-DCMAKE_TOOLCHAIN_FILE=${EMSCRIPTEN_CMAKE_FILE}")
|
||||
cmake \
|
||||
"${opts[@]}" \
|
||||
"${LIBWEBP_ROOT}"
|
||||
make -j
|
||||
else
|
||||
emcmake cmake \
|
||||
"${opts[@]}" \
|
||||
"${LIBWEBP_ROOT}"
|
||||
emmake make -j
|
||||
fi
|
||||
popd
|
98
infra/run_static_analysis.sh
Executable file
98
infra/run_static_analysis.sh
Executable file
@ -0,0 +1,98 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2021, Google Inc. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
#
|
||||
# * Neither the name of Google nor the names of its contributors may
|
||||
# be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
set -xe
|
||||
|
||||
LIBWEBP_ROOT="$(realpath "$(dirname "$0")/..")"
|
||||
readonly LIBWEBP_ROOT
|
||||
readonly WORKSPACE=${WORKSPACE:-"$(mktemp -d -t webp.scanbuild.XXX)"}
|
||||
|
||||
# shellcheck source=infra/common.sh
|
||||
source "${LIBWEBP_ROOT}/infra/common.sh"
|
||||
|
||||
usage() {
|
||||
cat << EOF
|
||||
Usage: $(basename "$0") MODE
|
||||
Options:
|
||||
MODE supported scan modes: (shallow|deep)
|
||||
Environment variables:
|
||||
WORKSPACE directory where the build is done.
|
||||
EOF
|
||||
}
|
||||
|
||||
#######################################
|
||||
# Wrap clang-tools scan-build.
|
||||
# Globals:
|
||||
# OUTPUT_DIR target directory where scan-build report is generated.
|
||||
# MODE scan-build mode
|
||||
# Arguments:
|
||||
# $* scan-build additional args.
|
||||
# Returns:
|
||||
# scan-build retcode
|
||||
#######################################
|
||||
scan_build() {
|
||||
scan-build -o "${OUTPUT_DIR}" --use-analyzer="$(command -v clang)" \
|
||||
-analyzer-config mode="${MODE}" "$*"
|
||||
}
|
||||
|
||||
MODE=${1:?"MODE is not specified.$(
|
||||
echo
|
||||
usage
|
||||
)"}
|
||||
|
||||
readonly OUTPUT_DIR="${WORKSPACE}/output-${MODE}"
|
||||
readonly BUILD_DIR="${WORKSPACE}/build"
|
||||
|
||||
make_build_dir "${OUTPUT_DIR}"
|
||||
make_build_dir "${BUILD_DIR}"
|
||||
|
||||
cd "${LIBWEBP_ROOT}"
|
||||
./autogen.sh
|
||||
|
||||
cd "${BUILD_DIR}"
|
||||
grep -m 1 -q 'enable-asserts' "${LIBWEBP_ROOT}/configure.ac" \
|
||||
&& args='--enable-asserts'
|
||||
scan_build "${LIBWEBP_ROOT}/configure" --enable-everything "${args}"
|
||||
scan_build make -j4
|
||||
|
||||
index="$(find "${OUTPUT_DIR}" -name index.html)"
|
||||
if [[ -f "${index}" ]]; then
|
||||
mv "$(dirname "${index}")/"* .
|
||||
else
|
||||
# make a empty report to wipe out any old bug reports.
|
||||
cat << EOT > index.html
|
||||
<html>
|
||||
<body>
|
||||
No bugs reported.
|
||||
</body>
|
||||
</html>
|
||||
EOT
|
||||
fi
|
@ -9,7 +9,7 @@
|
||||
# (the previous build will be erased if it exists).
|
||||
#
|
||||
# This script is inspired by the build script written by Carson McDonald.
|
||||
# (http://www.ioncannon.net/programming/1483/using-webp-to-reduce-native-ios-app-size/).
|
||||
# (https://www.ioncannon.net/programming/1483/using-webp-to-reduce-native-ios-app-size/).
|
||||
|
||||
set -e
|
||||
|
||||
@ -86,7 +86,7 @@ if [[ ! -e ${SRCDIR}/configure ]]; then
|
||||
Error creating configure script!
|
||||
This script requires the autoconf/automake and libtool to build. MacPorts can
|
||||
be used to obtain these:
|
||||
http://www.macports.org/install.php
|
||||
https://www.macports.org/install.php
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
|
@ -47,7 +47,7 @@ else
|
||||
endif
|
||||
|
||||
# To install libraries on Mac OS X:
|
||||
# 1. Install MacPorts (http://www.macports.org/install.php)
|
||||
# 1. Install MacPorts (https://www.macports.org/install.php)
|
||||
# 2. Run "sudo port install jpeg"
|
||||
# 3. Run "sudo port install libpng"
|
||||
# 4. Run "sudo port install tiff"
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.TH CWEBP 1 "November 19, 2020"
|
||||
.TH CWEBP 1 "November 17, 2021"
|
||||
.SH NAME
|
||||
cwebp \- compress an image file to a WebP file
|
||||
.SH SYNOPSIS
|
||||
@ -222,7 +222,7 @@ Compute and report average PSNR (Peak\-Signal\-To\-Noise ratio).
|
||||
.TP
|
||||
.B \-print_ssim
|
||||
Compute and report average SSIM (structural similarity
|
||||
metric, see http://en.wikipedia.org/wiki/SSIM for additional details).
|
||||
metric, see https://en.wikipedia.org/wiki/SSIM for additional details).
|
||||
.TP
|
||||
.B \-print_lsim
|
||||
Compute and report local similarity metric (sum of lowest error amongst the
|
||||
@ -298,7 +298,7 @@ Please report all bugs to the issue tracker:
|
||||
https://bugs.chromium.org/p/webp
|
||||
.br
|
||||
Patches welcome! See this page to get started:
|
||||
http://www.webmproject.org/code/contribute/submitting\-patches/
|
||||
https://www.webmproject.org/code/contribute/submitting\-patches/
|
||||
|
||||
.SH EXAMPLES
|
||||
cwebp \-q 50 -lossless picture.png \-o picture_lossless.webp
|
||||
@ -322,5 +322,5 @@ for the Debian project (and may be used by others).
|
||||
.BR dwebp (1),
|
||||
.BR gif2webp (1)
|
||||
.br
|
||||
Please refer to http://developers.google.com/speed/webp/ for additional
|
||||
Please refer to https://developers.google.com/speed/webp/ for additional
|
||||
information.
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.TH DWEBP 1 "November 19, 2020"
|
||||
.TH DWEBP 1 "November 17, 2021"
|
||||
.SH NAME
|
||||
dwebp \- decompress a WebP file to an image file
|
||||
.SH SYNOPSIS
|
||||
@ -113,7 +113,7 @@ Please report all bugs to the issue tracker:
|
||||
https://bugs.chromium.org/p/webp
|
||||
.br
|
||||
Patches welcome! See this page to get started:
|
||||
http://www.webmproject.org/code/contribute/submitting-patches/
|
||||
https://www.webmproject.org/code/contribute/submitting\-patches/
|
||||
|
||||
.SH EXAMPLES
|
||||
dwebp picture.webp \-o output.png
|
||||
@ -138,7 +138,7 @@ for the Debian project (and may be used by others).
|
||||
.BR gif2webp (1),
|
||||
.BR webpmux (1)
|
||||
.br
|
||||
Please refer to http://developers.google.com/speed/webp/ for additional
|
||||
Please refer to https://developers.google.com/speed/webp/ for additional
|
||||
information.
|
||||
.SS Output file format details
|
||||
PAM: http://netpbm.sourceforge.net/doc/pam.html
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.TH GIF2WEBP 1 "May 1, 2020"
|
||||
.TH GIF2WEBP 1 "November 17, 2021"
|
||||
.SH NAME
|
||||
gif2webp \- Convert a GIF image to WebP
|
||||
.SH SYNOPSIS
|
||||
@ -131,7 +131,7 @@ Please report all bugs to the issue tracker:
|
||||
https://bugs.chromium.org/p/webp
|
||||
.br
|
||||
Patches welcome! See this page to get started:
|
||||
http://www.webmproject.org/code/contribute/submitting-patches/
|
||||
https://www.webmproject.org/code/contribute/submitting\-patches/
|
||||
|
||||
.SH EXAMPLES
|
||||
gif2webp picture.gif \-o picture.webp
|
||||
@ -160,5 +160,5 @@ Debian project (and may be used by others).
|
||||
.BR dwebp (1),
|
||||
.BR webpmux (1)
|
||||
.br
|
||||
Please refer to http://developers.google.com/speed/webp/ for additional
|
||||
Please refer to https://developers.google.com/speed/webp/ for additional
|
||||
information.
|
||||
|
@ -1,10 +1,10 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.TH IMG2WEBP 1 "May 1, 2020"
|
||||
.TH IMG2WEBP 1 "January 5, 2022"
|
||||
.SH NAME
|
||||
img2webp \- create animated WebP file from a sequence of input images.
|
||||
.SH SYNOPSIS
|
||||
.B img2webp
|
||||
[file_level_options] [files] [per_frame_options...]
|
||||
[file_options] [[frame_options] frame_file]...
|
||||
.br
|
||||
.B img2webp argument_file_name
|
||||
.br
|
||||
@ -86,7 +86,7 @@ Please report all bugs to the issue tracker:
|
||||
https://bugs.chromium.org/p/webp
|
||||
.br
|
||||
Patches welcome! See this page to get started:
|
||||
http://www.webmproject.org/code/contribute/submitting\-patches/
|
||||
https://www.webmproject.org/code/contribute/submitting\-patches/
|
||||
|
||||
.SH AUTHORS
|
||||
\fBimg2webp\fP is a part of libwebp and was written by the WebP team.
|
||||
@ -101,5 +101,5 @@ for the Debian project (and may be used by others).
|
||||
.BR webpmux (1),
|
||||
.BR gif2webp (1)
|
||||
.br
|
||||
Please refer to http://developers.google.com/speed/webp/ for additional
|
||||
Please refer to https://developers.google.com/speed/webp/ for additional
|
||||
information.
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.TH VWEBP 1 "June 5, 2019"
|
||||
.TH VWEBP 1 "November 17, 2021"
|
||||
.SH NAME
|
||||
vwebp \- decompress a WebP file and display it in a window
|
||||
.SH SYNOPSIS
|
||||
@ -77,7 +77,7 @@ Please report all bugs to the issue tracker:
|
||||
https://bugs.chromium.org/p/webp
|
||||
.br
|
||||
Patches welcome! See this page to get started:
|
||||
http://www.webmproject.org/code/contribute/submitting-patches/
|
||||
https://www.webmproject.org/code/contribute/submitting\-patches/
|
||||
|
||||
.SH EXAMPLES
|
||||
vwebp picture.webp
|
||||
@ -97,5 +97,5 @@ This manual page was written for the Debian project (and may be used by others).
|
||||
.SH SEE ALSO
|
||||
.BR dwebp (1)
|
||||
.br
|
||||
Please refer to http://developers.google.com/speed/webp/ for additional
|
||||
Please refer to https://developers.google.com/speed/webp/ for additional
|
||||
information.
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.TH WEBPINFO 1 "November 24, 2017"
|
||||
.TH WEBPINFO 1 "November 17, 2021"
|
||||
.SH NAME
|
||||
webpinfo \- print out the chunk level structure of WebP files
|
||||
along with basic integrity checks.
|
||||
@ -52,7 +52,7 @@ Please report all bugs to the issue tracker:
|
||||
https://bugs.chromium.org/p/webp
|
||||
.br
|
||||
Patches welcome! See this page to get started:
|
||||
http://www.webmproject.org/code/contribute/submitting\-patches/
|
||||
https://www.webmproject.org/code/contribute/submitting\-patches/
|
||||
|
||||
.SH EXAMPLES
|
||||
.br
|
||||
@ -76,5 +76,5 @@ for the Debian project (and may be used by others).
|
||||
.SH SEE ALSO
|
||||
.BR webpmux (1)
|
||||
.br
|
||||
Please refer to http://developers.google.com/speed/webp/ for additional
|
||||
Please refer to https://developers.google.com/speed/webp/ for additional
|
||||
information.
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.TH WEBPMUX 1 "December 12, 2020"
|
||||
.TH WEBPMUX 1 "November 17, 2021"
|
||||
.SH NAME
|
||||
webpmux \- create animated WebP files from non\-animated WebP images, extract
|
||||
frames from animated WebP images, and manage XMP/EXIF metadata and ICC profile.
|
||||
@ -82,6 +82,12 @@ Set loop count on an animated file.
|
||||
.P
|
||||
Where: 'loop_count' must be in range [0, 65535].
|
||||
.TP
|
||||
.BI bgcolor " A,R,G,B
|
||||
Set the background color of the canvas on an animated file.
|
||||
.P
|
||||
where: 'A', 'R', 'G' and 'B' are integers in the range 0 to 255 specifying the
|
||||
Alpha, Red, Green and Blue component values respectively.
|
||||
.TP
|
||||
.BI icc " file.icc
|
||||
Set ICC profile.
|
||||
.P
|
||||
@ -185,7 +191,7 @@ Please report all bugs to the issue tracker:
|
||||
https://bugs.chromium.org/p/webp
|
||||
.br
|
||||
Patches welcome! See this page to get started:
|
||||
http://www.webmproject.org/code/contribute/submitting\-patches/
|
||||
https://www.webmproject.org/code/contribute/submitting\-patches/
|
||||
|
||||
.SH EXAMPLES
|
||||
.P
|
||||
@ -261,5 +267,5 @@ for the Debian project (and may be used by others).
|
||||
.BR dwebp (1),
|
||||
.BR gif2webp (1)
|
||||
.br
|
||||
Please refer to http://developers.google.com/speed/webp/ for additional
|
||||
Please refer to https://developers.google.com/speed/webp/ for additional
|
||||
information.
|
||||
|
@ -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
|
||||
# not have unresolved symbols. Some platforms (Windows among them) require all
|
||||
# symbols in shared libraries to be resolved at library creation.
|
||||
libwebp_la_LDFLAGS = -no-undefined -version-info 8:2:1
|
||||
libwebp_la_LDFLAGS = -no-undefined -version-info 8:3:1
|
||||
libwebpincludedir = $(includedir)/webp
|
||||
pkgconfig_DATA = libwebp.pc
|
||||
|
||||
@ -48,7 +48,7 @@ if BUILD_LIBWEBPDECODER
|
||||
libwebpdecoder_la_LIBADD += dsp/libwebpdspdecode.la
|
||||
libwebpdecoder_la_LIBADD += utils/libwebputilsdecode.la
|
||||
|
||||
libwebpdecoder_la_LDFLAGS = -no-undefined -version-info 4:2:1
|
||||
libwebpdecoder_la_LDFLAGS = -no-undefined -version-info 4:3:1
|
||||
pkgconfig_DATA += libwebpdecoder.pc
|
||||
endif
|
||||
|
||||
|
@ -331,13 +331,13 @@ static int InitYUVRescaler(const VP8Io* const io, WebPDecParams* const p) {
|
||||
p->scaler_a = has_alpha ? &scalers[3] : NULL;
|
||||
|
||||
if (!WebPRescalerInit(p->scaler_y, io->mb_w, io->mb_h,
|
||||
buf->y, out_width, out_height, buf->y_stride, 1,
|
||||
buf->y, out_width, out_height, buf->y_stride, 1,
|
||||
work) ||
|
||||
!WebPRescalerInit(p->scaler_u, uv_in_width, uv_in_height,
|
||||
buf->u, uv_out_width, uv_out_height, buf->u_stride, 1,
|
||||
buf->u, uv_out_width, uv_out_height, buf->u_stride, 1,
|
||||
work + work_size) ||
|
||||
!WebPRescalerInit(p->scaler_v, uv_in_width, uv_in_height,
|
||||
buf->v, uv_out_width, uv_out_height, buf->v_stride, 1,
|
||||
buf->v, uv_out_width, uv_out_height, buf->v_stride, 1,
|
||||
work + work_size + uv_work_size)) {
|
||||
return 0;
|
||||
}
|
||||
@ -345,7 +345,7 @@ static int InitYUVRescaler(const VP8Io* const io, WebPDecParams* const p) {
|
||||
|
||||
if (has_alpha) {
|
||||
if (!WebPRescalerInit(p->scaler_a, io->mb_w, io->mb_h,
|
||||
buf->a, out_width, out_height, buf->a_stride, 1,
|
||||
buf->a, out_width, out_height, buf->a_stride, 1,
|
||||
work + work_size + 2 * uv_work_size)) {
|
||||
return 0;
|
||||
}
|
||||
@ -524,13 +524,13 @@ static int InitRGBRescaler(const VP8Io* const io, WebPDecParams* const p) {
|
||||
p->scaler_a = has_alpha ? &scalers[3] : NULL;
|
||||
|
||||
if (!WebPRescalerInit(p->scaler_y, io->mb_w, io->mb_h,
|
||||
tmp + 0 * out_width, out_width, out_height, 0, 1,
|
||||
tmp + 0 * out_width, out_width, out_height, 0, 1,
|
||||
work + 0 * work_size) ||
|
||||
!WebPRescalerInit(p->scaler_u, uv_in_width, uv_in_height,
|
||||
tmp + 1 * out_width, out_width, out_height, 0, 1,
|
||||
tmp + 1 * out_width, out_width, out_height, 0, 1,
|
||||
work + 1 * work_size) ||
|
||||
!WebPRescalerInit(p->scaler_v, uv_in_width, uv_in_height,
|
||||
tmp + 2 * out_width, out_width, out_height, 0, 1,
|
||||
tmp + 2 * out_width, out_width, out_height, 0, 1,
|
||||
work + 2 * work_size)) {
|
||||
return 0;
|
||||
}
|
||||
@ -539,7 +539,7 @@ static int InitRGBRescaler(const VP8Io* const io, WebPDecParams* const p) {
|
||||
|
||||
if (has_alpha) {
|
||||
if (!WebPRescalerInit(p->scaler_a, io->mb_w, io->mb_h,
|
||||
tmp + 3 * out_width, out_width, out_height, 0, 1,
|
||||
tmp + 3 * out_width, out_width, out_height, 0, 1,
|
||||
work + 3 * work_size)) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -403,7 +403,7 @@ static const uint8_t kZigzag[16] = {
|
||||
0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15
|
||||
};
|
||||
|
||||
// See section 13-2: http://tools.ietf.org/html/rfc6386#section-13.2
|
||||
// See section 13-2: https://datatracker.ietf.org/doc/html/rfc6386#section-13.2
|
||||
static int GetLargeValue(VP8BitReader* const br, const uint8_t* const p) {
|
||||
int v;
|
||||
if (!VP8GetBit(br, p[3], "coeffs")) {
|
||||
|
@ -32,7 +32,7 @@ extern "C" {
|
||||
// version numbers
|
||||
#define DEC_MAJ_VERSION 1
|
||||
#define DEC_MIN_VERSION 2
|
||||
#define DEC_REV_VERSION 1
|
||||
#define DEC_REV_VERSION 2
|
||||
|
||||
// YUV-cache parameters. Cache is 32-bytes wide (= one cacheline).
|
||||
// Constraints are: We need to store one 16x16 block of luma samples (y),
|
||||
|
@ -84,7 +84,7 @@ static const uint8_t kCodeToPlane[CODE_TO_PLANE_CODES] = {
|
||||
// to 256 (green component values) + 24 (length prefix values)
|
||||
// + color_cache_size (between 0 and 2048).
|
||||
// All values computed for 8-bit first level lookup with Mark Adler's tool:
|
||||
// http://www.hdfgroup.org/ftp/lib-external/zlib/zlib-1.2.5/examples/enough.c
|
||||
// https://github.com/madler/zlib/blob/v1.2.5/examples/enough.c
|
||||
#define FIXED_TABLE_SIZE (630 * 3 + 410)
|
||||
static const uint16_t kTableSize[12] = {
|
||||
FIXED_TABLE_SIZE + 654,
|
||||
|
@ -13,6 +13,6 @@ noinst_HEADERS =
|
||||
noinst_HEADERS += ../webp/format_constants.h
|
||||
|
||||
libwebpdemux_la_LIBADD = ../libwebp.la
|
||||
libwebpdemux_la_LDFLAGS = -no-undefined -version-info 2:8:0
|
||||
libwebpdemux_la_LDFLAGS = -no-undefined -version-info 2:9:0
|
||||
libwebpdemuxincludedir = $(includedir)/webp
|
||||
pkgconfig_DATA = libwebpdemux.pc
|
||||
|
@ -23,6 +23,14 @@
|
||||
|
||||
#define NUM_CHANNELS 4
|
||||
|
||||
// Channel extraction from a uint32_t representation of a uint8_t RGBA/BGRA
|
||||
// buffer.
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#define CHANNEL_SHIFT(i) (24 - (i) * 8)
|
||||
#else
|
||||
#define CHANNEL_SHIFT(i) ((i) * 8)
|
||||
#endif
|
||||
|
||||
typedef void (*BlendRowFunc)(uint32_t* const, const uint32_t* const, int);
|
||||
static void BlendPixelRowNonPremult(uint32_t* const src,
|
||||
const uint32_t* const dst, int num_pixels);
|
||||
@ -209,35 +217,35 @@ static uint8_t BlendChannelNonPremult(uint32_t src, uint8_t src_a,
|
||||
const uint8_t dst_channel = (dst >> shift) & 0xff;
|
||||
const uint32_t blend_unscaled = src_channel * src_a + dst_channel * dst_a;
|
||||
assert(blend_unscaled < (1ULL << 32) / scale);
|
||||
return (blend_unscaled * scale) >> 24;
|
||||
return (blend_unscaled * scale) >> CHANNEL_SHIFT(3);
|
||||
}
|
||||
|
||||
// Blend 'src' over 'dst' assuming they are NOT pre-multiplied by alpha.
|
||||
static uint32_t BlendPixelNonPremult(uint32_t src, uint32_t dst) {
|
||||
const uint8_t src_a = (src >> 24) & 0xff;
|
||||
const uint8_t src_a = (src >> CHANNEL_SHIFT(3)) & 0xff;
|
||||
|
||||
if (src_a == 0) {
|
||||
return dst;
|
||||
} else {
|
||||
const uint8_t dst_a = (dst >> 24) & 0xff;
|
||||
const uint8_t dst_a = (dst >> CHANNEL_SHIFT(3)) & 0xff;
|
||||
// This is the approximate integer arithmetic for the actual formula:
|
||||
// dst_factor_a = (dst_a * (255 - src_a)) / 255.
|
||||
const uint8_t dst_factor_a = (dst_a * (256 - src_a)) >> 8;
|
||||
const uint8_t blend_a = src_a + dst_factor_a;
|
||||
const uint32_t scale = (1UL << 24) / blend_a;
|
||||
|
||||
const uint8_t blend_r =
|
||||
BlendChannelNonPremult(src, src_a, dst, dst_factor_a, scale, 0);
|
||||
const uint8_t blend_g =
|
||||
BlendChannelNonPremult(src, src_a, dst, dst_factor_a, scale, 8);
|
||||
const uint8_t blend_b =
|
||||
BlendChannelNonPremult(src, src_a, dst, dst_factor_a, scale, 16);
|
||||
const uint8_t blend_r = BlendChannelNonPremult(
|
||||
src, src_a, dst, dst_factor_a, scale, CHANNEL_SHIFT(0));
|
||||
const uint8_t blend_g = BlendChannelNonPremult(
|
||||
src, src_a, dst, dst_factor_a, scale, CHANNEL_SHIFT(1));
|
||||
const uint8_t blend_b = BlendChannelNonPremult(
|
||||
src, src_a, dst, dst_factor_a, scale, CHANNEL_SHIFT(2));
|
||||
assert(src_a + dst_factor_a < 256);
|
||||
|
||||
return (blend_r << 0) |
|
||||
(blend_g << 8) |
|
||||
(blend_b << 16) |
|
||||
((uint32_t)blend_a << 24);
|
||||
return ((uint32_t)blend_r << CHANNEL_SHIFT(0)) |
|
||||
((uint32_t)blend_g << CHANNEL_SHIFT(1)) |
|
||||
((uint32_t)blend_b << CHANNEL_SHIFT(2)) |
|
||||
((uint32_t)blend_a << CHANNEL_SHIFT(3));
|
||||
}
|
||||
}
|
||||
|
||||
@ -247,7 +255,7 @@ static void BlendPixelRowNonPremult(uint32_t* const src,
|
||||
const uint32_t* const dst, int num_pixels) {
|
||||
int i;
|
||||
for (i = 0; i < num_pixels; ++i) {
|
||||
const uint8_t src_alpha = (src[i] >> 24) & 0xff;
|
||||
const uint8_t src_alpha = (src[i] >> CHANNEL_SHIFT(3)) & 0xff;
|
||||
if (src_alpha != 0xff) {
|
||||
src[i] = BlendPixelNonPremult(src[i], dst[i]);
|
||||
}
|
||||
@ -264,7 +272,7 @@ static WEBP_INLINE uint32_t ChannelwiseMultiply(uint32_t pix, uint32_t scale) {
|
||||
|
||||
// Blend 'src' over 'dst' assuming they are pre-multiplied by alpha.
|
||||
static uint32_t BlendPixelPremult(uint32_t src, uint32_t dst) {
|
||||
const uint8_t src_a = (src >> 24) & 0xff;
|
||||
const uint8_t src_a = (src >> CHANNEL_SHIFT(3)) & 0xff;
|
||||
return src + ChannelwiseMultiply(dst, 256 - src_a);
|
||||
}
|
||||
|
||||
@ -274,7 +282,7 @@ static void BlendPixelRowPremult(uint32_t* const src, const uint32_t* const dst,
|
||||
int num_pixels) {
|
||||
int i;
|
||||
for (i = 0; i < num_pixels; ++i) {
|
||||
const uint8_t src_alpha = (src[i] >> 24) & 0xff;
|
||||
const uint8_t src_alpha = (src[i] >> CHANNEL_SHIFT(3)) & 0xff;
|
||||
if (src_alpha != 0xff) {
|
||||
src[i] = BlendPixelPremult(src[i], dst[i]);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#define DMUX_MAJ_VERSION 1
|
||||
#define DMUX_MIN_VERSION 2
|
||||
#define DMUX_REV_VERSION 1
|
||||
#define DMUX_REV_VERSION 2
|
||||
|
||||
typedef struct {
|
||||
size_t start_; // start location of the data
|
||||
|
@ -6,8 +6,8 @@
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,2,1
|
||||
PRODUCTVERSION 1,0,2,1
|
||||
FILEVERSION 1,0,2,2
|
||||
PRODUCTVERSION 1,0,2,2
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@ -24,12 +24,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Google, Inc."
|
||||
VALUE "FileDescription", "libwebpdemux DLL"
|
||||
VALUE "FileVersion", "1.2.1"
|
||||
VALUE "FileVersion", "1.2.2"
|
||||
VALUE "InternalName", "libwebpdemux.dll"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2021"
|
||||
VALUE "OriginalFilename", "libwebpdemux.dll"
|
||||
VALUE "ProductName", "WebP Image Demuxer"
|
||||
VALUE "ProductVersion", "1.2.1"
|
||||
VALUE "ProductVersion", "1.2.2"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
@ -119,7 +119,12 @@ extern "C" {
|
||||
#define WEBP_USE_NEON
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1700 && defined(_M_ARM)
|
||||
// Note: ARM64 is supported in Visual Studio 2017, but requires the direct
|
||||
// inclusion of arm64_neon.h; Visual Studio 2019 includes this file in
|
||||
// arm_neon.h.
|
||||
#if defined(_MSC_VER) && \
|
||||
((_MSC_VER >= 1700 && defined(_M_ARM)) || \
|
||||
(_MSC_VER >= 1920 && defined(_M_ARM64)))
|
||||
#define WEBP_USE_NEON
|
||||
#define WEBP_USE_INTRINSICS
|
||||
#endif
|
||||
|
@ -9,7 +9,7 @@
|
||||
//
|
||||
// ARM NEON version of speed-critical encoding functions.
|
||||
//
|
||||
// adapted from libvpx (http://www.webmproject.org/code/)
|
||||
// adapted from libvpx (https://www.webmproject.org/code/)
|
||||
|
||||
#include "src/dsp/dsp.h"
|
||||
|
||||
|
@ -107,63 +107,77 @@ static WEBP_INLINE uint32_t Select(uint32_t a, uint32_t b, uint32_t c) {
|
||||
//------------------------------------------------------------------------------
|
||||
// Predictors
|
||||
|
||||
uint32_t VP8LPredictor0_C(uint32_t left, const uint32_t* const top) {
|
||||
uint32_t VP8LPredictor0_C(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
(void)top;
|
||||
(void)left;
|
||||
return ARGB_BLACK;
|
||||
}
|
||||
uint32_t VP8LPredictor1_C(uint32_t left, const uint32_t* const top) {
|
||||
uint32_t VP8LPredictor1_C(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
(void)top;
|
||||
return left;
|
||||
return *left;
|
||||
}
|
||||
uint32_t VP8LPredictor2_C(uint32_t left, const uint32_t* const top) {
|
||||
uint32_t VP8LPredictor2_C(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
(void)left;
|
||||
return top[0];
|
||||
}
|
||||
uint32_t VP8LPredictor3_C(uint32_t left, const uint32_t* const top) {
|
||||
uint32_t VP8LPredictor3_C(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
(void)left;
|
||||
return top[1];
|
||||
}
|
||||
uint32_t VP8LPredictor4_C(uint32_t left, const uint32_t* const top) {
|
||||
uint32_t VP8LPredictor4_C(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
(void)left;
|
||||
return top[-1];
|
||||
}
|
||||
uint32_t VP8LPredictor5_C(uint32_t left, const uint32_t* const top) {
|
||||
const uint32_t pred = Average3(left, top[0], top[1]);
|
||||
uint32_t VP8LPredictor5_C(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
const uint32_t pred = Average3(*left, top[0], top[1]);
|
||||
return pred;
|
||||
}
|
||||
uint32_t VP8LPredictor6_C(uint32_t left, const uint32_t* const top) {
|
||||
const uint32_t pred = Average2(left, top[-1]);
|
||||
uint32_t VP8LPredictor6_C(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
const uint32_t pred = Average2(*left, top[-1]);
|
||||
return pred;
|
||||
}
|
||||
uint32_t VP8LPredictor7_C(uint32_t left, const uint32_t* const top) {
|
||||
const uint32_t pred = Average2(left, top[0]);
|
||||
uint32_t VP8LPredictor7_C(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
const uint32_t pred = Average2(*left, top[0]);
|
||||
return pred;
|
||||
}
|
||||
uint32_t VP8LPredictor8_C(uint32_t left, const uint32_t* const top) {
|
||||
uint32_t VP8LPredictor8_C(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
const uint32_t pred = Average2(top[-1], top[0]);
|
||||
(void)left;
|
||||
return pred;
|
||||
}
|
||||
uint32_t VP8LPredictor9_C(uint32_t left, const uint32_t* const top) {
|
||||
uint32_t VP8LPredictor9_C(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
const uint32_t pred = Average2(top[0], top[1]);
|
||||
(void)left;
|
||||
return pred;
|
||||
}
|
||||
uint32_t VP8LPredictor10_C(uint32_t left, const uint32_t* const top) {
|
||||
const uint32_t pred = Average4(left, top[-1], top[0], top[1]);
|
||||
uint32_t VP8LPredictor10_C(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
const uint32_t pred = Average4(*left, top[-1], top[0], top[1]);
|
||||
return pred;
|
||||
}
|
||||
uint32_t VP8LPredictor11_C(uint32_t left, const uint32_t* const top) {
|
||||
const uint32_t pred = Select(top[0], left, top[-1]);
|
||||
uint32_t VP8LPredictor11_C(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
const uint32_t pred = Select(top[0], *left, top[-1]);
|
||||
return pred;
|
||||
}
|
||||
uint32_t VP8LPredictor12_C(uint32_t left, const uint32_t* const top) {
|
||||
const uint32_t pred = ClampedAddSubtractFull(left, top[0], top[-1]);
|
||||
uint32_t VP8LPredictor12_C(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
const uint32_t pred = ClampedAddSubtractFull(*left, top[0], top[-1]);
|
||||
return pred;
|
||||
}
|
||||
uint32_t VP8LPredictor13_C(uint32_t left, const uint32_t* const top) {
|
||||
const uint32_t pred = ClampedAddSubtractHalf(left, top[0], top[-1]);
|
||||
uint32_t VP8LPredictor13_C(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
const uint32_t pred = ClampedAddSubtractHalf(*left, top[0], top[-1]);
|
||||
return pred;
|
||||
}
|
||||
|
||||
|
@ -28,23 +28,38 @@ extern "C" {
|
||||
//------------------------------------------------------------------------------
|
||||
// Decoding
|
||||
|
||||
typedef uint32_t (*VP8LPredictorFunc)(uint32_t left, const uint32_t* const top);
|
||||
typedef uint32_t (*VP8LPredictorFunc)(const uint32_t* const left,
|
||||
const uint32_t* const top);
|
||||
extern VP8LPredictorFunc VP8LPredictors[16];
|
||||
|
||||
uint32_t VP8LPredictor0_C(uint32_t left, const uint32_t* const top);
|
||||
uint32_t VP8LPredictor1_C(uint32_t left, const uint32_t* const top);
|
||||
uint32_t VP8LPredictor2_C(uint32_t left, const uint32_t* const top);
|
||||
uint32_t VP8LPredictor3_C(uint32_t left, const uint32_t* const top);
|
||||
uint32_t VP8LPredictor4_C(uint32_t left, const uint32_t* const top);
|
||||
uint32_t VP8LPredictor5_C(uint32_t left, const uint32_t* const top);
|
||||
uint32_t VP8LPredictor6_C(uint32_t left, const uint32_t* const top);
|
||||
uint32_t VP8LPredictor7_C(uint32_t left, const uint32_t* const top);
|
||||
uint32_t VP8LPredictor8_C(uint32_t left, const uint32_t* const top);
|
||||
uint32_t VP8LPredictor9_C(uint32_t left, const uint32_t* const top);
|
||||
uint32_t VP8LPredictor10_C(uint32_t left, const uint32_t* const top);
|
||||
uint32_t VP8LPredictor11_C(uint32_t left, const uint32_t* const top);
|
||||
uint32_t VP8LPredictor12_C(uint32_t left, const uint32_t* const top);
|
||||
uint32_t VP8LPredictor13_C(uint32_t left, const uint32_t* const top);
|
||||
uint32_t VP8LPredictor0_C(const uint32_t* const left,
|
||||
const uint32_t* const top);
|
||||
uint32_t VP8LPredictor1_C(const uint32_t* const left,
|
||||
const uint32_t* const top);
|
||||
uint32_t VP8LPredictor2_C(const uint32_t* const left,
|
||||
const uint32_t* const top);
|
||||
uint32_t VP8LPredictor3_C(const uint32_t* const left,
|
||||
const uint32_t* const top);
|
||||
uint32_t VP8LPredictor4_C(const uint32_t* const left,
|
||||
const uint32_t* const top);
|
||||
uint32_t VP8LPredictor5_C(const uint32_t* const left,
|
||||
const uint32_t* const top);
|
||||
uint32_t VP8LPredictor6_C(const uint32_t* const left,
|
||||
const uint32_t* const top);
|
||||
uint32_t VP8LPredictor7_C(const uint32_t* const left,
|
||||
const uint32_t* const top);
|
||||
uint32_t VP8LPredictor8_C(const uint32_t* const left,
|
||||
const uint32_t* const top);
|
||||
uint32_t VP8LPredictor9_C(const uint32_t* const left,
|
||||
const uint32_t* const top);
|
||||
uint32_t VP8LPredictor10_C(const uint32_t* const left,
|
||||
const uint32_t* const top);
|
||||
uint32_t VP8LPredictor11_C(const uint32_t* const left,
|
||||
const uint32_t* const top);
|
||||
uint32_t VP8LPredictor12_C(const uint32_t* const left,
|
||||
const uint32_t* const top);
|
||||
uint32_t VP8LPredictor13_C(const uint32_t* const left,
|
||||
const uint32_t* const top);
|
||||
|
||||
// These Add/Sub function expects upper[-1] and out[-1] to be readable.
|
||||
typedef void (*VP8LPredictorAddSubFunc)(const uint32_t* in,
|
||||
|
@ -179,7 +179,7 @@ static void PREDICTOR_ADD(const uint32_t* in, const uint32_t* upper, \
|
||||
int x; \
|
||||
assert(upper != NULL); \
|
||||
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); \
|
||||
} \
|
||||
}
|
||||
|
@ -745,7 +745,7 @@ static void PredictorSub##PREDICTOR_I##_C(const uint32_t* in, \
|
||||
assert(upper != NULL); \
|
||||
for (x = 0; x < num_pixels; ++x) { \
|
||||
const uint32_t pred = \
|
||||
VP8LPredictor##PREDICTOR_I##_C(in[x - 1], upper + x); \
|
||||
VP8LPredictor##PREDICTOR_I##_C(&in[x - 1], upper + x); \
|
||||
out[x] = VP8LSubPixels(in[x], pred); \
|
||||
} \
|
||||
}
|
||||
|
@ -188,46 +188,51 @@ static WEBP_INLINE uint32_t Average4(uint32_t a0, uint32_t a1,
|
||||
return Average2(Average2(a0, a1), Average2(a2, a3));
|
||||
}
|
||||
|
||||
static uint32_t Predictor5_MIPSdspR2(uint32_t left, const uint32_t* const top) {
|
||||
return Average3(left, top[0], top[1]);
|
||||
static uint32_t Predictor5_MIPSdspR2(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
return Average3(*left, top[0], top[1]);
|
||||
}
|
||||
|
||||
static uint32_t Predictor6_MIPSdspR2(uint32_t left, const uint32_t* const top) {
|
||||
return Average2(left, top[-1]);
|
||||
static uint32_t Predictor6_MIPSdspR2(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
return Average2(*left, top[-1]);
|
||||
}
|
||||
|
||||
static uint32_t Predictor7_MIPSdspR2(uint32_t left, const uint32_t* const top) {
|
||||
return Average2(left, top[0]);
|
||||
static uint32_t Predictor7_MIPSdspR2(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
return Average2(*left, top[0]);
|
||||
}
|
||||
|
||||
static uint32_t Predictor8_MIPSdspR2(uint32_t left, const uint32_t* const top) {
|
||||
static uint32_t Predictor8_MIPSdspR2(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
(void)left;
|
||||
return Average2(top[-1], top[0]);
|
||||
}
|
||||
|
||||
static uint32_t Predictor9_MIPSdspR2(uint32_t left, const uint32_t* const top) {
|
||||
static uint32_t Predictor9_MIPSdspR2(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
(void)left;
|
||||
return Average2(top[0], top[1]);
|
||||
}
|
||||
|
||||
static uint32_t Predictor10_MIPSdspR2(uint32_t left,
|
||||
static uint32_t Predictor10_MIPSdspR2(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
return Average4(left, top[-1], top[0], top[1]);
|
||||
return Average4(*left, top[-1], top[0], top[1]);
|
||||
}
|
||||
|
||||
static uint32_t Predictor11_MIPSdspR2(uint32_t left,
|
||||
static uint32_t Predictor11_MIPSdspR2(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
return Select(top[0], left, top[-1]);
|
||||
return Select(top[0], *left, top[-1]);
|
||||
}
|
||||
|
||||
static uint32_t Predictor12_MIPSdspR2(uint32_t left,
|
||||
static uint32_t Predictor12_MIPSdspR2(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
return ClampedAddSubtractFull(left, top[0], top[-1]);
|
||||
return ClampedAddSubtractFull(*left, top[0], top[-1]);
|
||||
}
|
||||
|
||||
static uint32_t Predictor13_MIPSdspR2(uint32_t left,
|
||||
static uint32_t Predictor13_MIPSdspR2(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
return ClampedAddSubtractHalf(left, top[0], top[-1]);
|
||||
return ClampedAddSubtractHalf(*left, top[0], top[-1]);
|
||||
}
|
||||
|
||||
// Add green to blue and red channels (i.e. perform the inverse transform of
|
||||
|
@ -188,17 +188,21 @@ static WEBP_INLINE uint32_t Average3_NEON(uint32_t a0, uint32_t a1,
|
||||
return avg;
|
||||
}
|
||||
|
||||
static uint32_t Predictor5_NEON(uint32_t left, const uint32_t* const top) {
|
||||
return Average3_NEON(left, top[0], top[1]);
|
||||
static uint32_t Predictor5_NEON(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
return Average3_NEON(*left, top[0], top[1]);
|
||||
}
|
||||
static uint32_t Predictor6_NEON(uint32_t left, const uint32_t* const top) {
|
||||
return Average2_NEON(left, top[-1]);
|
||||
static uint32_t Predictor6_NEON(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
return Average2_NEON(*left, top[-1]);
|
||||
}
|
||||
static uint32_t Predictor7_NEON(uint32_t left, const uint32_t* const top) {
|
||||
return Average2_NEON(left, top[0]);
|
||||
static uint32_t Predictor7_NEON(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
return Average2_NEON(*left, top[0]);
|
||||
}
|
||||
static uint32_t Predictor13_NEON(uint32_t left, const uint32_t* const top) {
|
||||
return ClampedAddSubtractHalf_NEON(left, top[0], top[-1]);
|
||||
static uint32_t Predictor13_NEON(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
return ClampedAddSubtractHalf_NEON(*left, top[0], top[-1]);
|
||||
}
|
||||
|
||||
// Batch versions of those functions.
|
||||
|
@ -138,42 +138,51 @@ static WEBP_INLINE uint32_t Average4_SSE2(uint32_t a0, uint32_t a1,
|
||||
return output;
|
||||
}
|
||||
|
||||
static uint32_t Predictor5_SSE2(uint32_t left, const uint32_t* const top) {
|
||||
const uint32_t pred = Average3_SSE2(left, top[0], top[1]);
|
||||
static uint32_t Predictor5_SSE2(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
const uint32_t pred = Average3_SSE2(*left, top[0], top[1]);
|
||||
return pred;
|
||||
}
|
||||
static uint32_t Predictor6_SSE2(uint32_t left, const uint32_t* const top) {
|
||||
const uint32_t pred = Average2_SSE2(left, top[-1]);
|
||||
static uint32_t Predictor6_SSE2(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
const uint32_t pred = Average2_SSE2(*left, top[-1]);
|
||||
return pred;
|
||||
}
|
||||
static uint32_t Predictor7_SSE2(uint32_t left, const uint32_t* const top) {
|
||||
const uint32_t pred = Average2_SSE2(left, top[0]);
|
||||
static uint32_t Predictor7_SSE2(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
const uint32_t pred = Average2_SSE2(*left, top[0]);
|
||||
return pred;
|
||||
}
|
||||
static uint32_t Predictor8_SSE2(uint32_t left, const uint32_t* const top) {
|
||||
static uint32_t Predictor8_SSE2(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
const uint32_t pred = Average2_SSE2(top[-1], top[0]);
|
||||
(void)left;
|
||||
return pred;
|
||||
}
|
||||
static uint32_t Predictor9_SSE2(uint32_t left, const uint32_t* const top) {
|
||||
static uint32_t Predictor9_SSE2(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
const uint32_t pred = Average2_SSE2(top[0], top[1]);
|
||||
(void)left;
|
||||
return pred;
|
||||
}
|
||||
static uint32_t Predictor10_SSE2(uint32_t left, const uint32_t* const top) {
|
||||
const uint32_t pred = Average4_SSE2(left, top[-1], top[0], top[1]);
|
||||
static uint32_t Predictor10_SSE2(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
const uint32_t pred = Average4_SSE2(*left, top[-1], top[0], top[1]);
|
||||
return pred;
|
||||
}
|
||||
static uint32_t Predictor11_SSE2(uint32_t left, const uint32_t* const top) {
|
||||
const uint32_t pred = Select_SSE2(top[0], left, top[-1]);
|
||||
static uint32_t Predictor11_SSE2(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
const uint32_t pred = Select_SSE2(top[0], *left, top[-1]);
|
||||
return pred;
|
||||
}
|
||||
static uint32_t Predictor12_SSE2(uint32_t left, const uint32_t* const top) {
|
||||
const uint32_t pred = ClampedAddSubtractFull_SSE2(left, top[0], top[-1]);
|
||||
static uint32_t Predictor12_SSE2(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
const uint32_t pred = ClampedAddSubtractFull_SSE2(*left, top[0], top[-1]);
|
||||
return pred;
|
||||
}
|
||||
static uint32_t Predictor13_SSE2(uint32_t left, const uint32_t* const top) {
|
||||
const uint32_t pred = ClampedAddSubtractHalf_SSE2(left, top[0], top[-1]);
|
||||
static uint32_t Predictor13_SSE2(const uint32_t* const left,
|
||||
const uint32_t* const top) {
|
||||
const uint32_t pred = ClampedAddSubtractHalf_SSE2(*left, top[0], top[-1]);
|
||||
return pred;
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,10 @@
|
||||
#ifndef WEBP_DSP_MSA_MACRO_H_
|
||||
#define WEBP_DSP_MSA_MACRO_H_
|
||||
|
||||
#include "src/dsp/dsp.h"
|
||||
|
||||
#if defined(WEBP_USE_MSA)
|
||||
|
||||
#include <stdint.h>
|
||||
#include <msa.h>
|
||||
|
||||
@ -1389,4 +1393,5 @@ static WEBP_INLINE uint32_t func_hadd_uh_u32(v8u16 in) {
|
||||
} while (0)
|
||||
#define AVER_UB2_UB(...) AVER_UB2(v16u8, __VA_ARGS__)
|
||||
|
||||
#endif // WEBP_USE_MSA
|
||||
#endif // WEBP_DSP_MSA_MACRO_H_
|
||||
|
@ -12,10 +12,12 @@
|
||||
#ifndef WEBP_DSP_NEON_H_
|
||||
#define WEBP_DSP_NEON_H_
|
||||
|
||||
#include <arm_neon.h>
|
||||
|
||||
#include "src/dsp/dsp.h"
|
||||
|
||||
#if defined(WEBP_USE_NEON)
|
||||
|
||||
#include <arm_neon.h>
|
||||
|
||||
// Right now, some intrinsics functions seem slower, so we disable them
|
||||
// everywhere except newer clang/gcc or aarch64 where the inline assembly is
|
||||
// incompatible.
|
||||
@ -98,4 +100,5 @@ static WEBP_INLINE int32x4x4_t Transpose4x4_NEON(const int32x4x4_t rows) {
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#endif // WEBP_USE_NEON
|
||||
#endif // WEBP_DSP_NEON_H_
|
||||
|
@ -10,7 +10,7 @@
|
||||
// inline YUV<->RGB conversion function
|
||||
//
|
||||
// The exact naming is Y'CbCr, following the ITU-R BT.601 standard.
|
||||
// More information at: http://en.wikipedia.org/wiki/YCbCr
|
||||
// More information at: https://en.wikipedia.org/wiki/YCbCr
|
||||
// Y = 0.2569 * R + 0.5044 * G + 0.0979 * B + 16
|
||||
// U = -0.1483 * R - 0.2911 * G + 0.4394 * B + 128
|
||||
// V = 0.4394 * R - 0.3679 * G - 0.0715 * B + 128
|
||||
|
@ -165,15 +165,15 @@ int WebPPictureCrop(WebPPicture* pic,
|
||||
// Simple picture rescaler
|
||||
|
||||
static int RescalePlane(const uint8_t* src,
|
||||
int src_width, int src_height, int src_stride,
|
||||
uint8_t* dst,
|
||||
int dst_width, int dst_height, int dst_stride,
|
||||
rescaler_t* const work,
|
||||
int num_channels) {
|
||||
int src_width, int src_height, int src_stride,
|
||||
uint8_t* dst,
|
||||
int dst_width, int dst_height, int dst_stride,
|
||||
rescaler_t* const work,
|
||||
int num_channels) {
|
||||
WebPRescaler rescaler;
|
||||
int y = 0;
|
||||
if (!WebPRescalerInit(&rescaler, src_width, src_height,
|
||||
dst, dst_width, dst_height, dst_stride,
|
||||
dst, dst_width, dst_height, dst_stride,
|
||||
num_channels, work)) {
|
||||
return 0;
|
||||
}
|
||||
@ -237,12 +237,12 @@ int WebPPictureRescale(WebPPicture* pic, int width, int height) {
|
||||
if (!RescalePlane(pic->y, prev_width, prev_height, pic->y_stride,
|
||||
tmp.y, width, height, tmp.y_stride, work, 1) ||
|
||||
!RescalePlane(pic->u,
|
||||
HALVE(prev_width), HALVE(prev_height), pic->uv_stride,
|
||||
tmp.u,
|
||||
HALVE(prev_width), HALVE(prev_height), pic->uv_stride,
|
||||
tmp.u,
|
||||
HALVE(width), HALVE(height), tmp.uv_stride, work, 1) ||
|
||||
!RescalePlane(pic->v,
|
||||
HALVE(prev_width), HALVE(prev_height), pic->uv_stride,
|
||||
tmp.v,
|
||||
HALVE(prev_width), HALVE(prev_height), pic->uv_stride,
|
||||
tmp.v,
|
||||
HALVE(width), HALVE(height), tmp.uv_stride, work, 1)) {
|
||||
return 0;
|
||||
}
|
||||
@ -259,8 +259,8 @@ int WebPPictureRescale(WebPPicture* pic, int width, int height) {
|
||||
WebPInitAlphaProcessing();
|
||||
AlphaMultiplyARGB(pic, 0);
|
||||
if (!RescalePlane((const uint8_t*)pic->argb, prev_width, prev_height,
|
||||
pic->argb_stride * 4,
|
||||
(uint8_t*)tmp.argb, width, height,
|
||||
pic->argb_stride * 4,
|
||||
(uint8_t*)tmp.argb, width, height,
|
||||
tmp.argb_stride * 4, work, 4)) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ static WEBP_INLINE void GetResidual(
|
||||
} else if (x == 0) {
|
||||
predict = upper_row[x]; // Top.
|
||||
} else {
|
||||
predict = pred_func(current_row[x - 1], upper_row + x);
|
||||
predict = pred_func(¤t_row[x - 1], upper_row + x);
|
||||
}
|
||||
#if (WEBP_NEAR_LOSSLESS == 1)
|
||||
if (max_quantization == 1 || mode == 0 || y == 0 || y == height - 1 ||
|
||||
|
@ -585,6 +585,9 @@ static WEBP_INLINE score_t RDScoreTrellis(int lambda, score_t rate,
|
||||
return rate * lambda + RD_DISTO_MULT * distortion;
|
||||
}
|
||||
|
||||
// Coefficient type.
|
||||
enum { TYPE_I16_AC = 0, TYPE_I16_DC = 1, TYPE_CHROMA_A = 2, TYPE_I4_AC = 3 };
|
||||
|
||||
static int TrellisQuantizeBlock(const VP8Encoder* const enc,
|
||||
int16_t in[16], int16_t out[16],
|
||||
int ctx0, int coeff_type,
|
||||
@ -593,7 +596,7 @@ static int TrellisQuantizeBlock(const VP8Encoder* const enc,
|
||||
const ProbaArray* const probas = enc->proba_.coeffs_[coeff_type];
|
||||
CostArrayPtr const costs =
|
||||
(CostArrayPtr)enc->proba_.remapped_costs_[coeff_type];
|
||||
const int first = (coeff_type == 0) ? 1 : 0;
|
||||
const int first = (coeff_type == TYPE_I16_AC) ? 1 : 0;
|
||||
Node nodes[16][NUM_NODES];
|
||||
ScoreState score_states[2][NUM_NODES];
|
||||
ScoreState* ss_cur = &SCORE_STATE(0, MIN_DELTA);
|
||||
@ -657,16 +660,17 @@ static int TrellisQuantizeBlock(const VP8Encoder* const enc,
|
||||
// test all alternate level values around level0.
|
||||
for (m = -MIN_DELTA; m <= MAX_DELTA; ++m) {
|
||||
Node* const cur = &NODE(n, m);
|
||||
int level = level0 + m;
|
||||
const int level = level0 + m;
|
||||
const int ctx = (level > 2) ? 2 : level;
|
||||
const int band = VP8EncBands[n + 1];
|
||||
score_t base_score;
|
||||
score_t best_cur_score = MAX_COST;
|
||||
int best_prev = 0; // default, in case
|
||||
score_t best_cur_score;
|
||||
int best_prev;
|
||||
score_t cost, score;
|
||||
|
||||
ss_cur[m].score = MAX_COST;
|
||||
ss_cur[m].costs = costs[n + 1][ctx];
|
||||
if (level < 0 || level > thresh_level) {
|
||||
ss_cur[m].score = MAX_COST;
|
||||
// Node is dead.
|
||||
continue;
|
||||
}
|
||||
@ -682,18 +686,24 @@ static int TrellisQuantizeBlock(const VP8Encoder* const enc,
|
||||
}
|
||||
|
||||
// Inspect all possible non-dead predecessors. Retain only the best one.
|
||||
for (p = -MIN_DELTA; p <= MAX_DELTA; ++p) {
|
||||
// The base_score is added to all scores so it is only added for the final
|
||||
// value after the loop.
|
||||
cost = VP8LevelCost(ss_prev[-MIN_DELTA].costs, level);
|
||||
best_cur_score =
|
||||
ss_prev[-MIN_DELTA].score + RDScoreTrellis(lambda, cost, 0);
|
||||
best_prev = -MIN_DELTA;
|
||||
for (p = -MIN_DELTA + 1; p <= MAX_DELTA; ++p) {
|
||||
// Dead nodes (with ss_prev[p].score >= MAX_COST) are automatically
|
||||
// eliminated since their score can't be better than the current best.
|
||||
const score_t cost = VP8LevelCost(ss_prev[p].costs, level);
|
||||
cost = VP8LevelCost(ss_prev[p].costs, level);
|
||||
// Examine node assuming it's a non-terminal one.
|
||||
const score_t score =
|
||||
base_score + ss_prev[p].score + RDScoreTrellis(lambda, cost, 0);
|
||||
score = ss_prev[p].score + RDScoreTrellis(lambda, cost, 0);
|
||||
if (score < best_cur_score) {
|
||||
best_cur_score = score;
|
||||
best_prev = p;
|
||||
}
|
||||
}
|
||||
best_cur_score += base_score;
|
||||
// Store best finding in current node.
|
||||
cur->sign = sign;
|
||||
cur->level = level;
|
||||
@ -701,11 +711,11 @@ static int TrellisQuantizeBlock(const VP8Encoder* const enc,
|
||||
ss_cur[m].score = best_cur_score;
|
||||
|
||||
// Now, record best terminal node (and thus best entry in the graph).
|
||||
if (level != 0) {
|
||||
if (level != 0 && best_cur_score < best_score) {
|
||||
const score_t last_pos_cost =
|
||||
(n < 15) ? VP8BitCost(0, probas[band][ctx][0]) : 0;
|
||||
const score_t last_pos_score = RDScoreTrellis(lambda, last_pos_cost, 0);
|
||||
const score_t score = best_cur_score + last_pos_score;
|
||||
score = best_cur_score + last_pos_score;
|
||||
if (score < best_score) {
|
||||
best_score = score;
|
||||
best_path[0] = n; // best eob position
|
||||
@ -717,10 +727,16 @@ static int TrellisQuantizeBlock(const VP8Encoder* const enc,
|
||||
}
|
||||
|
||||
// Fresh start
|
||||
memset(in + first, 0, (16 - first) * sizeof(*in));
|
||||
memset(out + first, 0, (16 - first) * sizeof(*out));
|
||||
// Beware! We must preserve in[0]/out[0] value for TYPE_I16_AC case.
|
||||
if (coeff_type == TYPE_I16_AC) {
|
||||
memset(in + 1, 0, 15 * sizeof(*in));
|
||||
memset(out + 1, 0, 15 * sizeof(*out));
|
||||
} else {
|
||||
memset(in, 0, 16 * sizeof(*in));
|
||||
memset(out, 0, 16 * sizeof(*out));
|
||||
}
|
||||
if (best_path[0] == -1) {
|
||||
return 0; // skip!
|
||||
return 0; // skip!
|
||||
}
|
||||
|
||||
{
|
||||
@ -775,9 +791,9 @@ static int ReconstructIntra16(VP8EncIterator* const it,
|
||||
for (y = 0, n = 0; y < 4; ++y) {
|
||||
for (x = 0; x < 4; ++x, ++n) {
|
||||
const int ctx = it->top_nz_[x] + it->left_nz_[y];
|
||||
const int non_zero =
|
||||
TrellisQuantizeBlock(enc, tmp[n], rd->y_ac_levels[n], ctx, 0,
|
||||
&dqm->y1_, dqm->lambda_trellis_i16_);
|
||||
const int non_zero = TrellisQuantizeBlock(
|
||||
enc, tmp[n], rd->y_ac_levels[n], ctx, TYPE_I16_AC, &dqm->y1_,
|
||||
dqm->lambda_trellis_i16_);
|
||||
it->top_nz_[x] = it->left_nz_[y] = non_zero;
|
||||
rd->y_ac_levels[n][0] = 0;
|
||||
nz |= non_zero << n;
|
||||
@ -818,7 +834,7 @@ static int ReconstructIntra4(VP8EncIterator* const it,
|
||||
if (DO_TRELLIS_I4 && it->do_trellis_) {
|
||||
const int x = it->i4_ & 3, y = it->i4_ >> 2;
|
||||
const int ctx = it->top_nz_[x] + it->left_nz_[y];
|
||||
nz = TrellisQuantizeBlock(enc, tmp, levels, ctx, 3, &dqm->y1_,
|
||||
nz = TrellisQuantizeBlock(enc, tmp, levels, ctx, TYPE_I4_AC, &dqm->y1_,
|
||||
dqm->lambda_trellis_i4_);
|
||||
} else {
|
||||
nz = VP8EncQuantizeBlock(tmp, levels, &dqm->y1_);
|
||||
@ -927,9 +943,9 @@ static int ReconstructUV(VP8EncIterator* const it, VP8ModeScore* const rd,
|
||||
for (y = 0; y < 2; ++y) {
|
||||
for (x = 0; x < 2; ++x, ++n) {
|
||||
const int ctx = it->top_nz_[4 + ch + x] + it->left_nz_[4 + ch + y];
|
||||
const int non_zero =
|
||||
TrellisQuantizeBlock(enc, tmp[n], rd->uv_levels[n], ctx, 2,
|
||||
&dqm->uv_, dqm->lambda_trellis_uv_);
|
||||
const int non_zero = TrellisQuantizeBlock(
|
||||
enc, tmp[n], rd->uv_levels[n], ctx, TYPE_CHROMA_A, &dqm->uv_,
|
||||
dqm->lambda_trellis_uv_);
|
||||
it->top_nz_[4 + ch + x] = it->left_nz_[4 + ch + y] = non_zero;
|
||||
nz |= non_zero << n;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ extern "C" {
|
||||
// version numbers
|
||||
#define ENC_MAJ_VERSION 1
|
||||
#define ENC_MIN_VERSION 2
|
||||
#define ENC_REV_VERSION 1
|
||||
#define ENC_REV_VERSION 2
|
||||
|
||||
enum { MAX_LF_LEVELS = 64, // Maximum loop filter level
|
||||
MAX_VARIABLE_LEVEL = 67, // last (inclusive) level with variable cost
|
||||
|
@ -6,8 +6,8 @@
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,2,1
|
||||
PRODUCTVERSION 1,0,2,1
|
||||
FILEVERSION 1,0,2,2
|
||||
PRODUCTVERSION 1,0,2,2
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@ -24,12 +24,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Google, Inc."
|
||||
VALUE "FileDescription", "libwebp DLL"
|
||||
VALUE "FileVersion", "1.2.1"
|
||||
VALUE "FileVersion", "1.2.2"
|
||||
VALUE "InternalName", "libwebp.dll"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2021"
|
||||
VALUE "OriginalFilename", "libwebp.dll"
|
||||
VALUE "ProductName", "WebP Image Codec"
|
||||
VALUE "ProductVersion", "1.2.1"
|
||||
VALUE "ProductVersion", "1.2.2"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
@ -6,8 +6,8 @@
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,2,1
|
||||
PRODUCTVERSION 1,0,2,1
|
||||
FILEVERSION 1,0,2,2
|
||||
PRODUCTVERSION 1,0,2,2
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@ -24,12 +24,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Google, Inc."
|
||||
VALUE "FileDescription", "libwebpdecoder DLL"
|
||||
VALUE "FileVersion", "1.2.1"
|
||||
VALUE "FileVersion", "1.2.2"
|
||||
VALUE "InternalName", "libwebpdecoder.dll"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2021"
|
||||
VALUE "OriginalFilename", "libwebpdecoder.dll"
|
||||
VALUE "ProductName", "WebP Image Decoder"
|
||||
VALUE "ProductVersion", "1.2.1"
|
||||
VALUE "ProductVersion", "1.2.2"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
@ -17,6 +17,6 @@ noinst_HEADERS =
|
||||
noinst_HEADERS += ../webp/format_constants.h
|
||||
|
||||
libwebpmux_la_LIBADD = ../libwebp.la
|
||||
libwebpmux_la_LDFLAGS = -no-undefined -version-info 3:7:0 -lm
|
||||
libwebpmux_la_LDFLAGS = -no-undefined -version-info 3:8:0 -lm
|
||||
libwebpmuxincludedir = $(includedir)/webp
|
||||
pkgconfig_DATA = libwebpmux.pc
|
||||
|
@ -6,8 +6,8 @@
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,2,1
|
||||
PRODUCTVERSION 1,0,2,1
|
||||
FILEVERSION 1,0,2,2
|
||||
PRODUCTVERSION 1,0,2,2
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@ -24,12 +24,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Google, Inc."
|
||||
VALUE "FileDescription", "libwebpmux DLL"
|
||||
VALUE "FileVersion", "1.2.1"
|
||||
VALUE "FileVersion", "1.2.2"
|
||||
VALUE "InternalName", "libwebpmux.dll"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2021"
|
||||
VALUE "OriginalFilename", "libwebpmux.dll"
|
||||
VALUE "ProductName", "WebP Image Muxer"
|
||||
VALUE "ProductVersion", "1.2.1"
|
||||
VALUE "ProductVersion", "1.2.2"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
@ -29,7 +29,7 @@ extern "C" {
|
||||
|
||||
#define MUX_MAJ_VERSION 1
|
||||
#define MUX_MIN_VERSION 2
|
||||
#define MUX_REV_VERSION 1
|
||||
#define MUX_REV_VERSION 2
|
||||
|
||||
// Chunk object.
|
||||
typedef struct WebPChunk WebPChunk;
|
||||
|
@ -161,7 +161,7 @@ static void SetBitDepths(const HuffmanTree* const tree,
|
||||
// especially when population counts are longer than 2**tree_limit, but
|
||||
// we are not planning to use this with extremely long blocks.
|
||||
//
|
||||
// See http://en.wikipedia.org/wiki/Huffman_coding
|
||||
// See https://en.wikipedia.org/wiki/Huffman_coding
|
||||
static void GenerateOptimalTree(const uint32_t* const histogram,
|
||||
int histogram_size,
|
||||
HuffmanTree* tree, int tree_depth_limit,
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#define DFIX 4 // extra precision for ordered dithering
|
||||
#define DSIZE 4 // dithering size (must be a power of two)
|
||||
// cf. http://en.wikipedia.org/wiki/Ordered_dithering
|
||||
// cf. https://en.wikipedia.org/wiki/Ordered_dithering
|
||||
static const uint8_t kOrderedDither[DSIZE][DSIZE] = {
|
||||
{ 0, 8, 2, 10 }, // coefficients are in DFIX fixed-point precision
|
||||
{ 12, 4, 14, 6 },
|
||||
|
@ -49,11 +49,11 @@ struct WebPRescaler {
|
||||
// Initialize a rescaler given scratch area 'work' and dimensions of src & dst.
|
||||
// Returns false in case of error.
|
||||
int WebPRescalerInit(WebPRescaler* const rescaler,
|
||||
int src_width, int src_height,
|
||||
uint8_t* const dst,
|
||||
int dst_width, int dst_height, int dst_stride,
|
||||
int num_channels,
|
||||
rescaler_t* const work);
|
||||
int src_width, int src_height,
|
||||
uint8_t* const dst,
|
||||
int dst_width, int dst_height, int dst_stride,
|
||||
int num_channels,
|
||||
rescaler_t* const work);
|
||||
|
||||
// If either 'scaled_width' or 'scaled_height' (but not both) is 0 the value
|
||||
// will be calculated preserving the aspect ratio, otherwise the values are
|
||||
|
@ -23,7 +23,7 @@
|
||||
// alloc/free etc) is printed. For debugging/tuning purpose only (it's slow,
|
||||
// and not multi-thread safe!).
|
||||
// An interesting alternative is valgrind's 'massif' tool:
|
||||
// http://valgrind.org/docs/manual/ms-manual.html
|
||||
// https://valgrind.org/docs/manual/ms-manual.html
|
||||
// Here is an example command line:
|
||||
/* valgrind --tool=massif --massif-out-file=massif.out \
|
||||
--stacks=yes --alloc-fn=WebPSafeMalloc --alloc-fn=WebPSafeCalloc
|
||||
|
@ -85,7 +85,7 @@ WEBP_EXTERN uint8_t* WebPDecodeBGR(const uint8_t* data, size_t data_size,
|
||||
// Upon return, the Y buffer has a stride returned as '*stride', while U and V
|
||||
// have a common stride returned as '*uv_stride'.
|
||||
// Return NULL in case of error.
|
||||
// (*) Also named Y'CbCr. See: http://en.wikipedia.org/wiki/YCbCr
|
||||
// (*) Also named Y'CbCr. See: https://en.wikipedia.org/wiki/YCbCr
|
||||
WEBP_EXTERN uint8_t* WebPDecodeYUV(const uint8_t* data, size_t data_size,
|
||||
int* width, int* height,
|
||||
uint8_t** u, uint8_t** v,
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "./fuzz_utils.h"
|
||||
#include "webp/decode.h"
|
||||
#include "src/webp/decode.h"
|
||||
|
||||
int LLVMFuzzerTestOneInput(const uint8_t* const data, size_t size) {
|
||||
int i;
|
||||
|
@ -15,9 +15,9 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "./fuzz_utils.h"
|
||||
#include "webp/decode.h"
|
||||
#include "webp/demux.h"
|
||||
#include "webp/mux_types.h"
|
||||
#include "src/webp/decode.h"
|
||||
#include "src/webp/demux.h"
|
||||
#include "src/webp/mux_types.h"
|
||||
|
||||
int LLVMFuzzerTestOneInput(const uint8_t* const data, size_t size) {
|
||||
WebPData webp_data;
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "examples/anim_util.h"
|
||||
#include "imageio/imageio_util.h"
|
||||
#include "webp/demux.h"
|
||||
#include "src/webp/demux.h"
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
// WebPAnimDecoderGetInfo() is too late to check the canvas size as
|
||||
|
@ -15,8 +15,8 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "./fuzz_utils.h"
|
||||
#include "webp/demux.h"
|
||||
#include "webp/mux.h"
|
||||
#include "src/webp/demux.h"
|
||||
#include "src/webp/mux.h"
|
||||
|
||||
int LLVMFuzzerTestOneInput(const uint8_t* const data, size_t size) {
|
||||
WebPData webp_data;
|
||||
|
@ -15,7 +15,7 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "./fuzz_utils.h"
|
||||
#include "webp/decode.h"
|
||||
#include "src/webp/decode.h"
|
||||
|
||||
int LLVMFuzzerTestOneInput(const uint8_t* const data, size_t size) {
|
||||
int w, h;
|
||||
|
@ -79,6 +79,26 @@ if [[ -z "${SDK[$IOS]}" ]] || [[ ${SDK[$IOS]%%.*} -lt 8 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#######################################
|
||||
# Moves Headers/*.h to Headers/<framework>/
|
||||
#
|
||||
# Places framework headers in a subdirectory to avoid Xcode errors when using
|
||||
# multiple frameworks:
|
||||
# error: Multiple commands produce
|
||||
# '.../Build/Products/Debug-iphoneos/include/types.h'
|
||||
# Arguments:
|
||||
# $1 - path to framework
|
||||
#######################################
|
||||
update_headers_path() {
|
||||
local framework_name="$(basename ${1%.xcframework})"
|
||||
local subdir
|
||||
for d in $(find "$1" -path "*/Headers"); do
|
||||
subdir="$d/$framework_name"
|
||||
mkdir "$subdir"
|
||||
mv "$d/"*.h "$subdir"
|
||||
done
|
||||
}
|
||||
|
||||
echo "Xcode Version: ${XCODE}"
|
||||
echo "iOS SDK Version: ${SDK[$IOS]}"
|
||||
echo "MacOS SDK Version: ${SDK[$MACOS]}"
|
||||
@ -105,7 +125,7 @@ if [[ ! -e ${SRCDIR}/configure ]]; then
|
||||
Error creating configure script!
|
||||
This script requires the autoconf/automake and libtool to build. MacPorts or
|
||||
Homebrew can be used to obtain these:
|
||||
http://www.macports.org/install.php
|
||||
https://www.macports.org/install.php
|
||||
https://brew.sh/
|
||||
EOF
|
||||
exit 1
|
||||
@ -228,6 +248,10 @@ xcodebuild -create-xcframework "${FAT_DEMUXLIBLIST[@]}" \
|
||||
-output ${DEMUXTARGETDIR}
|
||||
xcodebuild -create-xcframework "${FAT_MUXLIBLIST[@]}" \
|
||||
-output ${MUXTARGETDIR}
|
||||
update_headers_path "${TARGETDIR}"
|
||||
update_headers_path "${DECTARGETDIR}"
|
||||
update_headers_path "${DEMUXTARGETDIR}"
|
||||
update_headers_path "${MUXTARGETDIR}"
|
||||
set +x
|
||||
|
||||
echo "SUCCESS"
|
||||
|
Reference in New Issue
Block a user