Projects
openEuler:Mainline
libwebp
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 2
View file
_service:tar_scm:libwebp.spec
Changed
@@ -1,5 +1,5 @@ Name: libwebp -Version: 1.2.1 +Version: 1.3.0 Release: 1 URL: http://www.linuxfromscratch.org/blfs/view/svn/general/libwebp.html Summary: Library and tools for the WebP graphics format @@ -90,13 +90,14 @@ %files -n %{name} %defattr(-,root,root) -%doc README AUTHORS +%doc README.md AUTHORS %license COPYING %{_libdir}/*.so.* %files devel %defattr(-,root,root) %{_libdir}/%{name}*.so +%{_libdir}/libsharpyuv.so %{_includedir}/* %{_libdir}/*.a %{_libdir}/pkgconfig/* @@ -111,6 +112,12 @@ %{_mandir}/man*/* %changelog +* Fri Feb 03 2023 zhouwenpei <zhouwenpei1@h-partners.com> - 1.3.0-1 +- update to 1.3.0 + +* Wed Oct 26 2022 zhouwenpei <zhouwenpei1@h-partners.com> - 1.2.1-2 +- Rebuild for next release + * Wed Dec 01 2021 wangkerong <wangkerong@huawei.com> - 1.2.1-1 - update to 1.2.1
View file
_service
Changed
@@ -2,7 +2,7 @@ <service name="tar_scm"> <param name="scm">git</param> <param name="url">git@gitee.com:src-openeuler/libwebp.git</param> - <param name="revision">e9c1437a9592642ad22449e9b0a288df7969a3ad</param> + <param name="revision">master</param> <param name="exclude">*</param> <param name="extract">*</param> </service>
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/README
Deleted
@@ -1,795 +0,0 @@ - __ __ ____ ____ ____ - / \\/ \/ _ \/ _ )/ _ \ - \ / __/ _ \ __/ - \__\__/\____/\_____/__/ ____ ___ - / _/ / \ \ / _ \/ _/ - / \_/ / / \ \ __/ \__ - \____/____/\_____/_____/____/v1.2.1 - -Description: -============ - -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 - -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 -"COPYING" file for details. An additional intellectual -property rights grant can be found in the file PATENTS. - -Building: -========= - -Windows build: --------------- - -By running: - - nmake /f Makefile.vc CFG=release-static RTLIBCFG=static OBJDIR=output - -the directory output\release-static\(x64|x86)\bin will contain the tools -cwebp.exe and dwebp.exe. The directory output\release-static\(x64|x86)\lib will -contain the libwebp static library. -The target architecture (x86/x64) is detected by Makefile.vc from the Visual -Studio compiler (cl.exe) available in the system path. - -Unix build using makefile.unix: -------------------------------- - -On platforms with GNU tools installed (gcc and make), running - - make -f makefile.unix - -will build the binaries examples/cwebp and examples/dwebp, along -with the static library src/libwebp.a. No system-wide installation -is supplied, as this is a simple alternative to the full installation -system based on the autoconf tools (see below). -Please refer to makefile.unix for additional details and customizations. - -Using autoconf tools: ---------------------- -Prerequisites: -A compiler (e.g., gcc), make, autoconf, automake, libtool. -On a Debian-like system the following should install everything you need for a -minimal build: -$ sudo apt-get install gcc make autoconf automake libtool - -When building from git sources, you will need to run autogen.sh to generate the -configure script. - -./configure -make -make install - -should be all you need to have the following files - -/usr/local/include/webp/decode.h -/usr/local/include/webp/encode.h -/usr/local/include/webp/types.h -/usr/local/lib/libwebp.* -/usr/local/bin/cwebp -/usr/local/bin/dwebp - -installed. - -Note: A decode-only library, libwebpdecoder, is available using the -'--enable-libwebpdecoder' flag. The encode library is built separately and can -be installed independently using a minor modification in the corresponding -Makefile.am configure files (see comments there). See './configure --help' for -more options. - -Building for MIPS Linux: ------------------------- -MIPS Linux toolchain stable available releases can be found at: -https://community.imgtec.com/developers/mips/tools/codescape-mips-sdk/available-releases/ - -# Add toolchain to PATH -export PATH=$PATH:/path/to/toolchain/bin - -# 32-bit build for mips32r5 (p5600) -HOST=mips-mti-linux-gnu -MIPS_CFLAGS="-O3 -mips32r5 -mabi=32 -mtune=p5600 -mmsa -mfp64 \ - -msched-weight -mload-store-pairs -fPIE" -MIPS_LDFLAGS="-mips32r5 -mabi=32 -mmsa -mfp64 -pie" - -# 64-bit build for mips64r6 (i6400) -HOST=mips-img-linux-gnu -MIPS_CFLAGS="-O3 -mips64r6 -mabi=64 -mtune=i6400 -mmsa -mfp64 \ - -msched-weight -mload-store-pairs -fPIE" -MIPS_LDFLAGS="-mips64r6 -mabi=64 -mmsa -mfp64 -pie" - -./configure --host=${HOST} --build=`config.guess` \ - CC="${HOST}-gcc -EL" \ - CFLAGS="$MIPS_CFLAGS" \ - LDFLAGS="$MIPS_LDFLAGS" -make -make install - -CMake: ------- -With CMake, you can compile libwebp, cwebp, dwebp, gif2webp, img2webp, webpinfo -and the JS bindings. - -Prerequisites: -A compiler (e.g., gcc with autotools) and CMake. -On a Debian-like system the following should install everything you need for a -minimal build: -$ sudo apt-get install build-essential cmake - -When building from git sources, you will need to run cmake to generate the -makefiles. - -mkdir build && cd build && cmake ../ -make -make install - -If you also want any of the executables, you will need to enable them through -CMake, e.g.: - -cmake -DWEBP_BUILD_CWEBP=ON -DWEBP_BUILD_DWEBP=ON ../ - -or through your favorite interface (like ccmake or cmake-qt-gui). - -Use option -DWEBP_UNICODE=ON for Unicode support on Windows (with chcp 65001). - -Finally, once installed, you can also use WebP in your CMake project by doing: - -find_package(WebP) - -which will define the CMake variables WebP_INCLUDE_DIRS and WebP_LIBRARIES. - -Gradle: -------- -The support for Gradle is minimal: it only helps you compile libwebp, cwebp and -dwebp and webpmux_example. - -Prerequisites: -A compiler (e.g., gcc with autotools) and gradle. -On a Debian-like system the following should install everything you need for a -minimal build: -$ sudo apt-get install build-essential gradle - -When building from git sources, you will need to run the Gradle wrapper with the -appropriate target, e.g. : - -./gradlew buildAllExecutables - -SWIG bindings: --------------- - -To generate language bindings from swig/libwebp.swig at least swig-1.3 -(http://www.swig.org) is required. - -Currently the following functions are mapped: -Decode: - WebPGetDecoderVersion - WebPGetInfo - WebPDecodeRGBA - WebPDecodeARGB - WebPDecodeBGRA - WebPDecodeBGR - WebPDecodeRGB - -Encode: - WebPGetEncoderVersion - WebPEncodeRGBA - WebPEncodeBGRA - WebPEncodeRGB - WebPEncodeBGR - WebPEncodeLosslessRGBA - WebPEncodeLosslessBGRA - WebPEncodeLosslessRGB - WebPEncodeLosslessBGR - -See swig/README for more detailed build instructions. - -Java bindings: - -To build the swig-generated JNI wrapper code at least JDK-1.5 (or equivalent) -is necessary for enum support. The output is intended to be a shared object / -DLL that can be loaded via System.loadLibrary("webp_jni"). - -Python bindings: -
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/README.mux
Deleted
@@ -1,257 +0,0 @@ - __ __ ____ ____ ____ __ __ _ __ __ - / \\/ \/ _ \/ _ \/ _ \/ \ \/ \___/_ / _\ - \ / __/ _ \ __/ / / (_/ /__ - \__\__/\_____/_____/__/ \__//_/\_____/__/___/v1.2.1 - - -Description: -============ - -WebPMux: set of two libraries 'Mux' and 'Demux' for creation, extraction and -manipulation of an extended format WebP file, which can have features like -color profile, metadata and animation. Reference command-line tools 'webpmux' -and 'vwebp' as well as the WebP container specification -'doc/webp-container-spec.txt' are also provided in this package. - -WebP Mux tool: -============== - -The examples/ directory contains a tool (webpmux) for manipulating WebP -files. The webpmux tool can be used to create an extended format WebP file and -also to extract or strip relevant data from such a file. - -A list of options is available using the -help command line flag: - -> webpmux -help -Usage: webpmux -get GET_OPTIONS INPUT -o OUTPUT - webpmux -set SET_OPTIONS INPUT -o OUTPUT - webpmux -duration DURATION_OPTIONS -duration ... - INPUT -o OUTPUT - webpmux -strip STRIP_OPTIONS INPUT -o OUTPUT - webpmux -frame FRAME_OPTIONS -frame... -loop LOOP_COUNT - -bgcolor BACKGROUND_COLOR -o OUTPUT - webpmux -info INPUT - webpmux -h|-help - webpmux -version - webpmux argument_file_name - -GET_OPTIONS: - Extract relevant data: - icc get ICC profile - exif get EXIF metadata - xmp get XMP metadata - 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 - 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 - -DURATION_OPTIONS: - Set duration of selected frames: - duration set duration for each frames - duration,frame set duration of a particular frame - duration,start,end set duration of frames in the - interval start,end) - where: 'duration' is the duration in milliseconds - 'start' is the start frame index - 'end' is the inclusive end frame index - The special 'end' value '0' means: last frame. - -STRIP_OPTIONS: - Strip color profile/metadata: - icc strip ICC profile - exif strip EXIF metadata - xmp strip XMP metadata - -FRAME_OPTIONS(i): - Create animation: - file_i +di+xi+yi+mibi - where: 'file_i' is the i'th animation frame (WebP format), - 'di' is the pause duration before next frame, - 'xi','yi' specify the image offset for this frame, - 'mi' is the dispose method for this frame (0 or 1), - 'bi' is the blending method for this frame (+b or -b) - -LOOP_COUNT: - Number of times to repeat the animation. - Valid range is 0 to 65535 Default: 0 (infinite). - -BACKGROUND_COLOR: - Background color of the canvas. - A,R,G,B - where: 'A', 'R', 'G' and 'B' are integers in the range 0 to 255 specifying - the Alpha, Red, Green and Blue component values respectively - Default: 255,255,255,255 - -INPUT & OUTPUT are in WebP format. - -Note: The nature of EXIF, XMP and ICC data is not checked and is assumed to be -valid. - -Note: if a single file name is passed as the argument, the arguments will be -tokenized from this file. The file name must not start with the character '-'. - -Visualization tool: -=================== - -The examples/ directory also contains a tool (vwebp) for viewing WebP files. -It decodes the image and visualizes it using OpenGL. See the libwebp README -for details on building and running this program. - -Mux API: -======== -The Mux API contains methods for adding data to and reading data from WebP -files. This API currently supports XMP/EXIF metadata, ICC profile and animation. -Other features may be added in subsequent releases. - -Example#1 (pseudo code): Creating a WebPMux object with image data, color -profile and XMP metadata. - - int copy_data = 0; - WebPMux* mux = WebPMuxNew(); - // ... (Prepare image data). - WebPMuxSetImage(mux, &image, copy_data); - // ... (Prepare ICC profile data). - WebPMuxSetChunk(mux, "ICCP", &icc_profile, copy_data); - // ... (Prepare XMP metadata). - WebPMuxSetChunk(mux, "XMP ", &xmp, copy_data); - // Get data from mux in WebP RIFF format. - WebPMuxAssemble(mux, &output_data); - WebPMuxDelete(mux); - // ... (Consume output_data; e.g. write output_data.bytes to file). - WebPDataClear(&output_data); - - -Example#2 (pseudo code): Get image and color profile data from a WebP file. - - int copy_data = 0; - // ... (Read data from file). - WebPMux* mux = WebPMuxCreate(&data, copy_data); - WebPMuxGetFrame(mux, 1, &image); - // ... (Consume image; e.g. call WebPDecode() to decode the data). - WebPMuxGetChunk(mux, "ICCP", &icc_profile); - // ... (Consume icc_profile). - WebPMuxDelete(mux); - free(data); - - -For a detailed Mux API reference, please refer to the header file -(src/webp/mux.h). - -Demux API: -========== -The Demux API enables extraction of images and extended format data from -WebP files. This API currently supports reading of XMP/EXIF metadata, ICC -profile and animated images. Other features may be added in subsequent -releases. - -Code example: Demuxing WebP data to extract all the frames, ICC profile -and EXIF/XMP metadata. - - WebPDemuxer* demux = WebPDemux(&webp_data); - uint32_t width = WebPDemuxGetI(demux, WEBP_FF_CANVAS_WIDTH); - uint32_t height = WebPDemuxGetI(demux, WEBP_FF_CANVAS_HEIGHT); - // ... (Get information about the features present in the WebP file). - uint32_t flags = WebPDemuxGetI(demux, WEBP_FF_FORMAT_FLAGS); - - // ... (Iterate over all frames). - WebPIterator iter; - if (WebPDemuxGetFrame(demux, 1, &iter)) { - do { - // ... (Consume 'iter'; e.g. Decode 'iter.fragment' with WebPDecode(), - // ... and get other frame properties like width, height, offsets etc. - // ... see 'struct WebPIterator' below for more info). - } while (WebPDemuxNextFrame(&iter)); - WebPDemuxReleaseIterator(&iter); - } - - // ... (Extract metadata). - WebPChunkIterator chunk_iter; - if (flags & ICCP_FLAG) WebPDemuxGetChunk(demux, "ICCP", 1, &chunk_iter); - // ... (Consume the ICC profile in 'chunk_iter.chunk'). - WebPDemuxReleaseChunkIterator(&chunk_iter); - if (flags & EXIF_FLAG) WebPDemuxGetChunk(demux, "EXIF", 1, &chunk_iter); - // ... (Consume the EXIF metadata in 'chunk_iter.chunk'). - WebPDemuxReleaseChunkIterator(&chunk_iter); - if (flags & XMP_FLAG) WebPDemuxGetChunk(demux, "XMP ", 1, &chunk_iter); - // ... (Consume the XMP metadata in 'chunk_iter.chunk'). - WebPDemuxReleaseChunkIterator(&chunk_iter); - WebPDemuxDelete(demux); - - -For a detailed Demux API reference, please refer to the header file -(src/webp/demux.h). - -AnimEncoder API: -================ -The AnimEncoder API can be used to create animated WebP images. - -Code example: - - WebPAnimEncoderOptions enc_options; - WebPAnimEncoderOptionsInit(&enc_options); - // ... (Tune 'enc_options' as needed).
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/README.webp_js
Deleted
@@ -1,75 +0,0 @@ - __ __ ____ ____ ____ __ ____ - / \\/ \ _ \ _ \ _ \ (__)/ __\ - \ / __/ _ \ __/ _) \_ \ - \__\__/_____/____/_/ /____/____/ - -Description: -============ - -This file describes the compilation of libwebp into a JavaScript decoder -using Emscripten and CMake. - - - install the Emscripten SDK following the procedure described at: - https://emscripten.org/docs/getting_started/downloads.html#installation-instructions-using-the-emsdk-recommended - After installation, you should have some global variable positioned to the - location of the SDK. In particular, $EMSDK should point to the - top-level directory containing Emscripten tools. - - - configure the project 'WEBP_JS' with CMake using: - - cd webp_js && \ - emcmake cmake -DWEBP_BUILD_WEBP_JS=ON \ - ../ - - - compile webp.js using 'emmake make'. - - - that's it! Upon completion, you should have the webp.js and - webp.wasm files generated. - -The callable JavaScript function is WebPToSDL(), which decodes a raw WebP -bitstream into a canvas. See webp_js/index.html for a simple usage sample -(see below for instructions). - -Demo HTML page: -=============== - - The HTML page webp_js/index.html requires an HTTP server to serve the WebP - image example. It's easy to just use Python for that. - -cd webp_js && python -m SimpleHTTPServer 8080 - -and then navigate to http://localhost:8080 in your favorite browser. - - -Web-Assembly (WASM) version: -============================ - - CMakeLists.txt is configured to build the WASM version when using - the option WEBP_BUILD_WEBP_JS=ON. The compilation step will assemble - the files 'webp_wasm.js', 'webp_wasm.wasm' in the webp_js/ directory. - See webp_js/index_wasm.html for a simple demo page using the WASM version - of the library. - - You will need a fairly recent version of Emscripten (at least 2.0.18, - latest-upstream is recommended) and of your WASM-enabled browser to run this - version. - -Caveat: -======= - - - First decoding using the library is usually slower, due to just-in-time - compilation. - - - Some versions of llvm produce the following compile error when SSE2 is - enabled. - -"Unsupported: %516 = bitcast <8 x i16> %481 to i128 - LLVM ERROR: BitCast Instruction not yet supported for integer types larger than 64 bits" - - The corresponding Emscripten bug is at: - https://github.com/kripken/emscripten/issues/3788 - - Therefore, SSE2 optimization is currently disabled in CMakeLists.txt. - - - If WEBP_ENABLE_SIMD is set to 1 the JavaScript version (webp.js) will be - disabled as wasm2js does not support SIMD.
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/doc/README
Deleted
@@ -1,29 +0,0 @@ - -Generate libwebp Container Spec Docs from Text Source -===================================================== - -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/ - -HTML generation can then be done from the project root: - -$ kramdown doc/webp-container-spec.txt --template doc/template.html > \ - doc/output/webp-container-spec.html - -kramdown can optionally syntax highlight code blocks, using CodeRay 3, -a dependency of kramdown that rubygems will install automatically. The -following will apply inline CSS styling; an external stylesheet is not -needed. - -$ kramdown doc/webp-lossless-bitstream-spec.txt --template \ - doc/template.html --coderay-css style --coderay-line-numbers ' ' \ - --coderay-default-lang c > \ - doc/output/webp-lossless-bitstream-spec.html - -Optimally, use kramdown 0.13.7 or newer if syntax highlighting desired. - -3: http://coderay.rubychan.de/
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/swig/README
Deleted
@@ -1,56 +0,0 @@ -Building: -========= - -JNI SWIG bindings: ------------------- - $ gcc -shared -fPIC -fno-strict-aliasing -O2 \ - -I/path/to/your/jdk/includes \ - libwebp_java_wrap.c \ - -lwebp \ - -o libwebp_jni.so - --------------------------------------- BEGIN PSEUDO EXAMPLE -import com.google.webp.libwebp; - -import java.lang.reflect.Method; - -public class libwebp_jni_example { - static { - System.loadLibrary("webp_jni"); - } - - /** - * usage: java -cp libwebp.jar:. libwebp_jni_example - */ - public static void main(String argv) { - final int version = libwebp.WebPGetDecoderVersion(); - System.out.println("libwebp version: " + Integer.toHexString(version)); - - System.out.println("libwebp methods:"); - final Method libwebpMethods = libwebp.class.getDeclaredMethods(); - for (int i = 0; i < libwebpMethods.length; i++) { - System.out.println(libwebpMethodsi); - } - } -} --------------------------------------- END PSEUDO EXAMPLE - - $ javac -cp libwebp.jar libwebp_jni_example.java - $ java -Djava.library.path=. -cp libwebp.jar:. libwebp_jni_example - -Python SWIG bindings: ---------------------- - $ python setup.py build_ext - $ python setup.py install --prefix=pylocal - --------------------------------------- BEGIN PSEUDO EXAMPLE -import glob -import sys -sys.path.append(glob.glob('pylocal/lib/python*/site-packages')0) - -from com.google.webp import libwebp -print "libwebp decoder version: %x" % libwebp.WebPGetDecoderVersion() - -print "libwebp attributes:" -for attr in dir(libwebp): print attr --------------------------------------- END PSEUDO EXAMPLE
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/tests/README
Deleted
@@ -1,19 +0,0 @@ -Description: -============ - -This is a collection of tests for the libwebp libraries, currently covering -fuzzing through the APIs. Additional test vector coverage can be found at: -https://chromium.googlesource.com/webm/libwebp-test-data - -Building: -========= - -Fuzzers: --------- - -Follow the build instructions in ../README for libwebp, optionally adding build -flags for various sanitizers (e.g., -fsanitize=address). - -fuzzer/makefile.unix can then be used to compile the fuzzer targets: - -$ make -C fuzzer -f makefile.unix
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/.pylintrc
Added
@@ -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-Za-zA-Z0-9*)|(?P<snake_case>_?a-za-z0-9_*))$
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/.style.yapf
Added
@@ -0,0 +1,2 @@ +style +based_on_style = chromium \ No newline at end of file
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/AUTHORS -> _service:tar_scm:libwebp-1.3.0.tar.gz/AUTHORS
Changed
@@ -1,18 +1,23 @@ Contributors: - Aidan O'Loan (aidanol at gmail dot com) - Alan Browning (browning at google dot com) +- Alexandru Ardelean (ardeleanalex at gmail dot com) +- Brian Ledger (brianpl at google dot com) - Charles Munger (clm at google dot com) - Cheng Yi (cyi at google dot com) - Christian Duvivier (cduvivier at google dot com) - Christopher Degawa (ccom at randomderp dot com) - Clement Courbet (courbet at google dot com) - Djordje Pesut (djordje dot pesut at imgtec dot com) +- Frank Barchard (fbarchard at google dot com) - Hui Su (huisu at google dot com) +- H. Vetinari (h dot vetinari at gmx dot com) - Ilya Kurdyukov (jpegqs at gmail dot com) - Ingvar Stepanyan (rreverser at google dot com) - James Zern (jzern at google dot com) - Jan Engelhardt (jengelh at medozas dot de) - Jehan (jehan at girinstud dot io) +- Jeremy Maitin-Shepard (jbms at google dot com) - Johann Koenig (johann dot koenig at duck dot com) - Jovan Zelincevic (jovan dot zelincevic at imgtec dot com) - Jyrki Alakuijala (jyrki at google dot com) @@ -22,6 +27,7 @@ - Mans Rullgard (mans at mansr dot com) - Marcin Kowalczyk (qrczak at google dot com) - Martin Olsson (mnemo at minimum dot se) +- Maryla Ustarroz-Calonge (maryla at google dot com) - Mikołaj Zalewski (mikolajz at google dot com) - Mislav Bradac (mislavm at google dot com) - Nico Weber (thakis at chromium dot org) @@ -32,6 +38,7 @@ - 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)
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/Android.mk -> _service:tar_scm:libwebp-1.3.0.tar.gz/Android.mk
Changed
@@ -1,3 +1,5 @@ +# Ignore this file during non-NDK builds. +ifdef NDK_ROOT LOCAL_PATH := $(call my-dir) WEBP_CFLAGS := -Wall -DANDROID -DHAVE_MALLOC_H -DHAVE_PTHREAD -DWEBP_USE_THREAD @@ -33,6 +35,15 @@ NEON := c endif +sharpyuv_srcs := \ + sharpyuv/sharpyuv.c \ + sharpyuv/sharpyuv_cpu.c \ + sharpyuv/sharpyuv_csp.c \ + sharpyuv/sharpyuv_dsp.c \ + sharpyuv/sharpyuv_gamma.c \ + sharpyuv/sharpyuv_neon.$(NEON) \ + sharpyuv/sharpyuv_sse2.c \ + dec_srcs := \ src/dec/alpha_dec.c \ src/dec/buffer_dec.c \ @@ -204,12 +215,13 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES := \ + $(sharpyuv_srcs) \ $(dsp_enc_srcs) \ $(enc_srcs) \ $(utils_enc_srcs) \ LOCAL_CFLAGS := $(WEBP_CFLAGS) -LOCAL_EXPORT_C_INCLUDES += $(LOCAL_PATH)/src +LOCAL_EXPORT_C_INCLUDES += $(LOCAL_PATH)/src $(LOCAL_PATH) # prefer arm over thumb mode for performance gains LOCAL_ARM_MODE := arm @@ -279,3 +291,4 @@ ifeq ($(USE_CPUFEATURES),yes) $(call import-module,android/cpufeatures) endif +endif # NDK_ROOT
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/CMakeLists.txt -> _service:tar_scm:libwebp-1.3.0.tar.gz/CMakeLists.txt
Changed
@@ -6,7 +6,11 @@ # 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) +if(APPLE) + cmake_minimum_required(VERSION 3.17) +else() + cmake_minimum_required(VERSION 3.7) +endif() if(POLICY CMP0072) cmake_policy(SET CMP0072 NEW) @@ -15,6 +19,14 @@ project(WebP C) # Options for coder / decoder executables. +if(BUILD_SHARED_LIBS) + set(WEBP_LINK_STATIC_DEFAULT OFF) +else() + set(WEBP_LINK_STATIC_DEFAULT ON) +endif() +option(WEBP_LINK_STATIC + "Link using static libraries. If OFF, use dynamic libraries." + ${WEBP_LINK_STATIC_DEFAULT}) if(NOT EMSCRIPTEN) # Disable SIMD on Emscripten by default, as it's a new unstable Wasm feature. # Users can still explicitly opt-in to make a SIMD-enabled build. @@ -40,6 +52,18 @@ set(WEBP_BITTRACE "0" CACHE STRING "Bit trace mode (0=none, 1=bit, 2=bytes)") set_property(CACHE WEBP_BITTRACE PROPERTY STRINGS 0 1 2) +if(WEBP_LINK_STATIC) + if(WIN32) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + else() + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + endif() + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + # vwebp does not compile on Ubuntu with static libraries so disabling it for + # now. + set(WEBP_BUILD_VWEBP OFF) +endif() + # Option needed for handling Unicode file names on Windows. if(WIN32) option(WEBP_UNICODE "Build Unicode executables." ON) @@ -62,19 +86,27 @@ endif() endif() +set(SHARPYUV_DEP_LIBRARIES) +set(SHARPYUV_DEP_INCLUDE_DIRS) set(WEBP_DEP_LIBRARIES) set(WEBP_DEP_INCLUDE_DIRS) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type: Release, Debug, MinSizeRel or RelWithDebInfo" - FORCE) + FORCE) endif() # Include dependencies. include(cmake/deps.cmake) include(GNUInstallDirs) +if(BUILD_SHARED_LIBS AND NOT CMAKE_INSTALL_RPATH) + # Set the rpath to match autoconf/libtool behavior. Note this must be set + # before target creation. + set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") +endif() + # ############################################################################## # Options. if(WEBP_ENABLE_SWAP_16BIT_CSP) @@ -90,24 +122,50 @@ add_definitions(-DUNICODE -D_UNICODE) endif() +if(MSVC AND BUILD_SHARED_LIBS) + add_definitions(-DWEBP_DLL) +endif() + +# pkg-config variables used by *.pc.in. set(prefix ${CMAKE_INSTALL_PREFIX}) -set(exec_prefix "\$\{prefix\}") -set(libdir "\$\{prefix\}/lib") -set(includedir "\$\{prefix\}/include") +set(exec_prefix "\${prefix}") +if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}") + set(libdir "${CMAKE_INSTALL_LIBDIR}") +else() + set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") +endif() +if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}") + set(includedir "${CMAKE_INSTALL_INCLUDEDIR}") +else() + set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") +endif() set(PTHREAD_LIBS ${CMAKE_THREAD_LIBS_INIT}) set(INSTALLED_LIBRARIES) +if(MSVC) + # match the naming convention used by nmake + set(webp_libname_prefix "lib") + set(CMAKE_SHARED_LIBRARY_PREFIX "${webp_libname_prefix}") + set(CMAKE_IMPORT_LIBRARY_PREFIX "${webp_libname_prefix}") + set(CMAKE_STATIC_LIBRARY_PREFIX "${webp_libname_prefix}") +endif() + +set(CMAKE_C_VISIBILITY_PRESET hidden) + # ############################################################################## # Android only. if(ANDROID) include_directories(${ANDROID_NDK}/sources/android/cpufeatures) - add_library(cpufeatures STATIC + add_library(cpufeatures-webp STATIC ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c) - list(APPEND INSTALLED_LIBRARIES cpufeatures) - target_link_libraries(cpufeatures dl) - set(WEBP_DEP_LIBRARIES ${WEBP_DEP_LIBRARIES} cpufeatures) - set(WEBP_DEP_INCLUDE_DIRS ${WEBP_DEP_INCLUDE_DIRS} - ${ANDROID_NDK}/sources/android/cpufeatures) + list(APPEND INSTALLED_LIBRARIES cpufeatures-webp) + target_link_libraries(cpufeatures-webp dl) + set(SHARPYUV_DEP_LIBRARIES ${SHARPYUV_DEP_LIBRARIES} cpufeatures-webp) + set(WEBP_DEP_LIBRARIES ${WEBP_DEP_LIBRARIES} cpufeatures-webp) + set(cpufeatures_include_dir ${ANDROID_NDK}/sources/android/cpufeatures) + set(SHARPYUV_DEP_INCLUDE_DIRS ${SHARPYUV_DEP_INCLUDE_DIRS} + ${cpufeatures_include_dir}) + set(WEBP_DEP_INCLUDE_DIRS ${WEBP_DEP_INCLUDE_DIRS} ${cpufeatures_include_dir}) add_definitions(-DHAVE_CPU_FEATURES_H=1) set(HAVE_CPU_FEATURES_H 1) else() @@ -116,7 +174,7 @@ function(configure_pkg_config FILE) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.in" - "${CMAKE_CURRENT_BINARY_DIR}/${FILE}") + "${CMAKE_CURRENT_BINARY_DIR}/${FILE}" @ONLY) if(HAVE_MATH_LIBRARY) # MSVC doesn't have libm @@ -125,10 +183,8 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${FILE} ${data}) endif() - install( - FILES "${CMAKE_CURRENT_BINARY_DIR}/${FILE}" - DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig - ) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${FILE}" + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) endfunction() # ############################################################################## @@ -138,23 +194,15 @@ # E.g.: libimagedec_la_SOURCES = image_dec.c image_dec.h function(parse_Makefile_am FOLDER VAR SRC_REGEX) file(READ ${FOLDER}/Makefile.am MAKEFILE_AM) - string(REGEX MATCHALL - "${SRC_REGEX}_SOURCES *\\+?= +0-9a-z\\._ *" - FILES_PER_LINE - ${MAKEFILE_AM}) + string(REGEX MATCHALL "${SRC_REGEX}_SOURCES *\\+?= +0-9a-z\\._ *" + FILES_PER_LINE ${MAKEFILE_AM}) set(SRCS ${${VAR}}) foreach(FILES ${FILES_PER_LINE}) string(FIND ${FILES} "=" OFFSET) math(EXPR OFFSET "${OFFSET} + 2") - string(SUBSTRING ${FILES} - ${OFFSET} - -1 - FILES) + string(SUBSTRING ${FILES} ${OFFSET} -1 FILES) if(FILES) - string(REGEX MATCHALL - "0-9a-z\\._+" - FILES - ${FILES}) + string(REGEX MATCHALL "0-9a-z\\._+" FILES ${FILES}) foreach(FILE ${FILES}) list(APPEND SRCS ${FOLDER}/${FILE}) endforeach() @@ -183,9 +231,52 @@ # Generate the config.h file. configure_file(${CMAKE_CURRENT_LIST_DIR}/cmake/config.h.in - ${CMAKE_CURRENT_BINARY_DIR}/src/webp/config.h) + ${CMAKE_CURRENT_BINARY_DIR}/src/webp/config.h @ONLY) add_definitions(-DHAVE_CONFIG_H) +# Set the version numbers. +macro(set_version FILE TARGET_NAME NAME_IN_MAKEFILE) + file(READ ${CMAKE_CURRENT_SOURCE_DIR}/${FILE} SOURCE_FILE) + string(REGEX MATCH + "${NAME_IN_MAKEFILE}_la_LDFLAGS^\n* -version-info 0-9:+" TMP + ${SOURCE_FILE})
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/ChangeLog -> _service:tar_scm:libwebp-1.3.0.tar.gz/ChangeLog
Changed
@@ -1,7 +1,323 @@ +0ba77244 update NEWS +e763eb1e bump version to 1.3.0 +2a8686fc update AUTHORS +106a57c1 Merge "*/Android.mk: add a check for NDK_ROOT" into main +c5e841c4 Merge "extras: WebpToSDL -> WebPToSDL" into main +dbc30715 Merge "xcframeworkbuild.sh: bump MACOSX_CATALYST_MIN_VERSION" into main +6fc1a9f9 */Android.mk: add a check for NDK_ROOT +d3e151fc doc/api.md,webp_js/README.md: Webp -> WebP +ed92a626 extras: WebpToSDL -> WebPToSDL +6eb0189b xcframeworkbuild.sh: bump MACOSX_CATALYST_MIN_VERSION +1d58575b CMake: align .pc variables with autoconf +e5fe2cfc webp-lossless-bitstream-spec,cosmetics: reflow paragraphs +0ceeeab9 webp-lossless-bitstream-spec: add amendment note +607611cd Merge "webp-container-spec: normalize section title case" into main +f853685e lossless: SUBTRACT_GREEN -> SUBTRACT_GREEN_TRANSFORM +786497e4 webp-lossless-bitstream-spec: fix inv color txfm description +c6ac672d webp-lossless-bitstream-spec: fix num_code_lengths check +b5700efb webp-lossless-bitstream-spec,cosmetics: grammar/capitalization +d8ed8c11 webp-container-spec: normalize section title case +52ec0b8f Merge changes Ie975dbb5,Ifc8c93af,I6ca7c5d6,I2e8d66f5,I152477b8 into main +5097ef62 webp-container-spec,cosmetics: grammar/capitalization +e3ba2b1f webp-lossless-bitstream-spec,cosmetics: reflow abstract +1e8e3ded webp-lossless-bitstream-spec: reword abstract re alpha +017cb6fa webp-container-spec,cosmetics: normalize range syntax +f6a4684b webp-lossless-bitstream-spec,cosmetics: normalize range syntax +54ebd5a3 webp-lossless-bitstream-spec: limit dist map lut to 69 cols +44741f9c webp-lossless-bitstream-spec: fix dist mapping example +fad0ece7 pnmdec.c: use snprintf instead of sprintf +3f73e8f7 sharpyuv: add SharpYuvGetVersion() +ce2f2d66 SharpYuvConvert: fix a race on SharpYuvGetCPUInfo +a458e308 sharpyuv_dsp.h: restore sharpyuv_cpu.h include +9ba800a7 Merge changes Id72fbf3b,Ic59d23a2 into main +979c0ebb sharpyuv: add SharpYuvGetCPUInfo +8bab09a4 Merge "*.pc.in: rename lib_prefix to webp_libname_prefix" into main +769387c5 cpu.c,cosmetics: fix a typo +a02978c2 sharpyuv/Makefile.am+cmake: add missing -lm +28aedcb9 *.pc.in: rename lib_prefix to webp_libname_prefix +c42e6d5a configure.ac: export an empty lib_prefix variable +dfc843aa Merge "*.pc.in: add lib prefix to lib names w/MSVC" into main +2498209b *.pc.in: add lib prefix to lib names w/MSVC +ac252b61 Merge "analysis_enc.c: fix a dead store warning" into main +56944762 analysis_enc.c: fix a dead store warning +d34f9b99 Merge "webp-lossless-bitstream-spec: convert BNF to ABNF" into main +dc05b4db Merge changes I96bc063c,I45880467,If9e18e5a,I6ee938e4,I0a410b28, ... into main +83270c7f webp-container-spec: add prose for rendering process +73b19b64 webp-container-spec: note reserved fields MUST be ignored +57101d3f webp-lossless-bitstream-spec: improve 'small' color table stmt +dfd32e45 webp-container-spec: remove redundant sentence +8a6185dd doc/webp-*: fix some punctuation, grammar +72776530 webp-lossless-bitstream-spec: convert BNF to ABNF +d992bb08 cmake: rename cpufeatures target to cpufeatures-webp +3ed2b275 webp-container-spec: clarify background color note +951c292d webp-container-spec: come too late -> out of order +902dd787 webp-container-spec: prefer hex literals +a8f6b5ee webp-container-spec: change SHOULD to MUST w/ANIM chunk +1dc59435 webp-container-spec: add unknown fields MUST be ignored +280a810f webp-container-spec: make padding byte=0 a MUST +41f0bf68 webp-container-spec: update note on trailing data +6bdd36db webp-container-spec: clarify Chunk Size is in bytes +87e36c48 Merge "webp_js/README.md,cosmetics: reflow some lines" into main +5b01f321 Merge "Update Windows makefile to build libsharpyuv library." into main +19b1a71c webp_js/README.md,cosmetics: reflow some lines +780db756 Update Windows makefile to build libsharpyuv library. +e407d4b3 CMakeLists.txt: replace GLUT_glut_LIBRARY w/GLUT::GLUT +abf73d62 Merge "WebPConfig.cmake.in: add find_dependency(Threads)" into main +25807fb4 Merge "cmake: restore compatibility with cmake < 3.12" into main +5dbc4bfa WebPConfig.cmake.in: add find_dependency(Threads) +b2a175dd Merge "Update wasm instructions." into main +cb90f76b Update wasm instructions. +02d15258 cmake: restore compatibility with cmake < 3.12 +5ba046e2 CMake: add_definitions -> add_compile_options +e68765af dsp,neon: use vaddv in a few more places +e8f83de2 Set libsharpyuv include dir to 'webp' subdirectory. +15a91ab1 cmake,cosmetics: apply cmake-format +0dd49d1a CMakeLists.txt: set @ONLY in configure_file() calls +62b1bfe8 Merge changes I2877e7bb,I777cad70,I15af7d1a,I686e6740,If10538a9, ... into main +95c8fe5f Merge changes Iecea3603,I9dc228ab into main +e7c805cf picture_csp_enc.c: remove SafeInitSharpYuv +6af8845a sharpyuv: prefer webp/types.h +639619ce cmake: fix dll exports +782ed48c sharpyuv,SharpYuvInit: add mutex protection when available +cad0d5ad sharyuv_{neon,sse2}.c: merge WEBP_USE_* sections +ef70ee06 add a few missing <stddef.h> includes for NULL +f0f9eda4 sharpyuv.h: remove <inttypes.h> +9b902cba Merge "picture_csp_enc.c,CheckNonOpaque: rm unneeded local" into main +9c1d457c cmake/cpu.cmake: remove unused variable +9ac25bcb CMakeLists.txt,win32: match naming convention used by nmake +76c353ba picture_csp_enc.c,CheckNonOpaque: rm unneeded local +5000de54 Merge "cwebp: fix WebPPictureHasTransparency call" into main +e1729309 Merge "WebPPictureHasTransparency: add missing pointer check" into main +00ff988a vp8l_enc,AddSingleSubGreen: clear int sanitizer warnings +e2fecc22 dsp/lossless_enc.c: clear int sanitizer warnings +129cf9e9 dsp/lossless.c: clear int sanitizer warnings +ad7d1753 dsp/lossless_enc.c: clear int sanitizer warnings +5037220e VP8LSubtractGreenFromBlueAndRed_C: clear int sanitizer warnings +2ee786c7 upsampling_sse2.c: clear int sanitizer warnings +4cc157d4 ParseOptionalChunks: clear int sanitizer warning +892cf033 BuildHuffmanTable: clear int sanitizer warning +3a9a4d45 VP8GetSigned: clear int sanitizer warnings +704a3d0a dsp/lossless.c: quiet int sanitizer warnings +1a6c109c WebPPictureHasTransparency: add missing pointer check +c626e7d5 cwebp: fix WebPPictureHasTransparency call +866e349c Merge tag 'v1.2.4' +c170df38 Merge "Create libsharpyuv.a in makefile.unix." into main +9d7ff74a Create libsharpyuv.a in makefile.unix. +0d1f1254 update ChangeLog (tag: v1.2.4, origin/1.2.4) +fcbc2d78 Merge "doc/*.txt: restrict code to 69 columns" into main +4ad0e189 Merge "webp-container-spec.txt: normalize fourcc spelling" into main +980d2488 update NEWS +9fde8127 bump version to 1.2.4 +7a0a9935 doc/*.txt: restrict code to 69 columns +c040a615 webp-container-spec.txt: normalize fourcc spelling +aff1c546 dsp,x86: normalize types w/_mm_cvtsi128_si32 calls +ab540ae0 dsp,x86: normalize types w/_mm_cvtsi32_si128 calls +8980362e dsp,x86: normalize types w/_mm_set* calls (2) +e626925c lossless: fix crunch mode w/WEBP_REDUCE_SIZE +83539239 dsp,x86: normalize types w/_mm_set* calls +8a4576ce webp-container-spec.txt: replace & with & +db870881 Merge "webp-container-spec.txt: make reserved 0 values a MUST" into main +01d7d378 webp-lossless-bitstream-spec: number all sections +337cf69f webp-lossless-bitstream-spec: mv Nomenclature after Intro +79be856e Merge changes I7111d1f7,I872cd62c into main +5b87983a webp-container-spec.txt: make reserved 0 values a MUST +bd939123 Merge changes I7a25b1a6,I51b2c2a0,I87d0cbcf,I6ec60af6,I0a3fe9dc into main +04764b56 libwebp.pc: add libsharpyuv to requires +7deee810 libsharpyuv: add pkg-config file +1a64a7e6 webp-container-spec.txt: clarify some SHOULDs +bec2c88a webp-container-spec.txt: move ChunkHeader to terminology +c9359332 webp-container-spec.txt: clarify 'VP8 '/'XMP ' fourccs +70fe3063 webp-container-spec.txt: rightsize table entries +ddbf3f3f webp-container-spec.txt: update 'key words' text +c151e95b utils.h,WEBP_ALIGN: make bitmask unsigned +748e92bb add WebPInt32ToMem +3fe15b67 Merge "Build libsharpyuv as a full installable library." into main +4f402f34 add WebPMemToInt32 +a3b68c19 Build libsharpyuv as a full installable library. +b4994eaa CMake: set rpath for shared objects +94cd7117 Merge "CMake: fix dylib versioning" into main +e91451b6 Fix the lossless specs a bit more. +231bdfb7 CMake: fix dylib versioning +bfad7ab5 CMakeLists.txt: correct libwebpmux name in WebPConfig.cmake +c2e3fd30 Revert "cmake: fix webpmux lib name for cmake linking" +7366f7f3 Merge "lossless: fix crunch mode w/WEBP_REDUCE_SIZE" into main +84163d9d lossless: fix crunch mode w/WEBP_REDUCE_SIZE +d01c1eb3 webp-lossless-bitstream-spec,cosmetics: normalize capitalization +8813ca8e Merge tag 'v1.2.3' +3c4a0fbf update ChangeLog (tag: v1.2.3) +56a480e8 dsp/cpu.h: add missing extern "C" +62b45bdd update ChangeLog (tag: v1.2.3-rc1) +8764ec7a Merge changes Idb037953,Id582e395 into 1.2.3 +bcb872c3 vwebp: fix file name display in windows unicode build +67c44ac5 webpmux: fix -frame option in windows unicode build +8278825a makefile.unix: add sharpyuv objects to clean target +14a49e01 update NEWS +34b1dc33 bump version to 1.2.3 +0b397fda update AUTHORS +c16488ac update .mailmap +5a2d929c Merge "unicode.h: set console mode before using wprintf" into main +169f867f unicode.h: set console mode before using wprintf +a94b855c Merge "libsharpyuv: add version defines" into main +f83bdb52 libsharpyuv: add version defines +bef0d797 unicode_gif.h: fix -Wdeclaration-after-statement +404c1622 Rename Huffman coding to prefix coding in the bitstream spec +8895f8a3 Merge "run_static_analysis.sh: fix scan-build archive path" into main +92a673d2 Merge "Add -fvisibility=hidden flag in CMakeLists." into main +67c1d722 Merge "add WEBP_MSAN" into main +1124ff66 Add -fvisibility=hidden flag in CMakeLists. +e15b3560 add WEBP_MSAN +ec9e782a sharpyuv: remove minimum image size from sharpyuv library +7bd07f3b run_static_analysis.sh: fix scan-build archive path +5ecee06f Merge "sharpyuv: increase precision of gamma<->linear conversion" into main +f81dd7d6 Merge changes I3d17d529,I53026880,I1bd61639,I6bd4b25d,Icfec8fba into main +2d607ee6 sharpyuv: increase precision of gamma<->linear conversion +266cbbc5 sharpyuv: add 32bit version of SharpYuvFilterRow. +9fc12274 CMake: add src to webpinfo includes +7d18f40a CMake: add WEBP_BUILD_WEBPINFO to list of checks for exampleutil +11309aa5 CMake: add WEBP_BUILD_WEBPMUX to list of checks for exampleutil +4bc762f7 CMake: link imageioutil to exampleutil after defined +0d1b9bc4 WEBP_DEP_LIBRARIES: use Threads::Threads +20ef48f0 Merge "sharpyuv: add support for 10/12/16 bit rgb and 10/12 bit yuv." into main +93c54371 sharpyuv: add support for 10/12/16 bit rgb and 10/12 bit yuv. +53cf2b49 normalize WebPValidatePicture declaration w/definition +d3006f4b sharpyuv: slightly improve precision +ea967098 Merge changes Ia01bd397,Ibf3771af into main +11bc8410 Merge changes I2d317c4b,I9e77f6db into main +30453ea4 Add an internal WebPValidatePicture. +6c43219a Some renamings for consistency. +4f59fa73 update .mailmap +e74f8a62 webp-lossless-bitstream-spec,cosmetics: normalize range syntax +5a709ec0 webp-lossless-bitstream-spec,cosmetics: fix code typo +a2093acc webp-lossless-bitstream-spec: add amendment note +86c66930 webp-lossless-bitstream-spec: fix BNF +232f22da webp-lossless-bitstream-spec: fix 'simple code' snippet +44dd765d webp-lossless-bitstream-spec: fix ColorTransform impl +7a7e33e9 webp-lossless-bitstream-spec: fix TR-pixel right border note +86f94ee0 Update lossless spec with Huffman codes. +a3927cc8 sharpyuv.c,cosmetics: fix indent +6c45cef7 Make sure the stride has a minimum value in the importer. +0c8b0e67 sharpyuv: cleanup/cosmetic changes
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/Makefile.am -> _service:tar_scm:libwebp-1.3.0.tar.gz/Makefile.am
Changed
@@ -1,5 +1,5 @@ ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = src imageio man +SUBDIRS = sharpyuv src imageio man EXTRA_DIST = COPYING autogen.sh if BUILD_EXTRAS
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/Makefile.in -> _service:tar_scm:libwebp-1.3.0.tar.gz/Makefile.in
Changed
@@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -156,14 +156,11 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -CSCOPE = cscope -DIST_SUBDIRS = src imageio man extras examples +DIST_SUBDIRS = sharpyuv src imageio man extras examples am__DIST_COMMON = $(srcdir)/Makefile.in \ $(top_srcdir)/src/webp/config.h.in AUTHORS COPYING ChangeLog \ - NEWS README ar-lib compile config.guess config.sub install-sh \ - ltmain.sh missing + NEWS README.md ar-lib compile config.guess config.sub \ + install-sh ltmain.sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -221,8 +218,9 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -233,8 +231,10 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +FILECMD = @FILECMD@ GIF_INCLUDES = @GIF_INCLUDES@ GIF_LIBS = @GIF_LIBS@ GL_INCLUDES = @GL_INCLUDES@ @@ -349,8 +349,9 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +webp_libname_prefix = @webp_libname_prefix@ ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = src imageio man $(am__append_1) examples +SUBDIRS = sharpyuv src imageio man $(am__append_1) examples EXTRA_DIST = COPYING autogen.sh all: all-recursive @@ -518,7 +519,6 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/Makefile.vc -> _service:tar_scm:libwebp-1.3.0.tar.gz/Makefile.vc
Changed
@@ -5,6 +5,7 @@ LIBWEBP_BASENAME = libwebp LIBWEBPMUX_BASENAME = libwebpmux LIBWEBPDEMUX_BASENAME = libwebpdemux +LIBSHARPYUV_BASENAME = libsharpyuv !IFNDEF ARCH !IF ! cl 2>&1 | find "x86" > NUL @@ -31,12 +32,11 @@ CCDEBUG = cl.exe $(NOLOGO) /Od /Zi /D_DEBUG /RTC1 CFLAGS = /I. /Isrc $(NOLOGO) /W3 /EHsc /c CFLAGS = $(CFLAGS) /DWIN32 /D_CRT_SECURE_NO_WARNINGS /DWIN32_LEAN_AND_MEAN -LDFLAGS = /LARGEADDRESSAWARE /MANIFEST /NXCOMPAT /DYNAMICBASE +LDFLAGS = /LARGEADDRESSAWARE /MANIFEST:EMBED /NXCOMPAT /DYNAMICBASE LDFLAGS = $(LDFLAGS) $(PLATFORM_LDFLAGS) LNKDLL = link.exe /DLL $(NOLOGO) LNKEXE = link.exe $(NOLOGO) LNKLIB = lib.exe $(NOLOGO) -MT = mt.exe $(NOLOGO) RCNODBG = rc.exe $(NOLOGO) /l"0x0409" # 0x409 = U.S. English RCDEBUG = $(RCNODBG) /D_DEBUG @@ -82,6 +82,7 @@ $(DIROBJ)\extras \ $(DIROBJ)\imageio \ $(DIROBJ)\mux \ + $(DIROBJ)\sharpyuv \ $(DIROBJ)\utils \ # Target configuration @@ -96,6 +97,7 @@ LIBWEBP_BASENAME = $(LIBWEBP_BASENAME)_debug LIBWEBPMUX_BASENAME = $(LIBWEBPMUX_BASENAME)_debug LIBWEBPDEMUX_BASENAME = $(LIBWEBPDEMUX_BASENAME)_debug +LIBSHARPYUV_BASENAME = $(LIBSHARPYUV_BASENAME)_debug !ELSE IF "$(CFG)" == "release-dynamic" CC = $(CCNODBG) RC = $(RCNODBG) @@ -109,6 +111,7 @@ LIBWEBP_BASENAME = $(LIBWEBP_BASENAME)_debug LIBWEBPMUX_BASENAME = $(LIBWEBPMUX_BASENAME)_debug LIBWEBPDEMUX_BASENAME = $(LIBWEBPDEMUX_BASENAME)_debug +LIBSHARPYUV_BASENAME = $(LIBSHARPYUV_BASENAME)_debug !ENDIF !IF "$(STATICLIBBUILD)" == "TRUE" @@ -118,13 +121,14 @@ LIBWEBP = $(DIRLIB)\$(LIBWEBP_BASENAME).lib LIBWEBPMUX = $(DIRLIB)\$(LIBWEBPMUX_BASENAME).lib LIBWEBPDEMUX = $(DIRLIB)\$(LIBWEBPDEMUX_BASENAME).lib +LIBSHARPYUV = $(DIRLIB)\$(LIBSHARPYUV_BASENAME).lib !ELSE IF "$(DLLBUILD)" == "TRUE" -DLLINC = webp_dll.h -CC = $(CC) /I$(DIROBJ) /FI$(DLLINC) $(RTLIB) /DWEBP_DLL +CC = $(CC) /I$(DIROBJ) $(RTLIB) /DWEBP_DLL LIBWEBPDECODER = $(DIRLIB)\$(LIBWEBPDECODER_BASENAME)_dll.lib LIBWEBP = $(DIRLIB)\$(LIBWEBP_BASENAME)_dll.lib LIBWEBPMUX = $(DIRLIB)\$(LIBWEBPMUX_BASENAME)_dll.lib LIBWEBPDEMUX = $(DIRLIB)\$(LIBWEBPDEMUX_BASENAME)_dll.lib +LIBSHARPYUV = $(DIRLIB)\$(LIBSHARPYUV_BASENAME)_dll.lib LIBWEBP_PDBNAME = $(DIROBJ)\$(LIBWEBP_BASENAME)_dll.pdb CFGSET = TRUE !ENDIF @@ -174,6 +178,15 @@ # A config was provided, so the library can be built. # +SHARPYUV_OBJS = \ + $(DIROBJ)\sharpyuv\sharpyuv.obj \ + $(DIROBJ)\sharpyuv\sharpyuv_cpu.obj \ + $(DIROBJ)\sharpyuv\sharpyuv_csp.obj \ + $(DIROBJ)\sharpyuv\sharpyuv_dsp.obj \ + $(DIROBJ)\sharpyuv\sharpyuv_gamma.obj \ + $(DIROBJ)\sharpyuv\sharpyuv_neon.obj \ + $(DIROBJ)\sharpyuv\sharpyuv_sse2.obj \ + DEC_OBJS = \ $(DIROBJ)\dec\alpha_dec.obj \ $(DIROBJ)\dec\buffer_dec.obj \ @@ -335,12 +348,13 @@ $(DIROBJ)\utils\quant_levels_utils.obj \ LIBWEBPDECODER_OBJS = $(DEC_OBJS) $(DSP_DEC_OBJS) $(UTILS_DEC_OBJS) -LIBWEBP_OBJS = $(LIBWEBPDECODER_OBJS) $(ENC_OBJS) $(DSP_ENC_OBJS) \ - $(UTILS_ENC_OBJS) $(DLL_OBJS) +LIBWEBP_OBJS = $(LIBWEBPDECODER_OBJS) $(ENC_OBJS) \ + $(DSP_ENC_OBJS) $(UTILS_ENC_OBJS) $(DLL_OBJS) LIBWEBPMUX_OBJS = $(MUX_OBJS) $(LIBWEBPMUX_OBJS) LIBWEBPDEMUX_OBJS = $(DEMUX_OBJS) $(LIBWEBPDEMUX_OBJS) +LIBSHARPYUV_OBJS = $(SHARPYUV_OBJS) -OUT_LIBS = $(LIBWEBPDECODER) $(LIBWEBP) +OUT_LIBS = $(LIBWEBPDECODER) $(LIBWEBP) $(LIBSHARPYUV) !IF "$(ARCH)" == "ARM" ex: $(OUT_LIBS) all: ex @@ -368,7 +382,7 @@ $(DIRBIN)\anim_dump.exe: $(IMAGEIO_ENC_OBJS) $(DIRBIN)\cwebp.exe: $(DIROBJ)\examples\cwebp.obj $(IMAGEIO_DEC_OBJS) $(DIRBIN)\cwebp.exe: $(IMAGEIO_UTIL_OBJS) -$(DIRBIN)\cwebp.exe: $(LIBWEBPDEMUX) +$(DIRBIN)\cwebp.exe: $(LIBWEBPDEMUX) $(LIBSHARPYUV) $(DIRBIN)\dwebp.exe: $(DIROBJ)\examples\dwebp.obj $(IMAGEIO_DEC_OBJS) $(DIRBIN)\dwebp.exe: $(IMAGEIO_ENC_OBJS) $(DIRBIN)\dwebp.exe: $(IMAGEIO_UTIL_OBJS) @@ -409,17 +423,16 @@ $(IMAGEIO_DEC_OBJS) $(IMAGEIO_ENC_OBJS) $(EXTRAS_OBJS): $(OUTPUT_DIRS) !ENDIF # ARCH == ARM +$(LIBSHARPYUV): $(LIBSHARPYUV_OBJS) $(LIBWEBPDECODER): $(LIBWEBPDECODER_OBJS) -$(LIBWEBP): $(LIBWEBP_OBJS) +$(LIBWEBP): $(LIBWEBP_OBJS) $(LIBSHARPYUV) $(LIBWEBPMUX): $(LIBWEBPMUX_OBJS) $(LIBWEBPDEMUX): $(LIBWEBPDEMUX_OBJS) -$(LIBWEBP_OBJS) $(LIBWEBPMUX_OBJS) $(LIBWEBPDEMUX_OBJS): $(OUTPUT_DIRS) +$(LIBWEBP_OBJS) $(LIBWEBPMUX_OBJS) $(LIBWEBPDEMUX_OBJS) $(LIBSHARPYUV_OBJS): \ + $(OUTPUT_DIRS) !IF "$(DLLBUILD)" == "TRUE" -$(LIBWEBP_OBJS) $(LIBWEBPMUX_OBJS) $(LIBWEBPDEMUX_OBJS): \ - $(DIROBJ)\$(DLLINC) - {$(DIROBJ)}.c{$(DIROBJ)}.obj: $(CC) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$@ $< @@ -429,20 +442,20 @@ $(RC) /fo$@ $< {src\mux}.rc{$(DIROBJ)\mux}.res: $(RC) /fo$@ $< +{sharpyuv}.rc{$(DIROBJ)\sharpyuv}.res: + $(RC) /fo$@ $< -$(LIBWEBP): $(DIROBJ)\$(LIBWEBP_BASENAME:_debug=).res +$(LIBSHARPYUV): $(DIROBJ)\sharpyuv\$(LIBSHARPYUV_BASENAME:_debug=).res +$(LIBWEBP): $(LIBSHARPYUV) $(DIROBJ)\$(LIBWEBP_BASENAME:_debug=).res $(LIBWEBPDECODER): $(DIROBJ)\$(LIBWEBPDECODER_BASENAME:_debug=).res $(LIBWEBPMUX): $(LIBWEBP) $(DIROBJ)\mux\$(LIBWEBPMUX_BASENAME:_debug=).res $(LIBWEBPDEMUX): $(LIBWEBP) $(DIROBJ)\demux\$(LIBWEBPDEMUX_BASENAME:_debug=).res -$(LIBWEBPDECODER) $(LIBWEBP) $(LIBWEBPMUX) $(LIBWEBPDEMUX): +$(LIBWEBPDECODER) $(LIBWEBP) $(LIBWEBPMUX) $(LIBWEBPDEMUX) $(LIBSHARPYUV): $(LNKDLL) /out:$(DIRBIN)\$(@B:_dll=.dll) /implib:$@ $(LFLAGS) $** -xcopy $(DIROBJ)\*.pdb $(DIRLIB) /y - -clean:: - @-erase /s $(DIROBJ)\$(DLLINC) 2> NUL !ELSE -$(LIBWEBPDECODER) $(LIBWEBP) $(LIBWEBPMUX) $(LIBWEBPDEMUX): +$(LIBWEBPDECODER) $(LIBWEBP) $(LIBWEBPMUX) $(LIBWEBPDEMUX) $(LIBSHARPYUV): $(LNKLIB) /out:$@ $** -xcopy $(DIROBJ)\*.pdb $(DIRLIB) /y !ENDIF @@ -450,13 +463,6 @@ $(OUTPUT_DIRS): @if not exist "$(@)" mkdir "$(@)" -# generate a helper include to define WEBP_EXTERN suitable for the DLL build -$(DIROBJ)\$(DLLINC): - @echo #ifndef WEBP_DLL_H_ > $@ - @echo #define WEBP_DLL_H_ >> $@ - @echo #define WEBP_EXTERN __declspec(dllexport) >> $@ - @echo #endif /* WEBP_DLL_H_ */ >> $@ - .SUFFIXES: .c .obj .res .exe # File-specific flag builds. Note batch rules take precedence over wildcards, # so for now name each file individually. @@ -482,6 +488,8 @@ $(CC) $(CFLAGS) /Fd$(DIROBJ)\extras\ /Fo$(DIROBJ)\extras\ $< {imageio}.c{$(DIROBJ)\imageio}.obj:: $(CC) $(CFLAGS) /Fd$(DIROBJ)\imageio\ /Fo$(DIROBJ)\imageio\ $< +{sharpyuv}.c{$(DIROBJ)\sharpyuv}.obj:: + $(CC) $(CFLAGS) /Fd$(DIROBJ)\sharpyuv\ /Fo$(DIROBJ)\sharpyuv\ $< {src\dec}.c{$(DIROBJ)\dec}.obj:: $(CC) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$(DIROBJ)\dec\ $< {src\demux}.c{$(DIROBJ)\demux}.obj:: @@ -502,13 +510,9 @@ {$(DIROBJ)\examples}.obj{$(DIRBIN)}.exe: $(LNKEXE) $(LDFLAGS) /OUT:$@ $** $(LNKLIBS) - $(MT) -manifest $@.manifest -outputresource:$@;1 - del $@.manifest {$(DIROBJ)\extras}.obj{$(DIRBIN)}.exe: $(LNKEXE) $(LDFLAGS) /OUT:$@ $** $(LNKLIBS) - $(MT) -manifest $@.manifest -outputresource:$@;1 - del $@.manifest clean:: @-erase /s $(DIROBJ)\*.dll 2> NUL
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/NEWS -> _service:tar_scm:libwebp-1.3.0.tar.gz/NEWS
Changed
@@ -1,3 +1,33 @@ +- 12/16/2022: version 1.3.0 + This is a binary compatible release. + * add libsharpyuv, which exposes -sharp_yuv/config.use_sharp_yuv + functionality to other libraries; libwebp now depends on this library + * major updates to the container and lossless bitstream docs (#448, #546, + #551) + * miscellaneous warning, bug & build fixes (#576, #583, #584) + +- 8/4/2022: version 1.2.4 + This is a binary compatible release. + * restore CMake libwebpmux target name for compatibility with 1.2.2 (#575) + * fix lossless crunch mode encoding with WEBP_REDUCE_SIZE + (chromium: #1345547, #1345595, #1345772, #1345804) + +- 6/30/2022: version 1.2.3 + This is a binary compatible release. + * security fix for lossless encoder (#565, chromium:1313709) + * improved progress granularity in WebPReportProgress() when using lossless + * improved precision in Sharp YUV (-sharp_yuv) conversion + * many corrections to webp-lossless-bitstream-spec.txt (#551) + * crash/leak fixes on error/OOM and other bug fixes (#558, #563, #569, #573) + +- 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
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/PRESUBMIT.py
Added
@@ -0,0 +1,245 @@ +# 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$" +_INCLUDE_SOURCE_FILES_ONLY = r".*\.ch$" +_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 _CheckDuplicateFiles(input_api, output_api): + """Ensures there are not repeated filenames.""" + all_files = + for f in input_api.change.AllFiles(): + for include_file in _INCLUDE_SOURCE_FILES_ONLY: + if re.match(include_file, f): + all_files.append(f) + break + + basename_to_path = {} + for f in all_files: + basename_file = input_api.basename(f) + if basename_file in basename_to_path: + basename_to_pathbasename_file.append(f) + else: + basename_to_pathbasename_file = f + + dupes = + for files in basename_to_path.values(): + if len(files) > 1: + dupes.extend(files) + + if dupes: + return output_api.PresubmitError( + "Duplicate source files, rebase or rename some to make them unique:\n%s" + % dupes) + return output_api.PresubmitResult("No duplicates, success\n") + + +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 output1: + return output_api.PresubmitError("%s\n%s (%4.2fs) failed\n%s" % + (name, " ".join(cmd), duration, output1)) + 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, output1)) + + +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, output1)) + + +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)) + results.append(_CheckDuplicateFiles(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(
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/README.md
Added
@@ -0,0 +1,53 @@ +# WebP Codec + +``` + __ __ ____ ____ ____ + / \\/ \/ _ \/ _ )/ _ \ + \ / __/ _ \ __/ + \__\__/\____/\_____/__/ ____ ___ + / _/ / \ \ / _ \/ _/ + / \_/ / / \ \ __/ \__ + \____/____/\_____/_____/____/v1.3.0 +``` + +WebP codec is a 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' to compress and decompress +images respectively. + +See https://developers.google.com/speed/webp for details on the image format. + +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 +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. + +## Building + +See the building documentation(doc/building.md). + +## Encoding and Decoding Tools + +The examples/ directory contains tools to encode and decode images and +animations, view information about WebP images, and more. See the +tools documentation(doc/tools.md). + +## APIs + +See the APIs documentation(doc/api.md), and API usage examples in the +`examples/` directory. + +## Bugs + +Please report all bugs to the issue tracker: https://bugs.chromium.org/p/webp + +Patches welcome! See how to contribute(CONTRIBUTING.md). + +## Discuss + +Email: webp-discuss@webmproject.org + +Web: https://groups.google.com/a/webmproject.org/group/webp-discuss
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/aclocal.m4 -> _service:tar_scm:libwebp-1.3.0.tar.gz/aclocal.m4
Changed
@@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.16.3 -*- Autoconf -*- +# generated automatically by aclocal 1.16.5 -*- Autoconf -*- -# Copyright (C) 1996-2020 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -14,13 +14,13 @@ m4_ifndef(AC_CONFIG_MACRO_DIRS, m4_defun(_AM_CONFIG_MACRO_DIRS, )m4_defun(AC_CONFIG_MACRO_DIRS, _AM_CONFIG_MACRO_DIRS($@))) m4_ifndef(AC_AUTOCONF_VERSION, m4_copy(m4_PACKAGE_VERSION, AC_AUTOCONF_VERSION))dnl -m4_if(m4_defn(AC_AUTOCONF_VERSION), 2.69,, -m4_warning(this file was generated for autoconf 2.69. +m4_if(m4_defn(AC_AUTOCONF_VERSION), 2.71,, +m4_warning(this file was generated for autoconf 2.71. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.)) -# Copyright (C) 2002-2020 Free Software Foundation, Inc. +# Copyright (C) 2002-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -35,7 +35,7 @@ am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if($1, 1.16.3, , +m4_if($1, 1.16.5, , AC_FATAL(Do not call $0, use AM_INIT_AUTOMAKE($1).))dnl ) @@ -51,12 +51,12 @@ # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN(AM_SET_CURRENT_AUTOMAKE_VERSION, -AM_AUTOMAKE_VERSION(1.16.3)dnl +AM_AUTOMAKE_VERSION(1.16.5)dnl m4_ifndef(AC_AUTOCONF_VERSION, m4_copy(m4_PACKAGE_VERSION, AC_AUTOCONF_VERSION))dnl _AM_AUTOCONF_VERSION(m4_defn(AC_AUTOCONF_VERSION))) -# Copyright (C) 2011-2020 Free Software Foundation, Inc. +# Copyright (C) 2011-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -118,7 +118,7 @@ # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -170,7 +170,7 @@ # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2020 Free Software Foundation, Inc. +# Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -201,7 +201,7 @@ Usually this means the macro was only invoked conditionally.) fi)) -# Copyright (C) 1999-2020 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -392,7 +392,7 @@ # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2020 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -460,7 +460,7 @@ # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2020 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -488,6 +488,10 @@ # release and drop the old call support. AC_DEFUN(AM_INIT_AUTOMAKE, AC_PREREQ(2.65)dnl +m4_ifdef(_$0_ALREADY_INIT, + m4_fatal($0 expanded multiple times +m4_defn(_$0_ALREADY_INIT)), + m4_define(_$0_ALREADY_INIT, m4_expansion_stack))dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow(^AM_A-Z+FLAGS$)dnl @@ -524,7 +528,7 @@ _AM_SET_OPTIONS($1)dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( - m4_ifdef(AC_PACKAGE_NAME, ok):m4_ifdef(AC_PACKAGE_VERSION, ok), + m4_ifset(AC_PACKAGE_NAME, ok):m4_ifset(AC_PACKAGE_VERSION, ok), ok:ok,, m4_fatal(AC_INIT should be called with package and version arguments))dnl AC_SUBST(PACKAGE, 'AC_PACKAGE_TARNAME')dnl @@ -576,6 +580,20 @@ m4_define(AC_PROG_OBJCXX, m4_defn(AC_PROG_OBJCXX)_AM_DEPENDENCIES(OBJCXX)))dnl ) +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi +AC_SUBST(CTAGS) +if test -z "$ETAGS"; then + ETAGS=etags +fi +AC_SUBST(ETAGS) +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi +AC_SUBST(CSCOPE) + AC_REQUIRE(AM_SILENT_RULES)dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This @@ -657,7 +675,7 @@ done echo "timestamp for $_am_arg" >`AS_DIRNAME("$_am_arg")`/stamp-h$_am_stamp_count) -# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -678,7 +696,7 @@ fi AC_SUBST(install_sh)) -# Copyright (C) 2003-2020 Free Software Foundation, Inc. +# Copyright (C) 2003-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -699,7 +717,7 @@ # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -742,7 +760,7 @@ # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2020 Free Software Foundation, Inc. +# Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -776,7 +794,7 @@ # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -805,7 +823,7 @@ AC_DEFUN(_AM_IF_OPTION, m4_ifset(_AM_MANGLE_OPTION($1), $2, $3)) -# Copyright (C) 1999-2020 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -852,7 +870,7 @@ # For backward compatibility. AC_DEFUN_ONCE(AM_PROG_CC_C_O, AC_REQUIRE(AC_PROG_CC)) -# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -871,7 +889,7 @@
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/ar-lib -> _service:tar_scm:libwebp-1.3.0.tar.gz/ar-lib
Changed
@@ -4,7 +4,7 @@ me=ar-lib scriptversion=2019-07-04.01; # UTC -# Copyright (C) 2010-2020 Free Software Foundation, Inc. +# Copyright (C) 2010-2021 Free Software Foundation, Inc. # Written by Peter Rosin <peda@lysator.liu.se>. # # This program is free software; you can redistribute it and/or modify
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/build.gradle -> _service:tar_scm:libwebp-1.3.0.tar.gz/build.gradle
Changed
@@ -105,6 +105,14 @@ sources { c { source { + srcDir "sharpyuv" + include "sharpyuv.c" + include "sharpyuv_cpu.c" + include "sharpyuv_csp.c" + include "sharpyuv_dsp.c" + include "sharpyuv_gamma.c" + include "sharpyuv_neon.c" + include "sharpyuv_sse2.c" srcDir "src/dec" include "alpha_dec.c" include "buffer_dec.c"
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/cmake/WebPConfig.cmake.in -> _service:tar_scm:libwebp-1.3.0.tar.gz/cmake/WebPConfig.cmake.in
Changed
@@ -3,6 +3,11 @@ @PACKAGE_INIT@ +if(@WEBP_USE_THREAD@) + include(CMakeFindDependencyMacro) + find_dependency(Threads REQUIRED) +endif() + include ("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") set(WebP_INCLUDE_DIRS "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/cmake/cpu.cmake -> _service:tar_scm:libwebp-1.3.0.tar.gz/cmake/cpu.cmake
Changed
@@ -18,7 +18,8 @@ unset(WEBP_HAVE_FLAG_${WEBP_SIMD_FLAG} CACHE) cmake_push_check_state() set(CMAKE_REQUIRED_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}) - check_c_source_compiles(" + check_c_source_compiles( + " #include \"${CMAKE_CURRENT_LIST_DIR}/../src/dsp/dsp.h\" int main(void) { #if !defined(WEBP_USE_${WEBP_SIMD_FLAG}) @@ -26,7 +27,8 @@ #endif return 0; } - " WEBP_HAVE_FLAG_${WEBP_SIMD_FLAG}) + " + WEBP_HAVE_FLAG_${WEBP_SIMD_FLAG}) cmake_pop_check_state() if(WEBP_HAVE_FLAG_${WEBP_SIMD_FLAG}) set(WEBP_HAVE_${WEBP_SIMD_FLAG} 1 PARENT_SCOPE) @@ -52,13 +54,10 @@ endif() set(SIMD_DISABLE_FLAGS) else() - set(SIMD_ENABLE_FLAGS - "-msse4.1;-msse2;-mips32;-mdspr2;-mfpu=neon;-mmsa") - set(SIMD_DISABLE_FLAGS - "-mno-sse4.1;-mno-sse2;;-mno-dspr2;;-mno-msa") + set(SIMD_ENABLE_FLAGS "-msse4.1;-msse2;-mips32;-mdspr2;-mfpu=neon;-mmsa") + set(SIMD_DISABLE_FLAGS "-mno-sse4.1;-mno-sse2;;-mno-dspr2;;-mno-msa") endif() -set(WEBP_SIMD_FILES_TO_NOT_INCLUDE) set(WEBP_SIMD_FILES_TO_INCLUDE) set(WEBP_SIMD_FLAGS_TO_INCLUDE) @@ -75,8 +74,8 @@ math(EXPR WEBP_SIMD_FLAGS_RANGE "${WEBP_SIMD_FLAGS_LENGTH} - 1") foreach(I_SIMD RANGE ${WEBP_SIMD_FLAGS_RANGE}) - # With Emscripten 2.0.9 -msimd128 -mfpu=neon will enable NEON, but the - # source will fail to compile. + # With Emscripten 2.0.9 -msimd128 -mfpu=neon will enable NEON, but the source + # will fail to compile. if(EMSCRIPTEN AND ${I_SIMD} GREATER_EQUAL 2) break() endif() @@ -108,7 +107,7 @@ # Check which files we should include or not. list(GET WEBP_SIMD_FILE_EXTENSIONS ${I_SIMD} WEBP_SIMD_FILE_EXTENSION) file(GLOB SIMD_FILES "${CMAKE_CURRENT_LIST_DIR}/../" - "src/dsp/*${WEBP_SIMD_FILE_EXTENSION}") + "src/dsp/*${WEBP_SIMD_FILE_EXTENSION}") if(WEBP_HAVE_${WEBP_SIMD_FLAG}) # Memorize the file and flags. foreach(FILE ${SIMD_FILES}) @@ -142,11 +141,9 @@ set(COMMON_PATTERNS) endif() set(CMAKE_REQUIRED_DEFINITIONS ${SIMD_COMPILE_FLAG}) - check_c_source_compiles("int main(void) {return 0;}" - FLAG_${SIMD_COMPILE_FLAG} - FAIL_REGEX - "warning: argument unused during compilation:" - ${COMMON_PATTERNS}) + check_c_source_compiles( + "int main(void) {return 0;}" FLAG_${SIMD_COMPILE_FLAG} FAIL_REGEX + "warning: argument unused during compilation:" ${COMMON_PATTERNS}) if(NOT FLAG_${SIMD_COMPILE_FLAG}) unset(HAS_COMPILE_FLAG) unset(HAS_COMPILE_FLAG CACHE)
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/cmake/deps.cmake -> _service:tar_scm:libwebp-1.3.0.tar.gz/cmake/deps.cmake
Changed
@@ -10,24 +10,30 @@ # Check for compiler options. include(CheckCSourceCompiles) -check_c_source_compiles(" +check_c_source_compiles( + " int main(void) { (void)__builtin_bswap16(0); return 0; } - " HAVE_BUILTIN_BSWAP16) -check_c_source_compiles(" + " + HAVE_BUILTIN_BSWAP16) +check_c_source_compiles( + " int main(void) { (void)__builtin_bswap32(0); return 0; } - " HAVE_BUILTIN_BSWAP32) -check_c_source_compiles(" + " + HAVE_BUILTIN_BSWAP32) +check_c_source_compiles( + " int main(void) { (void)__builtin_bswap64(0); return 0; } - " HAVE_BUILTIN_BSWAP64) + " + HAVE_BUILTIN_BSWAP64) # Check for libraries. if(WEBP_USE_THREAD) @@ -37,15 +43,17 @@ if(CMAKE_USE_PTHREADS_INIT AND NOT CMAKE_SYSTEM_NAME STREQUAL "QNX") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread") endif() - check_c_source_compiles(" + check_c_source_compiles( + " #include <pthread.h> int main (void) { int attr = PTHREAD_PRIO_INHERIT; return attr; } - " FLAG_HAVE_PTHREAD_PRIO_INHERIT) + " + FLAG_HAVE_PTHREAD_PRIO_INHERIT) set(HAVE_PTHREAD_PRIO_INHERIT ${FLAG_HAVE_PTHREAD_PRIO_INHERIT}) - list(APPEND WEBP_DEP_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) + list(APPEND WEBP_DEP_LIBRARIES Threads::Threads) endif() set(WEBP_USE_THREAD ${Threads_FOUND}) endif() @@ -59,14 +67,17 @@ # Check if we need to link to the C math library. We do not look for it as it is # not found when cross-compiling, while it is here. -check_c_source_compiles(" +check_c_source_compiles( + " #include <math.h> int main(int argc, char** argv) { return (int)pow(argc, 2.5); } - " HAVE_MATH_LIBRARY) + " + HAVE_MATH_LIBRARY) if(NOT HAVE_MATH_LIBRARY) message(STATUS "Adding -lm flag.") + list(APPEND SHARPYUV_DEP_LIBRARIES m) list(APPEND WEBP_DEP_LIBRARIES m) endif() @@ -74,12 +85,17 @@ set(WEBP_DEP_IMG_LIBRARIES) set(WEBP_DEP_IMG_INCLUDE_DIRS) foreach(I_LIB PNG JPEG TIFF) + # Disable tiff when compiling in static mode as it is failing on Ubuntu. + if(WEBP_LINK_STATIC AND ${I_LIB} STREQUAL "TIFF") + message("TIFF is disabled when statically linking.") + continue() + endif() find_package(${I_LIB}) set(WEBP_HAVE_${I_LIB} ${${I_LIB}_FOUND}) if(${I_LIB}_FOUND) list(APPEND WEBP_DEP_IMG_LIBRARIES ${${I_LIB}_LIBRARIES}) list(APPEND WEBP_DEP_IMG_INCLUDE_DIRS ${${I_LIB}_INCLUDE_DIR} - ${${I_LIB}_INCLUDE_DIRS}) + ${${I_LIB}_INCLUDE_DIRS}) endif() endforeach() if(WEBP_DEP_IMG_INCLUDE_DIRS) @@ -100,13 +116,15 @@ cmake_push_check_state() set(CMAKE_REQUIRED_LIBRARIES ${GIF_LIBRARIES}) set(CMAKE_REQUIRED_INCLUDES ${GIF_INCLUDE_DIR}) - check_c_source_compiles(" + check_c_source_compiles( + " #include <gif_lib.h> int main(void) { (void)DGifOpenFileHandle; return 0; } - " GIF_COMPILES) + " + GIF_COMPILES) cmake_pop_check_state() if(GIF_COMPILES) list(APPEND WEBP_DEP_GIF_LIBRARIES ${GIF_LIBRARIES}) @@ -138,10 +156,7 @@ # Windows specifics if(HAVE_WINCODEC_H) - list(APPEND WEBP_DEP_LIBRARIES - shlwapi - ole32 - windowscodecs) + list(APPEND WEBP_DEP_LIBRARIES shlwapi ole32 windowscodecs) endif() # Check for SIMD extensions. @@ -153,17 +168,12 @@ # Read from configure.ac. file(READ ${CMAKE_CURRENT_SOURCE_DIR}/configure.ac CONFIGURE_AC) -string(REGEX MATCHALL - "\\(0-9a-z\\.:/*)\\" - CONFIGURE_AC_PACKAGE_INFO +string(REGEX MATCHALL "\\(0-9a-z\\.:/*)\\" CONFIGURE_AC_PACKAGE_INFO ${CONFIGURE_AC}) function(strip_bracket VAR) string(LENGTH ${${VAR}} TMP_LEN) math(EXPR TMP_LEN ${TMP_LEN}-2) - string(SUBSTRING ${${VAR}} - 1 - ${TMP_LEN} - TMP_SUB) + string(SUBSTRING ${${VAR}} 1 ${TMP_LEN} TMP_SUB) set(${VAR} ${TMP_SUB} PARENT_SCOPE) endfunction()
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/compile -> _service:tar_scm:libwebp-1.3.0.tar.gz/compile
Changed
@@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2020 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # Written by Tom Tromey <tromey@cygnus.com>. # # This program is free software; you can redistribute it and/or modify
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/config.guess -> _service:tar_scm:libwebp-1.3.0.tar.gz/config.guess
Changed
@@ -1,12 +1,14 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2018 Free Software Foundation, Inc. +# Copyright 1992-2022 Free Software Foundation, Inc. -timestamp='2018-02-24' +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2022-01-09' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or +# the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -27,11 +29,19 @@ # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess +# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess # # Please send patches to <config-patches@gnu.org>. +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + + me=`echo "$0" | sed -e 's,.*/,,'` usage="\ @@ -50,7 +60,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2018 Free Software Foundation, Inc. +Copyright 1992-2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -84,7 +94,8 @@ exit 1 fi -trap 'exit 1' 1 2 15 +# Just in case it came from the environment. +GUESS= # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires @@ -96,73 +107,90 @@ # Portable tmp directory creation inspired by the Autoconf team. -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > "$dummy.c" ; - for c in cc gcc c89 c99 ; do - if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' +tmp= +# shellcheck disable=SC2172 +trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 + +set_cc_for_build() { + # prevent multiple calls if $tmp is already set + test "$tmp" && return 0 + : "${TMPDIR=/tmp}" + # shellcheck disable=SC2039,SC3028 + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } + dummy=$tmp/dummy + case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in + ,,) echo "int x;" > "$dummy.c" + for driver in cc gcc c89 c99 ; do + if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + CC_FOR_BUILD=$driver + break + fi + done + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; + esac +} # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then +if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "$UNAME_SYSTEM" in +case $UNAME_SYSTEM in Linux|GNU|GNU/*) - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - LIBC=gnu + LIBC=unknown - eval "$set_cc_for_build" + set_cc_for_build cat <<-EOF > "$dummy.c" #include <features.h> #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc - #else + #elif defined(__GLIBC__) LIBC=gnu + #else + #include <stdarg.h> + /* First heuristic to detect musl libc. */ + #ifdef __DEFINED_va_list + LIBC=musl + #endif #endif EOF - eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" + cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + eval "$cc_set_libc" - # If ldd exists, use it to detect musl libc. - if command -v ldd >/dev/null && \ - ldd --version 2>&1 | grep -q ^musl - then - LIBC=musl + # Second heuristic to detect musl libc. + if "$LIBC" = unknown && + command -v ldd >/dev/null && + ldd --version 2>&1 | grep -q ^musl; then + LIBC=musl + fi + + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + if "$LIBC" = unknown ; then + LIBC=gnu fi ;; esac # Note: order is significant - the case branches are not exclusive. -case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in +case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, @@ -174,12 +202,12 @@ # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ - "/sbin/$sysctl" 2>/dev/null || \ - "/usr/sbin/$sysctl" 2>/dev/null || \ + /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ echo unknown)` - case "$UNAME_MACHINE_ARCH" in
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/config.sub -> _service:tar_scm:libwebp-1.3.0.tar.gz/config.sub
Changed
@@ -1,12 +1,14 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2018 Free Software Foundation, Inc. +# Copyright 1992-2022 Free Software Foundation, Inc. -timestamp='2018-02-22' +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2022-01-03' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or +# the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -33,7 +35,7 @@ # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub +# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -50,6 +52,13 @@ # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + me=`echo "$0" | sed -e 's,.*/,,'` usage="\ @@ -67,7 +76,7 @@ version="\ GNU config.sub ($timestamp) -Copyright 1992-2018 Free Software Foundation, Inc. +Copyright 1992-2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -89,7 +98,7 @@ - ) # Use stdin as input. break ;; -* ) - echo "$me: invalid option $1$help" + echo "$me: invalid option $1$help" >&2 exit 1 ;; *local*) @@ -110,1223 +119,1186 @@ exit 1;; esac -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo "$1" | sed 's/^\(.*\)-\(^-*-^-*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ - kopensolaris*-gnu* | cloudabi*-eabi* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo "$1" | sed 's/^\(.*\)-\(^-*-^-*\)$/\1/'` - ;; - android-linux) - os=-linux-android - basic_machine=`echo "$1" | sed 's/^\(.*\)-\(^-*-^-*\)$/\1/'`-unknown - ;; - *) - basic_machine=`echo "$1" | sed 's/-^-*$//'` - if "$basic_machine" != "$1" - then os=`echo "$1" | sed 's/.*-/-/'` - else os=; fi - ;; -esac +# Split fields of configuration type +# shellcheck disable=SC2162 +saved_IFS=$IFS +IFS="-" read field1 field2 field3 field4 <<EOF +$1 +EOF +IFS=$saved_IFS -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun234* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c123* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze*) - os= - basic_machine=$1 - ;; - -bluegene*) - os=-cnk - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.4-9*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v4-9*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*178) - os=-lynxos178 - ;; - -lynx*5) - os=-lynxos5 +# Separate into logical components for further validation +case $1 in + *-*-*-*-*) + echo Invalid configuration \`"$1"\': more than four components >&2 + exit 1 ;; - -lynx*) - os=-lynxos + *-*-*-*) + basic_machine=$field1-$field2 + basic_os=$field3-$field4 ;; - -ptx*) - basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'` + *-*-*) + # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two + # parts + maybe_os=$field2-$field3
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/configure -> _service:tar_scm:libwebp-1.3.0.tar.gz/configure
Changed
@@ -1,11 +1,12 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libwebp 1.2.1. +# Generated by GNU Autoconf 2.71 for libwebp 1.3.0. # # Report bugs to <https://bugs.chromium.org/p/webp>. # # -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, +# Inc. # # # This configure script is free software; the Free Software Foundation @@ -16,14 +17,16 @@ # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -33,46 +36,46 @@ fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0</dev/null; fi +if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -81,13 +84,6 @@ fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -96,8 +92,12 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -109,30 +109,10 @@ as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. @@ -154,20 +134,22 @@ exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + as_bourne_compatible="as_nop=: +if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST -else
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/configure.ac -> _service:tar_scm:libwebp-1.3.0.tar.gz/configure.ac
Changed
@@ -1,6 +1,6 @@ -AC_INIT(libwebp, 1.2.1, +AC_INIT(libwebp, 1.3.0, 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) @@ -9,7 +9,8 @@ dnl === it must occur before LT_INIT (AC_PROG_LIBTOOL). m4_ifdef(AM_PROG_AR, AM_PROG_AR) -AC_PROG_LIBTOOL +dnl === AC_PROG_LIBTOOL is deprecated. +m4_ifdef(LT_INIT, LT_INIT, AC_PROG_LIBTOOL) AC_PROG_SED AM_PROG_CC_C_O @@ -27,7 +28,8 @@ AS_HELP_STRING(--enable-everything, Enable all optional targets. These can still be disabled with --disable-target), - SET_IF_UNSET(enable_libwebpdecoder, $enableval) + SET_IF_UNSET(enable_libsharpyuv, $enableval) + SET_IF_UNSET(enable_libwebpdecoder, $enableval) SET_IF_UNSET(enable_libwebpdemux, $enableval) SET_IF_UNSET(enable_libwebpextras, $enableval) SET_IF_UNSET(enable_libwebpmux, $enableval)) @@ -747,10 +749,13 @@ dnl ========================= +dnl Add an empty webp_libname_prefix variable for use in *.pc.in. +AC_SUBST(webp_libname_prefix) AC_CONFIG_MACRO_DIR(m4) AC_CONFIG_HEADERS(src/webp/config.h) AC_CONFIG_FILES(Makefile src/Makefile man/Makefile \ examples/Makefile extras/Makefile imageio/Makefile \ + sharpyuv/Makefile sharpyuv/libsharpyuv.pc \ src/dec/Makefile src/enc/Makefile src/dsp/Makefile \ src/demux/Makefile src/mux/Makefile \ src/utils/Makefile \
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/depcomp -> _service:tar_scm:libwebp-1.3.0.tar.gz/depcomp
Changed
@@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2020 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/doc/api.md
Added
@@ -0,0 +1,385 @@ +# WebP APIs + +## Encoding API + +The main encoding functions are available in the header src/webp/encode.h + +The ready-to-use ones are: + +```c +size_t WebPEncodeRGB(const uint8_t* rgb, int width, int height, int stride, + float quality_factor, uint8_t** output); +size_t WebPEncodeBGR(const uint8_t* bgr, int width, int height, int stride, + float quality_factor, uint8_t** output); +size_t WebPEncodeRGBA(const uint8_t* rgba, int width, int height, int stride, + float quality_factor, uint8_t** output); +size_t WebPEncodeBGRA(const uint8_t* bgra, int width, int height, int stride, + float quality_factor, uint8_t** output); +``` + +They will convert raw RGB samples to a WebP data. The only control supplied is +the quality factor. + +There are some variants for using the lossless format: + +```c +size_t WebPEncodeLosslessRGB(const uint8_t* rgb, int width, int height, + int stride, uint8_t** output); +size_t WebPEncodeLosslessBGR(const uint8_t* bgr, int width, int height, + int stride, uint8_t** output); +size_t WebPEncodeLosslessRGBA(const uint8_t* rgba, int width, int height, + int stride, uint8_t** output); +size_t WebPEncodeLosslessBGRA(const uint8_t* bgra, int width, int height, + int stride, uint8_t** output); +``` + +Of course in this case, no quality factor is needed since the compression occurs +without loss of the input values, at the expense of larger output sizes. + +### Advanced encoding API + +A more advanced API is based on the WebPConfig and WebPPicture structures. + +WebPConfig contains the encoding settings and is not tied to a particular +picture. WebPPicture contains input data, on which some WebPConfig will be used +for compression. The encoding flow looks like: + +```c +#include <webp/encode.h> + +// Setup a config, starting form a preset and tuning some additional +// parameters +WebPConfig config; +if (!WebPConfigPreset(&config, WEBP_PRESET_PHOTO, quality_factor)) { + return 0; // version error +} +// ... additional tuning +config.sns_strength = 90; +config.filter_sharpness = 6; +config_error = WebPValidateConfig(&config); // not mandatory, but useful + +// Setup the input data +WebPPicture pic; +if (!WebPPictureInit(&pic)) { + return 0; // version error +} +pic.width = width; +pic.height = height; +// allocated picture of dimension width x height +if (!WebPPictureAlloc(&pic)) { + return 0; // memory error +} +// at this point, 'pic' has been initialized as a container, +// and can receive the Y/U/V samples. +// Alternatively, one could use ready-made import functions like +// WebPPictureImportRGB(), which will take care of memory allocation. +// In any case, past this point, one will have to call +// WebPPictureFree(&pic) to reclaim memory. + +// Set up a byte-output write method. WebPMemoryWriter, for instance. +WebPMemoryWriter wrt; +WebPMemoryWriterInit(&wrt); // initialize 'wrt' + +pic.writer = MyFileWriter; +pic.custom_ptr = my_opaque_structure_to_make_MyFileWriter_work; + +// Compress! +int ok = WebPEncode(&config, &pic); // ok = 0 => error occurred! +WebPPictureFree(&pic); // must be called independently of the 'ok' result. + +// output data should have been handled by the writer at that point. +// -> compressed data is the memory buffer described by wrt.mem / wrt.size + +// deallocate the memory used by compressed data +WebPMemoryWriterClear(&wrt); +``` + +## Decoding API + +This is mainly just one function to call: + +```c +#include "webp/decode.h" +uint8_t* WebPDecodeRGB(const uint8_t* data, size_t data_size, + int* width, int* height); +``` + +Please have a look at the file src/webp/decode.h for the details. There are +variants for decoding in BGR/RGBA/ARGB/BGRA order, along with decoding to raw +Y'CbCr samples. One can also decode the image directly into a pre-allocated +buffer. + +To detect a WebP file and gather the picture's dimensions, the function: + +```c +int WebPGetInfo(const uint8_t* data, size_t data_size, + int* width, int* height); +``` + +is supplied. No decoding is involved when using it. + +### Incremental decoding API + +In the case when data is being progressively transmitted, pictures can still be +incrementally decoded using a slightly more complicated API. Decoder state is +stored into an instance of the WebPIDecoder object. This object can be created +with the purpose of decoding either RGB or Y'CbCr samples. For instance: + +```c +WebPDecBuffer buffer; +WebPInitDecBuffer(&buffer); +buffer.colorspace = MODE_BGR; +... +WebPIDecoder* idec = WebPINewDecoder(&buffer); +``` + +As data is made progressively available, this incremental-decoder object can be +used to decode the picture further. There are two (mutually exclusive) ways to +pass freshly arrived data: + +either by appending the fresh bytes: + +```c +WebPIAppend(idec, fresh_data, size_of_fresh_data); +``` + +or by just mentioning the new size of the transmitted data: + +```c +WebPIUpdate(idec, buffer, size_of_transmitted_buffer); +``` + +Note that 'buffer' can be modified between each call to WebPIUpdate, in +particular when the buffer is resized to accommodate larger data. + +These functions will return the decoding status: either VP8_STATUS_SUSPENDED if +decoding is not finished yet or VP8_STATUS_OK when decoding is done. Any other +status is an error condition. + +The 'idec' object must always be released (even upon an error condition) by +calling: WebPDelete(idec). + +To retrieve partially decoded picture samples, one must use the corresponding +method: WebPIDecGetRGB or WebPIDecGetYUVA. It will return the last displayable +pixel row. + +Lastly, note that decoding can also be performed into a pre-allocated pixel +buffer. This buffer must be passed when creating a WebPIDecoder, calling +WebPINewRGB() or WebPINewYUVA(). + +Please have a look at the src/webp/decode.h header for further details. + +### Advanced Decoding API + +WebP decoding supports an advanced API which provides on-the-fly cropping and +rescaling, something of great usefulness on memory-constrained environments like +mobile phones. Basically, the memory usage will scale with the output's size, +not the input's, when one only needs a quick preview or a zoomed in portion of +an otherwise too-large picture. Some CPU can be saved too, incidentally. + +```c +// A) Init a configuration object +WebPDecoderConfig config; +CHECK(WebPInitDecoderConfig(&config)); + +// B) optional: retrieve the bitstream's features. +CHECK(WebPGetFeatures(data, data_size, &config.input) == VP8_STATUS_OK); + +// C) Adjust 'config' options, if needed +config.options.no_fancy_upsampling = 1; +config.options.use_scaling = 1; +config.options.scaled_width = scaledWidth(); +config.options.scaled_height = scaledHeight(); +// etc. + +// D) Specify 'config' output options for specifying output colorspace. +// Optionally the external image decode buffer can also be specified. +config.output.colorspace = MODE_BGRA; +// Optionally, the config.output can be pointed to an external buffer as +// well for decoding the image. This externally supplied memory buffer
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/doc/building.md
Added
@@ -0,0 +1,213 @@ +# Building + +## Windows build + +By running: + +```batch +nmake /f Makefile.vc CFG=release-static RTLIBCFG=static OBJDIR=output +``` + +the directory `output\release-static\(x64|x86)\bin` will contain the tools +cwebp.exe and dwebp.exe. The directory `output\release-static\(x64|x86)\lib` +will contain the libwebp static library. The target architecture (x86/x64) is +detected by Makefile.vc from the Visual Studio compiler (cl.exe) available in +the system path. + +## Unix build using makefile.unix + +On platforms with GNU tools installed (gcc and make), running + +```shell +make -f makefile.unix +``` + +will build the binaries examples/cwebp and examples/dwebp, along with the static +library src/libwebp.a. No system-wide installation is supplied, as this is a +simple alternative to the full installation system based on the autoconf tools +(see below). Please refer to makefile.unix for additional details and +customizations. + +## Using autoconf tools + +Prerequisites: a compiler (e.g., gcc), make, autoconf, automake, libtool. + +On a Debian-like system the following should install everything you need for a +minimal build: + +```shell +$ sudo apt-get install gcc make autoconf automake libtool +``` + +When building from git sources, you will need to run autogen.sh to generate the +configure script. + +```shell +./configure +make +make install +``` + +should be all you need to have the following files + +``` +/usr/local/include/webp/decode.h +/usr/local/include/webp/encode.h +/usr/local/include/webp/types.h +/usr/local/lib/libwebp.* +/usr/local/bin/cwebp +/usr/local/bin/dwebp +``` + +installed. + +Note: A decode-only library, libwebpdecoder, is available using the +`--enable-libwebpdecoder` flag. The encode library is built separately and can +be installed independently using a minor modification in the corresponding +Makefile.am configure files (see comments there). See `./configure --help` for +more options. + +## Building for MIPS Linux + +MIPS Linux toolchain stable available releases can be found at: +https://community.imgtec.com/developers/mips/tools/codescape-mips-sdk/available-releases/ + +```shell +# Add toolchain to PATH +export PATH=$PATH:/path/to/toolchain/bin + +# 32-bit build for mips32r5 (p5600) +HOST=mips-mti-linux-gnu +MIPS_CFLAGS="-O3 -mips32r5 -mabi=32 -mtune=p5600 -mmsa -mfp64 \ + -msched-weight -mload-store-pairs -fPIE" +MIPS_LDFLAGS="-mips32r5 -mabi=32 -mmsa -mfp64 -pie" + +# 64-bit build for mips64r6 (i6400) +HOST=mips-img-linux-gnu +MIPS_CFLAGS="-O3 -mips64r6 -mabi=64 -mtune=i6400 -mmsa -mfp64 \ + -msched-weight -mload-store-pairs -fPIE" +MIPS_LDFLAGS="-mips64r6 -mabi=64 -mmsa -mfp64 -pie" + +./configure --host=${HOST} --build=`config.guess` \ + CC="${HOST}-gcc -EL" \ + CFLAGS="$MIPS_CFLAGS" \ + LDFLAGS="$MIPS_LDFLAGS" +make +make install +``` + +## CMake + +With CMake, you can compile libwebp, cwebp, dwebp, gif2webp, img2webp, webpinfo +and the JS bindings. + +Prerequisites: a compiler (e.g., gcc with autotools) and CMake. + +On a Debian-like system the following should install everything you need for a +minimal build: + +```shell +$ sudo apt-get install build-essential cmake +``` + +When building from git sources, you will need to run cmake to generate the +makefiles. + +```shell +mkdir build && cd build && cmake ../ +make +make install +``` + +If you also want any of the executables, you will need to enable them through +CMake, e.g.: + +```shell +cmake -DWEBP_BUILD_CWEBP=ON -DWEBP_BUILD_DWEBP=ON ../ +``` + +or through your favorite interface (like ccmake or cmake-qt-gui). + +Use option `-DWEBP_UNICODE=ON` for Unicode support on Windows (with chcp 65001). + +Finally, once installed, you can also use WebP in your CMake project by doing: + +```cmake +find_package(WebP) +``` + +which will define the CMake variables WebP_INCLUDE_DIRS and WebP_LIBRARIES. + +## Gradle + +The support for Gradle is minimal: it only helps you compile libwebp, cwebp and +dwebp and webpmux_example. + +Prerequisites: a compiler (e.g., gcc with autotools) and gradle. + +On a Debian-like system the following should install everything you need for a +minimal build: + +```shell +$ sudo apt-get install build-essential gradle +``` + +When building from git sources, you will need to run the Gradle wrapper with the +appropriate target, e.g. : + +```shell +./gradlew buildAllExecutables +``` + +## SWIG bindings + +To generate language bindings from swig/libwebp.swig at least swig-1.3 +(http://www.swig.org) is required. + +Currently the following functions are mapped: + +Decode: + +``` +WebPGetDecoderVersion +WebPGetInfo +WebPDecodeRGBA +WebPDecodeARGB +WebPDecodeBGRA +WebPDecodeBGR +WebPDecodeRGB +``` + +Encode: + +``` +WebPGetEncoderVersion +WebPEncodeRGBA +WebPEncodeBGRA +WebPEncodeRGB +WebPEncodeBGR +WebPEncodeLosslessRGBA +WebPEncodeLosslessBGRA +WebPEncodeLosslessRGB +WebPEncodeLosslessBGR +``` + +See also the swig documentation(../swig/README.md) for more detailed build +instructions and usage examples. + +### Java bindings +
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/doc/specs_generation.md
Added
@@ -0,0 +1,26 @@ +# Generate libwebp Container Spec Docs from Text Source + +HTML generation requires kramdown(https://kramdown.gettalong.org/), easily +installed as a rubygem(https://rubygems.org/). Rubygems installation should +satisfy dependencies automatically. + +HTML generation can then be done from the project root: + +```shell +$ kramdown doc/webp-container-spec.txt --template doc/template.html > \ + doc/output/webp-container-spec.html +``` + +kramdown can optionally syntax highlight code blocks, using +CodeRay(https://github.com/rubychan/coderay), a dependency of kramdown that +rubygems will install automatically. The following will apply inline CSS +styling; an external stylesheet is not needed. + +```shell +$ kramdown doc/webp-lossless-bitstream-spec.txt --template \ + doc/template.html --coderay-css style --coderay-line-numbers ' ' \ + --coderay-default-lang c > \ + doc/output/webp-lossless-bitstream-spec.html +``` + +Optimally, use kramdown 0.13.7 or newer if syntax highlighting desired.
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/doc/tools.md
Added
@@ -0,0 +1,512 @@ +# WebP tools + +## Encoding tool + +The examples/ directory contains tools for encoding (cwebp) and decoding (dwebp) +images. + +The easiest use should look like: + +```shell +cwebp input.png -q 80 -o output.webp +``` + +which will convert the input file to a WebP file using a quality factor of 80 on +a 0->100 scale (0 being the lowest quality, 100 being the best. Default value is +75). + +You might want to try the `-lossless` flag too, which will compress the source +(in RGBA format) without any loss. The `-q` quality parameter will in this case +control the amount of processing time spent trying to make the output file as +small as possible. + +A longer list of options is available using the `-longhelp` command line flag: + +```shell +> cwebp -longhelp +Usage: + cwebp -preset <...> options in_file -o out_file +``` + +If input size (-s) for an image is not specified, it is assumed to be a PNG, +JPEG, TIFF or WebP file. Note: Animated PNG and WebP files are not supported. + +Options: + +``` +-h / -help ............. short help +-H / -longhelp ......... long help +-q <float> ............. quality factor (0:small..100:big), default=75 +-alpha_q <int> ......... transparency-compression quality (0..100), + default=100 +-preset <string> ....... preset setting, one of: + default, photo, picture, + drawing, icon, text + -preset must come first, as it overwrites other parameters +-z <int> ............... activates lossless preset with given + level in 0:fast, ..., 9:slowest + +-m <int> ............... compression method (0=fast, 6=slowest), default=4 +-segments <int> ........ number of segments to use (1..4), default=4 +-size <int> ............ target size (in bytes) +-psnr <float> .......... target PSNR (in dB. typically: 42) + +-s <int> <int> ......... input size (width x height) for YUV +-sns <int> ............. spatial noise shaping (0:off, 100:max), default=50 +-f <int> ............... filter strength (0=off..100), default=60 +-sharpness <int> ....... filter sharpness (0:most .. 7:least sharp), default=0 +-strong ................ use strong filter instead of simple (default) +-nostrong .............. use simple filter instead of strong +-sharp_yuv ............. use sharper (and slower) RGB->YUV conversion +-partition_limit <int> . limit quality to fit the 512k limit on + the first partition (0=no degradation ... 100=full) +-pass <int> ............ analysis pass number (1..10) +-qrange <min> <max> .... specifies the permissible quality range + (default: 0 100) +-crop <x> <y> <w> <h> .. crop picture with the given rectangle +-resize <w> <h> ........ resize picture (*after* any cropping) +-mt .................... use multi-threading if available +-low_memory ............ reduce memory usage (slower encoding) +-map <int> ............. print map of extra info +-print_psnr ............ prints averaged PSNR distortion +-print_ssim ............ prints averaged SSIM distortion +-print_lsim ............ prints local-similarity distortion +-d <file.pgm> .......... dump the compressed output (PGM file) +-alpha_method <int> .... transparency-compression method (0..1), default=1 +-alpha_filter <string> . predictive filtering for alpha plane, + one of: none, fast (default) or best +-exact ................. preserve RGB values in transparent area, default=off +-blend_alpha <hex> ..... blend colors against background color + expressed as RGB values written in + hexadecimal, e.g. 0xc0e0d0 for red=0xc0 + green=0xe0 and blue=0xd0 +-noalpha ............... discard any transparency information +-lossless .............. encode image losslessly, default=off +-near_lossless <int> ... use near-lossless image + preprocessing (0..100=off), default=100 +-hint <string> ......... specify image characteristics hint, + one of: photo, picture or graph + +-metadata <string> ..... comma separated list of metadata to + copy from the input to the output if present. + Valid values: all, none (default), exif, icc, xmp + +-short ................. condense printed message +-quiet ................. don't print anything +-version ............... print version number and exit +-noasm ................. disable all assembly optimizations +-v ..................... verbose, e.g. print encoding/decoding times +-progress .............. report encoding progress +``` + +Experimental Options: + +``` +-jpeg_like ............. roughly match expected JPEG size +-af .................... auto-adjust filter strength +-pre <int> ............. pre-processing filter +``` + +The main options you might want to try in order to further tune the visual +quality are: + +-preset -sns -f -m + +Namely: + +* `preset` will set up a default encoding configuration targeting a particular + type of input. It should appear first in the list of options, so that + subsequent options can take effect on top of this preset. Default value is + 'default'. +* `sns` will progressively turn on (when going from 0 to 100) some additional + visual optimizations (like: segmentation map re-enforcement). This option + will balance the bit allocation differently. It tries to take bits from the + "easy" parts of the picture and use them in the "difficult" ones instead. + Usually, raising the sns value (at fixed -q value) leads to larger files, + but with better quality. Typical value is around '75'. +* `f` option directly links to the filtering strength used by the codec's + in-loop processing. The higher the value, the smoother the highly-compressed + area will look. This is particularly useful when aiming at very small files. + Typical values are around 20-30. Note that using the option + -strong/-nostrong will change the type of filtering. Use "-f 0" to turn + filtering off. +* `m` controls the trade-off between encoding speed and quality. Default is 4. + You can try -m 5 or -m 6 to explore more (time-consuming) encoding + possibilities. A lower value will result in faster encoding at the expense + of quality. + +## Decoding tool + +There is a decoding sample in examples/dwebp.c which will take a .webp file and +decode it to a PNG image file (amongst other formats). This is simply to +demonstrate the use of the API. You can verify the file test.webp decodes to +exactly the same as test_ref.ppm by using: + +```shell +cd examples +./dwebp test.webp -ppm -o test.ppm +diff test.ppm test_ref.ppm +``` + +The full list of options is available using -h: + +```shell +> dwebp -h +Usage: dwebp in_file options -o out_file +``` + +Decodes the WebP image file to PNG format Default. Note: Animated WebP files +are not supported. + +Use following options to convert into alternate image formats: + +``` +-pam ......... save the raw RGBA samples as a color PAM +-ppm ......... save the raw RGB samples as a color PPM +-bmp ......... save as uncompressed BMP format +-tiff ........ save as uncompressed TIFF format +-pgm ......... save the raw YUV samples as a grayscale PGM + file with IMC4 layout +-yuv ......... save the raw YUV samples in flat layout +``` + +Other options are: + +``` +-version ..... print version number and exit +-nofancy ..... don't use the fancy YUV420 upscaler +-nofilter .... disable in-loop filtering +-nodither .... disable dithering +-dither <d> .. dithering strength (in 0..100) +-alpha_dither use alpha-plane dithering if needed +-mt .......... use multi-threading +-crop <x> <y> <w> <h> ... crop output with the given rectangle +-resize <w> <h> ......... resize output (*after* any cropping) +-flip ........ flip the output vertically +-alpha ....... only save the alpha plane +-incremental . use incremental decoding (useful for tests) +-h ........... this help message +-v ........... verbose (e.g. print encoding/decoding times) +-quiet ....... quiet mode, don't print anything +-noasm ....... disable all assembly optimizations +``` + +## WebP file analysis tool + +`webpinfo` can be used to print out the chunk level structure and bitstream +header information of WebP files. It can also check if the files are of valid +WebP format. +
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/doc/webp-container-spec.txt -> _service:tar_scm:libwebp-1.3.0.tar.gz/doc/webp-container-spec.txt
Changed
@@ -2,10 +2,10 @@ 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. +See the accompanying specs_generation.md. External link targets are referenced +at the end of this file. --> @@ -25,7 +25,7 @@ (and possibly other encodings in the future). These encoding schemes should make it more efficient than currently used formats. It is optimized for fast image transfer over the network (e.g., for websites). The WebP format has -feature parity (color profile, metadata, animation etc) with other formats as +feature parity (color profile, metadata, animation, etc.) with other formats as well. This document describes the structure of a WebP file. The WebP container (i.e., RIFF container for WebP) allows feature support over @@ -36,7 +36,7 @@ * **Lossless compression.** An image can be losslessly compressed, using the WebP Lossless Format. - * **Metadata.** An image may have metadata stored in EXIF or XMP formats. + * **Metadata.** An image may have metadata stored in Exif or XMP formats. * **Transparency.** An image may have transparency, i.e., an alpha channel. @@ -46,19 +46,16 @@ * **Animation.** An image may have multiple frames with pauses between them, making it an animation. -The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", -"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this -document are to be interpreted as described in RFC 2119. +The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", +"SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this +document are to be interpreted as described in BCP 14 RFC 2119 RFC 8174 +when, and only when, they appear in all capitals, as shown here. 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 ------------------------- +Terminology & Basics +-------------------- A WebP file contains either a still image (i.e., an encoded matrix of pixels) or an animation(#animation). Optionally, it can also contain transparency @@ -87,18 +84,25 @@ _FourCC_ : A _FourCC_ (four-character code) is a _uint32_ created by concatenating four - ASCII characters in little-endian order. + ASCII characters in little-endian order. This means 'aaaa' (0x61616161) and + 'AAAA' (0x41414141) are treated as different _FourCCs_. _1-based_ : An unsigned integer field storing values offset by `-1`. e.g., Such a field would store value _25_ as _24_. +_ChunkHeader('ABCD')_ + +: This is used to describe the _FourCC_ and _Chunk Size_ header of individual + chunks, where 'ABCD' is the FourCC for the chunk. This element's size is 8 + bytes. + RIFF File Format ---------------- -The WebP file format is based on the RIFF (resource interchange file format) +The WebP file format is based on the RIFF (Resource Interchange File Format) document format. The basic element of a RIFF file is a _chunk_. It consists of: @@ -110,7 +114,7 @@ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Chunk Size | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Chunk Payload | + : Chunk Payload : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Chunk FourCC: 32 bits @@ -119,19 +123,13 @@ Chunk Size: 32 bits (_uint32_) -: The size of the chunk not including this field, the chunk identifier or - padding. +: The size of the chunk in bytes, not including this field, the chunk + identifier or padding. Chunk Payload: _Chunk Size_ bytes -: The data payload. If _Chunk Size_ is odd, a single padding byte -- that - SHOULD be `0` -- is added. - -_ChunkHeader('ABCD')_ - -: This is used to describe the _FourCC_ and _Chunk Size_ header of individual - chunks, where 'ABCD' is the FourCC for the chunk. This element's - size is 8 bytes. +: The data payload. If _Chunk Size_ is odd, a single padding byte -- that MUST + be `0` to conform with RIFF -- is added. **Note:** RIFF has a convention that all-uppercase chunk FourCCs are standard chunks that apply to any RIFF file format, while FourCCs specific to a file @@ -167,9 +165,11 @@ A WebP file MUST begin with a RIFF header with the FourCC 'WEBP'. The file size in the header is the total size of the chunks that follow plus `4` bytes for -the 'WEBP' FourCC. The file SHOULD NOT contain anything after it. As the size -of any chunk is even, the size given by the RIFF header is also even. The -contents of individual chunks will be described in the following sections. +the 'WEBP' FourCC. The file SHOULD NOT contain any data after the data +specified by _File Size_. Readers MAY parse such files, ignoring the trailing +data. As the size of any chunk is even, the size given by the RIFF header is +also even. The contents of individual chunks will be described in the following +sections. Simple File Format (Lossy) @@ -184,9 +184,11 @@ 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | | WebP file header (12 bytes) | + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | VP8 chunk | + : VP8 chunk : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ VP8 chunk: @@ -195,20 +197,24 @@ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ChunkHeader('VP8 ') | + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | VP8 data | + : VP8 data : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ VP8 data: _Chunk Size_ bytes : VP8 bitstream data. +Note the fourth character in the 'VP8 ' FourCC is an ASCII space (0x20). + The VP8 bitstream format specification can be found at VP8 Data Format and Decoding Guidevp8spec. Note that the VP8 frame header contains the VP8 frame width and height. That is assumed to be the width and height of the canvas. -The VP8 specification describes how to decode the image into Y'CbCr -format. To convert to RGB, Rec. 601 SHOULD be used. +The VP8 specification describes how to decode the image into Y'CbCr format. To +convert to RGB, Rec. 601 SHOULD be used. Applications MAY use another +conversion method, but visual results may differ among decoders. Simple File Format (Lossless) @@ -225,9 +231,11 @@ 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | | WebP file header (12 bytes) | + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | VP8L chunk | + : VP8L chunk : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ VP8L chunk: @@ -236,8 +244,9 @@ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ChunkHeader('VP8L') | + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | VP8L data | + : VP8L data : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ VP8L data: _Chunk Size_ bytes @@ -265,11 +274,11 @@
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/doc/webp-lossless-bitstream-spec.txt -> _service:tar_scm:libwebp-1.3.0.tar.gz/doc/webp-lossless-bitstream-spec.txt
Changed
@@ -1,11 +1,11 @@ <!-- -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. +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(https://kramdown.gettalong.org/) transformer. -See the accompanying README. External link targets are referenced at the -end of this file. +See the accompanying specs_generation.md. External link targets are referenced +at the end of this file. --> @@ -16,128 +16,128 @@ Paragraphs marked as \AMENDED\ were amended on 2014-09-16. +Paragraphs marked as \AMENDED2\ were amended on 2022-05-13. + +Paragraphs marked as \AMENDED3\ were amended on 2022-11-21. + Abstract -------- -WebP lossless is an image format for lossless compression of ARGB -images. The lossless format stores and restores the pixel values -exactly, including the color values for zero alpha pixels. The -format uses subresolution images, recursively embedded into the format -itself, for storing statistical data about the images, such as the used -entropy codes, spatial predictors, color space conversion, and color -table. LZ77, Huffman coding, and a color cache are used for compression -of the bulk data. Decoding speeds faster than PNG have been -demonstrated, as well as 25% denser compression than can be achieved -using today's PNG format. +WebP lossless is an image format for lossless compression of ARGB images. The +lossless format stores and restores the pixel values exactly, including the +color values for pixels whose alpha value is 0. The format uses subresolution +images, recursively embedded into the format itself, for storing statistical +data about the images, such as the used entropy codes, spatial predictors, color +space conversion, and color table. LZ77, prefix coding, and a color cache are +used for compression of the bulk data. Decoding speeds faster than PNG have been +demonstrated, as well as 25% denser compression than can be achieved using +today's PNG format. * TOC placeholder {:toc} -Nomenclature ------------- +1 Introduction +-------------- + +This document describes the compressed data representation of a WebP lossless +image. It is intended as a detailed reference for the WebP lossless encoder and +decoder implementation. + +In this document, we extensively use C programming language syntax to describe +the bitstream, and assume the existence of a function for reading bits, +`ReadBits(n)`. The bytes are read in the natural order of the stream containing +them, and bits of each byte are read in least-significant-bit-first order. When +multiple bits are read at the same time, the integer is constructed from the +original data in the original order. The most significant bits of the returned +integer are also the most significant bits of the original data. Thus, the +statement + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +b = ReadBits(2); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +is equivalent with the two statements below: + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +b = ReadBits(1); +b |= ReadBits(1) << 1; +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +We assume that each color component (e.g. alpha, red, blue and green) is +represented using an 8-bit byte. We define the corresponding type as uint8. A +whole ARGB pixel is represented by a type called uint32, an unsigned integer +consisting of 32 bits. In the code showing the behavior of the transformations, +alpha value is codified in bits 31..24, red in bits 23..16, green in bits 15..8 +and blue in bits 7..0, but implementations of the format are free to use another +representation internally. + +Broadly, a WebP lossless image contains header data, transform information and +actual image data. Headers contain width and height of the image. A WebP +lossless image can go through four different types of transformation before +being entropy encoded. The transform information in the bitstream contains the +data required to apply the respective inverse transforms. + + +2 Nomenclature +-------------- ARGB -: A pixel value consisting of alpha, red, green, and blue values. +: A pixel value consisting of alpha, red, green, and blue values. ARGB image -: A two-dimensional array containing ARGB pixels. +: A two-dimensional array containing ARGB pixels. color cache -: A small hash-addressed array to store recently used colors, to be able - to recall them with shorter codes. +: A small hash-addressed array to store recently used colors, to be able to + recall them with shorter codes. color indexing image -: A one-dimensional image of colors that can be indexed using a small - integer (up to 256 within WebP lossless). +: A one-dimensional image of colors that can be indexed using a small integer + (up to 256 within WebP lossless). color transform image -: A two-dimensional subresolution image containing data about - correlations of color components. +: A two-dimensional subresolution image containing data about correlations of + color components. distance mapping -: Changes LZ77 distances to have the smallest values for pixels in 2D - proximity. +: Changes LZ77 distances to have the smallest values for pixels in 2D + proximity. entropy image -: A two-dimensional subresolution image indicating which entropy coding - should be used in a respective square in the image, i.e., each pixel - is a meta Huffman code. +: A two-dimensional subresolution image indicating which entropy coding should + be used in a respective square in the image, i.e., each pixel is a meta + prefix code. -Huffman code -: A classic way to do entropy coding where a smaller number of bits are - used for more frequent codes. +prefix code +: A classic way to do entropy coding where a smaller number of bits are used + for more frequent codes. LZ77 -: Dictionary-based sliding window compression algorithm that either - emits symbols or describes them as sequences of past symbols. +: Dictionary-based sliding window compression algorithm that either emits + symbols or describes them as sequences of past symbols. -meta Huffman code -: A small integer (up to 16 bits) that indexes an element in the meta - Huffman table. +meta prefix code +: A small integer (up to 16 bits) that indexes an element in the meta prefix + table. predictor image -: A two-dimensional subresolution image indicating which spatial - predictor is used for a particular square in the image. +: A two-dimensional subresolution image indicating which spatial predictor is + used for a particular square in the image. prefix coding -: A way to entropy code larger integers that codes a few bits of the - integer using an entropy code and codifies the remaining bits raw. - This allows for the descriptions of the entropy codes to remain - relatively small even when the range of symbols is large. +: A way to entropy code larger integers that codes a few bits of the integer + using an entropy code and codifies the remaining bits raw. This allows for + the descriptions of the entropy codes to remain relatively small even when + the range of symbols is large. scan-line order -: A processing order of pixels, left-to-right, top-to-bottom, starting - from the left-hand-top pixel, proceeding to the right. Once a row is - completed, continue from the left-hand column of the next row. - - -1 Introduction --------------- - -This document describes the compressed data representation of a WebP -lossless image. It is intended as a detailed reference for WebP lossless -encoder and decoder implementation. - -In this document, we extensively use C programming language syntax to -describe the bitstream, and assume the existence of a function for -reading bits, `ReadBits(n)`. The bytes are read in the natural order of -the stream containing them, and bits of each byte are read in -least-significant-bit-first order. When multiple bits are read at the -same time, the integer is constructed from the original data in the -original order. The most significant bits of the returned integer are -also the most significant bits of the original data. Thus the statement - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -b = ReadBits(2);
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/examples/Android.mk -> _service:tar_scm:libwebp-1.3.0.tar.gz/examples/Android.mk
Changed
@@ -1,3 +1,5 @@ +# Ignore this file during non-NDK builds. +ifdef NDK_ROOT LOCAL_PATH := $(call my-dir) ################################################################################ @@ -91,3 +93,4 @@ LOCAL_MODULE := webpinfo_example include $(BUILD_EXECUTABLE) +endif # NDK_ROOT
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/examples/Makefile.am -> _service:tar_scm:libwebp-1.3.0.tar.gz/examples/Makefile.am
Changed
@@ -47,7 +47,7 @@ anim_dump_LDADD += $(PNG_LIBS) $(GIF_LIBS) $(TIFF_LIBS) -lm cwebp_SOURCES = cwebp.c stopwatch.h -cwebp_CPPFLAGS = $(AM_CPPFLAGS) +cwebp_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir) cwebp_LDADD = cwebp_LDADD += libexample_util.la cwebp_LDADD += ../imageio/libimageio_util.la
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/examples/Makefile.in -> _service:tar_scm:libwebp-1.3.0.tar.gz/examples/Makefile.in
Changed
@@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -263,8 +263,6 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ @@ -280,8 +278,9 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -292,8 +291,10 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +FILECMD = @FILECMD@ GIF_INCLUDES = @GIF_INCLUDES@ GIF_LIBS = @GIF_LIBS@ GL_INCLUDES = @GL_INCLUDES@ @@ -408,6 +409,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +webp_libname_prefix = @webp_libname_prefix@ noinst_LTLIBRARIES = libexample_util.la libexample_util_la_SOURCES = example_util.c example_util.h libexample_util_la_LIBADD = ../src/libwebp.la @@ -423,7 +425,7 @@ $(PNG_LIBS) $(GIF_LIBS) $(TIFF_LIBS) -lm $(am__append_8) \ $(am__append_11) cwebp_SOURCES = cwebp.c stopwatch.h -cwebp_CPPFLAGS = $(AM_CPPFLAGS) +cwebp_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir) cwebp_LDADD = libexample_util.la ../imageio/libimageio_util.la \ ../imageio/libimagedec.la ../src/libwebp.la $(JPEG_LIBS) \ $(PNG_LIBS) $(TIFF_LIBS) @@ -901,7 +903,6 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/examples/anim_util.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/examples/anim_util.c
Changed
@@ -241,7 +241,7 @@ image->bgcolor = anim_info.bgcolor; // Allocate frames. - if (!AllocateFrames(image, anim_info.frame_count)) return 0; + if (!AllocateFrames(image, anim_info.frame_count)) goto End; // Decode frames. while (WebPAnimDecoderHasMoreFrames(dec)) { @@ -558,7 +558,10 @@ } } // Allocate frames. - AllocateFrames(image, frame_count); + if (!AllocateFrames(image, frame_count)) { + DGifCloseFile(gif, NULL); + return 0; + } canvas_width = image->canvas_width; canvas_height = image->canvas_height;
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/examples/cwebp.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/examples/cwebp.c
Changed
@@ -27,6 +27,7 @@ #include "../imageio/webpdec.h" #include "./stopwatch.h" #include "./unicode.h" +#include "sharpyuv/sharpyuv.h" #include "webp/encode.h" #ifndef WEBP_DLL @@ -571,7 +572,7 @@ printf(" -qrange <min> <max> .... specifies the permissible quality range\n" " (default: 0 100)\n"); printf(" -crop <x> <y> <w> <h> .. crop picture with the given rectangle\n"); - printf(" -resize <w> <h> ........ resize picture (after any cropping)\n"); + printf(" -resize <w> <h> ........ resize picture (*after* any cropping)\n"); printf(" -mt .................... use multi-threading if available\n"); printf(" -low_memory ............ reduce memory usage (slower encoding)\n"); printf(" -map <int> ............. print map of extra info\n"); @@ -620,6 +621,7 @@ printf(" -af .................... auto-adjust filter strength\n"); printf(" -pre <int> ............. pre-processing filter\n"); printf("\n"); + printf("Supported input formats:\n %s\n", WebPGetEnabledInputFileFormats()); } //------------------------------------------------------------------------------ @@ -831,8 +833,12 @@ #endif } else if (!strcmp(argvc, "-version")) { const int version = WebPGetEncoderVersion(); + const int sharpyuv_version = SharpYuvGetVersion(); printf("%d.%d.%d\n", (version >> 16) & 0xff, (version >> 8) & 0xff, version & 0xff); + printf("libsharpyuv: %d.%d.%d\n", + (sharpyuv_version >> 24) & 0xff, (sharpyuv_version >> 16) & 0xffff, + sharpyuv_version & 0xff); FREE_WARGV_AND_RETURN(0); } else if (!strcmp(argvc, "-progress")) { show_progress = 1; @@ -1139,9 +1145,10 @@ } picture.use_argb = 1; - if (!ReadWebP(memory_writer.mem, memory_writer.size, &picture, - /*keep_alpha=*/WebPPictureHasTransparency(&picture), - /*metadata=*/NULL)) { + if (!ReadWebP( + memory_writer.mem, memory_writer.size, &picture, + /*keep_alpha=*/WebPPictureHasTransparency(&original_picture), + /*metadata=*/NULL)) { fprintf(stderr, "Error! Cannot decode encoded WebP bitstream\n"); fprintf(stderr, "Error code: %d (%s)\n", picture.error_code, kErrorMessagespicture.error_code);
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/examples/dwebp.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/examples/dwebp.c
Changed
@@ -96,7 +96,7 @@ " -alpha_dither use alpha-plane dithering if needed\n" " -mt .......... use multi-threading\n" " -crop <x> <y> <w> <h> ... crop output with the given rectangle\n" - " -resize <w> <h> ......... scale the output (*after* any cropping)\n" + " -resize <w> <h> ......... resize output (*after* any cropping)\n" " -flip ........ flip the output vertically\n" " -alpha ....... only save the alpha plane\n" " -incremental . use incremental decoding (useful for tests)\n"
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/examples/example_util.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/examples/example_util.c
Changed
@@ -103,7 +103,10 @@ } args->own_argv_ = 1; args->argv_ = (const char**)WebPMalloc(MAX_ARGC * sizeof(*args->argv_)); - if (args->argv_ == NULL) return 0; + if (args->argv_ == NULL) { + ExUtilDeleteCommandLineArguments(args); + return 0; + } argc = 0; for (cur = strtok((char*)args->argv_data_.bytes, sep); @@ -111,6 +114,7 @@ cur = strtok(NULL, sep)) { if (argc == MAX_ARGC) { fprintf(stderr, "ERROR: Arguments limit %d reached\n", MAX_ARGC); + ExUtilDeleteCommandLineArguments(args); return 0; } assert(strlen(cur) != 0);
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/examples/gif2webp.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/examples/gif2webp.c
Changed
@@ -314,8 +314,11 @@ frame.use_argb = 1; if (!WebPPictureAlloc(&frame)) goto End; GIFClearPic(&frame, NULL); - WebPPictureCopy(&frame, &curr_canvas); - WebPPictureCopy(&frame, &prev_canvas); + if (!(WebPPictureCopy(&frame, &curr_canvas) && + WebPPictureCopy(&frame, &prev_canvas))) { + fprintf(stderr, "Error allocating canvas.\n"); + goto End; + } // Background color. GIFGetBackgroundColor(gif->SColorMap, gif->SBackGroundColor,
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/examples/img2webp.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/examples/img2webp.c
Changed
@@ -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"); @@ -66,6 +65,8 @@ "arguments will be\n"); printf("tokenized from this file. The file name must not start with " "the character '-'.\n"); + printf("\nSupported input formats:\n %s\n", + WebPGetEnabledInputFileFormats()); } //------------------------------------------------------------------------------ @@ -187,7 +188,7 @@ verbose = 1; } else if (!strcmp(argvc, "-h") || !strcmp(argvc, "-help")) { Help(); - goto End; + FREE_WARGV_AND_RETURN(0); } else if (!strcmp(argvc, "-version")) { const int enc_version = WebPGetEncoderVersion(); const int mux_version = WebPGetMuxVersion();
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/examples/unicode.h -> _service:tar_scm:libwebp-1.3.0.tar.gz/examples/unicode.h
Changed
@@ -16,11 +16,15 @@ #ifndef WEBP_EXAMPLES_UNICODE_H_ #define WEBP_EXAMPLES_UNICODE_H_ +#include <stdio.h> + #if defined(_WIN32) && defined(_UNICODE) // wchar_t is used instead of TCHAR because we only perform additional work when // Unicode is enabled and because the output of CommandLineToArgvW() is wchar_t. +#include <fcntl.h> +#include <io.h> #include <wchar.h> #include <windows.h> #include <shellapi.h> @@ -55,8 +59,16 @@ #define WFOPEN(ARG, OPT) _wfopen((const W_CHAR*)ARG, TO_W_CHAR(OPT)) -#define WPRINTF(STR, ...) wprintf(TO_W_CHAR(STR), __VA_ARGS__) -#define WFPRINTF(STDERR, STR, ...) fwprintf(STDERR, TO_W_CHAR(STR), __VA_ARGS__) +#define WFPRINTF(STREAM, STR, ...) \ + do { \ + int prev_mode; \ + fflush(STREAM); \ + prev_mode = _setmode(_fileno(STREAM), _O_U8TEXT); \ + fwprintf(STREAM, TO_W_CHAR(STR), __VA_ARGS__); \ + fflush(STREAM); \ + (void)_setmode(_fileno(STREAM), prev_mode); \ + } while (0) +#define WPRINTF(STR, ...) WFPRINTF(stdout, STR, __VA_ARGS__) #define WSTRLEN(FILENAME) wcslen((const W_CHAR*)FILENAME) #define WSTRCMP(FILENAME, STR) wcscmp((const W_CHAR*)FILENAME, TO_W_CHAR(STR)) @@ -65,6 +77,8 @@ #else +#include <string.h> + // Unicode file paths work as is on Unix platforms, and no extra work is done on // Windows either if Unicode is disabled. @@ -83,7 +97,7 @@ #define WFOPEN(ARG, OPT) fopen(ARG, OPT) #define WPRINTF(STR, ...) printf(STR, __VA_ARGS__) -#define WFPRINTF(STDERR, STR, ...) fprintf(STDERR, STR, __VA_ARGS__) +#define WFPRINTF(STREAM, STR, ...) fprintf(STREAM, STR, __VA_ARGS__) #define WSTRLEN(FILENAME) strlen(FILENAME) #define WSTRCMP(FILENAME, STR) strcmp(FILENAME, STR)
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/examples/unicode_gif.h -> _service:tar_scm:libwebp-1.3.0.tar.gz/examples/unicode_gif.h
Changed
@@ -45,18 +45,19 @@ } #if defined(_WIN32) && defined(_UNICODE) - - int file_handle = _wopen(file_name, _O_RDONLY | _O_BINARY); - if (file_handle == -1) { - if (error != NULL) *error = D_GIF_ERR_OPEN_FAILED; - return NULL; - } + { + int file_handle = _wopen(file_name, _O_RDONLY | _O_BINARY); + if (file_handle == -1) { + if (error != NULL) *error = D_GIF_ERR_OPEN_FAILED; + return NULL; + } #if LOCAL_GIF_PREREQ(5, 0) - return DGifOpenFileHandle(file_handle, error); + return DGifOpenFileHandle(file_handle, error); #else - return DGifOpenFileHandle(file_handle); + return DGifOpenFileHandle(file_handle); #endif + } #else
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/examples/vwebp.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/examples/vwebp.c
Changed
@@ -292,6 +292,19 @@ } } +static void PrintStringW(const char* const text) { +#if defined(_WIN32) && defined(_UNICODE) + void* const font = GLUT_BITMAP_9_BY_15; + const W_CHAR* const wtext = (const W_CHAR*)text; + int i; + for (i = 0; wtexti; ++i) { + glutBitmapCharacter(font, wtexti); + } +#else + PrintString(text); +#endif +} + static float GetColorf(uint32_t color, int shift) { return ((color >> shift) & 0xff) / 255.f; } @@ -396,7 +409,7 @@ glColor4f(0.90f, 0.0f, 0.90f, 1.0f); glRasterPos2f(-0.95f, 0.90f); - PrintString(kParams.file_name); + PrintStringW(kParams.file_name); snprintf(tmp, sizeof(tmp), "Dimension:%d x %d", pic->width, pic->height); glColor4f(0.90f, 0.0f, 0.90f, 1.0f);
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/examples/webpinfo.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/examples/webpinfo.c
Changed
@@ -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 kFormats3 = { @@ -116,6 +117,7 @@ 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 @@ memset(webp_info, 0, sizeof(*webp_info)); } -static const char kWebPChunkTagsCHUNK_TYPES4 = { - { '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 kWebPChunkTagsCHUNK_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 @@ // ----------------------------------------------------------------------------- // 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 @@ return WEBP_INFO_TRUNCATED_DATA; } for (i = 0; i < CHUNK_TYPES; ++i) { - if (!memcmp(kWebPChunkTagsi, &fourcc, TAG_SIZE)) break; + if (kWebPChunkTagsi == fourcc) break; } chunk_data->offset_ = chunk_start_offset; chunk_data->size_ = chunk_size; @@ -937,7 +939,13 @@ LOG_WARN(error_message); } else { if (!webp_info->quiet_) { - const char* tag = kWebPChunkTagschunk_data->id_; + char tag4; + uint32_t fourcc = kWebPChunkTagschunk_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", tag0, tag1, tag2, tag3, (int)chunk_data->offset_, (int)chunk_data->size_); @@ -988,7 +996,7 @@ 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 @@ } 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 @@ 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(argvc, "-h") || !strcmp(argvc, "-help")) { - HelpShort(); - FREE_WARGV_AND_RETURN(WEBP_INFO_OK); - } else if (!strcmp(argvc, "-H") || !strcmp(argvc, "-longhelp")) { - HelpLong(); + if (!strcmp(argvc, "-h") || !strcmp(argvc, "-help") || + !strcmp(argvc, "-H") || !strcmp(argvc, "-longhelp")) { + Help(); FREE_WARGV_AND_RETURN(WEBP_INFO_OK); } else if (!strcmp(argvc, "-quiet")) { quiet = 1; @@ -1154,7 +1158,7 @@ } if (c == argc) { - HelpShort(); + Help(); FREE_WARGV_AND_RETURN(WEBP_INFO_INVALID_COMMAND); }
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/examples/webpmux.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/examples/webpmux.c
Changed
@@ -99,6 +99,7 @@ FEATURE_ANMF, FEATURE_DURATION, FEATURE_LOOP, + FEATURE_BGCOLOR, LAST_FEATURE } FeatureType; @@ -315,11 +316,12 @@ 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"); @@ -327,7 +329,7 @@ printf("\n"); printf("DURATION_OPTIONS:\n"); printf(" Set duration of selected frames:\n"); - printf(" duration set duration for each frames\n"); + printf(" duration set duration for all frames\n"); printf(" duration,frame set duration of a particular frame\n"); printf(" duration,start,end set duration of frames in the\n"); printf(" interval start,end)\n"); @@ -346,7 +348,7 @@ printf("\n"); printf("FRAME_OPTIONS(i):\n"); printf(" Create animation:\n"); - printf(" file_i +di+xi+yi+mibi\n"); + printf(" file_i +di+xi+yi+mibi\n"); printf(" where: 'file_i' is the i'th animation frame (WebP format),\n"); printf(" 'di' is the pause duration before next frame,\n"); printf(" 'xi','yi' specify the image offset for this frame,\n"); @@ -458,7 +460,8 @@ if (err == WEBP_MUX_OK && metadata.size > 0) { err = WebPMuxSetChunk(new_mux, kFourccListi, &metadata, 1); if (err != WEBP_MUX_OK) { - ERROR_GOTO1("Error transferring metadata in DuplicateMux().", End); + ERROR_GOTO1("Error transferring metadata in DuplicateMuxHeader().", + End); } } } @@ -682,7 +685,7 @@ ERROR_GOTO1("ERROR: Multiple features specified.\n", ErrParse); } arg->subtype_ = SUBTYPE_ANMF; - arg->filename_ = argvi + 1; + arg->filename_ = wargvi + 1; arg->params_ = argvi + 2; ++feature_arg_index; i += 3; @@ -778,6 +781,13 @@ arg->params_ = argvi + 1; ++feature_arg_index; i += 2; + } else if (!strcmp(argvi, "bgcolor") && + (config->action_type_ == ACTION_SET)) { + CHECK_NUM_ARGS_AT_LEAST(2, ErrParse); + config->type_ = FEATURE_BGCOLOR; + arg->params_ = argvi + 1; + ++feature_arg_index; + i += 2; } else { // Assume input file. if (config->input_ == NULL) { config->input_ = wargvi; @@ -1053,6 +1063,30 @@ } 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;
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/extras/Makefile.in -> _service:tar_scm:libwebp-1.3.0.tar.gz/extras/Makefile.in
Changed
@@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -207,8 +207,6 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ @@ -225,8 +223,9 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -237,8 +236,10 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +FILECMD = @FILECMD@ GIF_INCLUDES = @GIF_INCLUDES@ GIF_LIBS = @GIF_LIBS@ GL_INCLUDES = @GL_INCLUDES@ @@ -353,6 +354,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +webp_libname_prefix = @webp_libname_prefix@ noinst_LTLIBRARIES = libwebpextras.la noinst_HEADERS = ../src/webp/types.h libwebpextras_la_SOURCES = extras.c extras.h quality_estimate.c @@ -611,7 +613,6 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/extras/extras.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/extras/extras.c
Changed
@@ -18,8 +18,8 @@ #include <string.h> #define XTRA_MAJ_VERSION 1 -#define XTRA_MIN_VERSION 2 -#define XTRA_REV_VERSION 1 +#define XTRA_MIN_VERSION 3 +#define XTRA_REV_VERSION 0 //------------------------------------------------------------------------------
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/extras/get_disto.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/extras/get_disto.c
Changed
@@ -223,7 +223,8 @@ " -o <file> . save the diff map as a WebP lossless file\n" " -scale .... scale the difference map to fit 0..255 range\n" " -gray ..... use grayscale for difference map (-scale)\n" - " Also handles PNG, JPG and TIFF files, in addition to WebP.\n"); + "\nSupported input formats:\n %s\n", + WebPGetEnabledInputFileFormats()); } int main(int argc, const char* argv) {
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/extras/vwebp_sdl.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/extras/vwebp_sdl.c
Changed
@@ -75,7 +75,7 @@ fprintf(stderr, "File too large.\n"); goto Error; } - ok = WebpToSDL((const char*)webp, (int)webp_size); + ok = WebPToSDL((const char*)webp, (int)webp_size); free((void*)webp); if (!ok) { WFPRINTF(stderr, "Error decoding file %s\n", (const W_CHAR*)file);
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/extras/webp_to_sdl.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/extras/webp_to_sdl.c
Changed
@@ -29,7 +29,7 @@ #endif static int init_ok = 0; -int WebpToSDL(const char* data, unsigned int data_size) { +int WebPToSDL(const char* data, unsigned int data_size) { int ok = 0; VP8StatusCode status; WebPDecoderConfig config;
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/extras/webp_to_sdl.h -> _service:tar_scm:libwebp-1.3.0.tar.gz/extras/webp_to_sdl.h
Changed
@@ -14,9 +14,9 @@ #ifndef WEBP_EXTRAS_WEBP_TO_SDL_H_ #define WEBP_EXTRAS_WEBP_TO_SDL_H_ -// Exports the method WebpToSDL(const char* data, int data_size) which decodes +// Exports the method WebPToSDL(const char* data, int data_size) which decodes // a WebP bitstream into an RGBA SDL surface. // Return false on failure. -extern int WebpToSDL(const char* data, unsigned int data_size); +extern int WebPToSDL(const char* data, unsigned int data_size); #endif // WEBP_EXTRAS_WEBP_TO_SDL_H_
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/imageio/Android.mk -> _service:tar_scm:libwebp-1.3.0.tar.gz/imageio/Android.mk
Changed
@@ -1,3 +1,5 @@ +# Ignore this file during non-NDK builds. +ifdef NDK_ROOT LOCAL_PATH := $(call my-dir) ################################################################################ @@ -52,3 +54,4 @@ LOCAL_MODULE := imageenc include $(BUILD_STATIC_LIBRARY) +endif # NDK_ROOT
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/imageio/Makefile.in -> _service:tar_scm:libwebp-1.3.0.tar.gz/imageio/Makefile.in
Changed
@@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -194,8 +194,6 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ @@ -211,8 +209,9 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -223,8 +222,10 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +FILECMD = @FILECMD@ GIF_INCLUDES = @GIF_INCLUDES@ GIF_LIBS = @GIF_LIBS@ GL_INCLUDES = @GL_INCLUDES@ @@ -339,6 +340,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +webp_libname_prefix = @webp_libname_prefix@ noinst_LTLIBRARIES = libimageio_util.la $(am__append_1) libimageenc.la noinst_HEADERS = ../src/webp/decode.h ../src/webp/types.h libimageio_util_la_SOURCES = imageio_util.c imageio_util.h @@ -572,7 +574,6 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/imageio/image_dec.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/imageio/image_dec.c
Changed
@@ -11,6 +11,24 @@ #include "./image_dec.h" +const char* WebPGetEnabledInputFileFormats(void) { + return "WebP" +#ifdef WEBP_HAVE_JPEG + ", JPEG" +#endif +#ifdef WEBP_HAVE_PNG + ", PNG" +#endif + ", PNM (PGM, PPM, PAM)" +#ifdef WEBP_HAVE_TIFF + ", TIFF" +#endif +#ifdef HAVE_WINCODEC_H + ", Windows Imaging Component (WIC)" +#endif + ""; +} + static WEBP_INLINE uint32_t GetBE32(const uint8_t buf) { return ((uint32_t)buf0 << 24) | (buf1 << 16) | (buf2 << 8) | buf3; }
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/imageio/image_dec.h -> _service:tar_scm:libwebp-1.3.0.tar.gz/imageio/image_dec.h
Changed
@@ -41,6 +41,9 @@ WEBP_UNSUPPORTED_FORMAT } WebPInputFileFormat; +// Returns a comma separated list of enabled input formats. +const char* WebPGetEnabledInputFileFormats(void); + // Try to infer the image format. 'data_size' should be larger than 12. // Returns WEBP_UNSUPPORTED_FORMAT if format can't be guess safely. WebPInputFileFormat WebPGuessImageType(const uint8_t* const data,
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/imageio/image_enc.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/imageio/image_enc.c
Changed
@@ -280,7 +280,7 @@ } //------------------------------------------------------------------------------ -// BMP +// BMP (see https://en.wikipedia.org/wiki/BMP_file_format#Pixel_storage) static void PutLE16(uint8_t* const dst, uint32_t value) { dst0 = (value >> 0) & 0xff; @@ -293,8 +293,11 @@ } #define BMP_HEADER_SIZE 54 +#define BMP_HEADER_ALPHA_EXTRA_SIZE 16 // for alpha info int WebPWriteBMP(FILE* fout, const WebPDecBuffer* const buffer) { const int has_alpha = WebPIsAlphaMode(buffer->colorspace); + const int header_size = + BMP_HEADER_SIZE + (has_alpha ? BMP_HEADER_ALPHA_EXTRA_SIZE : 0); const uint32_t width = buffer->width; const uint32_t height = buffer->height; const uint8_t* rgba = buffer->u.RGBA.rgba; @@ -303,8 +306,9 @@ uint32_t y; const uint32_t line_size = bytes_per_px * width; const uint32_t bmp_stride = (line_size + 3) & ~3; // pad to 4 - const uint32_t total_size = bmp_stride * height + BMP_HEADER_SIZE; - uint8_t bmp_headerBMP_HEADER_SIZE = { 0 }; + const uint32_t image_size = bmp_stride * height; + const uint32_t total_size = image_size + header_size; + uint8_t bmp_headerBMP_HEADER_SIZE + BMP_HEADER_ALPHA_EXTRA_SIZE = { 0 }; if (fout == NULL || buffer == NULL || rgba == NULL) return 0; @@ -312,30 +316,37 @@ PutLE16(bmp_header + 0, 0x4d42); // signature 'BM' PutLE32(bmp_header + 2, total_size); // size including header PutLE32(bmp_header + 6, 0); // reserved - PutLE32(bmp_header + 10, BMP_HEADER_SIZE); // offset to pixel array + PutLE32(bmp_header + 10, header_size); // offset to pixel array // bitmap info header - PutLE32(bmp_header + 14, 40); // DIB header size + PutLE32(bmp_header + 14, header_size - 14); // DIB header size PutLE32(bmp_header + 18, width); // dimensions - PutLE32(bmp_header + 22, -(int)height); // vertical flip! + PutLE32(bmp_header + 22, height); // no vertical flip PutLE16(bmp_header + 26, 1); // number of planes PutLE16(bmp_header + 28, bytes_per_px * 8); // bits per pixel - PutLE32(bmp_header + 30, 0); // no compression (BI_RGB) - PutLE32(bmp_header + 34, 0); // image size (placeholder) + PutLE32(bmp_header + 30, has_alpha ? 3 : 0); // BI_BITFIELDS or BI_RGB + PutLE32(bmp_header + 34, image_size); PutLE32(bmp_header + 38, 2400); // x pixels/meter PutLE32(bmp_header + 42, 2400); // y pixels/meter PutLE32(bmp_header + 46, 0); // number of palette colors PutLE32(bmp_header + 50, 0); // important color count + if (has_alpha) { // BITMAPV3INFOHEADER complement + PutLE32(bmp_header + 54, 0x00ff0000); // red mask + PutLE32(bmp_header + 58, 0x0000ff00); // green mask + PutLE32(bmp_header + 62, 0x000000ff); // blue mask + PutLE32(bmp_header + 66, 0xff000000); // alpha mask + } // TODO(skal): color profile // write header - if (fwrite(bmp_header, sizeof(bmp_header), 1, fout) != 1) { + if (fwrite(bmp_header, header_size, 1, fout) != 1) { return 0; } - // write pixel array + // write pixel array, bottom to top for (y = 0; y < height; ++y) { - if (fwrite(rgba, line_size, 1, fout) != 1) { + const uint8_t* const src = &rgba(uint64_t)(height - 1 - y) * stride; + if (fwrite(src, line_size, 1, fout) != 1) { return 0; } // write padding zeroes @@ -345,11 +356,11 @@ return 0; } } - rgba += stride; } return 1; } #undef BMP_HEADER_SIZE +#undef BMP_HEADER_ALPHA_EXTRA_SIZE //------------------------------------------------------------------------------ // TIFF
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/imageio/image_enc.h -> _service:tar_scm:libwebp-1.3.0.tar.gz/imageio/image_enc.h
Changed
@@ -79,7 +79,7 @@ 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);
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/imageio/jpegdec.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/imageio/jpegdec.c
Changed
@@ -336,7 +336,11 @@ pic->width = width; pic->height = height; ok = WebPPictureImportRGB(pic, rgb, (int)stride); - if (!ok) goto Error; + if (!ok) { + pic->width = 0; // WebPPictureImportRGB() barely touches 'pic' on failure. + pic->height = 0; // Just reset dimensions but keep any 'custom_ptr' etc. + MetadataFree(metadata); // In case the caller forgets to free it on error. + } End: free(rgb);
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/imageio/pngdec.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/imageio/pngdec.c
Changed
@@ -133,7 +133,7 @@ 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) },
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/imageio/pnmdec.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/imageio/pnmdec.c
Changed
@@ -20,6 +20,10 @@ #include "webp/encode.h" #include "./imageio_util.h" +#if defined(_MSC_VER) && _MSC_VER < 1900 +#define snprintf _snprintf +#endif + typedef enum { WIDTH_FLAG = 1 << 0, HEIGHT_FLAG = 1 << 1, @@ -111,8 +115,9 @@ break; } else { static const char kEllipsis = " ..."; + const size_t kLen = strlen(kEllipsis) + 1; // +1 = trailing \0 int i; - if (out_size > 20) sprintf(out + 20 - strlen(kEllipsis), kEllipsis); + if (out_size > 20) snprintf(out + 20 - kLen, kLen, kEllipsis); for (i = 0; i < (int)strlen(out); ++i) { // isprint() might trigger a "char-subscripts" warning if given a char. if (!isprint((int)outi)) outi = ' ';
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/imageio/tiffdec.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/imageio/tiffdec.c
Changed
@@ -46,7 +46,7 @@ (MetadataPayload*)((uint8_t*)metadata + kTIFFMetadataMapi.storage_offset); void* tag_data; - uint32 tag_data_len; + uint32_t tag_data_len; if (TIFFGetField(tif, kTIFFMetadataMapi.tag, &tag_data_len, &tag_data) && !MetadataCopy((const char*)tag_data, tag_data_len, payload)) { @@ -188,7 +188,9 @@ fprintf(stderr, "Error! Cannot retrieve TIFF samples-per-pixel info.\n"); goto End; } - if (samples_per_px < 3 || samples_per_px > 4) goto End; // not supported + if (!(samples_per_px == 1 || samples_per_px == 3 || samples_per_px == 4)) { + goto End; // not supported + } if (!(TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &image_width) && TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &image_height))) { @@ -212,7 +214,7 @@ TIFFGetField(tif, TIFFTAG_TILELENGTH, &tile_height)) { if ((tile_width > 32 && tile_width / 2 > image_width) || (tile_height > 32 && tile_height / 2 > image_height) || - ImgIoUtilCheckSizeArgumentsOverflow( + !ImgIoUtilCheckSizeArgumentsOverflow( (uint64_t)tile_width * sizeof(*raster), tile_height)) { fprintf(stderr, "Error! TIFF tile dimension (%d x %d) is too large.\n", tile_width, tile_height); @@ -230,7 +232,7 @@ 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)) {
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/infra
Added
+(directory)
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/infra/common.sh
Added
@@ -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 "*.lao" \) -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}" +}
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/infra/compile.sh
Added
@@ -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"
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/infra/compile_android.sh
Added
@@ -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 \
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/infra/compile_js.sh
Added
@@ -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
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/infra/run_static_analysis.sh
Added
@@ -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}")/"* "${OUTPUT_DIR}" +else + # make a empty report to wipe out any old bug reports. + cat << EOT > "${OUTPUT_DIR}/index.html" +<html> +<body> +No bugs reported. +</body> +</html> +EOT +fi
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/iosbuild.sh -> _service:tar_scm:libwebp-1.3.0.tar.gz/iosbuild.sh
Changed
@@ -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 @@ 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 @@ -133,10 +133,9 @@ CFLAGS="${CFLAGS}" set +x - # run make only in the src/ directory to create libwebp.a/libwebpdecoder.a - cd src/ - make V=0 - make install + # Build only the libraries, skip the examples. + make V=0 -C sharpyuv + make V=0 -C src install LIBLIST+=" ${ROOTDIR}/lib/libwebp.a" DECLIBLIST+=" ${ROOTDIR}/lib/libwebpdecoder.a" @@ -144,7 +143,6 @@ DEMUXLIBLIST+=" ${ROOTDIR}/lib/libwebpdemux.a" make clean - cd .. export PATH=${OLDPATH} done
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/ltmain.sh -> _service:tar_scm:libwebp-1.3.0.tar.gz/ltmain.sh
Changed
@@ -1,12 +1,12 @@ -#! /bin/sh +#! /usr/bin/env sh ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in -## by inline-source v2014-01-03.01 +## by inline-source v2019-02-19.15 -# libtool (GNU libtool) 2.4.6 +# libtool (GNU libtool) 2.4.7 # Provide generalized library-building support services. # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 -# Copyright (C) 1996-2015 Free Software Foundation, Inc. +# Copyright (C) 1996-2019, 2021-2022 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -31,8 +31,8 @@ PROGRAM=libtool PACKAGE=libtool -VERSION="2.4.6 Debian-2.4.6-15" -package_revision=2.4.6 +VERSION="2.4.7 Debian-2.4.7-4" +package_revision=2.4.7 ## ------ ## @@ -64,34 +64,25 @@ # libraries, which are installed to $pkgauxdir. # Set a version string for this script. -scriptversion=2015-01-20.17; # UTC +scriptversion=2019-02-19.15; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 -# Copyright (C) 2004-2015 Free Software Foundation, Inc. -# This is free software; see the source for copying conditions. There is NO -# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. - -# As a special exception to the GNU General Public License, if you distribute -# this file as part of a program or library that is built using GNU Libtool, -# you may include this file under the same distribution terms that you use -# for the rest of that program. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# This is free software. There is NO warranty; not even for +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# Copyright (C) 2004-2019, 2021 Bootstrap Authors +# +# This file is dual licensed under the terms of the MIT license +# <https://opensource.org/license/MIT>, and GPL version 2 or later +# <http://www.gnu.org/licenses/gpl-2.0.html>. You must apply one of +# these licenses when using or redistributing this software or any of +# the files within it. See the URLs above, or the file `LICENSE` +# included in the Bootstrap distribution for the full license texts. -# Please report bugs or propose patches to gary@gnu.org. +# Please report bugs or propose patches to: +# <https://github.com/gnulib-modules/bootstrap/issues> ## ------ ## @@ -139,9 +130,12 @@ _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" fi" done - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH +# These NLS vars are set unconditionally (bootstrap issue #24). Unset those +# in case the environment reset is needed later and the $save_* variant is not +# defined (see the code above). +LC_ALL=C +LANGUAGE=C +export LANGUAGE LC_ALL # Make sure IFS has a sensible default sp=' ' @@ -159,6 +153,26 @@ fi +# func_unset VAR +# -------------- +# Portably unset VAR. +# In some shells, an 'unset VAR' statement leaves a non-zero return +# status if VAR is already unset, which might be problematic if the +# statement is used at the end of a function (thus poisoning its return +# value) or when 'set -e' is active (causing even a spurious abort of +# the script in this case). +func_unset () +{ + { eval $1=; (eval unset $1) >/dev/null 2>&1 && eval unset $1 || : ; } +} + + +# Make sure CDPATH doesn't cause `cd` commands to output the target dir. +func_unset CDPATH + +# Make sure ${,E,F}GREP behave sanely. +func_unset GREP_OPTIONS + ## ------------------------- ## ## Locate command utilities. ## @@ -259,7 +273,7 @@ rm -f conftest.in conftest.tmp conftest.nl conftest.out } - func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin + func_path_progs "sed gsed" func_check_prog_sed "$PATH:/usr/xpg4/bin" rm -f conftest.sed SED=$func_path_progs_result } @@ -295,7 +309,7 @@ rm -f conftest.in conftest.tmp conftest.nl conftest.out } - func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin + func_path_progs "grep ggrep" func_check_prog_grep "$PATH:/usr/xpg4/bin" GREP=$func_path_progs_result } @@ -360,6 +374,35 @@ s/\\(^$_G_bs\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g s/\n//g" +# require_check_ifs_backslash +# --------------------------- +# Check if we can use backslash as IFS='\' separator, and set +# $check_ifs_backshlash_broken to ':' or 'false'. +require_check_ifs_backslash=func_require_check_ifs_backslash +func_require_check_ifs_backslash () +{ + _G_save_IFS=$IFS + IFS='\' + _G_check_ifs_backshlash='a\\b' + for _G_i in $_G_check_ifs_backshlash + do + case $_G_i in + a) + check_ifs_backshlash_broken=false + ;; + '') + break + ;; + *) + check_ifs_backshlash_broken=: + break + ;; + esac + done + IFS=$_G_save_IFS + require_check_ifs_backslash=: +} + ## ----------------- ## ## Global variables. ## @@ -580,16 +623,16 @@ { $debug_cmd - func_quote_for_eval "$2" - eval "$1+=\\ \$func_quote_for_eval_result" + func_quote_arg pretty "$2" + eval "$1+=\\ \$func_quote_arg_result" }' else func_append_quoted () { $debug_cmd - func_quote_for_eval "$2" - eval "$1=\$$1\\ \$func_quote_for_eval_result" + func_quote_arg pretty "$2" + eval "$1=\$$1\\ \$func_quote_arg_result" } fi @@ -1091,85 +1134,203 @@ } -# func_quote_for_eval ARG...
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/m4/libtool.m4 -> _service:tar_scm:libwebp-1.3.0.tar.gz/m4/libtool.m4
Changed
@@ -1,6 +1,7 @@ # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # -# Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc. +# Copyright (C) 1996-2001, 2003-2019, 2021-2022 Free Software +# Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives @@ -31,7 +32,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. ) -# serial 58 LT_INIT +# serial 59 LT_INIT # LT_PREREQ(VERSION) @@ -181,6 +182,7 @@ m4_require(_LT_CHECK_SHELL_FEATURES)dnl m4_require(_LT_PATH_CONVERSION_FUNCTIONS)dnl m4_require(_LT_CMD_RELOAD)dnl +m4_require(_LT_DECL_FILECMD)dnl m4_require(_LT_CHECK_MAGIC_METHOD)dnl m4_require(_LT_CHECK_SHAREDLIB_FROM_LINKLIB)dnl m4_require(_LT_CMD_OLD_ARCHIVE)dnl @@ -219,8 +221,8 @@ ofile=libtool can_build_shared=yes -# All known linkers require a '.a' archive for static linking (except MSVC, -# which needs '.lib'). +# All known linkers require a '.a' archive for static linking (except MSVC and +# ICC, which need '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld @@ -777,7 +779,7 @@ # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" \ + $SED '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || @@ -1041,8 +1043,8 @@ _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD - echo "$AR cr libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD - $AR cr libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD + echo "$AR $AR_FLAGS libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD + $AR $AR_FLAGS libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF @@ -1066,17 +1068,12 @@ _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin912*) - _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; - 10.012,.*) - _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; - 10.*|11.*) - _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + darwin*) + case $MACOSX_DEPLOYMENT_TARGET,$host in + 10.012,*|,*powerpc*-darwin5-8*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + *) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac @@ -1125,12 +1122,12 @@ output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" - _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" + _LT_TAGVAR(archive_expsym_cmds, $1)="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" + _LT_TAGVAR(module_expsym_cmds, $1)="$SED -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" m4_if($1, CXX, if test yes != "$lt_cv_apple_cc_single_mod"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" + _LT_TAGVAR(archive_expsym_cmds, $1)="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" fi ,) else @@ -1244,7 +1241,8 @@ # _LT_WITH_SYSROOT # ---------------- AC_DEFUN(_LT_WITH_SYSROOT, -AC_MSG_CHECKING(for sysroot) +m4_require(_LT_DECL_SED)dnl +AC_MSG_CHECKING(for sysroot) AC_ARG_WITH(sysroot, AS_HELP_STRING(--with-sysroot@<:@=DIR@:>@, Search for dependent libraries within DIR (or the compiler's sysroot @@ -1261,7 +1259,7 @@ fi ;; #( /*) - lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + lt_sysroot=`echo "$with_sysroot" | $SED -e "$sed_quote_subst"` ;; #( no|'') ;; #( @@ -1291,7 +1289,7 @@ # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in + case `$FILECMD conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; @@ -1308,7 +1306,7 @@ echo '#line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test yes = "$lt_cv_prog_gnu_ld"; then - case `/usr/bin/file conftest.$ac_objext` in + case `$FILECMD conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; @@ -1320,7 +1318,7 @@ ;; esac else - case `/usr/bin/file conftest.$ac_objext` in + case `$FILECMD conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; @@ -1342,7 +1340,7 @@ echo '#line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then emul=elf - case `/usr/bin/file conftest.$ac_objext` in + case `$FILECMD conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; @@ -1350,7 +1348,7 @@ emul="${emul}64" ;; esac - case `/usr/bin/file conftest.$ac_objext` in + case `$FILECMD conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; @@ -1358,7 +1356,7 @@ emul="${emul}ltsmip" ;; esac - case `/usr/bin/file conftest.$ac_objext` in + case `$FILECMD conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; @@ -1378,14 +1376,14 @@ # not appear in the list. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.o` in + case `$FILECMD conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) - case `/usr/bin/file conftest.o` in + case `$FILECMD conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; @@ -1453,7 +1451,7 @@ # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.o` in + case `$FILECMD conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) @@ -1492,9 +1490,22 @@ m4_defun(_LT_PROG_AR, AC_CHECK_TOOLS(AR, ar, false) : ${AR=ar}
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/m4/ltoptions.m4 -> _service:tar_scm:libwebp-1.3.0.tar.gz/m4/ltoptions.m4
Changed
@@ -1,7 +1,7 @@ # Helper functions for option handling. -*- Autoconf -*- # -# Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software -# Foundation, Inc. +# Copyright (C) 2004-2005, 2007-2009, 2011-2019, 2021-2022 Free +# Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/m4/ltsugar.m4 -> _service:tar_scm:libwebp-1.3.0.tar.gz/m4/ltsugar.m4
Changed
@@ -1,6 +1,6 @@ # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # -# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software +# Copyright (C) 2004-2005, 2007-2008, 2011-2019, 2021-2022 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 #
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/m4/ltversion.m4 -> _service:tar_scm:libwebp-1.3.0.tar.gz/m4/ltversion.m4
Changed
@@ -1,6 +1,7 @@ # ltversion.m4 -- version numbers -*- Autoconf -*- # -# Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. +# Copyright (C) 2004, 2011-2019, 2021-2022 Free Software Foundation, +# Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives @@ -9,15 +10,15 @@ # @configure_input@ -# serial 4179 ltversion.m4 +# serial 4245 ltversion.m4 # This file is part of GNU Libtool -m4_define(LT_PACKAGE_VERSION, 2.4.6) -m4_define(LT_PACKAGE_REVISION, 2.4.6) +m4_define(LT_PACKAGE_VERSION, 2.4.7) +m4_define(LT_PACKAGE_REVISION, 2.4.7) AC_DEFUN(LTVERSION_VERSION, -macro_version='2.4.6' -macro_revision='2.4.6' +macro_version='2.4.7' +macro_revision='2.4.7' _LT_DECL(, macro_version, 0, Which release of libtool.m4 was used?) _LT_DECL(, macro_revision, 0) )
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/m4/lt~obsolete.m4 -> _service:tar_scm:libwebp-1.3.0.tar.gz/m4/lt~obsolete.m4
Changed
@@ -1,7 +1,7 @@ # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # -# Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software -# Foundation, Inc. +# Copyright (C) 2004-2005, 2007, 2009, 2011-2019, 2021-2022 Free +# Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/makefile.unix -> _service:tar_scm:libwebp-1.3.0.tar.gz/makefile.unix
Changed
@@ -3,7 +3,8 @@ # It will not install the libraries system-wide, but just create the 'cwebp' # and 'dwebp' tools in the examples/ directory, along with the static # libraries 'src/libwebp.a', 'src/libwebpdecoder.a', 'src/mux/libwebpmux.a', -# 'src/demux/libwebpdemux.a' and 'extras/libwebpextras.a'. +# 'src/demux/libwebpdemux.a', 'extras/libwebpextras.a' and +# 'sharpyuv/libsharpyuv.a'. # # To build the library and examples, use: # make -f makefile.unix @@ -47,7 +48,7 @@ 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" @@ -125,6 +126,15 @@ ANIM_UTIL_OBJS = \ examples/anim_util.o \ +SHARPYUV_OBJS = \ + sharpyuv/sharpyuv.o \ + sharpyuv/sharpyuv_cpu.o \ + sharpyuv/sharpyuv_csp.o \ + sharpyuv/sharpyuv_dsp.o \ + sharpyuv/sharpyuv_gamma.o \ + sharpyuv/sharpyuv_neon.o \ + sharpyuv/sharpyuv_sse2.o \ + DEC_OBJS = \ src/dec/alpha_dec.o \ src/dec/buffer_dec.o \ @@ -282,11 +292,12 @@ extras/quality_estimate.o \ LIBWEBPDECODER_OBJS = $(DEC_OBJS) $(DSP_DEC_OBJS) $(UTILS_DEC_OBJS) -LIBWEBP_OBJS = $(LIBWEBPDECODER_OBJS) $(ENC_OBJS) $(DSP_ENC_OBJS) \ - $(UTILS_ENC_OBJS) +LIBWEBP_OBJS = $(LIBWEBPDECODER_OBJS) $(ENC_OBJS) \ + $(DSP_ENC_OBJS) $(UTILS_ENC_OBJS) LIBWEBPMUX_OBJS = $(MUX_OBJS) LIBWEBPDEMUX_OBJS = $(DEMUX_OBJS) LIBWEBPEXTRA_OBJS = $(EXTRA_OBJS) +LIBSHARPYUV_OBJS = $(SHARPYUV_OBJS) HDRS_INSTALLED = \ src/webp/decode.h \ @@ -296,6 +307,11 @@ src/webp/mux_types.h \ src/webp/types.h \ +SHARPYUV_HDRS_INSTALLED = \ + sharpyuv/sharpyuv.h \ + sharpyuv/sharpyuv_cpu.h \ + sharpyuv/sharpyuv_csp.h \ + HDRS = \ src/dec/alphai_dec.h \ src/dec/common_dec.h \ @@ -304,6 +320,7 @@ src/dec/vp8li_dec.h \ src/dec/webpi_dec.h \ src/dsp/common_sse2.h \ + src/dsp/cpu.h \ src/dsp/dsp.h \ src/dsp/lossless.h \ src/dsp/lossless_common.h \ @@ -334,6 +351,7 @@ src/utils/utils.h \ src/webp/format_constants.h \ $(HDRS_INSTALLED) \ + $(SHARPYUV_HDRS_INSTALLED) \ OUT_LIBS = examples/libexample_util.a OUT_LIBS += imageio/libimageio_util.a @@ -341,6 +359,7 @@ OUT_LIBS += imageio/libimageenc.a OUT_LIBS += src/libwebpdecoder.a OUT_LIBS += src/libwebp.a +OUT_LIBS += sharpyuv/libsharpyuv.a EXTRA_LIB = extras/libwebpextras.a OUT_EXAMPLES = examples/cwebp examples/dwebp EXTRA_EXAMPLES = examples/gif2webp examples/vwebp examples/webpmux \ @@ -386,6 +405,7 @@ src/libwebp.a: $(LIBWEBP_OBJS) src/mux/libwebpmux.a: $(LIBWEBPMUX_OBJS) src/demux/libwebpdemux.a: $(LIBWEBPDEMUX_OBJS) +sharpyuv/libsharpyuv.a: $(LIBSHARPYUV_OBJS) %.a: $(AR) $(ARFLAGS) $@ $^ @@ -403,6 +423,7 @@ examples/anim_diff: examples/libanim_util.a examples/libgifdec.a examples/anim_diff: src/demux/libwebpdemux.a examples/libexample_util.a examples/anim_diff: imageio/libimageio_util.a src/libwebp.a +examples/anim_diff: sharpyuv/libsharpyuv.a examples/anim_diff: override EXTRA_LIBS += $(GIF_LIBS) examples/anim_diff: EXTRA_FLAGS += -DWEBP_HAVE_GIF examples/anim_dump: examples/libanim_util.a examples/libgifdec.a @@ -411,12 +432,14 @@ examples/anim_dump: imageio/libimageio_util.a examples/anim_dump: imageio/libimageenc.a examples/anim_dump: src/libwebp.a +examples/anim_dump: sharpyuv/libsharpyuv.a examples/anim_dump: override EXTRA_LIBS += $(GIF_LIBS) $(DWEBP_LIBS) examples/cwebp: examples/libexample_util.a examples/cwebp: imageio/libimagedec.a examples/cwebp: src/demux/libwebpdemux.a examples/cwebp: imageio/libimageio_util.a examples/cwebp: src/libwebp.a +examples/cwebp: sharpyuv/libsharpyuv.a examples/cwebp: override EXTRA_LIBS += $(CWEBP_LIBS) examples/dwebp: examples/libexample_util.a examples/dwebp: imageio/libimagedec.a @@ -424,13 +447,16 @@ examples/dwebp: imageio/libimageenc.a examples/dwebp: imageio/libimageio_util.a examples/dwebp: src/libwebp.a +examples/dwebp: sharpyuv/libsharpyuv.a examples/dwebp: override EXTRA_LIBS += $(DWEBP_LIBS) examples/gif2webp: examples/libexample_util.a imageio/libimageio_util.a examples/gif2webp: examples/libgifdec.a src/mux/libwebpmux.a src/libwebp.a +examples/gif2webp: sharpyuv/libsharpyuv.a examples/gif2webp: override EXTRA_LIBS += $(GIF_LIBS) examples/gif2webp: EXTRA_FLAGS += -DWEBP_HAVE_GIF examples/vwebp: examples/libexample_util.a src/demux/libwebpdemux.a examples/vwebp: imageio/libimageio_util.a src/libwebp.a +examples/vwebp: sharpyuv/libsharpyuv.a examples/vwebp: override EXTRA_LIBS += $(GL_LIBS) examples/vwebp: EXTRA_FLAGS += -DWEBP_HAVE_GL examples/webpmux: examples/libexample_util.a imageio/libimageio_util.a @@ -438,7 +464,9 @@ examples/img2webp: examples/libexample_util.a imageio/libimageio_util.a examples/img2webp: imageio/libimagedec.a examples/img2webp: src/demux/libwebpdemux.a -examples/img2webp: src/mux/libwebpmux.a src/libwebp.a +examples/img2webp: src/mux/libwebpmux.a +examples/img2webp: src/libwebp.a +examples/img2webp: sharpyuv/libsharpyuv.a examples/img2webp: override EXTRA_LIBS += $(CWEBP_LIBS) examples/webpinfo: examples/libexample_util.a imageio/libimageio_util.a examples/webpinfo: src/libwebpdecoder.a @@ -448,16 +476,19 @@ extras/get_disto: src/demux/libwebpdemux.a extras/get_disto: imageio/libimageio_util.a extras/get_disto: src/libwebp.a +extras/get_disto: sharpyuv/libsharpyuv.a extras/get_disto: override EXTRA_LIBS += $(CWEBP_LIBS) extras/webp_quality: extras/webp_quality.o extras/webp_quality: imageio/libimageio_util.a extras/webp_quality: $(EXTRA_LIB) src/libwebp.a +extras/webp_quality: sharpyuv/libsharpyuv.a extras/vwebp_sdl: extras/vwebp_sdl.o extras/vwebp_sdl: extras/webp_to_sdl.o extras/vwebp_sdl: imageio/libimageio_util.a extras/vwebp_sdl: src/libwebp.a +extras/vwebp_sdl: sharpyuv/libsharpyuv.a extras/vwebp_sdl: EXTRA_FLAGS += -DWEBP_HAVE_SDL $(SDL_FLAGS) extras/vwebp_sdl: override EXTRA_LIBS += $(SDL_LIBS) @@ -468,12 +499,15 @@ dist: OUT_EXAMPLES += $(EXTRA_EXAMPLES) dist: all $(INSTALL) -m755 -d $(DESTDIR)/include/webp \ - $(DESTDIR)/bin $(DESTDIR)/doc $(DESTDIR)/lib + $(DESTDIR)/include/webp/sharpyuv \ + $(DESTDIR)/bin $(DESTDIR)/doc $(DESTDIR)/lib $(INSTALL) -m755 -s $(OUT_EXAMPLES) $(DESTDIR)/bin $(INSTALL) -m644 $(HDRS_INSTALLED) $(DESTDIR)/include/webp + $(INSTALL) -m644 $(SHARPYUV_HDRS_INSTALLED) $(DESTDIR)/include/webp/sharpyuv $(INSTALL) -m644 src/libwebp.a $(DESTDIR)/lib $(INSTALL) -m644 src/demux/libwebpdemux.a $(DESTDIR)/lib $(INSTALL) -m644 src/mux/libwebpmux.a $(DESTDIR)/lib + $(INSTALL) -m644 sharpyuv/libsharpyuv.a $(DESTDIR)/lib umask 022; \ for m in man/cdvwebp.1 man/gif2webp.1 man/webpmux.1 \ man/img2webp.1 man/webpinfo.1; do \ @@ -489,6 +523,7 @@ examples/*.o examples/*~ \ extras/*.o extras/*~ \ imageio/*.o imageio/*~ \ + sharpyuv/*.o sharpyuv/*~ \ src/dec/*.o src/dec/*~ \ src/demux/*.o src/demux/*~ \ src/dsp/*.o src/dsp/*~ \
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/man/Makefile.in -> _service:tar_scm:libwebp-1.3.0.tar.gz/man/Makefile.in
Changed
@@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -171,8 +171,9 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -183,8 +184,10 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +FILECMD = @FILECMD@ GIF_INCLUDES = @GIF_INCLUDES@ GIF_LIBS = @GIF_LIBS@ GL_INCLUDES = @GL_INCLUDES@ @@ -299,6 +302,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +webp_libname_prefix = @webp_libname_prefix@ man_MANS = cwebp.1 dwebp.1 $(am__append_1) $(am__append_2) \ $(am__append_3) $(am__append_4) $(am__append_5) EXTRA_DIST = $(man_MANS) @@ -389,7 +393,6 @@ cscope cscopelist: - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/man/cwebp.1 -> _service:tar_scm:libwebp-1.3.0.tar.gz/man/cwebp.1
Changed
@@ -1,5 +1,5 @@ .\" Hey, EMACS: -*- nroff -*- -.TH CWEBP 1 "November 19, 2020" +.TH CWEBP 1 "March 17, 2022" .SH NAME cwebp \- compress an image file to a WebP file .SH SYNOPSIS @@ -90,15 +90,17 @@ Lower value can result in faster processing time at the expense of larger file size and lower compression quality. .TP -.BI \-resize " width height -Resize the source to a rectangle with size \fBwidth\fP x \fBheight\fP. -If either (but not both) of the \fBwidth\fP or \fBheight\fP parameters is 0, -the value will be calculated preserving the aspect\-ratio. -.TP .BI \-crop " x_position y_position width height Crop the source to a rectangle with top\-left corner at coordinates (\fBx_position\fP, \fBy_position\fP) and size \fBwidth\fP x \fBheight\fP. This cropping area must be fully contained within the source rectangle. +Note: the cropping is applied \fIbefore\fP any scaling. +.TP +.BI \-resize " width height +Resize the source to a rectangle with size \fBwidth\fP x \fBheight\fP. +If either (but not both) of the \fBwidth\fP or \fBheight\fP parameters is 0, +the value will be calculated preserving the aspect\-ratio. Note: scaling +is applied \fIafter\fP cropping. .TP .B \-mt Use multi\-threading for encoding, if possible. @@ -222,7 +224,7 @@ .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 +300,7 @@ 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 +324,5 @@ .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.
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/man/dwebp.1 -> _service:tar_scm:libwebp-1.3.0.tar.gz/man/dwebp.1
Changed
@@ -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 @@ 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 @@ .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
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/man/gif2webp.1 -> _service:tar_scm:libwebp-1.3.0.tar.gz/man/gif2webp.1
Changed
@@ -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 @@ 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 @@ .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.
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/man/img2webp.1 -> _service:tar_scm:libwebp-1.3.0.tar.gz/man/img2webp.1
Changed
@@ -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 @@ 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 @@ .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.
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/man/vwebp.1 -> _service:tar_scm:libwebp-1.3.0.tar.gz/man/vwebp.1
Changed
@@ -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 @@ 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 @@ .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.
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/man/webpinfo.1 -> _service:tar_scm:libwebp-1.3.0.tar.gz/man/webpinfo.1
Changed
@@ -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 @@ 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 @@ .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.
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/man/webpmux.1 -> _service:tar_scm:libwebp-1.3.0.tar.gz/man/webpmux.1
Changed
@@ -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 @@ .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 @@ 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 @@ .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.
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/missing -> _service:tar_scm:libwebp-1.3.0.tar.gz/missing
Changed
@@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1996-2020 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. # This program is free software; you can redistribute it and/or modify
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/sharpyuv
Added
+(directory)
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/sharpyuv/Makefile.am
Added
@@ -0,0 +1,41 @@ +AM_CPPFLAGS += -I$(top_builddir) -I$(top_srcdir) +AM_CPPFLAGS += -I$(top_builddir)/src -I$(top_srcdir)/src + +lib_LTLIBRARIES = libsharpyuv.la + +noinst_LTLIBRARIES = +noinst_LTLIBRARIES += libsharpyuv_sse2.la +noinst_LTLIBRARIES += libsharpyuv_neon.la + +libsharpyuvinclude_HEADERS = +libsharpyuvinclude_HEADERS += sharpyuv.h +libsharpyuvinclude_HEADERS += sharpyuv_csp.h +noinst_HEADERS = +noinst_HEADERS += ../src/dsp/cpu.c +noinst_HEADERS += ../src/dsp/cpu.h +noinst_HEADERS += ../src/webp/types.h + +libsharpyuv_sse2_la_SOURCES = +libsharpyuv_sse2_la_SOURCES += sharpyuv_sse2.c +libsharpyuv_sse2_la_CPPFLAGS = $(libsharpyuv_la_CPPFLAGS) +libsharpyuv_sse2_la_CFLAGS = $(AM_CFLAGS) $(SSE2_FLAGS) + +libsharpyuv_neon_la_SOURCES = +libsharpyuv_neon_la_SOURCES += sharpyuv_neon.c +libsharpyuv_neon_la_CPPFLAGS = $(libsharpyuv_la_CPPFLAGS) +libsharpyuv_neon_la_CFLAGS = $(AM_CFLAGS) $(NEON_FLAGS) + +libsharpyuv_la_SOURCES = +libsharpyuv_la_SOURCES += sharpyuv_cpu.c sharpyuv_cpu.h +libsharpyuv_la_SOURCES += sharpyuv_csp.c sharpyuv_csp.h +libsharpyuv_la_SOURCES += sharpyuv_dsp.c sharpyuv_dsp.h +libsharpyuv_la_SOURCES += sharpyuv_gamma.c sharpyuv_gamma.h +libsharpyuv_la_SOURCES += sharpyuv.c sharpyuv.h + +libsharpyuv_la_CPPFLAGS = $(AM_CPPFLAGS) +libsharpyuv_la_LDFLAGS = -no-undefined -version-info 0:0:0 -lm +libsharpyuv_la_LIBADD = +libsharpyuv_la_LIBADD += libsharpyuv_sse2.la +libsharpyuv_la_LIBADD += libsharpyuv_neon.la +libsharpyuvincludedir = $(includedir)/webp/sharpyuv +pkgconfig_DATA = libsharpyuv.pc
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/sharpyuv/Makefile.in
Added
@@ -0,0 +1,862 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\\ \ *) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs$$bs $$bs *//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -dEDm) skip_next=yes;; \ + -JT) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = sharpyuv +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(libsharpyuvinclude_HEADERS) \ + $(noinst_HEADERS) $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/src/webp/config.h +CONFIG_CLEAN_FILES = libsharpyuv.pc +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/.^$$\\*|/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/^/*$$,\1,' | \ + $(AWK) 'BEGIN { files"." = "" } { files$$2 = files$$2 " " $$1; \ + if (++n$$2 == $(am__install_max)) \ + { print $$2, files$$2; n$$2 = 0; files$$2 = "" } } \ + END { for (dir in files) print dir, filesdir }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" \ + "$(DESTDIR)$(libsharpyuvincludedir)" +LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) +libsharpyuv_la_DEPENDENCIES = libsharpyuv_sse2.la libsharpyuv_neon.la +am_libsharpyuv_la_OBJECTS = libsharpyuv_la-sharpyuv_cpu.lo \ + libsharpyuv_la-sharpyuv_csp.lo libsharpyuv_la-sharpyuv_dsp.lo \ + libsharpyuv_la-sharpyuv_gamma.lo libsharpyuv_la-sharpyuv.lo +libsharpyuv_la_OBJECTS = $(am_libsharpyuv_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libsharpyuv_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(libsharpyuv_la_LDFLAGS) $(LDFLAGS) -o \ + $@ +libsharpyuv_neon_la_LIBADD = +am_libsharpyuv_neon_la_OBJECTS = libsharpyuv_neon_la-sharpyuv_neon.lo +libsharpyuv_neon_la_OBJECTS = $(am_libsharpyuv_neon_la_OBJECTS) +libsharpyuv_neon_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libsharpyuv_neon_la_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +libsharpyuv_sse2_la_LIBADD = +am_libsharpyuv_sse2_la_OBJECTS = libsharpyuv_sse2_la-sharpyuv_sse2.lo +libsharpyuv_sse2_la_OBJECTS = $(am_libsharpyuv_sse2_la_OBJECTS) +libsharpyuv_sse2_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libsharpyuv_sse2_la_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src/webp +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/libsharpyuv_la-sharpyuv.Plo \ + ./$(DEPDIR)/libsharpyuv_la-sharpyuv_cpu.Plo \ + ./$(DEPDIR)/libsharpyuv_la-sharpyuv_csp.Plo \ + ./$(DEPDIR)/libsharpyuv_la-sharpyuv_dsp.Plo \ + ./$(DEPDIR)/libsharpyuv_la-sharpyuv_gamma.Plo \ + ./$(DEPDIR)/libsharpyuv_neon_la-sharpyuv_neon.Plo \ + ./$(DEPDIR)/libsharpyuv_sse2_la-sharpyuv_sse2.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/sharpyuv/libsharpyuv.pc.in
Added
@@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@/webp + +Name: libsharpyuv +Description: Library for sharp RGB to YUV conversion +Version: @PACKAGE_VERSION@ +Cflags: -I${includedir} +Libs: -L${libdir} -l@webp_libname_prefix@sharpyuv +Libs.private: -lm @PTHREAD_CFLAGS@ @PTHREAD_LIBS@
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/sharpyuv/libsharpyuv.rc
Added
@@ -0,0 +1,41 @@ +#define APSTUDIO_READONLY_SYMBOLS +#include "winres.h" +#undef APSTUDIO_READONLY_SYMBOLS + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 0,0,2,0 + PRODUCTVERSION 0,0,2,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Google, Inc." + VALUE "FileDescription", "libsharpyuv DLL" + VALUE "FileVersion", "0.2.0" + VALUE "InternalName", "libsharpyuv.dll" + VALUE "LegalCopyright", "Copyright (C) 2022" + VALUE "OriginalFilename", "libsharpyuv.dll" + VALUE "ProductName", "SharpYuv Library" + VALUE "ProductVersion", "0.2.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // English (United States) resources
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/sharpyuv/sharpyuv.c
Added
@@ -0,0 +1,526 @@ +// Copyright 2022 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- +// +// Sharp RGB to YUV conversion. +// +// Author: Skal (pascal.massimino@gmail.com) + +#include "sharpyuv/sharpyuv.h" + +#include <assert.h> +#include <limits.h> +#include <stddef.h> +#include <stdlib.h> +#include <string.h> + +#include "src/webp/types.h" +#include "sharpyuv/sharpyuv_cpu.h" +#include "sharpyuv/sharpyuv_dsp.h" +#include "sharpyuv/sharpyuv_gamma.h" + +//------------------------------------------------------------------------------ + +int SharpYuvGetVersion(void) { + return SHARPYUV_VERSION; +} + +//------------------------------------------------------------------------------ +// Sharp RGB->YUV conversion + +static const int kNumIterations = 4; + +#define YUV_FIX 16 // fixed-point precision for RGB->YUV +static const int kYuvHalf = 1 << (YUV_FIX - 1); + +// Max bit depth so that intermediate calculations fit in 16 bits. +static const int kMaxBitDepth = 14; + +// Returns the precision shift to use based on the input rgb_bit_depth. +static int GetPrecisionShift(int rgb_bit_depth) { + // Try to add 2 bits of precision if it fits in kMaxBitDepth. Otherwise remove + // bits if needed. + return ((rgb_bit_depth + 2) <= kMaxBitDepth) ? 2 + : (kMaxBitDepth - rgb_bit_depth); +} + +typedef int16_t fixed_t; // signed type with extra precision for UV +typedef uint16_t fixed_y_t; // unsigned type with extra precision for W + +//------------------------------------------------------------------------------ + +static uint8_t clip_8b(fixed_t v) { + return (!(v & ~0xff)) ? (uint8_t)v : (v < 0) ? 0u : 255u; +} + +static uint16_t clip(fixed_t v, int max) { + return (v < 0) ? 0 : (v > max) ? max : (uint16_t)v; +} + +static fixed_y_t clip_bit_depth(int y, int bit_depth) { + const int max = (1 << bit_depth) - 1; + return (!(y & ~max)) ? (fixed_y_t)y : (y < 0) ? 0 : max; +} + +//------------------------------------------------------------------------------ + +static int RGBToGray(int64_t r, int64_t g, int64_t b) { + const int64_t luma = 13933 * r + 46871 * g + 4732 * b + kYuvHalf; + return (int)(luma >> YUV_FIX); +} + +static uint32_t ScaleDown(uint16_t a, uint16_t b, uint16_t c, uint16_t d, + int rgb_bit_depth) { + const int bit_depth = rgb_bit_depth + GetPrecisionShift(rgb_bit_depth); + const uint32_t A = SharpYuvGammaToLinear(a, bit_depth); + const uint32_t B = SharpYuvGammaToLinear(b, bit_depth); + const uint32_t C = SharpYuvGammaToLinear(c, bit_depth); + const uint32_t D = SharpYuvGammaToLinear(d, bit_depth); + return SharpYuvLinearToGamma((A + B + C + D + 2) >> 2, bit_depth); +} + +static WEBP_INLINE void UpdateW(const fixed_y_t* src, fixed_y_t* dst, int w, + int rgb_bit_depth) { + const int bit_depth = rgb_bit_depth + GetPrecisionShift(rgb_bit_depth); + int i; + for (i = 0; i < w; ++i) { + const uint32_t R = SharpYuvGammaToLinear(src0 * w + i, bit_depth); + const uint32_t G = SharpYuvGammaToLinear(src1 * w + i, bit_depth); + const uint32_t B = SharpYuvGammaToLinear(src2 * w + i, bit_depth); + const uint32_t Y = RGBToGray(R, G, B); + dsti = (fixed_y_t)SharpYuvLinearToGamma(Y, bit_depth); + } +} + +static void UpdateChroma(const fixed_y_t* src1, const fixed_y_t* src2, + fixed_t* dst, int uv_w, int rgb_bit_depth) { + int i; + for (i = 0; i < uv_w; ++i) { + const int r = + ScaleDown(src10 * uv_w + 0, src10 * uv_w + 1, src20 * uv_w + 0, + src20 * uv_w + 1, rgb_bit_depth); + const int g = + ScaleDown(src12 * uv_w + 0, src12 * uv_w + 1, src22 * uv_w + 0, + src22 * uv_w + 1, rgb_bit_depth); + const int b = + ScaleDown(src14 * uv_w + 0, src14 * uv_w + 1, src24 * uv_w + 0, + src24 * uv_w + 1, rgb_bit_depth); + const int W = RGBToGray(r, g, b); + dst0 * uv_w = (fixed_t)(r - W); + dst1 * uv_w = (fixed_t)(g - W); + dst2 * uv_w = (fixed_t)(b - W); + dst += 1; + src1 += 2; + src2 += 2; + } +} + +static void StoreGray(const fixed_y_t* rgb, fixed_y_t* y, int w) { + int i; + assert(w > 0); + for (i = 0; i < w; ++i) { + yi = RGBToGray(rgb0 * w + i, rgb1 * w + i, rgb2 * w + i); + } +} + +//------------------------------------------------------------------------------ + +static WEBP_INLINE fixed_y_t Filter2(int A, int B, int W0, int bit_depth) { + const int v0 = (A * 3 + B + 2) >> 2; + return clip_bit_depth(v0 + W0, bit_depth); +} + +//------------------------------------------------------------------------------ + +static WEBP_INLINE int Shift(int v, int shift) { + return (shift >= 0) ? (v << shift) : (v >> -shift); +} + +static void ImportOneRow(const uint8_t* const r_ptr, + const uint8_t* const g_ptr, + const uint8_t* const b_ptr, + int rgb_step, + int rgb_bit_depth, + int pic_width, + fixed_y_t* const dst) { + // Convert the rgb_step from a number of bytes to a number of uint8_t or + // uint16_t values depending the bit depth. + const int step = (rgb_bit_depth > 8) ? rgb_step / 2 : rgb_step; + int i; + const int w = (pic_width + 1) & ~1; + for (i = 0; i < pic_width; ++i) { + const int off = i * step; + const int shift = GetPrecisionShift(rgb_bit_depth); + if (rgb_bit_depth == 8) { + dsti + 0 * w = Shift(r_ptroff, shift); + dsti + 1 * w = Shift(g_ptroff, shift); + dsti + 2 * w = Shift(b_ptroff, shift); + } else { + dsti + 0 * w = Shift(((uint16_t*)r_ptr)off, shift); + dsti + 1 * w = Shift(((uint16_t*)g_ptr)off, shift); + dsti + 2 * w = Shift(((uint16_t*)b_ptr)off, shift); + } + } + if (pic_width & 1) { // replicate rightmost pixel + dstpic_width + 0 * w = dstpic_width + 0 * w - 1; + dstpic_width + 1 * w = dstpic_width + 1 * w - 1; + dstpic_width + 2 * w = dstpic_width + 2 * w - 1; + } +} + +static void InterpolateTwoRows(const fixed_y_t* const best_y, + const fixed_t* prev_uv, + const fixed_t* cur_uv, + const fixed_t* next_uv, + int w, + fixed_y_t* out1, + fixed_y_t* out2, + int rgb_bit_depth) { + const int uv_w = w >> 1; + const int len = (w - 1) >> 1; // length to filter + int k = 3; + const int bit_depth = rgb_bit_depth + GetPrecisionShift(rgb_bit_depth); + while (k-- > 0) { // process each R/G/B segments in turn + // special boundary case for i==0 + out10 = Filter2(cur_uv0, prev_uv0, best_y0, bit_depth); + out20 = Filter2(cur_uv0, next_uv0, best_yw, bit_depth); + + SharpYuvFilterRow(cur_uv, prev_uv, len, best_y + 0 + 1, out1 + 1, + bit_depth); + SharpYuvFilterRow(cur_uv, next_uv, len, best_y + w + 1, out2 + 1, + bit_depth); + + // special boundary case for i == w - 1 when w is even + if (!(w & 1)) {
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/sharpyuv/sharpyuv.h
Added
@@ -0,0 +1,103 @@ +// Copyright 2022 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- +// +// Sharp RGB to YUV conversion. + +#ifndef WEBP_SHARPYUV_SHARPYUV_H_ +#define WEBP_SHARPYUV_SHARPYUV_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef SHARPYUV_EXTERN +#ifdef WEBP_EXTERN +#define SHARPYUV_EXTERN WEBP_EXTERN +#else +// This explicitly marks library functions and allows for changing the +// signature for e.g., Windows DLL builds. +#if defined(__GNUC__) && __GNUC__ >= 4 +#define SHARPYUV_EXTERN extern __attribute__((visibility("default"))) +#else +#if defined(_MSC_VER) && defined(WEBP_DLL) +#define SHARPYUV_EXTERN __declspec(dllexport) +#else +#define SHARPYUV_EXTERN extern +#endif /* _MSC_VER && WEBP_DLL */ +#endif /* __GNUC__ >= 4 */ +#endif /* WEBP_EXTERN */ +#endif /* SHARPYUV_EXTERN */ + +// SharpYUV API version following the convention from semver.org +#define SHARPYUV_VERSION_MAJOR 0 +#define SHARPYUV_VERSION_MINOR 2 +#define SHARPYUV_VERSION_PATCH 0 +// Version as a uint32_t. The major number is the high 8 bits. +// The minor number is the middle 8 bits. The patch number is the low 16 bits. +#define SHARPYUV_MAKE_VERSION(MAJOR, MINOR, PATCH) \ + (((MAJOR) << 24) | ((MINOR) << 16) | (PATCH)) +#define SHARPYUV_VERSION \ + SHARPYUV_MAKE_VERSION(SHARPYUV_VERSION_MAJOR, SHARPYUV_VERSION_MINOR, \ + SHARPYUV_VERSION_PATCH) + +// Returns the library's version number, packed in hexadecimal. See +// SHARPYUV_VERSION. +SHARPYUV_EXTERN int SharpYuvGetVersion(void); + +// RGB to YUV conversion matrix, in 16 bit fixed point. +// y = rgb_to_y0 * r + rgb_to_y1 * g + rgb_to_y2 * b + rgb_to_y3 +// u = rgb_to_u0 * r + rgb_to_u1 * g + rgb_to_u2 * b + rgb_to_u3 +// v = rgb_to_v0 * r + rgb_to_v1 * g + rgb_to_v2 * b + rgb_to_v3 +// Then y, u and v values are divided by 1<<16 and rounded. +typedef struct { + int rgb_to_y4; + int rgb_to_u4; + int rgb_to_v4; +} SharpYuvConversionMatrix; + +// Converts RGB to YUV420 using a downsampling algorithm that minimizes +// artefacts caused by chroma subsampling. +// This is slower than standard downsampling (averaging of 4 UV values). +// Assumes that the image will be upsampled using a bilinear filter. If nearest +// neighbor is used instead, the upsampled image might look worse than with +// standard downsampling. +// r_ptr, g_ptr, b_ptr: pointers to the source r, g and b channels. Should point +// to uint8_t buffers if rgb_bit_depth is 8, or uint16_t buffers otherwise. +// rgb_step: distance in bytes between two horizontally adjacent pixels on the +// r, g and b channels. If rgb_bit_depth is > 8, it should be a +// multiple of 2. +// rgb_stride: distance in bytes between two vertically adjacent pixels on the +// r, g, and b channels. If rgb_bit_depth is > 8, it should be a +// multiple of 2. +// rgb_bit_depth: number of bits for each r/g/b value. One of: 8, 10, 12, 16. +// Note: 16 bit input is truncated to 14 bits before conversion to yuv. +// yuv_bit_depth: number of bits for each y/u/v value. One of: 8, 10, 12. +// y_ptr, u_ptr, v_ptr: pointers to the destination y, u and v channels. Should +// point to uint8_t buffers if yuv_bit_depth is 8, or uint16_t buffers +// otherwise. +// y_stride, u_stride, v_stride: distance in bytes between two vertically +// adjacent pixels on the y, u and v channels. If yuv_bit_depth > 8, they +// should be multiples of 2. +// width, height: width and height of the image in pixels +SHARPYUV_EXTERN int SharpYuvConvert(const void* r_ptr, const void* g_ptr, + const void* b_ptr, int rgb_step, + int rgb_stride, int rgb_bit_depth, + void* y_ptr, int y_stride, void* u_ptr, + int u_stride, void* v_ptr, int v_stride, + int yuv_bit_depth, int width, int height, + const SharpYuvConversionMatrix* yuv_matrix); + +// TODO(b/194336375): Add YUV444 to YUV420 conversion. Maybe also add 422 +// support (it's rarely used in practice, especially for images). + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // WEBP_SHARPYUV_SHARPYUV_H_
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/sharpyuv/sharpyuv_cpu.c
Added
@@ -0,0 +1,14 @@ +// Copyright 2022 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- +// +#include "sharpyuv/sharpyuv_cpu.h" + +// Include src/dsp/cpu.c to create SharpYuvGetCPUInfo from VP8GetCPUInfo. The +// function pointer is renamed in sharpyuv_cpu.h. +#include "src/dsp/cpu.c"
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/sharpyuv/sharpyuv_cpu.h
Added
@@ -0,0 +1,22 @@ +// Copyright 2022 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- +// +#ifndef WEBP_SHARPYUV_SHARPYUV_CPU_H_ +#define WEBP_SHARPYUV_SHARPYUV_CPU_H_ + +#include "sharpyuv/sharpyuv.h" + +// Avoid exporting SharpYuvGetCPUInfo in shared object / DLL builds. +// SharpYuvInit() replaces the use of the function pointer. +#undef WEBP_EXTERN +#define WEBP_EXTERN extern +#define VP8GetCPUInfo SharpYuvGetCPUInfo +#include "src/dsp/cpu.h" + +#endif // WEBP_SHARPYUV_SHARPYUV_CPU_H_
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/sharpyuv/sharpyuv_csp.c
Added
@@ -0,0 +1,110 @@ +// Copyright 2022 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- +// +// Colorspace utilities. + +#include "sharpyuv/sharpyuv_csp.h" + +#include <assert.h> +#include <math.h> +#include <stddef.h> + +static int ToFixed16(float f) { return (int)floor(f * (1 << 16) + 0.5f); } + +void SharpYuvComputeConversionMatrix(const SharpYuvColorSpace* yuv_color_space, + SharpYuvConversionMatrix* matrix) { + const float kr = yuv_color_space->kr; + const float kb = yuv_color_space->kb; + const float kg = 1.0f - kr - kb; + const float cr = 0.5f / (1.0f - kb); + const float cb = 0.5f / (1.0f - kr); + + const int shift = yuv_color_space->bit_depth - 8; + + const float denom = (float)((1 << yuv_color_space->bit_depth) - 1); + float scale_y = 1.0f; + float add_y = 0.0f; + float scale_u = cr; + float scale_v = cb; + float add_uv = (float)(128 << shift); + assert(yuv_color_space->bit_depth >= 8); + + if (yuv_color_space->range == kSharpYuvRangeLimited) { + scale_y *= (219 << shift) / denom; + scale_u *= (224 << shift) / denom; + scale_v *= (224 << shift) / denom; + add_y = (float)(16 << shift); + } + + matrix->rgb_to_y0 = ToFixed16(kr * scale_y); + matrix->rgb_to_y1 = ToFixed16(kg * scale_y); + matrix->rgb_to_y2 = ToFixed16(kb * scale_y); + matrix->rgb_to_y3 = ToFixed16(add_y); + + matrix->rgb_to_u0 = ToFixed16(-kr * scale_u); + matrix->rgb_to_u1 = ToFixed16(-kg * scale_u); + matrix->rgb_to_u2 = ToFixed16((1 - kb) * scale_u); + matrix->rgb_to_u3 = ToFixed16(add_uv); + + matrix->rgb_to_v0 = ToFixed16((1 - kr) * scale_v); + matrix->rgb_to_v1 = ToFixed16(-kg * scale_v); + matrix->rgb_to_v2 = ToFixed16(-kb * scale_v); + matrix->rgb_to_v3 = ToFixed16(add_uv); +} + +// Matrices are in YUV_FIX fixed point precision. +// WebP's matrix, similar but not identical to kRec601LimitedMatrix. +static const SharpYuvConversionMatrix kWebpMatrix = { + {16839, 33059, 6420, 16 << 16}, + {-9719, -19081, 28800, 128 << 16}, + {28800, -24116, -4684, 128 << 16}, +}; +// Kr=0.2990f Kb=0.1140f bits=8 range=kSharpYuvRangeLimited +static const SharpYuvConversionMatrix kRec601LimitedMatrix = { + {16829, 33039, 6416, 16 << 16}, + {-9714, -19071, 28784, 128 << 16}, + {28784, -24103, -4681, 128 << 16}, +}; +// Kr=0.2990f Kb=0.1140f bits=8 range=kSharpYuvRangeFull +static const SharpYuvConversionMatrix kRec601FullMatrix = { + {19595, 38470, 7471, 0}, + {-11058, -21710, 32768, 128 << 16}, + {32768, -27439, -5329, 128 << 16}, +}; +// Kr=0.2126f Kb=0.0722f bits=8 range=kSharpYuvRangeLimited +static const SharpYuvConversionMatrix kRec709LimitedMatrix = { + {11966, 40254, 4064, 16 << 16}, + {-6596, -22189, 28784, 128 << 16}, + {28784, -26145, -2639, 128 << 16}, +}; +// Kr=0.2126f Kb=0.0722f bits=8 range=kSharpYuvRangeFull +static const SharpYuvConversionMatrix kRec709FullMatrix = { + {13933, 46871, 4732, 0}, + {-7509, -25259, 32768, 128 << 16}, + {32768, -29763, -3005, 128 << 16}, +}; + +const SharpYuvConversionMatrix* SharpYuvGetConversionMatrix( + SharpYuvMatrixType matrix_type) { + switch (matrix_type) { + case kSharpYuvMatrixWebp: + return &kWebpMatrix; + case kSharpYuvMatrixRec601Limited: + return &kRec601LimitedMatrix; + case kSharpYuvMatrixRec601Full: + return &kRec601FullMatrix; + case kSharpYuvMatrixRec709Limited: + return &kRec709LimitedMatrix; + case kSharpYuvMatrixRec709Full: + return &kRec709FullMatrix; + case kSharpYuvMatrixNum: + return NULL; + } + return NULL; +}
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/sharpyuv/sharpyuv_csp.h
Added
@@ -0,0 +1,60 @@ +// Copyright 2022 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- +// +// Colorspace utilities. + +#ifndef WEBP_SHARPYUV_SHARPYUV_CSP_H_ +#define WEBP_SHARPYUV_SHARPYUV_CSP_H_ + +#include "sharpyuv/sharpyuv.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Range of YUV values. +typedef enum { + kSharpYuvRangeFull, // YUV values between 0;255 (for 8 bit) + kSharpYuvRangeLimited // Y in 16;235, YUV in 16;240 (for 8 bit) +} SharpYuvRange; + +// Constants that define a YUV color space. +typedef struct { + // Kr and Kb are defined such that: + // Y = Kr * r + Kg * g + Kb * b where Kg = 1 - Kr - Kb. + float kr; + float kb; + int bit_depth; // 8, 10 or 12 + SharpYuvRange range; +} SharpYuvColorSpace; + +// Fills in 'matrix' for the given YUVColorSpace. +SHARPYUV_EXTERN void SharpYuvComputeConversionMatrix( + const SharpYuvColorSpace* yuv_color_space, + SharpYuvConversionMatrix* matrix); + +// Enums for precomputed conversion matrices. +typedef enum { + kSharpYuvMatrixWebp = 0, + kSharpYuvMatrixRec601Limited, + kSharpYuvMatrixRec601Full, + kSharpYuvMatrixRec709Limited, + kSharpYuvMatrixRec709Full, + kSharpYuvMatrixNum +} SharpYuvMatrixType; + +// Returns a pointer to a matrix for one of the predefined colorspaces. +SHARPYUV_EXTERN const SharpYuvConversionMatrix* SharpYuvGetConversionMatrix( + SharpYuvMatrixType matrix_type); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // WEBP_SHARPYUV_SHARPYUV_CSP_H_
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/sharpyuv/sharpyuv_dsp.c
Added
@@ -0,0 +1,103 @@ +// Copyright 2022 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- +// +// Speed-critical functions for Sharp YUV. +// +// Author: Skal (pascal.massimino@gmail.com) + +#include "sharpyuv/sharpyuv_dsp.h" + +#include <assert.h> +#include <stdlib.h> + +#include "sharpyuv/sharpyuv_cpu.h" + +//----------------------------------------------------------------------------- + +#if !WEBP_NEON_OMIT_C_CODE +static uint16_t clip(int v, int max) { + return (v < 0) ? 0 : (v > max) ? max : (uint16_t)v; +} + +static uint64_t SharpYuvUpdateY_C(const uint16_t* ref, const uint16_t* src, + uint16_t* dst, int len, int bit_depth) { + uint64_t diff = 0; + int i; + const int max_y = (1 << bit_depth) - 1; + for (i = 0; i < len; ++i) { + const int diff_y = refi - srci; + const int new_y = (int)dsti + diff_y; + dsti = clip(new_y, max_y); + diff += (uint64_t)abs(diff_y); + } + return diff; +} + +static void SharpYuvUpdateRGB_C(const int16_t* ref, const int16_t* src, + int16_t* dst, int len) { + int i; + for (i = 0; i < len; ++i) { + const int diff_uv = refi - srci; + dsti += diff_uv; + } +} + +static void SharpYuvFilterRow_C(const int16_t* A, const int16_t* B, int len, + const uint16_t* best_y, uint16_t* out, + int bit_depth) { + int i; + const int max_y = (1 << bit_depth) - 1; + for (i = 0; i < len; ++i, ++A, ++B) { + const int v0 = (A0 * 9 + A1 * 3 + B0 * 3 + B1 + 8) >> 4; + const int v1 = (A1 * 9 + A0 * 3 + B1 * 3 + B0 + 8) >> 4; + out2 * i + 0 = clip(best_y2 * i + 0 + v0, max_y); + out2 * i + 1 = clip(best_y2 * i + 1 + v1, max_y); + } +} +#endif // !WEBP_NEON_OMIT_C_CODE + +//----------------------------------------------------------------------------- + +uint64_t (*SharpYuvUpdateY)(const uint16_t* src, const uint16_t* ref, + uint16_t* dst, int len, int bit_depth); +void (*SharpYuvUpdateRGB)(const int16_t* src, const int16_t* ref, int16_t* dst, + int len); +void (*SharpYuvFilterRow)(const int16_t* A, const int16_t* B, int len, + const uint16_t* best_y, uint16_t* out, + int bit_depth); + +extern void InitSharpYuvSSE2(void); +extern void InitSharpYuvNEON(void); + +void SharpYuvInitDsp(void) { +#if !WEBP_NEON_OMIT_C_CODE + SharpYuvUpdateY = SharpYuvUpdateY_C; + SharpYuvUpdateRGB = SharpYuvUpdateRGB_C; + SharpYuvFilterRow = SharpYuvFilterRow_C; +#endif + + if (SharpYuvGetCPUInfo != NULL) { +#if defined(WEBP_HAVE_SSE2) + if (SharpYuvGetCPUInfo(kSSE2)) { + InitSharpYuvSSE2(); + } +#endif // WEBP_HAVE_SSE2 + } + +#if defined(WEBP_HAVE_NEON) + if (WEBP_NEON_OMIT_C_CODE || + (SharpYuvGetCPUInfo != NULL && SharpYuvGetCPUInfo(kNEON))) { + InitSharpYuvNEON(); + } +#endif // WEBP_HAVE_NEON + + assert(SharpYuvUpdateY != NULL); + assert(SharpYuvUpdateRGB != NULL); + assert(SharpYuvFilterRow != NULL); +}
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/sharpyuv/sharpyuv_dsp.h
Added
@@ -0,0 +1,28 @@ +// Copyright 2022 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- +// +// Speed-critical functions for Sharp YUV. + +#ifndef WEBP_SHARPYUV_SHARPYUV_DSP_H_ +#define WEBP_SHARPYUV_SHARPYUV_DSP_H_ + +#include "sharpyuv/sharpyuv_cpu.h" +#include "src/webp/types.h" + +extern uint64_t (*SharpYuvUpdateY)(const uint16_t* src, const uint16_t* ref, + uint16_t* dst, int len, int bit_depth); +extern void (*SharpYuvUpdateRGB)(const int16_t* src, const int16_t* ref, + int16_t* dst, int len); +extern void (*SharpYuvFilterRow)(const int16_t* A, const int16_t* B, int len, + const uint16_t* best_y, uint16_t* out, + int bit_depth); + +void SharpYuvInitDsp(void); + +#endif // WEBP_SHARPYUV_SHARPYUV_DSP_H_
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/sharpyuv/sharpyuv_gamma.c
Added
@@ -0,0 +1,113 @@ +// Copyright 2022 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- +// +// Gamma correction utilities. + +#include "sharpyuv/sharpyuv_gamma.h" + +#include <assert.h> +#include <math.h> + +#include "src/webp/types.h" + +// Gamma correction compensates loss of resolution during chroma subsampling. +// Size of pre-computed table for converting from gamma to linear. +#define GAMMA_TO_LINEAR_TAB_BITS 10 +#define GAMMA_TO_LINEAR_TAB_SIZE (1 << GAMMA_TO_LINEAR_TAB_BITS) +static uint32_t kGammaToLinearTabSGAMMA_TO_LINEAR_TAB_SIZE + 2; +#define LINEAR_TO_GAMMA_TAB_BITS 9 +#define LINEAR_TO_GAMMA_TAB_SIZE (1 << LINEAR_TO_GAMMA_TAB_BITS) +static uint32_t kLinearToGammaTabSLINEAR_TO_GAMMA_TAB_SIZE + 2; + +static const double kGammaF = 1. / 0.45; +#define GAMMA_TO_LINEAR_BITS 16 + +static volatile int kGammaTablesSOk = 0; +void SharpYuvInitGammaTables(void) { + assert(GAMMA_TO_LINEAR_BITS <= 16); + if (!kGammaTablesSOk) { + int v; + const double a = 0.09929682680944; + const double thresh = 0.018053968510807; + const double final_scale = 1 << GAMMA_TO_LINEAR_BITS; + // Precompute gamma to linear table. + { + const double norm = 1. / GAMMA_TO_LINEAR_TAB_SIZE; + const double a_rec = 1. / (1. + a); + for (v = 0; v <= GAMMA_TO_LINEAR_TAB_SIZE; ++v) { + const double g = norm * v; + double value; + if (g <= thresh * 4.5) { + value = g / 4.5; + } else { + value = pow(a_rec * (g + a), kGammaF); + } + kGammaToLinearTabSv = (uint32_t)(value * final_scale + .5); + } + // to prevent small rounding errors to cause read-overflow: + kGammaToLinearTabSGAMMA_TO_LINEAR_TAB_SIZE + 1 = + kGammaToLinearTabSGAMMA_TO_LINEAR_TAB_SIZE; + } + // Precompute linear to gamma table. + { + const double scale = 1. / LINEAR_TO_GAMMA_TAB_SIZE; + for (v = 0; v <= LINEAR_TO_GAMMA_TAB_SIZE; ++v) { + const double g = scale * v; + double value; + if (g <= thresh) { + value = 4.5 * g; + } else { + value = (1. + a) * pow(g, 1. / kGammaF) - a; + } + kLinearToGammaTabSv = + (uint32_t)(final_scale * value + 0.5); + } + // to prevent small rounding errors to cause read-overflow: + kLinearToGammaTabSLINEAR_TO_GAMMA_TAB_SIZE + 1 = + kLinearToGammaTabSLINEAR_TO_GAMMA_TAB_SIZE; + } + kGammaTablesSOk = 1; + } +} + +static WEBP_INLINE int Shift(int v, int shift) { + return (shift >= 0) ? (v << shift) : (v >> -shift); +} + +static WEBP_INLINE uint32_t FixedPointInterpolation(int v, uint32_t* tab, + int tab_pos_shift_right, + int tab_value_shift) { + const uint32_t tab_pos = Shift(v, -tab_pos_shift_right); + // fractional part, in 'tab_pos_shift' fixed-point precision + const uint32_t x = v - (tab_pos << tab_pos_shift_right); // fractional part + // v0 / v1 are in kGammaToLinearBits fixed-point precision (range 0..1) + const uint32_t v0 = Shift(tabtab_pos + 0, tab_value_shift); + const uint32_t v1 = Shift(tabtab_pos + 1, tab_value_shift); + // Final interpolation. + const uint32_t v2 = (v1 - v0) * x; // note: v1 >= v0. + const int half = + (tab_pos_shift_right > 0) ? 1 << (tab_pos_shift_right - 1) : 0; + const uint32_t result = v0 + ((v2 + half) >> tab_pos_shift_right); + return result; +} + +uint32_t SharpYuvGammaToLinear(uint16_t v, int bit_depth) { + const int shift = GAMMA_TO_LINEAR_TAB_BITS - bit_depth; + if (shift > 0) { + return kGammaToLinearTabSv << shift; + } + return FixedPointInterpolation(v, kGammaToLinearTabS, -shift, 0); +} + +uint16_t SharpYuvLinearToGamma(uint32_t value, int bit_depth) { + return FixedPointInterpolation( + value, kLinearToGammaTabS, + (GAMMA_TO_LINEAR_BITS - LINEAR_TO_GAMMA_TAB_BITS), + bit_depth - GAMMA_TO_LINEAR_BITS); +}
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/sharpyuv/sharpyuv_gamma.h
Added
@@ -0,0 +1,35 @@ +// Copyright 2022 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- +// +// Gamma correction utilities. + +#ifndef WEBP_SHARPYUV_SHARPYUV_GAMMA_H_ +#define WEBP_SHARPYUV_SHARPYUV_GAMMA_H_ + +#include "src/webp/types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Initializes precomputed tables. Must be called once before calling +// SharpYuvGammaToLinear or SharpYuvLinearToGamma. +void SharpYuvInitGammaTables(void); + +// Converts a gamma color value on 'bit_depth' bits to a 16 bit linear value. +uint32_t SharpYuvGammaToLinear(uint16_t v, int bit_depth); + +// Converts a 16 bit linear color value to a gamma value on 'bit_depth' bits. +uint16_t SharpYuvLinearToGamma(uint32_t value, int bit_depth); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // WEBP_SHARPYUV_SHARPYUV_GAMMA_H_
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/sharpyuv/sharpyuv_neon.c
Added
@@ -0,0 +1,181 @@ +// Copyright 2022 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- +// +// Speed-critical functions for Sharp YUV. +// +// Author: Skal (pascal.massimino@gmail.com) + +#include "sharpyuv/sharpyuv_dsp.h" + +#if defined(WEBP_USE_NEON) +#include <assert.h> +#include <stdlib.h> +#include <arm_neon.h> + +static uint16_t clip_NEON(int v, int max) { + return (v < 0) ? 0 : (v > max) ? max : (uint16_t)v; +} + +static uint64_t SharpYuvUpdateY_NEON(const uint16_t* ref, const uint16_t* src, + uint16_t* dst, int len, int bit_depth) { + const int max_y = (1 << bit_depth) - 1; + int i; + const int16x8_t zero = vdupq_n_s16(0); + const int16x8_t max = vdupq_n_s16(max_y); + uint64x2_t sum = vdupq_n_u64(0); + uint64_t diff; + + for (i = 0; i + 8 <= len; i += 8) { + const int16x8_t A = vreinterpretq_s16_u16(vld1q_u16(ref + i)); + const int16x8_t B = vreinterpretq_s16_u16(vld1q_u16(src + i)); + const int16x8_t C = vreinterpretq_s16_u16(vld1q_u16(dst + i)); + const int16x8_t D = vsubq_s16(A, B); // diff_y + const int16x8_t F = vaddq_s16(C, D); // new_y + const uint16x8_t H = + vreinterpretq_u16_s16(vmaxq_s16(vminq_s16(F, max), zero)); + const int16x8_t I = vabsq_s16(D); // abs(diff_y) + vst1q_u16(dst + i, H); + sum = vpadalq_u32(sum, vpaddlq_u16(vreinterpretq_u16_s16(I))); + } + diff = vgetq_lane_u64(sum, 0) + vgetq_lane_u64(sum, 1); + for (; i < len; ++i) { + const int diff_y = refi - srci; + const int new_y = (int)(dsti) + diff_y; + dsti = clip_NEON(new_y, max_y); + diff += (uint64_t)(abs(diff_y)); + } + return diff; +} + +static void SharpYuvUpdateRGB_NEON(const int16_t* ref, const int16_t* src, + int16_t* dst, int len) { + int i; + for (i = 0; i + 8 <= len; i += 8) { + const int16x8_t A = vld1q_s16(ref + i); + const int16x8_t B = vld1q_s16(src + i); + const int16x8_t C = vld1q_s16(dst + i); + const int16x8_t D = vsubq_s16(A, B); // diff_uv + const int16x8_t E = vaddq_s16(C, D); // new_uv + vst1q_s16(dst + i, E); + } + for (; i < len; ++i) { + const int diff_uv = refi - srci; + dsti += diff_uv; + } +} + +static void SharpYuvFilterRow16_NEON(const int16_t* A, const int16_t* B, + int len, const uint16_t* best_y, + uint16_t* out, int bit_depth) { + const int max_y = (1 << bit_depth) - 1; + int i; + const int16x8_t max = vdupq_n_s16(max_y); + const int16x8_t zero = vdupq_n_s16(0); + for (i = 0; i + 8 <= len; i += 8) { + const int16x8_t a0 = vld1q_s16(A + i + 0); + const int16x8_t a1 = vld1q_s16(A + i + 1); + const int16x8_t b0 = vld1q_s16(B + i + 0); + const int16x8_t b1 = vld1q_s16(B + i + 1); + const int16x8_t a0b1 = vaddq_s16(a0, b1); + const int16x8_t a1b0 = vaddq_s16(a1, b0); + const int16x8_t a0a1b0b1 = vaddq_s16(a0b1, a1b0); // A0+A1+B0+B1 + const int16x8_t a0b1_2 = vaddq_s16(a0b1, a0b1); // 2*(A0+B1) + const int16x8_t a1b0_2 = vaddq_s16(a1b0, a1b0); // 2*(A1+B0) + const int16x8_t c0 = vshrq_n_s16(vaddq_s16(a0b1_2, a0a1b0b1), 3); + const int16x8_t c1 = vshrq_n_s16(vaddq_s16(a1b0_2, a0a1b0b1), 3); + const int16x8_t e0 = vrhaddq_s16(c1, a0); + const int16x8_t e1 = vrhaddq_s16(c0, a1); + const int16x8x2_t f = vzipq_s16(e0, e1); + const int16x8_t g0 = vreinterpretq_s16_u16(vld1q_u16(best_y + 2 * i + 0)); + const int16x8_t g1 = vreinterpretq_s16_u16(vld1q_u16(best_y + 2 * i + 8)); + const int16x8_t h0 = vaddq_s16(g0, f.val0); + const int16x8_t h1 = vaddq_s16(g1, f.val1); + const int16x8_t i0 = vmaxq_s16(vminq_s16(h0, max), zero); + const int16x8_t i1 = vmaxq_s16(vminq_s16(h1, max), zero); + vst1q_u16(out + 2 * i + 0, vreinterpretq_u16_s16(i0)); + vst1q_u16(out + 2 * i + 8, vreinterpretq_u16_s16(i1)); + } + for (; i < len; ++i) { + const int a0b1 = Ai + 0 + Bi + 1; + const int a1b0 = Ai + 1 + Bi + 0; + const int a0a1b0b1 = a0b1 + a1b0 + 8; + const int v0 = (8 * Ai + 0 + 2 * a1b0 + a0a1b0b1) >> 4; + const int v1 = (8 * Ai + 1 + 2 * a0b1 + a0a1b0b1) >> 4; + out2 * i + 0 = clip_NEON(best_y2 * i + 0 + v0, max_y); + out2 * i + 1 = clip_NEON(best_y2 * i + 1 + v1, max_y); + } +} + +static void SharpYuvFilterRow32_NEON(const int16_t* A, const int16_t* B, + int len, const uint16_t* best_y, + uint16_t* out, int bit_depth) { + const int max_y = (1 << bit_depth) - 1; + int i; + const uint16x8_t max = vdupq_n_u16(max_y); + for (i = 0; i + 4 <= len; i += 4) { + const int16x4_t a0 = vld1_s16(A + i + 0); + const int16x4_t a1 = vld1_s16(A + i + 1); + const int16x4_t b0 = vld1_s16(B + i + 0); + const int16x4_t b1 = vld1_s16(B + i + 1); + const int32x4_t a0b1 = vaddl_s16(a0, b1); + const int32x4_t a1b0 = vaddl_s16(a1, b0); + const int32x4_t a0a1b0b1 = vaddq_s32(a0b1, a1b0); // A0+A1+B0+B1 + const int32x4_t a0b1_2 = vaddq_s32(a0b1, a0b1); // 2*(A0+B1) + const int32x4_t a1b0_2 = vaddq_s32(a1b0, a1b0); // 2*(A1+B0) + const int32x4_t c0 = vshrq_n_s32(vaddq_s32(a0b1_2, a0a1b0b1), 3); + const int32x4_t c1 = vshrq_n_s32(vaddq_s32(a1b0_2, a0a1b0b1), 3); + const int32x4_t e0 = vrhaddq_s32(c1, vmovl_s16(a0)); + const int32x4_t e1 = vrhaddq_s32(c0, vmovl_s16(a1)); + const int32x4x2_t f = vzipq_s32(e0, e1); + + const int16x8_t g = vreinterpretq_s16_u16(vld1q_u16(best_y + 2 * i)); + const int32x4_t h0 = vaddw_s16(f.val0, vget_low_s16(g)); + const int32x4_t h1 = vaddw_s16(f.val1, vget_high_s16(g)); + const uint16x8_t i_16 = vcombine_u16(vqmovun_s32(h0), vqmovun_s32(h1)); + const uint16x8_t i_clamped = vminq_u16(i_16, max); + vst1q_u16(out + 2 * i + 0, i_clamped); + } + for (; i < len; ++i) { + const int a0b1 = Ai + 0 + Bi + 1; + const int a1b0 = Ai + 1 + Bi + 0; + const int a0a1b0b1 = a0b1 + a1b0 + 8; + const int v0 = (8 * Ai + 0 + 2 * a1b0 + a0a1b0b1) >> 4; + const int v1 = (8 * Ai + 1 + 2 * a0b1 + a0a1b0b1) >> 4; + out2 * i + 0 = clip_NEON(best_y2 * i + 0 + v0, max_y); + out2 * i + 1 = clip_NEON(best_y2 * i + 1 + v1, max_y); + } +} + +static void SharpYuvFilterRow_NEON(const int16_t* A, const int16_t* B, int len, + const uint16_t* best_y, uint16_t* out, + int bit_depth) { + if (bit_depth <= 10) { + SharpYuvFilterRow16_NEON(A, B, len, best_y, out, bit_depth); + } else { + SharpYuvFilterRow32_NEON(A, B, len, best_y, out, bit_depth); + } +} + +//------------------------------------------------------------------------------ + +extern void InitSharpYuvNEON(void); + +WEBP_TSAN_IGNORE_FUNCTION void InitSharpYuvNEON(void) { + SharpYuvUpdateY = SharpYuvUpdateY_NEON; + SharpYuvUpdateRGB = SharpYuvUpdateRGB_NEON; + SharpYuvFilterRow = SharpYuvFilterRow_NEON; +} + +#else // !WEBP_USE_NEON + +extern void InitSharpYuvNEON(void); + +void InitSharpYuvNEON(void) {} + +#endif // WEBP_USE_NEON
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/sharpyuv/sharpyuv_sse2.c
Added
@@ -0,0 +1,201 @@ +// Copyright 2022 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- +// +// Speed-critical functions for Sharp YUV. +// +// Author: Skal (pascal.massimino@gmail.com) + +#include "sharpyuv/sharpyuv_dsp.h" + +#if defined(WEBP_USE_SSE2) +#include <stdlib.h> +#include <emmintrin.h> + +static uint16_t clip_SSE2(int v, int max) { + return (v < 0) ? 0 : (v > max) ? max : (uint16_t)v; +} + +static uint64_t SharpYuvUpdateY_SSE2(const uint16_t* ref, const uint16_t* src, + uint16_t* dst, int len, int bit_depth) { + const int max_y = (1 << bit_depth) - 1; + uint64_t diff = 0; + uint32_t tmp4; + int i; + const __m128i zero = _mm_setzero_si128(); + const __m128i max = _mm_set1_epi16(max_y); + const __m128i one = _mm_set1_epi16(1); + __m128i sum = zero; + + for (i = 0; i + 8 <= len; i += 8) { + const __m128i A = _mm_loadu_si128((const __m128i*)(ref + i)); + const __m128i B = _mm_loadu_si128((const __m128i*)(src + i)); + const __m128i C = _mm_loadu_si128((const __m128i*)(dst + i)); + const __m128i D = _mm_sub_epi16(A, B); // diff_y + const __m128i E = _mm_cmpgt_epi16(zero, D); // sign (-1 or 0) + const __m128i F = _mm_add_epi16(C, D); // new_y + const __m128i G = _mm_or_si128(E, one); // -1 or 1 + const __m128i H = _mm_max_epi16(_mm_min_epi16(F, max), zero); + const __m128i I = _mm_madd_epi16(D, G); // sum(abs(...)) + _mm_storeu_si128((__m128i*)(dst + i), H); + sum = _mm_add_epi32(sum, I); + } + _mm_storeu_si128((__m128i*)tmp, sum); + diff = tmp3 + tmp2 + tmp1 + tmp0; + for (; i < len; ++i) { + const int diff_y = refi - srci; + const int new_y = (int)dsti + diff_y; + dsti = clip_SSE2(new_y, max_y); + diff += (uint64_t)abs(diff_y); + } + return diff; +} + +static void SharpYuvUpdateRGB_SSE2(const int16_t* ref, const int16_t* src, + int16_t* dst, int len) { + int i = 0; + for (i = 0; i + 8 <= len; i += 8) { + const __m128i A = _mm_loadu_si128((const __m128i*)(ref + i)); + const __m128i B = _mm_loadu_si128((const __m128i*)(src + i)); + const __m128i C = _mm_loadu_si128((const __m128i*)(dst + i)); + const __m128i D = _mm_sub_epi16(A, B); // diff_uv + const __m128i E = _mm_add_epi16(C, D); // new_uv + _mm_storeu_si128((__m128i*)(dst + i), E); + } + for (; i < len; ++i) { + const int diff_uv = refi - srci; + dsti += diff_uv; + } +} + +static void SharpYuvFilterRow16_SSE2(const int16_t* A, const int16_t* B, + int len, const uint16_t* best_y, + uint16_t* out, int bit_depth) { + const int max_y = (1 << bit_depth) - 1; + int i; + const __m128i kCst8 = _mm_set1_epi16(8); + const __m128i max = _mm_set1_epi16(max_y); + const __m128i zero = _mm_setzero_si128(); + for (i = 0; i + 8 <= len; i += 8) { + const __m128i a0 = _mm_loadu_si128((const __m128i*)(A + i + 0)); + const __m128i a1 = _mm_loadu_si128((const __m128i*)(A + i + 1)); + const __m128i b0 = _mm_loadu_si128((const __m128i*)(B + i + 0)); + const __m128i b1 = _mm_loadu_si128((const __m128i*)(B + i + 1)); + const __m128i a0b1 = _mm_add_epi16(a0, b1); + const __m128i a1b0 = _mm_add_epi16(a1, b0); + const __m128i a0a1b0b1 = _mm_add_epi16(a0b1, a1b0); // A0+A1+B0+B1 + const __m128i a0a1b0b1_8 = _mm_add_epi16(a0a1b0b1, kCst8); + const __m128i a0b1_2 = _mm_add_epi16(a0b1, a0b1); // 2*(A0+B1) + const __m128i a1b0_2 = _mm_add_epi16(a1b0, a1b0); // 2*(A1+B0) + const __m128i c0 = _mm_srai_epi16(_mm_add_epi16(a0b1_2, a0a1b0b1_8), 3); + const __m128i c1 = _mm_srai_epi16(_mm_add_epi16(a1b0_2, a0a1b0b1_8), 3); + const __m128i d0 = _mm_add_epi16(c1, a0); + const __m128i d1 = _mm_add_epi16(c0, a1); + const __m128i e0 = _mm_srai_epi16(d0, 1); + const __m128i e1 = _mm_srai_epi16(d1, 1); + const __m128i f0 = _mm_unpacklo_epi16(e0, e1); + const __m128i f1 = _mm_unpackhi_epi16(e0, e1); + const __m128i g0 = _mm_loadu_si128((const __m128i*)(best_y + 2 * i + 0)); + const __m128i g1 = _mm_loadu_si128((const __m128i*)(best_y + 2 * i + 8)); + const __m128i h0 = _mm_add_epi16(g0, f0); + const __m128i h1 = _mm_add_epi16(g1, f1); + const __m128i i0 = _mm_max_epi16(_mm_min_epi16(h0, max), zero); + const __m128i i1 = _mm_max_epi16(_mm_min_epi16(h1, max), zero); + _mm_storeu_si128((__m128i*)(out + 2 * i + 0), i0); + _mm_storeu_si128((__m128i*)(out + 2 * i + 8), i1); + } + for (; i < len; ++i) { + // (9 * A0 + 3 * A1 + 3 * B0 + B1 + 8) >> 4 = + // = (8 * A0 + 2 * (A1 + B0) + (A0 + A1 + B0 + B1 + 8)) >> 4 + // We reuse the common sub-expressions. + const int a0b1 = Ai + 0 + Bi + 1; + const int a1b0 = Ai + 1 + Bi + 0; + const int a0a1b0b1 = a0b1 + a1b0 + 8; + const int v0 = (8 * Ai + 0 + 2 * a1b0 + a0a1b0b1) >> 4; + const int v1 = (8 * Ai + 1 + 2 * a0b1 + a0a1b0b1) >> 4; + out2 * i + 0 = clip_SSE2(best_y2 * i + 0 + v0, max_y); + out2 * i + 1 = clip_SSE2(best_y2 * i + 1 + v1, max_y); + } +} + +static WEBP_INLINE __m128i s16_to_s32(__m128i in) { + return _mm_srai_epi32(_mm_unpacklo_epi16(in, in), 16); +} + +static void SharpYuvFilterRow32_SSE2(const int16_t* A, const int16_t* B, + int len, const uint16_t* best_y, + uint16_t* out, int bit_depth) { + const int max_y = (1 << bit_depth) - 1; + int i; + const __m128i kCst8 = _mm_set1_epi32(8); + const __m128i max = _mm_set1_epi16(max_y); + const __m128i zero = _mm_setzero_si128(); + for (i = 0; i + 4 <= len; i += 4) { + const __m128i a0 = s16_to_s32(_mm_loadl_epi64((const __m128i*)(A + i + 0))); + const __m128i a1 = s16_to_s32(_mm_loadl_epi64((const __m128i*)(A + i + 1))); + const __m128i b0 = s16_to_s32(_mm_loadl_epi64((const __m128i*)(B + i + 0))); + const __m128i b1 = s16_to_s32(_mm_loadl_epi64((const __m128i*)(B + i + 1))); + const __m128i a0b1 = _mm_add_epi32(a0, b1); + const __m128i a1b0 = _mm_add_epi32(a1, b0); + const __m128i a0a1b0b1 = _mm_add_epi32(a0b1, a1b0); // A0+A1+B0+B1 + const __m128i a0a1b0b1_8 = _mm_add_epi32(a0a1b0b1, kCst8); + const __m128i a0b1_2 = _mm_add_epi32(a0b1, a0b1); // 2*(A0+B1) + const __m128i a1b0_2 = _mm_add_epi32(a1b0, a1b0); // 2*(A1+B0) + const __m128i c0 = _mm_srai_epi32(_mm_add_epi32(a0b1_2, a0a1b0b1_8), 3); + const __m128i c1 = _mm_srai_epi32(_mm_add_epi32(a1b0_2, a0a1b0b1_8), 3); + const __m128i d0 = _mm_add_epi32(c1, a0); + const __m128i d1 = _mm_add_epi32(c0, a1); + const __m128i e0 = _mm_srai_epi32(d0, 1); + const __m128i e1 = _mm_srai_epi32(d1, 1); + const __m128i f0 = _mm_unpacklo_epi32(e0, e1); + const __m128i f1 = _mm_unpackhi_epi32(e0, e1); + const __m128i g = _mm_loadu_si128((const __m128i*)(best_y + 2 * i + 0)); + const __m128i h_16 = _mm_add_epi16(g, _mm_packs_epi32(f0, f1)); + const __m128i final = _mm_max_epi16(_mm_min_epi16(h_16, max), zero); + _mm_storeu_si128((__m128i*)(out + 2 * i + 0), final); + } + for (; i < len; ++i) { + // (9 * A0 + 3 * A1 + 3 * B0 + B1 + 8) >> 4 = + // = (8 * A0 + 2 * (A1 + B0) + (A0 + A1 + B0 + B1 + 8)) >> 4 + // We reuse the common sub-expressions. + const int a0b1 = Ai + 0 + Bi + 1; + const int a1b0 = Ai + 1 + Bi + 0; + const int a0a1b0b1 = a0b1 + a1b0 + 8; + const int v0 = (8 * Ai + 0 + 2 * a1b0 + a0a1b0b1) >> 4; + const int v1 = (8 * Ai + 1 + 2 * a0b1 + a0a1b0b1) >> 4; + out2 * i + 0 = clip_SSE2(best_y2 * i + 0 + v0, max_y); + out2 * i + 1 = clip_SSE2(best_y2 * i + 1 + v1, max_y); + } +} + +static void SharpYuvFilterRow_SSE2(const int16_t* A, const int16_t* B, int len, + const uint16_t* best_y, uint16_t* out, + int bit_depth) { + if (bit_depth <= 10) { + SharpYuvFilterRow16_SSE2(A, B, len, best_y, out, bit_depth); + } else { + SharpYuvFilterRow32_SSE2(A, B, len, best_y, out, bit_depth); + } +} + +//------------------------------------------------------------------------------ + +extern void InitSharpYuvSSE2(void); + +WEBP_TSAN_IGNORE_FUNCTION void InitSharpYuvSSE2(void) { + SharpYuvUpdateY = SharpYuvUpdateY_SSE2; + SharpYuvUpdateRGB = SharpYuvUpdateRGB_SSE2; + SharpYuvFilterRow = SharpYuvFilterRow_SSE2; +} +#else // !WEBP_USE_SSE2 + +extern void InitSharpYuvSSE2(void); + +void InitSharpYuvSSE2(void) {}
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/Makefile.am -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/Makefile.am
Changed
@@ -36,7 +36,7 @@ # 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:6:1 libwebpincludedir = $(includedir)/webp pkgconfig_DATA = libwebp.pc @@ -48,7 +48,7 @@ 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:6:1 pkgconfig_DATA += libwebpdecoder.pc endif
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/Makefile.in -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/Makefile.in
Changed
@@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -235,8 +235,6 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags DIST_SUBDIRS = dec enc dsp utils . mux demux am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/libwebp.pc.in \ $(srcdir)/libwebpdecoder.pc.in @@ -279,8 +277,9 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -291,8 +290,10 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +FILECMD = @FILECMD@ GIF_INCLUDES = @GIF_INCLUDES@ GIF_LIBS = @GIF_LIBS@ GL_INCLUDES = @GL_INCLUDES@ @@ -407,6 +408,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +webp_libname_prefix = @webp_libname_prefix@ # The mux and demux libraries depend on libwebp, thus the '.' to force # the build order so it's available to them. @@ -424,7 +426,7 @@ # 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:6:1 libwebpincludedir = $(includedir)/webp pkgconfig_DATA = libwebp.pc $(am__append_4) @BUILD_LIBWEBPDECODER_TRUE@libwebpdecoder_la_SOURCES = @@ -432,7 +434,7 @@ @BUILD_LIBWEBPDECODER_TRUE@ dec/libwebpdecode.la \ @BUILD_LIBWEBPDECODER_TRUE@ dsp/libwebpdspdecode.la \ @BUILD_LIBWEBPDECODER_TRUE@ utils/libwebputilsdecode.la -@BUILD_LIBWEBPDECODER_TRUE@libwebpdecoder_la_LDFLAGS = -no-undefined -version-info 4:2:1 +@BUILD_LIBWEBPDECODER_TRUE@libwebpdecoder_la_LDFLAGS = -no-undefined -version-info 4:6:1 all: all-recursive .SUFFIXES: @@ -684,7 +686,6 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dec/Makefile.in -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dec/Makefile.in
Changed
@@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -213,8 +213,6 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ @@ -230,8 +228,9 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -242,8 +241,10 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +FILECMD = @FILECMD@ GIF_INCLUDES = @GIF_INCLUDES@ GIF_LIBS = @GIF_LIBS@ GL_INCLUDES = @GL_INCLUDES@ @@ -358,6 +359,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +webp_libname_prefix = @webp_libname_prefix@ noinst_LTLIBRARIES = libwebpdecode.la libwebpdecode_la_SOURCES = alpha_dec.c alphai_dec.h buffer_dec.c \ common_dec.h vp8_dec.h frame_dec.c idec_dec.c io_dec.c \ @@ -610,7 +612,6 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dec/vp8_dec.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dec/vp8_dec.c
Changed
@@ -403,7 +403,7 @@ 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, p3, "coeffs")) {
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dec/vp8i_dec.h -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dec/vp8i_dec.h
Changed
@@ -31,8 +31,8 @@ // version numbers #define DEC_MAJ_VERSION 1 -#define DEC_MIN_VERSION 2 -#define DEC_REV_VERSION 1 +#define DEC_MIN_VERSION 3 +#define DEC_REV_VERSION 0 // YUV-cache parameters. Cache is 32-bytes wide (= one cacheline). // Constraints are: We need to store one 16x16 block of luma samples (y),
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dec/vp8l_dec.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dec/vp8l_dec.c
Changed
@@ -84,7 +84,7 @@ // 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 kTableSize12 = { FIXED_TABLE_SIZE + 654, @@ -178,7 +178,7 @@ //------------------------------------------------------------------------------ // Decodes the next Huffman code from bit-stream. -// FillBitWindow(br) needs to be called at minimum every second call +// VP8LFillBitWindow(br) needs to be called at minimum every second call // to ReadSymbol, in order to pre-fetch enough bits. static WEBP_INLINE int ReadSymbol(const HuffmanCode* table, VP8LBitReader* const br) { @@ -321,7 +321,7 @@ // The first code is either 1 bit or 8 bit code. int symbol = VP8LReadBits(br, (first_symbol_len_code == 0) ? 1 : 8); code_lengthssymbol = 1; - // The second code (if present), is always 8 bit long. + // The second code (if present), is always 8 bits long. if (num_symbols == 2) { symbol = VP8LReadBits(br, 8); code_lengthssymbol = 1; @@ -1281,7 +1281,7 @@ uint8_t* const new_data = (uint8_t*)new_color_map; new_color_map0 = transform->data_0; for (i = 4; i < 4 * num_colors; ++i) { - // Equivalent to AddPixelEq(), on a byte-basis. + // Equivalent to VP8LAddPixels(), on a byte-basis. new_datai = (datai + new_datai - 4) & 0xff; } for (; i < 4 * final_num_colors; ++i) { @@ -1336,7 +1336,7 @@ ok = ok && ExpandColorMap(num_colors, transform); break; } - case SUBTRACT_GREEN: + case SUBTRACT_GREEN_TRANSFORM: break; default: assert(0); // can't happen
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dec/webp_dec.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dec/webp_dec.c
Changed
@@ -179,7 +179,7 @@ return VP8_STATUS_BITSTREAM_ERROR; // Not a valid chunk size. } // For odd-sized chunk-payload, there's one byte padding at the end. - disk_chunk_size = (CHUNK_HEADER_SIZE + chunk_size + 1) & ~1; + disk_chunk_size = (CHUNK_HEADER_SIZE + chunk_size + 1) & ~1u; total_size += disk_chunk_size; // Check that total bytes skipped so far does not exceed riff_size.
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/demux/Makefile.am -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/demux/Makefile.am
Changed
@@ -13,6 +13,6 @@ 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:12:0 libwebpdemuxincludedir = $(includedir)/webp pkgconfig_DATA = libwebpdemux.pc
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/demux/Makefile.in -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/demux/Makefile.in
Changed
@@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -207,8 +207,6 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/libwebpdemux.pc.in \ $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -225,8 +223,9 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -237,8 +236,10 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +FILECMD = @FILECMD@ GIF_INCLUDES = @GIF_INCLUDES@ GIF_LIBS = @GIF_LIBS@ GL_INCLUDES = @GL_INCLUDES@ @@ -353,13 +354,14 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +webp_libname_prefix = @webp_libname_prefix@ lib_LTLIBRARIES = libwebpdemux.la libwebpdemux_la_SOURCES = anim_decode.c demux.c libwebpdemuxinclude_HEADERS = ../webp/decode.h ../webp/demux.h \ ../webp/mux_types.h ../webp/types.h 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:12:0 libwebpdemuxincludedir = $(includedir)/webp pkgconfig_DATA = libwebpdemux.pc all: all-am @@ -574,7 +576,6 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/demux/anim_decode.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/demux/anim_decode.c
Changed
@@ -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 @@ 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 @@ const uint32_t* const dst, int num_pixels) { int i; for (i = 0; i < num_pixels; ++i) { - const uint8_t src_alpha = (srci >> 24) & 0xff; + const uint8_t src_alpha = (srci >> CHANNEL_SHIFT(3)) & 0xff; if (src_alpha != 0xff) { srci = BlendPixelNonPremult(srci, dsti); } @@ -264,7 +272,7 @@ // 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 @@ int num_pixels) { int i; for (i = 0; i < num_pixels; ++i) { - const uint8_t src_alpha = (srci >> 24) & 0xff; + const uint8_t src_alpha = (srci >> CHANNEL_SHIFT(3)) & 0xff; if (src_alpha != 0xff) { srci = BlendPixelPremult(srci, dsti); }
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/demux/demux.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/demux/demux.c
Changed
@@ -24,8 +24,8 @@ #include "src/webp/format_constants.h" #define DMUX_MAJ_VERSION 1 -#define DMUX_MIN_VERSION 2 -#define DMUX_REV_VERSION 1 +#define DMUX_MIN_VERSION 3 +#define DMUX_REV_VERSION 0 typedef struct { size_t start_; // start location of the data @@ -614,7 +614,6 @@ while (f != NULL) { const int cur_frame_set = f->frame_num_; - int frame_count = 0; // Check frame properties. for (; f != NULL && f->frame_num_ == cur_frame_set; f = f->next_) { @@ -649,8 +648,6 @@ dmux->canvas_width_, dmux->canvas_height_)) { return 0; } - - ++frame_count; } } return 1;
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/demux/libwebpdemux.pc.in -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/demux/libwebpdemux.pc.in
Changed
@@ -8,4 +8,4 @@ Version: @PACKAGE_VERSION@ Requires: libwebp >= 0.2.0 Cflags: -I${includedir} -Libs: -L${libdir} -lwebpdemux +Libs: -L${libdir} -l@webp_libname_prefix@webpdemux
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/demux/libwebpdemux.rc -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/demux/libwebpdemux.rc
Changed
@@ -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,3,0 + PRODUCTVERSION 1,0,3,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -24,12 +24,12 @@ BEGIN VALUE "CompanyName", "Google, Inc." VALUE "FileDescription", "libwebpdemux DLL" - VALUE "FileVersion", "1.2.1" + VALUE "FileVersion", "1.3.0" VALUE "InternalName", "libwebpdemux.dll" - VALUE "LegalCopyright", "Copyright (C) 2021" + VALUE "LegalCopyright", "Copyright (C) 2022" VALUE "OriginalFilename", "libwebpdemux.dll" VALUE "ProductName", "WebP Image Demuxer" - VALUE "ProductVersion", "1.2.1" + VALUE "ProductVersion", "1.3.0" END END BLOCK "VarFileInfo"
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/Makefile.am -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/Makefile.am
Changed
@@ -24,6 +24,7 @@ COMMON_SOURCES = COMMON_SOURCES += alpha_processing.c COMMON_SOURCES += cpu.c +COMMON_SOURCES += cpu.h COMMON_SOURCES += dec.c COMMON_SOURCES += dec_clip_tables.c COMMON_SOURCES += dsp.h
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/Makefile.in -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/Makefile.in
Changed
@@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -187,8 +187,8 @@ @BUILD_LIBWEBPDECODER_TRUE@ libwebpdspdecode_msa.la \ @BUILD_LIBWEBPDECODER_TRUE@ libwebpdspdecode_mips32.la \ @BUILD_LIBWEBPDECODER_TRUE@ libwebpdspdecode_mips_dsp_r2.la -am__libwebpdspdecode_la_SOURCES_DIST = alpha_processing.c cpu.c dec.c \ - dec_clip_tables.c dsp.h filters.c lossless.c lossless.h \ +am__libwebpdspdecode_la_SOURCES_DIST = alpha_processing.c cpu.c cpu.h \ + dec.c dec_clip_tables.c dsp.h filters.c lossless.c lossless.h \ lossless_common.h rescaler.c upsampling.c yuv.c yuv.h am__objects_3 = libwebpdspdecode_la-alpha_processing.lo \ libwebpdspdecode_la-cpu.lo libwebpdspdecode_la-dec.lo \ @@ -466,8 +466,6 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ @@ -483,8 +481,9 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -495,8 +494,10 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +FILECMD = @FILECMD@ GIF_INCLUDES = @GIF_INCLUDES@ GIF_LIBS = @GIF_LIBS@ GL_INCLUDES = @GL_INCLUDES@ @@ -611,6 +612,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +webp_libname_prefix = @webp_libname_prefix@ noinst_LTLIBRARIES = libwebpdsp.la libwebpdsp_sse2.la \ libwebpdspdecode_sse2.la libwebpdsp_sse41.la \ libwebpdspdecode_sse41.la libwebpdsp_neon.la \ @@ -620,9 +622,9 @@ libwebpdspdecode_mips_dsp_r2.la $(am__append_1) common_HEADERS = ../webp/types.h commondir = $(includedir)/webp -COMMON_SOURCES = alpha_processing.c cpu.c dec.c dec_clip_tables.c \ - dsp.h filters.c lossless.c lossless.h lossless_common.h \ - rescaler.c upsampling.c yuv.c yuv.h +COMMON_SOURCES = alpha_processing.c cpu.c cpu.h dec.c \ + dec_clip_tables.c dsp.h filters.c lossless.c lossless.h \ + lossless_common.h rescaler.c upsampling.c yuv.c yuv.h ENC_SOURCES = cost.c enc.c lossless_enc.c quant.h ssim.c libwebpdspdecode_sse41_la_SOURCES = alpha_processing_sse41.c \ dec_sse41.c lossless_sse41.c upsampling_sse41.c yuv_sse41.c @@ -1484,7 +1486,6 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/alpha_processing_neon.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/alpha_processing_neon.c
Changed
@@ -83,7 +83,7 @@ static int DispatchAlpha_NEON(const uint8_t* WEBP_RESTRICT alpha, int alpha_stride, int width, int height, uint8_t* WEBP_RESTRICT dst, int dst_stride) { - uint32_t alpha_mask = 0xffffffffu; + uint32_t alpha_mask = 0xffu; uint8x8_t mask8 = vdup_n_u8(0xff); uint32_t tmp2; int i, j; @@ -107,6 +107,7 @@ dst += dst_stride; } vst1_u8((uint8_t*)tmp, mask8); + alpha_mask *= 0x01010101; alpha_mask &= tmp0; alpha_mask &= tmp1; return (alpha_mask != 0xffffffffu); @@ -135,7 +136,7 @@ static int ExtractAlpha_NEON(const uint8_t* WEBP_RESTRICT argb, int argb_stride, int width, int height, uint8_t* WEBP_RESTRICT alpha, int alpha_stride) { - uint32_t alpha_mask = 0xffffffffu; + uint32_t alpha_mask = 0xffu; uint8x8_t mask8 = vdup_n_u8(0xff); uint32_t tmp2; int i, j; @@ -157,6 +158,7 @@ alpha += alpha_stride; } vst1_u8((uint8_t*)tmp, mask8); + alpha_mask *= 0x01010101; alpha_mask &= tmp0; alpha_mask &= tmp1; return (alpha_mask == 0xffffffffu);
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/alpha_processing_sse2.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/alpha_processing_sse2.c
Changed
@@ -26,8 +26,8 @@ uint32_t alpha_and = 0xff; int i, j; const __m128i zero = _mm_setzero_si128(); - const __m128i rgb_mask = _mm_set1_epi32(0xffffff00u); // to preserve RGB - const __m128i all_0xff = _mm_set_epi32(0, 0, ~0u, ~0u); + const __m128i rgb_mask = _mm_set1_epi32((int)0xffffff00); // to preserve RGB + const __m128i all_0xff = _mm_set_epi32(0, 0, ~0, ~0); __m128i all_alphas = all_0xff; // We must be able to access 3 extra bytes after the last written byte @@ -106,8 +106,8 @@ // value is not 0xff if any of the alpha is not equal to 0xff. uint32_t alpha_and = 0xff; int i, j; - const __m128i a_mask = _mm_set1_epi32(0xffu); // to preserve alpha - const __m128i all_0xff = _mm_set_epi32(0, 0, ~0u, ~0u); + const __m128i a_mask = _mm_set1_epi32(0xff); // to preserve alpha + const __m128i all_0xff = _mm_set_epi32(0, 0, ~0, ~0); __m128i all_alphas = all_0xff; // We must be able to access 3 extra bytes after the last written byte @@ -178,7 +178,7 @@ static void ApplyAlphaMultiply_SSE2(uint8_t* rgba, int alpha_first, int w, int h, int stride) { const __m128i zero = _mm_setzero_si128(); - const __m128i kMult = _mm_set1_epi16(0x8081u); + const __m128i kMult = _mm_set1_epi16((short)0x8081); const __m128i kMask = _mm_set_epi16(0, 0xff, 0xff, 0, 0, 0xff, 0xff, 0); const int kSpan = 4; while (h-- > 0) { @@ -267,7 +267,7 @@ } static void AlphaReplace_SSE2(uint32_t* src, int length, uint32_t color) { - const __m128i m_color = _mm_set1_epi32(color); + const __m128i m_color = _mm_set1_epi32((int)color); const __m128i zero = _mm_setzero_si128(); int i = 0; for (; i + 8 <= length; i += 8) {
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/alpha_processing_sse41.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/alpha_processing_sse41.c
Changed
@@ -26,7 +26,7 @@ // value is not 0xff if any of the alpha is not equal to 0xff. uint32_t alpha_and = 0xff; int i, j; - const __m128i all_0xff = _mm_set1_epi32(~0u); + const __m128i all_0xff = _mm_set1_epi32(~0); __m128i all_alphas = all_0xff; // We must be able to access 3 extra bytes after the last written byte
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/cpu.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/cpu.c
Changed
@@ -11,7 +11,7 @@ // // Author: Christian Duvivier (cduvivier@google.com) -#include "src/dsp/dsp.h" +#include "src/dsp/cpu.h" #if defined(WEBP_HAVE_NEON_RTCD) #include <stdio.h> @@ -212,7 +212,7 @@ #elif defined(WEBP_HAVE_NEON) // In most cases this function doesn't check for NEON support (it's assumed by // the configuration), but enables turning off NEON at runtime, for testing -// purposes, by setting VP8DecGetCPUInfo = NULL. +// purposes, by setting VP8GetCPUInfo = NULL. static int armCPUInfo(CPUFeature feature) { if (feature != kNEON) return 0; #if defined(__linux__) && defined(WEBP_HAVE_NEON_RTCD)
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/cpu.h
Added
@@ -0,0 +1,256 @@ +// Copyright 2022 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- +// +// CPU detection functions and macros. +// +// Author: Skal (pascal.massimino@gmail.com) + +#ifndef WEBP_DSP_CPU_H_ +#define WEBP_DSP_CPU_H_ + +#include <stddef.h> + +#ifdef HAVE_CONFIG_H +#include "src/webp/config.h" +#endif + +#include "src/webp/types.h" + +#if defined(__GNUC__) +#define LOCAL_GCC_VERSION ((__GNUC__ << 8) | __GNUC_MINOR__) +#define LOCAL_GCC_PREREQ(maj, min) (LOCAL_GCC_VERSION >= (((maj) << 8) | (min))) +#else +#define LOCAL_GCC_VERSION 0 +#define LOCAL_GCC_PREREQ(maj, min) 0 +#endif + +#if defined(__clang__) +#define LOCAL_CLANG_VERSION ((__clang_major__ << 8) | __clang_minor__) +#define LOCAL_CLANG_PREREQ(maj, min) \ + (LOCAL_CLANG_VERSION >= (((maj) << 8) | (min))) +#else +#define LOCAL_CLANG_VERSION 0 +#define LOCAL_CLANG_PREREQ(maj, min) 0 +#endif + +#ifndef __has_builtin +#define __has_builtin(x) 0 +#endif + +#if !defined(HAVE_CONFIG_H) +#if defined(_MSC_VER) && _MSC_VER > 1310 && \ + (defined(_M_X64) || defined(_M_IX86)) +#define WEBP_MSC_SSE2 // Visual C++ SSE2 targets +#endif + +#if defined(_MSC_VER) && _MSC_VER >= 1500 && \ + (defined(_M_X64) || defined(_M_IX86)) +#define WEBP_MSC_SSE41 // Visual C++ SSE4.1 targets +#endif +#endif + +// WEBP_HAVE_* are used to indicate the presence of the instruction set in dsp +// files without intrinsics, allowing the corresponding Init() to be called. +// Files containing intrinsics will need to be built targeting the instruction +// set so should succeed on one of the earlier tests. +#if (defined(__SSE2__) || defined(WEBP_MSC_SSE2)) && \ + (!defined(HAVE_CONFIG_H) || defined(WEBP_HAVE_SSE2)) +#define WEBP_USE_SSE2 +#endif + +#if defined(WEBP_USE_SSE2) && !defined(WEBP_HAVE_SSE2) +#define WEBP_HAVE_SSE2 +#endif + +#if (defined(__SSE4_1__) || defined(WEBP_MSC_SSE41)) && \ + (!defined(HAVE_CONFIG_H) || defined(WEBP_HAVE_SSE41)) +#define WEBP_USE_SSE41 +#endif + +#if defined(WEBP_USE_SSE41) && !defined(WEBP_HAVE_SSE41) +#define WEBP_HAVE_SSE41 +#endif + +#undef WEBP_MSC_SSE41 +#undef WEBP_MSC_SSE2 + +// The intrinsics currently cause compiler errors with arm-nacl-gcc and the +// inline assembly would need to be modified for use with Native Client. +#if ((defined(__ARM_NEON__) || defined(__aarch64__)) && \ + (!defined(HAVE_CONFIG_H) || defined(WEBP_HAVE_NEON))) && \ + !defined(__native_client__) +#define WEBP_USE_NEON +#endif + +#if !defined(WEBP_USE_NEON) && defined(__ANDROID__) && \ + defined(__ARM_ARCH_7A__) && defined(HAVE_CPU_FEATURES_H) +#define WEBP_ANDROID_NEON // Android targets that may have NEON +#define WEBP_USE_NEON +#endif + +// 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. Compile errors were seen with Visual Studio 2019 16.4 with +// vtbl4_u8(); a fix was made in 16.6. +#if defined(_MSC_VER) && ((_MSC_VER >= 1700 && defined(_M_ARM)) || \ + (_MSC_VER >= 1926 && defined(_M_ARM64))) +#define WEBP_USE_NEON +#define WEBP_USE_INTRINSICS +#endif + +#if defined(WEBP_USE_NEON) && !defined(WEBP_HAVE_NEON) +#define WEBP_HAVE_NEON +#endif + +#if defined(__mips__) && !defined(__mips64) && defined(__mips_isa_rev) && \ + (__mips_isa_rev >= 1) && (__mips_isa_rev < 6) +#define WEBP_USE_MIPS32 +#if (__mips_isa_rev >= 2) +#define WEBP_USE_MIPS32_R2 +#if defined(__mips_dspr2) || (defined(__mips_dsp_rev) && __mips_dsp_rev >= 2) +#define WEBP_USE_MIPS_DSP_R2 +#endif +#endif +#endif + +#if defined(__mips_msa) && defined(__mips_isa_rev) && (__mips_isa_rev >= 5) +#define WEBP_USE_MSA +#endif + +#ifndef WEBP_DSP_OMIT_C_CODE +#define WEBP_DSP_OMIT_C_CODE 1 +#endif + +#if defined(WEBP_USE_NEON) && WEBP_DSP_OMIT_C_CODE +#define WEBP_NEON_OMIT_C_CODE 1 +#else +#define WEBP_NEON_OMIT_C_CODE 0 +#endif + +#if !(LOCAL_CLANG_PREREQ(3, 8) || LOCAL_GCC_PREREQ(4, 8) || \ + defined(__aarch64__)) +#define WEBP_NEON_WORK_AROUND_GCC 1 +#else +#define WEBP_NEON_WORK_AROUND_GCC 0 +#endif + +// This macro prevents thread_sanitizer from reporting known concurrent writes. +#define WEBP_TSAN_IGNORE_FUNCTION +#if defined(__has_feature) +#if __has_feature(thread_sanitizer) +#undef WEBP_TSAN_IGNORE_FUNCTION +#define WEBP_TSAN_IGNORE_FUNCTION __attribute__((no_sanitize_thread)) +#endif +#endif + +#if defined(__has_feature) +#if __has_feature(memory_sanitizer) +#define WEBP_MSAN +#endif +#endif + +#if defined(WEBP_USE_THREAD) && !defined(_WIN32) +#include <pthread.h> // NOLINT + +#define WEBP_DSP_INIT(func) \ + do { \ + static volatile VP8CPUInfo func##_last_cpuinfo_used = \ + (VP8CPUInfo)&func##_last_cpuinfo_used; \ + static pthread_mutex_t func##_lock = PTHREAD_MUTEX_INITIALIZER; \ + if (pthread_mutex_lock(&func##_lock)) break; \ + if (func##_last_cpuinfo_used != VP8GetCPUInfo) func(); \ + func##_last_cpuinfo_used = VP8GetCPUInfo; \ + (void)pthread_mutex_unlock(&func##_lock); \ + } while (0) +#else // !(defined(WEBP_USE_THREAD) && !defined(_WIN32)) +#define WEBP_DSP_INIT(func) \ + do { \ + static volatile VP8CPUInfo func##_last_cpuinfo_used = \ + (VP8CPUInfo)&func##_last_cpuinfo_used; \ + if (func##_last_cpuinfo_used == VP8GetCPUInfo) break; \ + func(); \ + func##_last_cpuinfo_used = VP8GetCPUInfo; \ + } while (0) +#endif // defined(WEBP_USE_THREAD) && !defined(_WIN32) + +// Defines an Init + helper function that control multiple initialization of +// function pointers / tables. +/* Usage: + WEBP_DSP_INIT_FUNC(InitFunc) { + ...function body + } +*/ +#define WEBP_DSP_INIT_FUNC(name) \ + static WEBP_TSAN_IGNORE_FUNCTION void name##_body(void); \ + WEBP_TSAN_IGNORE_FUNCTION void name(void) { WEBP_DSP_INIT(name##_body); } \ + static WEBP_TSAN_IGNORE_FUNCTION void name##_body(void) + +#define WEBP_UBSAN_IGNORE_UNDEF +#define WEBP_UBSAN_IGNORE_UNSIGNED_OVERFLOW +#if defined(__clang__) && defined(__has_attribute) +#if __has_attribute(no_sanitize) +// This macro prevents the undefined behavior sanitizer from reporting +// failures. This is only meant to silence unaligned loads on platforms that
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/dec_sse2.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/dec_sse2.c
Changed
@@ -158,10 +158,10 @@ dst3 = _mm_loadl_epi64((__m128i*)(dst + 3 * BPS)); } else { // Load four bytes/pixels per line. - dst0 = _mm_cvtsi32_si128(WebPMemToUint32(dst + 0 * BPS)); - dst1 = _mm_cvtsi32_si128(WebPMemToUint32(dst + 1 * BPS)); - dst2 = _mm_cvtsi32_si128(WebPMemToUint32(dst + 2 * BPS)); - dst3 = _mm_cvtsi32_si128(WebPMemToUint32(dst + 3 * BPS)); + dst0 = _mm_cvtsi32_si128(WebPMemToInt32(dst + 0 * BPS)); + dst1 = _mm_cvtsi32_si128(WebPMemToInt32(dst + 1 * BPS)); + dst2 = _mm_cvtsi32_si128(WebPMemToInt32(dst + 2 * BPS)); + dst3 = _mm_cvtsi32_si128(WebPMemToInt32(dst + 3 * BPS)); } // Convert to 16b. dst0 = _mm_unpacklo_epi8(dst0, zero); @@ -187,10 +187,10 @@ _mm_storel_epi64((__m128i*)(dst + 3 * BPS), dst3); } else { // Store four bytes/pixels per line. - WebPUint32ToMem(dst + 0 * BPS, _mm_cvtsi128_si32(dst0)); - WebPUint32ToMem(dst + 1 * BPS, _mm_cvtsi128_si32(dst1)); - WebPUint32ToMem(dst + 2 * BPS, _mm_cvtsi128_si32(dst2)); - WebPUint32ToMem(dst + 3 * BPS, _mm_cvtsi128_si32(dst3)); + WebPInt32ToMem(dst + 0 * BPS, _mm_cvtsi128_si32(dst0)); + WebPInt32ToMem(dst + 1 * BPS, _mm_cvtsi128_si32(dst1)); + WebPInt32ToMem(dst + 2 * BPS, _mm_cvtsi128_si32(dst2)); + WebPInt32ToMem(dst + 3 * BPS, _mm_cvtsi128_si32(dst3)); } } } @@ -213,10 +213,10 @@ const __m128i m3 = _mm_subs_epi16(B, d4); const __m128i zero = _mm_setzero_si128(); // Load the source pixels. - __m128i dst0 = _mm_cvtsi32_si128(WebPMemToUint32(dst + 0 * BPS)); - __m128i dst1 = _mm_cvtsi32_si128(WebPMemToUint32(dst + 1 * BPS)); - __m128i dst2 = _mm_cvtsi32_si128(WebPMemToUint32(dst + 2 * BPS)); - __m128i dst3 = _mm_cvtsi32_si128(WebPMemToUint32(dst + 3 * BPS)); + __m128i dst0 = _mm_cvtsi32_si128(WebPMemToInt32(dst + 0 * BPS)); + __m128i dst1 = _mm_cvtsi32_si128(WebPMemToInt32(dst + 1 * BPS)); + __m128i dst2 = _mm_cvtsi32_si128(WebPMemToInt32(dst + 2 * BPS)); + __m128i dst3 = _mm_cvtsi32_si128(WebPMemToInt32(dst + 3 * BPS)); // Convert to 16b. dst0 = _mm_unpacklo_epi8(dst0, zero); dst1 = _mm_unpacklo_epi8(dst1, zero); @@ -233,10 +233,10 @@ dst2 = _mm_packus_epi16(dst2, dst2); dst3 = _mm_packus_epi16(dst3, dst3); // Store the results. - WebPUint32ToMem(dst + 0 * BPS, _mm_cvtsi128_si32(dst0)); - WebPUint32ToMem(dst + 1 * BPS, _mm_cvtsi128_si32(dst1)); - WebPUint32ToMem(dst + 2 * BPS, _mm_cvtsi128_si32(dst2)); - WebPUint32ToMem(dst + 3 * BPS, _mm_cvtsi128_si32(dst3)); + WebPInt32ToMem(dst + 0 * BPS, _mm_cvtsi128_si32(dst0)); + WebPInt32ToMem(dst + 1 * BPS, _mm_cvtsi128_si32(dst1)); + WebPInt32ToMem(dst + 2 * BPS, _mm_cvtsi128_si32(dst2)); + WebPInt32ToMem(dst + 3 * BPS, _mm_cvtsi128_si32(dst3)); } #undef MUL #endif // USE_TRANSFORM_AC3 @@ -477,11 +477,11 @@ // A0 = 63 62 61 60 23 22 21 20 43 42 41 40 03 02 01 00 // A1 = 73 72 71 70 33 32 31 30 53 52 51 50 13 12 11 10 const __m128i A0 = _mm_set_epi32( - WebPMemToUint32(&b6 * stride), WebPMemToUint32(&b2 * stride), - WebPMemToUint32(&b4 * stride), WebPMemToUint32(&b0 * stride)); + WebPMemToInt32(&b6 * stride), WebPMemToInt32(&b2 * stride), + WebPMemToInt32(&b4 * stride), WebPMemToInt32(&b0 * stride)); const __m128i A1 = _mm_set_epi32( - WebPMemToUint32(&b7 * stride), WebPMemToUint32(&b3 * stride), - WebPMemToUint32(&b5 * stride), WebPMemToUint32(&b1 * stride)); + WebPMemToInt32(&b7 * stride), WebPMemToInt32(&b3 * stride), + WebPMemToInt32(&b5 * stride), WebPMemToInt32(&b1 * stride)); // B0 = 53 43 52 42 51 41 50 40 13 03 12 02 11 01 10 00 // B1 = 73 63 72 62 71 61 70 60 33 23 32 22 31 21 30 20 @@ -540,7 +540,7 @@ uint8_t* dst, int stride) { int i; for (i = 0; i < 4; ++i, dst += stride) { - WebPUint32ToMem(dst, _mm_cvtsi128_si32(*x)); + WebPInt32ToMem(dst, _mm_cvtsi128_si32(*x)); *x = _mm_srli_si128(*x, 4); } } @@ -908,10 +908,10 @@ const __m128i lsb = _mm_and_si128(_mm_xor_si128(ABCDEFGH, CDEFGH00), one); const __m128i b = _mm_subs_epu8(a, lsb); const __m128i avg = _mm_avg_epu8(b, BCDEFGH0); - const uint32_t vals = _mm_cvtsi128_si32(avg); + const int vals = _mm_cvtsi128_si32(avg); int i; for (i = 0; i < 4; ++i) { - WebPUint32ToMem(dst + i * BPS, vals); + WebPInt32ToMem(dst + i * BPS, vals); } } @@ -925,10 +925,10 @@ const __m128i lsb = _mm_and_si128(_mm_xor_si128(ABCDEFGH, CDEFGHH0), one); const __m128i avg2 = _mm_subs_epu8(avg1, lsb); const __m128i abcdefg = _mm_avg_epu8(avg2, BCDEFGH0); - WebPUint32ToMem(dst + 0 * BPS, _mm_cvtsi128_si32( abcdefg )); - WebPUint32ToMem(dst + 1 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 1))); - WebPUint32ToMem(dst + 2 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 2))); - WebPUint32ToMem(dst + 3 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 3))); + WebPInt32ToMem(dst + 0 * BPS, _mm_cvtsi128_si32( abcdefg )); + WebPInt32ToMem(dst + 1 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 1))); + WebPInt32ToMem(dst + 2 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 2))); + WebPInt32ToMem(dst + 3 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 3))); } static void VR4_SSE2(uint8_t* dst) { // Vertical-Right @@ -946,10 +946,10 @@ const __m128i lsb = _mm_and_si128(_mm_xor_si128(IXABCD, ABCD0), one); const __m128i avg2 = _mm_subs_epu8(avg1, lsb); const __m128i efgh = _mm_avg_epu8(avg2, XABCD); - WebPUint32ToMem(dst + 0 * BPS, _mm_cvtsi128_si32( abcd )); - WebPUint32ToMem(dst + 1 * BPS, _mm_cvtsi128_si32( efgh )); - WebPUint32ToMem(dst + 2 * BPS, _mm_cvtsi128_si32(_mm_slli_si128(abcd, 1))); - WebPUint32ToMem(dst + 3 * BPS, _mm_cvtsi128_si32(_mm_slli_si128(efgh, 1))); + WebPInt32ToMem(dst + 0 * BPS, _mm_cvtsi128_si32( abcd )); + WebPInt32ToMem(dst + 1 * BPS, _mm_cvtsi128_si32( efgh )); + WebPInt32ToMem(dst + 2 * BPS, _mm_cvtsi128_si32(_mm_slli_si128(abcd, 1))); + WebPInt32ToMem(dst + 3 * BPS, _mm_cvtsi128_si32(_mm_slli_si128(efgh, 1))); // these two are hard to implement in SSE2, so we keep the C-version: DST(0, 2) = AVG3(J, I, X); @@ -970,11 +970,12 @@ const __m128i abbc = _mm_or_si128(ab, bc); const __m128i lsb2 = _mm_and_si128(abbc, lsb1); const __m128i avg4 = _mm_subs_epu8(avg3, lsb2); - const uint32_t extra_out = _mm_cvtsi128_si32(_mm_srli_si128(avg4, 4)); - WebPUint32ToMem(dst + 0 * BPS, _mm_cvtsi128_si32( avg1 )); - WebPUint32ToMem(dst + 1 * BPS, _mm_cvtsi128_si32( avg4 )); - WebPUint32ToMem(dst + 2 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(avg1, 1))); - WebPUint32ToMem(dst + 3 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(avg4, 1))); + const uint32_t extra_out = + (uint32_t)_mm_cvtsi128_si32(_mm_srli_si128(avg4, 4)); + WebPInt32ToMem(dst + 0 * BPS, _mm_cvtsi128_si32( avg1 )); + WebPInt32ToMem(dst + 1 * BPS, _mm_cvtsi128_si32( avg4 )); + WebPInt32ToMem(dst + 2 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(avg1, 1))); + WebPInt32ToMem(dst + 3 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(avg4, 1))); // these two are hard to get and irregular DST(3, 2) = (extra_out >> 0) & 0xff; @@ -990,7 +991,7 @@ const uint32_t K = dst-1 + 2 * BPS; const uint32_t L = dst-1 + 3 * BPS; const __m128i LKJI_____ = - _mm_cvtsi32_si128(L | (K << 8) | (J << 16) | (I << 24)); + _mm_cvtsi32_si128((int)(L | (K << 8) | (J << 16) | (I << 24))); const __m128i LKJIXABCD = _mm_or_si128(LKJI_____, ____XABCD); const __m128i KJIXABCD_ = _mm_srli_si128(LKJIXABCD, 1); const __m128i JIXABCD__ = _mm_srli_si128(LKJIXABCD, 2); @@ -998,10 +999,10 @@ const __m128i lsb = _mm_and_si128(_mm_xor_si128(JIXABCD__, LKJIXABCD), one); const __m128i avg2 = _mm_subs_epu8(avg1, lsb); const __m128i abcdefg = _mm_avg_epu8(avg2, KJIXABCD_); - WebPUint32ToMem(dst + 3 * BPS, _mm_cvtsi128_si32( abcdefg )); - WebPUint32ToMem(dst + 2 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 1))); - WebPUint32ToMem(dst + 1 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 2))); - WebPUint32ToMem(dst + 0 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 3))); + WebPInt32ToMem(dst + 3 * BPS, _mm_cvtsi128_si32( abcdefg )); + WebPInt32ToMem(dst + 2 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 1))); + WebPInt32ToMem(dst + 1 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 2))); + WebPInt32ToMem(dst + 0 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 3))); } #undef DST @@ -1015,13 +1016,13 @@ const __m128i zero = _mm_setzero_si128(); int y; if (size == 4) { - const __m128i top_values = _mm_cvtsi32_si128(WebPMemToUint32(top)); + const __m128i top_values = _mm_cvtsi32_si128(WebPMemToInt32(top)); const __m128i top_base = _mm_unpacklo_epi8(top_values, zero); for (y = 0; y < 4; ++y, dst += BPS) { const int val = dst-1 - top-1; const __m128i base = _mm_set1_epi16(val); const __m128i out = _mm_packus_epi16(_mm_add_epi16(base, top_base), zero); - WebPUint32ToMem(dst, _mm_cvtsi128_si32(out)); + WebPInt32ToMem(dst, _mm_cvtsi128_si32(out)); } } else if (size == 8) { const __m128i top_values = _mm_loadl_epi64((const __m128i*)top); @@ -1062,7 +1063,7 @@ static void HE16_SSE2(uint8_t* dst) { // horizontal int j; for (j = 16; j > 0; --j) { - const __m128i values = _mm_set1_epi8(dst-1); + const __m128i values = _mm_set1_epi8((char)dst-1); _mm_storeu_si128((__m128i*)dst, values); dst += BPS; } @@ -1070,7 +1071,7 @@ static WEBP_INLINE void Put16_SSE2(uint8_t v, uint8_t* dst) { int j; - const __m128i values = _mm_set1_epi8(v);
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/dec_sse41.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/dec_sse41.c
Changed
@@ -23,7 +23,7 @@ int j; const __m128i kShuffle3 = _mm_set1_epi8(3); for (j = 16; j > 0; --j) { - const __m128i in = _mm_cvtsi32_si128(WebPMemToUint32(dst - 4)); + const __m128i in = _mm_cvtsi32_si128(WebPMemToInt32(dst - 4)); const __m128i values = _mm_shuffle_epi8(in, kShuffle3); _mm_storeu_si128((__m128i*)dst, values); dst += BPS;
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/dsp.h -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/dsp.h
Changed
@@ -18,6 +18,7 @@ #include "src/webp/config.h" #endif +#include "src/dsp/cpu.h" #include "src/webp/types.h" #ifdef __cplusplus @@ -43,220 +44,6 @@ #define WEBP_RESTRICT #endif -//------------------------------------------------------------------------------ -// CPU detection - -#if defined(__GNUC__) -# define LOCAL_GCC_VERSION ((__GNUC__ << 8) | __GNUC_MINOR__) -# define LOCAL_GCC_PREREQ(maj, min) \ - (LOCAL_GCC_VERSION >= (((maj) << 8) | (min))) -#else -# define LOCAL_GCC_VERSION 0 -# define LOCAL_GCC_PREREQ(maj, min) 0 -#endif - -#if defined(__clang__) -# define LOCAL_CLANG_VERSION ((__clang_major__ << 8) | __clang_minor__) -# define LOCAL_CLANG_PREREQ(maj, min) \ - (LOCAL_CLANG_VERSION >= (((maj) << 8) | (min))) -#else -# define LOCAL_CLANG_VERSION 0 -# define LOCAL_CLANG_PREREQ(maj, min) 0 -#endif - -#ifndef __has_builtin -# define __has_builtin(x) 0 -#endif - -#if !defined(HAVE_CONFIG_H) -#if defined(_MSC_VER) && _MSC_VER > 1310 && \ - (defined(_M_X64) || defined(_M_IX86)) -#define WEBP_MSC_SSE2 // Visual C++ SSE2 targets -#endif - -#if defined(_MSC_VER) && _MSC_VER >= 1500 && \ - (defined(_M_X64) || defined(_M_IX86)) -#define WEBP_MSC_SSE41 // Visual C++ SSE4.1 targets -#endif -#endif - -// WEBP_HAVE_* are used to indicate the presence of the instruction set in dsp -// files without intrinsics, allowing the corresponding Init() to be called. -// Files containing intrinsics will need to be built targeting the instruction -// set so should succeed on one of the earlier tests. -#if (defined(__SSE2__) || defined(WEBP_MSC_SSE2)) && \ - (!defined(HAVE_CONFIG_H) || defined(WEBP_HAVE_SSE2)) -#define WEBP_USE_SSE2 -#endif - -#if defined(WEBP_USE_SSE2) && !defined(WEBP_HAVE_SSE2) -#define WEBP_HAVE_SSE2 -#endif - -#if (defined(__SSE4_1__) || defined(WEBP_MSC_SSE41)) && \ - (!defined(HAVE_CONFIG_H) || defined(WEBP_HAVE_SSE41)) -#define WEBP_USE_SSE41 -#endif - -#if defined(WEBP_USE_SSE41) && !defined(WEBP_HAVE_SSE41) -#define WEBP_HAVE_SSE41 -#endif - -#undef WEBP_MSC_SSE41 -#undef WEBP_MSC_SSE2 - -// The intrinsics currently cause compiler errors with arm-nacl-gcc and the -// inline assembly would need to be modified for use with Native Client. -#if ((defined(__ARM_NEON__) || defined(__aarch64__)) && \ - (!defined(HAVE_CONFIG_H) || defined(WEBP_HAVE_NEON))) && \ - !defined(__native_client__) -#define WEBP_USE_NEON -#endif - -#if !defined(WEBP_USE_NEON) && defined(__ANDROID__) && \ - defined(__ARM_ARCH_7A__) && defined(HAVE_CPU_FEATURES_H) -#define WEBP_ANDROID_NEON // Android targets that may have NEON -#define WEBP_USE_NEON -#endif - -#if defined(_MSC_VER) && _MSC_VER >= 1700 && defined(_M_ARM) -#define WEBP_USE_NEON -#define WEBP_USE_INTRINSICS -#endif - -#if defined(WEBP_USE_NEON) && !defined(WEBP_HAVE_NEON) -#define WEBP_HAVE_NEON -#endif - -#if defined(__mips__) && !defined(__mips64) && \ - defined(__mips_isa_rev) && (__mips_isa_rev >= 1) && (__mips_isa_rev < 6) -#define WEBP_USE_MIPS32 -#if (__mips_isa_rev >= 2) -#define WEBP_USE_MIPS32_R2 -#if defined(__mips_dspr2) || (defined(__mips_dsp_rev) && __mips_dsp_rev >= 2) -#define WEBP_USE_MIPS_DSP_R2 -#endif -#endif -#endif - -#if defined(__mips_msa) && defined(__mips_isa_rev) && (__mips_isa_rev >= 5) -#define WEBP_USE_MSA -#endif - -#ifndef WEBP_DSP_OMIT_C_CODE -#define WEBP_DSP_OMIT_C_CODE 1 -#endif - -#if defined(WEBP_USE_NEON) && WEBP_DSP_OMIT_C_CODE -#define WEBP_NEON_OMIT_C_CODE 1 -#else -#define WEBP_NEON_OMIT_C_CODE 0 -#endif - -#if !(LOCAL_CLANG_PREREQ(3,8) || LOCAL_GCC_PREREQ(4,8) || defined(__aarch64__)) -#define WEBP_NEON_WORK_AROUND_GCC 1 -#else -#define WEBP_NEON_WORK_AROUND_GCC 0 -#endif - -// This macro prevents thread_sanitizer from reporting known concurrent writes. -#define WEBP_TSAN_IGNORE_FUNCTION -#if defined(__has_feature) -#if __has_feature(thread_sanitizer) -#undef WEBP_TSAN_IGNORE_FUNCTION -#define WEBP_TSAN_IGNORE_FUNCTION __attribute__((no_sanitize_thread)) -#endif -#endif - -#if defined(WEBP_USE_THREAD) && !defined(_WIN32) -#include <pthread.h> // NOLINT - -#define WEBP_DSP_INIT(func) do { \ - static volatile VP8CPUInfo func ## _last_cpuinfo_used = \ - (VP8CPUInfo)&func ## _last_cpuinfo_used; \ - static pthread_mutex_t func ## _lock = PTHREAD_MUTEX_INITIALIZER; \ - if (pthread_mutex_lock(&func ## _lock)) break; \ - if (func ## _last_cpuinfo_used != VP8GetCPUInfo) func(); \ - func ## _last_cpuinfo_used = VP8GetCPUInfo; \ - (void)pthread_mutex_unlock(&func ## _lock); \ -} while (0) -#else // !(defined(WEBP_USE_THREAD) && !defined(_WIN32)) -#define WEBP_DSP_INIT(func) do { \ - static volatile VP8CPUInfo func ## _last_cpuinfo_used = \ - (VP8CPUInfo)&func ## _last_cpuinfo_used; \ - if (func ## _last_cpuinfo_used == VP8GetCPUInfo) break; \ - func(); \ - func ## _last_cpuinfo_used = VP8GetCPUInfo; \ -} while (0) -#endif // defined(WEBP_USE_THREAD) && !defined(_WIN32) - -// Defines an Init + helper function that control multiple initialization of -// function pointers / tables. -/* Usage: - WEBP_DSP_INIT_FUNC(InitFunc) { - ...function body - } -*/ -#define WEBP_DSP_INIT_FUNC(name) \ - static WEBP_TSAN_IGNORE_FUNCTION void name ## _body(void); \ - WEBP_TSAN_IGNORE_FUNCTION void name(void) { \ - WEBP_DSP_INIT(name ## _body); \ - } \ - static WEBP_TSAN_IGNORE_FUNCTION void name ## _body(void) - -#define WEBP_UBSAN_IGNORE_UNDEF -#define WEBP_UBSAN_IGNORE_UNSIGNED_OVERFLOW -#if defined(__clang__) && defined(__has_attribute) -#if __has_attribute(no_sanitize) -// This macro prevents the undefined behavior sanitizer from reporting -// failures. This is only meant to silence unaligned loads on platforms that -// are known to support them. -#undef WEBP_UBSAN_IGNORE_UNDEF -#define WEBP_UBSAN_IGNORE_UNDEF \ - __attribute__((no_sanitize("undefined"))) - -// This macro prevents the undefined behavior sanitizer from reporting -// failures related to unsigned integer overflows. This is only meant to -// silence cases where this well defined behavior is expected. -#undef WEBP_UBSAN_IGNORE_UNSIGNED_OVERFLOW -#define WEBP_UBSAN_IGNORE_UNSIGNED_OVERFLOW \ - __attribute__((no_sanitize("unsigned-integer-overflow"))) -#endif -#endif - -// If 'ptr' is NULL, returns NULL. Otherwise returns 'ptr + off'. -// Prevents undefined behavior sanitizer nullptr-with-nonzero-offset warning. -#if !defined(WEBP_OFFSET_PTR) -#define WEBP_OFFSET_PTR(ptr, off) (((ptr) == NULL) ? NULL : ((ptr) + (off))) -#endif - -// Regularize the definition of WEBP_SWAP_16BIT_CSP (backward compatibility)
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/enc_neon.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/enc_neon.c
Changed
@@ -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" @@ -764,9 +764,14 @@ // Horizontal sum of all four uint32_t values in 'sum'. static int SumToInt_NEON(uint32x4_t sum) { +#if defined(__aarch64__) + return (int)vaddvq_u32(sum); +#else const uint64x2_t sum2 = vpaddlq_u32(sum); - const uint64_t sum3 = vgetq_lane_u64(sum2, 0) + vgetq_lane_u64(sum2, 1); - return (int)sum3; + const uint32x2_t sum3 = vadd_u32(vreinterpret_u32_u64(vget_low_u64(sum2)), + vreinterpret_u32_u64(vget_high_u64(sum2))); + return (int)vget_lane_u32(sum3, 0); +#endif } static int SSE16x16_NEON(const uint8_t* a, const uint8_t* b) {
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/enc_sse2.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/enc_sse2.c
Changed
@@ -156,10 +156,10 @@ ref3 = _mm_loadl_epi64((const __m128i*)&ref3 * BPS); } else { // Load four bytes/pixels per line. - ref0 = _mm_cvtsi32_si128(WebPMemToUint32(&ref0 * BPS)); - ref1 = _mm_cvtsi32_si128(WebPMemToUint32(&ref1 * BPS)); - ref2 = _mm_cvtsi32_si128(WebPMemToUint32(&ref2 * BPS)); - ref3 = _mm_cvtsi32_si128(WebPMemToUint32(&ref3 * BPS)); + ref0 = _mm_cvtsi32_si128(WebPMemToInt32(&ref0 * BPS)); + ref1 = _mm_cvtsi32_si128(WebPMemToInt32(&ref1 * BPS)); + ref2 = _mm_cvtsi32_si128(WebPMemToInt32(&ref2 * BPS)); + ref3 = _mm_cvtsi32_si128(WebPMemToInt32(&ref3 * BPS)); } // Convert to 16b. ref0 = _mm_unpacklo_epi8(ref0, zero); @@ -185,10 +185,10 @@ _mm_storel_epi64((__m128i*)&dst3 * BPS, ref3); } else { // Store four bytes/pixels per line. - WebPUint32ToMem(&dst0 * BPS, _mm_cvtsi128_si32(ref0)); - WebPUint32ToMem(&dst1 * BPS, _mm_cvtsi128_si32(ref1)); - WebPUint32ToMem(&dst2 * BPS, _mm_cvtsi128_si32(ref2)); - WebPUint32ToMem(&dst3 * BPS, _mm_cvtsi128_si32(ref3)); + WebPInt32ToMem(&dst0 * BPS, _mm_cvtsi128_si32(ref0)); + WebPInt32ToMem(&dst1 * BPS, _mm_cvtsi128_si32(ref1)); + WebPInt32ToMem(&dst2 * BPS, _mm_cvtsi128_si32(ref2)); + WebPInt32ToMem(&dst3 * BPS, _mm_cvtsi128_si32(ref3)); } } } @@ -481,7 +481,7 @@ // helper for chroma-DC predictions static WEBP_INLINE void Put8x8uv_SSE2(uint8_t v, uint8_t* dst) { int j; - const __m128i values = _mm_set1_epi8(v); + const __m128i values = _mm_set1_epi8((char)v); for (j = 0; j < 8; ++j) { _mm_storel_epi64((__m128i*)(dst + j * BPS), values); } @@ -489,7 +489,7 @@ static WEBP_INLINE void Put16_SSE2(uint8_t v, uint8_t* dst) { int j; - const __m128i values = _mm_set1_epi8(v); + const __m128i values = _mm_set1_epi8((char)v); for (j = 0; j < 16; ++j) { _mm_store_si128((__m128i*)(dst + j * BPS), values); } @@ -540,7 +540,7 @@ static WEBP_INLINE void HE8uv_SSE2(uint8_t* dst, const uint8_t* left) { int j; for (j = 0; j < 8; ++j) { - const __m128i values = _mm_set1_epi8(leftj); + const __m128i values = _mm_set1_epi8((char)leftj); _mm_storel_epi64((__m128i*)dst, values); dst += BPS; } @@ -549,7 +549,7 @@ static WEBP_INLINE void HE16_SSE2(uint8_t* dst, const uint8_t* left) { int j; for (j = 0; j < 16; ++j) { - const __m128i values = _mm_set1_epi8(leftj); + const __m128i values = _mm_set1_epi8((char)leftj); _mm_store_si128((__m128i*)dst, values); dst += BPS; } @@ -722,10 +722,10 @@ const __m128i lsb = _mm_and_si128(_mm_xor_si128(ABCDEFGH, CDEFGH00), one); const __m128i b = _mm_subs_epu8(a, lsb); const __m128i avg = _mm_avg_epu8(b, BCDEFGH0); - const uint32_t vals = _mm_cvtsi128_si32(avg); + const int vals = _mm_cvtsi128_si32(avg); int i; for (i = 0; i < 4; ++i) { - WebPUint32ToMem(dst + i * BPS, vals); + WebPInt32ToMem(dst + i * BPS, vals); } } @@ -760,10 +760,10 @@ const __m128i lsb = _mm_and_si128(_mm_xor_si128(ABCDEFGH, CDEFGHH0), one); const __m128i avg2 = _mm_subs_epu8(avg1, lsb); const __m128i abcdefg = _mm_avg_epu8(avg2, BCDEFGH0); - WebPUint32ToMem(dst + 0 * BPS, _mm_cvtsi128_si32( abcdefg )); - WebPUint32ToMem(dst + 1 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 1))); - WebPUint32ToMem(dst + 2 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 2))); - WebPUint32ToMem(dst + 3 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 3))); + WebPInt32ToMem(dst + 0 * BPS, _mm_cvtsi128_si32( abcdefg )); + WebPInt32ToMem(dst + 1 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 1))); + WebPInt32ToMem(dst + 2 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 2))); + WebPInt32ToMem(dst + 3 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 3))); } static WEBP_INLINE void VR4_SSE2(uint8_t* dst, @@ -782,10 +782,10 @@ const __m128i lsb = _mm_and_si128(_mm_xor_si128(IXABCD, ABCD0), one); const __m128i avg2 = _mm_subs_epu8(avg1, lsb); const __m128i efgh = _mm_avg_epu8(avg2, XABCD); - WebPUint32ToMem(dst + 0 * BPS, _mm_cvtsi128_si32( abcd )); - WebPUint32ToMem(dst + 1 * BPS, _mm_cvtsi128_si32( efgh )); - WebPUint32ToMem(dst + 2 * BPS, _mm_cvtsi128_si32(_mm_slli_si128(abcd, 1))); - WebPUint32ToMem(dst + 3 * BPS, _mm_cvtsi128_si32(_mm_slli_si128(efgh, 1))); + WebPInt32ToMem(dst + 0 * BPS, _mm_cvtsi128_si32( abcd )); + WebPInt32ToMem(dst + 1 * BPS, _mm_cvtsi128_si32( efgh )); + WebPInt32ToMem(dst + 2 * BPS, _mm_cvtsi128_si32(_mm_slli_si128(abcd, 1))); + WebPInt32ToMem(dst + 3 * BPS, _mm_cvtsi128_si32(_mm_slli_si128(efgh, 1))); // these two are hard to implement in SSE2, so we keep the C-version: DST(0, 2) = AVG3(J, I, X); @@ -807,11 +807,12 @@ const __m128i abbc = _mm_or_si128(ab, bc); const __m128i lsb2 = _mm_and_si128(abbc, lsb1); const __m128i avg4 = _mm_subs_epu8(avg3, lsb2); - const uint32_t extra_out = _mm_cvtsi128_si32(_mm_srli_si128(avg4, 4)); - WebPUint32ToMem(dst + 0 * BPS, _mm_cvtsi128_si32( avg1 )); - WebPUint32ToMem(dst + 1 * BPS, _mm_cvtsi128_si32( avg4 )); - WebPUint32ToMem(dst + 2 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(avg1, 1))); - WebPUint32ToMem(dst + 3 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(avg4, 1))); + const uint32_t extra_out = + (uint32_t)_mm_cvtsi128_si32(_mm_srli_si128(avg4, 4)); + WebPInt32ToMem(dst + 0 * BPS, _mm_cvtsi128_si32( avg1 )); + WebPInt32ToMem(dst + 1 * BPS, _mm_cvtsi128_si32( avg4 )); + WebPInt32ToMem(dst + 2 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(avg1, 1))); + WebPInt32ToMem(dst + 3 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(avg4, 1))); // these two are hard to get and irregular DST(3, 2) = (extra_out >> 0) & 0xff; @@ -829,10 +830,10 @@ const __m128i lsb = _mm_and_si128(_mm_xor_si128(JIXABCD__, LKJIXABCD), one); const __m128i avg2 = _mm_subs_epu8(avg1, lsb); const __m128i abcdefg = _mm_avg_epu8(avg2, KJIXABCD_); - WebPUint32ToMem(dst + 3 * BPS, _mm_cvtsi128_si32( abcdefg )); - WebPUint32ToMem(dst + 2 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 1))); - WebPUint32ToMem(dst + 1 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 2))); - WebPUint32ToMem(dst + 0 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 3))); + WebPInt32ToMem(dst + 3 * BPS, _mm_cvtsi128_si32( abcdefg )); + WebPInt32ToMem(dst + 2 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 1))); + WebPInt32ToMem(dst + 1 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 2))); + WebPInt32ToMem(dst + 0 * BPS, _mm_cvtsi128_si32(_mm_srli_si128(abcdefg, 3))); } static WEBP_INLINE void HU4_SSE2(uint8_t* dst, const uint8_t* top) { @@ -875,14 +876,14 @@ static WEBP_INLINE void TM4_SSE2(uint8_t* dst, const uint8_t* top) { const __m128i zero = _mm_setzero_si128(); - const __m128i top_values = _mm_cvtsi32_si128(WebPMemToUint32(top)); + const __m128i top_values = _mm_cvtsi32_si128(WebPMemToInt32(top)); const __m128i top_base = _mm_unpacklo_epi8(top_values, zero); int y; for (y = 0; y < 4; ++y, dst += BPS) { const int val = top-2 - y - top-1; const __m128i base = _mm_set1_epi16(val); const __m128i out = _mm_packus_epi16(_mm_add_epi16(base, top_base), zero); - WebPUint32ToMem(dst, _mm_cvtsi128_si32(out)); + WebPInt32ToMem(dst, _mm_cvtsi128_si32(out)); } }
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/lossless.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/lossless.c
Changed
@@ -49,7 +49,7 @@ } static WEBP_INLINE int AddSubtractComponentFull(int a, int b, int c) { - return Clip255(a + b - c); + return Clip255((uint32_t)(a + b - c)); } static WEBP_INLINE uint32_t ClampedAddSubtractFull(uint32_t c0, uint32_t c1, @@ -66,7 +66,7 @@ } static WEBP_INLINE int AddSubtractComponentHalf(int a, int b) { - return Clip255(a + (a - b) / 2); + return Clip255((uint32_t)(a + (a - b) / 2)); } static WEBP_INLINE uint32_t ClampedAddSubtractHalf(uint32_t c0, uint32_t c1, @@ -107,63 +107,77 @@ //------------------------------------------------------------------------------ // 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 top0; } -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 top1; } -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, top0, top1); +uint32_t VP8LPredictor5_C(const uint32_t* const left, + const uint32_t* const top) { + const uint32_t pred = Average3(*left, top0, top1); 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, top0); +uint32_t VP8LPredictor7_C(const uint32_t* const left, + const uint32_t* const top) { + const uint32_t pred = Average2(*left, top0); 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, top0); (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(top0, top1); (void)left; return pred; } -uint32_t VP8LPredictor10_C(uint32_t left, const uint32_t* const top) { - const uint32_t pred = Average4(left, top-1, top0, top1); +uint32_t VP8LPredictor10_C(const uint32_t* const left, + const uint32_t* const top) { + const uint32_t pred = Average4(*left, top-1, top0, top1); return pred; } -uint32_t VP8LPredictor11_C(uint32_t left, const uint32_t* const top) { - const uint32_t pred = Select(top0, left, top-1); +uint32_t VP8LPredictor11_C(const uint32_t* const left, + const uint32_t* const top) { + const uint32_t pred = Select(top0, *left, top-1); return pred; } -uint32_t VP8LPredictor12_C(uint32_t left, const uint32_t* const top) { - const uint32_t pred = ClampedAddSubtractFull(left, top0, top-1); +uint32_t VP8LPredictor12_C(const uint32_t* const left, + const uint32_t* const top) { + const uint32_t pred = ClampedAddSubtractFull(*left, top0, top-1); return pred; } -uint32_t VP8LPredictor13_C(uint32_t left, const uint32_t* const top) { - const uint32_t pred = ClampedAddSubtractHalf(left, top0, top-1); +uint32_t VP8LPredictor13_C(const uint32_t* const left, + const uint32_t* const top) { + const uint32_t pred = ClampedAddSubtractHalf(*left, top0, top-1); return pred; } @@ -279,10 +293,10 @@ const uint32_t red = argb >> 16; int new_red = red & 0xff; int new_blue = argb & 0xff; - new_red += ColorTransformDelta(m->green_to_red_, green); + new_red += ColorTransformDelta((int8_t)m->green_to_red_, green); new_red &= 0xff; - new_blue += ColorTransformDelta(m->green_to_blue_, green); - new_blue += ColorTransformDelta(m->red_to_blue_, (int8_t)new_red); + new_blue += ColorTransformDelta((int8_t)m->green_to_blue_, green); + new_blue += ColorTransformDelta((int8_t)m->red_to_blue_, (int8_t)new_red); new_blue &= 0xff; dsti = (argb & 0xff00ff00u) | (new_red << 16) | (new_blue); } @@ -381,7 +395,7 @@ assert(row_start < row_end); assert(row_end <= transform->ysize_); switch (transform->type_) { - case SUBTRACT_GREEN: + case SUBTRACT_GREEN_TRANSFORM: VP8LAddGreenToBlueAndRed(in, (row_end - row_start) * width, out); break; case PREDICTOR_TRANSFORM:
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/lossless.h -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/lossless.h
Changed
@@ -28,23 +28,38 @@ //------------------------------------------------------------------------------ // 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 VP8LPredictors16; -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, @@ -167,9 +182,9 @@ // ----------------------------------------------------------------------------- // Huffman-cost related functions. -typedef double (*VP8LCostFunc)(const uint32_t* population, int length); -typedef double (*VP8LCostCombinedFunc)(const uint32_t* X, const uint32_t* Y, - int length); +typedef float (*VP8LCostFunc)(const uint32_t* population, int length); +typedef float (*VP8LCostCombinedFunc)(const uint32_t* X, const uint32_t* Y, + int length); typedef float (*VP8LCombinedShannonEntropyFunc)(const int X256, const int Y256); @@ -183,7 +198,7 @@ } VP8LStreaks; typedef struct { // small struct to hold bit entropy results - double entropy; // entropy + float entropy; // entropy uint32_t sum; // sum of the population int nonzeros; // number of non-zero elements in the population uint32_t max_val; // maximum value in the population
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/lossless_common.h -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/lossless_common.h
Changed
@@ -179,7 +179,7 @@ int x; \ assert(upper != NULL); \ for (x = 0; x < num_pixels; ++x) { \ - const uint32_t pred = (PREDICTOR)(outx - 1, upper + x); \ + const uint32_t pred = (PREDICTOR)(&outx - 1, upper + x); \ outx = VP8LAddPixels(inx, pred); \ } \ }
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/lossless_enc.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/lossless_enc.c
Changed
@@ -402,7 +402,7 @@ // Compute the combined Shanon's entropy for distribution {X} and {X+Y} static float CombinedShannonEntropy_C(const int X256, const int Y256) { int i; - double retval = 0.; + float retval = 0.f; int sumX = 0, sumXY = 0; for (i = 0; i < 256; ++i) { const int x = Xi; @@ -418,7 +418,7 @@ } } retval += VP8LFastSLog2(sumX) + VP8LFastSLog2(sumXY); - return (float)retval; + return retval; } void VP8LBitEntropyInit(VP8LBitEntropy* const entropy) { @@ -522,11 +522,11 @@ void VP8LSubtractGreenFromBlueAndRed_C(uint32_t* argb_data, int num_pixels) { int i; for (i = 0; i < num_pixels; ++i) { - const int argb = argb_datai; + const int argb = (int)argb_datai; const int green = (argb >> 8) & 0xff; const uint32_t new_r = (((argb >> 16) & 0xff) - green) & 0xff; const uint32_t new_b = (((argb >> 0) & 0xff) - green) & 0xff; - argb_datai = (argb & 0xff00ff00u) | (new_r << 16) | new_b; + argb_datai = ((uint32_t)argb & 0xff00ff00u) | (new_r << 16) | new_b; } } @@ -547,10 +547,10 @@ const int8_t red = U32ToS8(argb >> 16); int new_red = red & 0xff; int new_blue = argb & 0xff; - new_red -= ColorTransformDelta(m->green_to_red_, green); + new_red -= ColorTransformDelta((int8_t)m->green_to_red_, green); new_red &= 0xff; - new_blue -= ColorTransformDelta(m->green_to_blue_, green); - new_blue -= ColorTransformDelta(m->red_to_blue_, red); + new_blue -= ColorTransformDelta((int8_t)m->green_to_blue_, green); + new_blue -= ColorTransformDelta((int8_t)m->red_to_blue_, red); new_blue &= 0xff; datai = (argb & 0xff00ff00u) | (new_red << 16) | (new_blue); } @@ -560,7 +560,7 @@ uint32_t argb) { const int8_t green = U32ToS8(argb >> 8); int new_red = argb >> 16; - new_red -= ColorTransformDelta(green_to_red, green); + new_red -= ColorTransformDelta((int8_t)green_to_red, green); return (new_red & 0xff); } @@ -569,9 +569,9 @@ uint32_t argb) { const int8_t green = U32ToS8(argb >> 8); const int8_t red = U32ToS8(argb >> 16); - uint8_t new_blue = argb & 0xff; - new_blue -= ColorTransformDelta(green_to_blue, green); - new_blue -= ColorTransformDelta(red_to_blue, red); + int new_blue = argb & 0xff; + new_blue -= ColorTransformDelta((int8_t)green_to_blue, green); + new_blue -= ColorTransformDelta((int8_t)red_to_blue, red); return (new_blue & 0xff); } @@ -636,17 +636,17 @@ //------------------------------------------------------------------------------ -static double ExtraCost_C(const uint32_t* population, int length) { +static float ExtraCost_C(const uint32_t* population, int length) { int i; - double cost = 0.; + float cost = 0.f; for (i = 2; i < length - 2; ++i) cost += (i >> 1) * populationi + 2; return cost; } -static double ExtraCostCombined_C(const uint32_t* X, const uint32_t* Y, +static float ExtraCostCombined_C(const uint32_t* X, const uint32_t* Y, int length) { int i; - double cost = 0.; + float cost = 0.f; for (i = 2; i < length - 2; ++i) { const int xy = Xi + 2 + Yi + 2; cost += (i >> 1) * xy; @@ -745,7 +745,7 @@ assert(upper != NULL); \ for (x = 0; x < num_pixels; ++x) { \ const uint32_t pred = \ - VP8LPredictor##PREDICTOR_I##_C(inx - 1, upper + x); \ + VP8LPredictor##PREDICTOR_I##_C(&inx - 1, upper + x); \ outx = VP8LSubPixels(inx, pred); \ } \ }
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/lossless_enc_mips32.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/lossless_enc_mips32.c
Changed
@@ -103,8 +103,8 @@ // cost += i * *(pop + 1); // pop += 2; // } -// return (double)cost; -static double ExtraCost_MIPS32(const uint32_t* const population, int length) { +// return (float)cost; +static float ExtraCost_MIPS32(const uint32_t* const population, int length) { int i, temp0, temp1; const uint32_t* pop = &population4; const uint32_t* const LoopEnd = &populationlength; @@ -130,7 +130,7 @@ : "memory", "hi", "lo" ); - return (double)((int64_t)temp0 << 32 | temp1); + return (float)((int64_t)temp0 << 32 | temp1); } // C version of this function: @@ -148,9 +148,9 @@ // pX += 2; // pY += 2; // } -// return (double)cost; -static double ExtraCostCombined_MIPS32(const uint32_t* const X, - const uint32_t* const Y, int length) { +// return (float)cost; +static float ExtraCostCombined_MIPS32(const uint32_t* const X, + const uint32_t* const Y, int length) { int i, temp0, temp1, temp2, temp3; const uint32_t* pX = &X4; const uint32_t* pY = &Y4; @@ -183,7 +183,7 @@ : "memory", "hi", "lo" ); - return (double)((int64_t)temp0 << 32 | temp1); + return (float)((int64_t)temp0 << 32 | temp1); } #define HUFFMAN_COST_PASS \ @@ -347,24 +347,24 @@ static void AddVector_MIPS32(const uint32_t* pa, const uint32_t* pb, uint32_t* pout, int size) { uint32_t temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7; - const uint32_t end = ((size) / 4) * 4; + const int end = ((size) / 4) * 4; const uint32_t* const LoopEnd = pa + end; int i; ASM_START ADD_TO_OUT(0, 4, 8, 12, 1, pa, pb, pout) ASM_END_0 - for (i = end; i < size; ++i) pouti = pai + pbi; + for (i = 0; i < size - end; ++i) pouti = pai + pbi; } static void AddVectorEq_MIPS32(const uint32_t* pa, uint32_t* pout, int size) { uint32_t temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7; - const uint32_t end = ((size) / 4) * 4; + const int end = ((size) / 4) * 4; const uint32_t* const LoopEnd = pa + end; int i; ASM_START ADD_TO_OUT(0, 4, 8, 12, 0, pa, pout, pout) ASM_END_1 - for (i = end; i < size; ++i) pouti += pai; + for (i = 0; i < size - end; ++i) pouti += pai; } #undef ASM_END_1
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/lossless_enc_sse2.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/lossless_enc_sse2.c
Changed
@@ -54,8 +54,8 @@ const __m128i mults_rb = MK_CST_16(CST_5b(m->green_to_red_), CST_5b(m->green_to_blue_)); const __m128i mults_b2 = MK_CST_16(CST_5b(m->red_to_blue_), 0); - const __m128i mask_ag = _mm_set1_epi32(0xff00ff00); // alpha-green masks - const __m128i mask_rb = _mm_set1_epi32(0x00ff00ff); // red-blue masks + const __m128i mask_ag = _mm_set1_epi32((int)0xff00ff00); // alpha-green masks + const __m128i mask_rb = _mm_set1_epi32(0x00ff00ff); // red-blue masks int i; for (i = 0; i + 4 <= num_pixels; i += 4) { const __m128i in = _mm_loadu_si128((__m128i*)&argb_datai); // argb @@ -239,7 +239,7 @@ static float CombinedShannonEntropy_SSE2(const int X256, const int Y256) { int i; - double retval = 0.; + float retval = 0.f; int sumX = 0, sumXY = 0; const __m128i zero = _mm_setzero_si128(); @@ -273,7 +273,7 @@ } } retval += VP8LFastSLog2(sumX) + VP8LFastSLog2(sumXY); - return (float)retval; + return retval; } #else @@ -376,7 +376,7 @@ break; } case 2: { - const __m128i mask_or = _mm_set1_epi32(0xff000000); + const __m128i mask_or = _mm_set1_epi32((int)0xff000000); const __m128i mul_cst = _mm_set1_epi16(0x0104); const __m128i mask_mul = _mm_set1_epi16(0x0f00); for (x = 0; x + 16 <= width; x += 16, dst += 4) { @@ -427,7 +427,7 @@ static void PredictorSub0_SSE2(const uint32_t* in, const uint32_t* upper, int num_pixels, uint32_t* out) { int i; - const __m128i black = _mm_set1_epi32(ARGB_BLACK); + const __m128i black = _mm_set1_epi32((int)ARGB_BLACK); for (i = 0; i + 4 <= num_pixels; i += 4) { const __m128i src = _mm_loadu_si128((const __m128i*)&ini); const __m128i res = _mm_sub_epi8(src, black);
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/lossless_mips_dsp_r2.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/lossless_mips_dsp_r2.c
Changed
@@ -188,46 +188,51 @@ return Average2(Average2(a0, a1), Average2(a2, a3)); } -static uint32_t Predictor5_MIPSdspR2(uint32_t left, const uint32_t* const top) { - return Average3(left, top0, top1); +static uint32_t Predictor5_MIPSdspR2(const uint32_t* const left, + const uint32_t* const top) { + return Average3(*left, top0, top1); } -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, top0); +static uint32_t Predictor7_MIPSdspR2(const uint32_t* const left, + const uint32_t* const top) { + return Average2(*left, top0); } -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, top0); } -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(top0, top1); } -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, top0, top1); + return Average4(*left, top-1, top0, top1); } -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(top0, left, top-1); + return Select(top0, *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, top0, top-1); + return ClampedAddSubtractFull(*left, top0, 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, top0, top-1); + return ClampedAddSubtractHalf(*left, top0, top-1); } // Add green to blue and red channels (i.e. perform the inverse transform of
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/lossless_neon.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/lossless_neon.c
Changed
@@ -188,17 +188,21 @@ return avg; } -static uint32_t Predictor5_NEON(uint32_t left, const uint32_t* const top) { - return Average3_NEON(left, top0, top1); +static uint32_t Predictor5_NEON(const uint32_t* const left, + const uint32_t* const top) { + return Average3_NEON(*left, top0, top1); } -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, top0); +static uint32_t Predictor7_NEON(const uint32_t* const left, + const uint32_t* const top) { + return Average2_NEON(*left, top0); } -static uint32_t Predictor13_NEON(uint32_t left, const uint32_t* const top) { - return ClampedAddSubtractHalf_NEON(left, top0, top-1); +static uint32_t Predictor13_NEON(const uint32_t* const left, + const uint32_t* const top) { + return ClampedAddSubtractHalf_NEON(*left, top0, top-1); } // Batch versions of those functions.
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/lossless_sse2.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/lossless_sse2.c
Changed
@@ -27,23 +27,22 @@ uint32_t c1, uint32_t c2) { const __m128i zero = _mm_setzero_si128(); - const __m128i C0 = _mm_unpacklo_epi8(_mm_cvtsi32_si128(c0), zero); - const __m128i C1 = _mm_unpacklo_epi8(_mm_cvtsi32_si128(c1), zero); - const __m128i C2 = _mm_unpacklo_epi8(_mm_cvtsi32_si128(c2), zero); + const __m128i C0 = _mm_unpacklo_epi8(_mm_cvtsi32_si128((int)c0), zero); + const __m128i C1 = _mm_unpacklo_epi8(_mm_cvtsi32_si128((int)c1), zero); + const __m128i C2 = _mm_unpacklo_epi8(_mm_cvtsi32_si128((int)c2), zero); const __m128i V1 = _mm_add_epi16(C0, C1); const __m128i V2 = _mm_sub_epi16(V1, C2); const __m128i b = _mm_packus_epi16(V2, V2); - const uint32_t output = _mm_cvtsi128_si32(b); - return output; + return (uint32_t)_mm_cvtsi128_si32(b); } static WEBP_INLINE uint32_t ClampedAddSubtractHalf_SSE2(uint32_t c0, uint32_t c1, uint32_t c2) { const __m128i zero = _mm_setzero_si128(); - const __m128i C0 = _mm_unpacklo_epi8(_mm_cvtsi32_si128(c0), zero); - const __m128i C1 = _mm_unpacklo_epi8(_mm_cvtsi32_si128(c1), zero); - const __m128i B0 = _mm_unpacklo_epi8(_mm_cvtsi32_si128(c2), zero); + const __m128i C0 = _mm_unpacklo_epi8(_mm_cvtsi32_si128((int)c0), zero); + const __m128i C1 = _mm_unpacklo_epi8(_mm_cvtsi32_si128((int)c1), zero); + const __m128i B0 = _mm_unpacklo_epi8(_mm_cvtsi32_si128((int)c2), zero); const __m128i avg = _mm_add_epi16(C1, C0); const __m128i A0 = _mm_srli_epi16(avg, 1); const __m128i A1 = _mm_sub_epi16(A0, B0); @@ -52,16 +51,15 @@ const __m128i A3 = _mm_srai_epi16(A2, 1); const __m128i A4 = _mm_add_epi16(A0, A3); const __m128i A5 = _mm_packus_epi16(A4, A4); - const uint32_t output = _mm_cvtsi128_si32(A5); - return output; + return (uint32_t)_mm_cvtsi128_si32(A5); } static WEBP_INLINE uint32_t Select_SSE2(uint32_t a, uint32_t b, uint32_t c) { int pa_minus_pb; const __m128i zero = _mm_setzero_si128(); - const __m128i A0 = _mm_cvtsi32_si128(a); - const __m128i B0 = _mm_cvtsi32_si128(b); - const __m128i C0 = _mm_cvtsi32_si128(c); + const __m128i A0 = _mm_cvtsi32_si128((int)a); + const __m128i B0 = _mm_cvtsi32_si128((int)b); + const __m128i C0 = _mm_cvtsi32_si128((int)c); const __m128i AC0 = _mm_subs_epu8(A0, C0); const __m128i CA0 = _mm_subs_epu8(C0, A0); const __m128i BC0 = _mm_subs_epu8(B0, C0); @@ -94,8 +92,8 @@ __m128i* const avg) { // (a + b) >> 1 = ((a + b + 1) >> 1) - ((a ^ b) & 1) const __m128i ones = _mm_set1_epi8(1); - const __m128i A0 = _mm_cvtsi32_si128(a0); - const __m128i A1 = _mm_cvtsi32_si128(a1); + const __m128i A0 = _mm_cvtsi32_si128((int)a0); + const __m128i A1 = _mm_cvtsi32_si128((int)a1); const __m128i avg1 = _mm_avg_epu8(A0, A1); const __m128i one = _mm_and_si128(_mm_xor_si128(A0, A1), ones); *avg = _mm_sub_epi8(avg1, one); @@ -103,8 +101,8 @@ static WEBP_INLINE __m128i Average2_uint32_16_SSE2(uint32_t a0, uint32_t a1) { const __m128i zero = _mm_setzero_si128(); - const __m128i A0 = _mm_unpacklo_epi8(_mm_cvtsi32_si128(a0), zero); - const __m128i A1 = _mm_unpacklo_epi8(_mm_cvtsi32_si128(a1), zero); + const __m128i A0 = _mm_unpacklo_epi8(_mm_cvtsi32_si128((int)a0), zero); + const __m128i A1 = _mm_unpacklo_epi8(_mm_cvtsi32_si128((int)a1), zero); const __m128i sum = _mm_add_epi16(A1, A0); return _mm_srli_epi16(sum, 1); } @@ -112,19 +110,18 @@ static WEBP_INLINE uint32_t Average2_SSE2(uint32_t a0, uint32_t a1) { __m128i output; Average2_uint32_SSE2(a0, a1, &output); - return _mm_cvtsi128_si32(output); + return (uint32_t)_mm_cvtsi128_si32(output); } static WEBP_INLINE uint32_t Average3_SSE2(uint32_t a0, uint32_t a1, uint32_t a2) { const __m128i zero = _mm_setzero_si128(); const __m128i avg1 = Average2_uint32_16_SSE2(a0, a2); - const __m128i A1 = _mm_unpacklo_epi8(_mm_cvtsi32_si128(a1), zero); + const __m128i A1 = _mm_unpacklo_epi8(_mm_cvtsi32_si128((int)a1), zero); const __m128i sum = _mm_add_epi16(avg1, A1); const __m128i avg2 = _mm_srli_epi16(sum, 1); const __m128i A2 = _mm_packus_epi16(avg2, avg2); - const uint32_t output = _mm_cvtsi128_si32(A2); - return output; + return (uint32_t)_mm_cvtsi128_si32(A2); } static WEBP_INLINE uint32_t Average4_SSE2(uint32_t a0, uint32_t a1, @@ -134,46 +131,54 @@ const __m128i sum = _mm_add_epi16(avg2, avg1); const __m128i avg3 = _mm_srli_epi16(sum, 1); const __m128i A0 = _mm_packus_epi16(avg3, avg3); - const uint32_t output = _mm_cvtsi128_si32(A0); - return output; + return (uint32_t)_mm_cvtsi128_si32(A0); } -static uint32_t Predictor5_SSE2(uint32_t left, const uint32_t* const top) { - const uint32_t pred = Average3_SSE2(left, top0, top1); +static uint32_t Predictor5_SSE2(const uint32_t* const left, + const uint32_t* const top) { + const uint32_t pred = Average3_SSE2(*left, top0, top1); 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, top0); +static uint32_t Predictor7_SSE2(const uint32_t* const left, + const uint32_t* const top) { + const uint32_t pred = Average2_SSE2(*left, top0); 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, top0); (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(top0, top1); (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, top0, top1); +static uint32_t Predictor10_SSE2(const uint32_t* const left, + const uint32_t* const top) { + const uint32_t pred = Average4_SSE2(*left, top-1, top0, top1); return pred; } -static uint32_t Predictor11_SSE2(uint32_t left, const uint32_t* const top) { - const uint32_t pred = Select_SSE2(top0, left, top-1); +static uint32_t Predictor11_SSE2(const uint32_t* const left, + const uint32_t* const top) { + const uint32_t pred = Select_SSE2(top0, *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, top0, top-1); +static uint32_t Predictor12_SSE2(const uint32_t* const left, + const uint32_t* const top) { + const uint32_t pred = ClampedAddSubtractFull_SSE2(*left, top0, top-1); return pred; } -static uint32_t Predictor13_SSE2(uint32_t left, const uint32_t* const top) { - const uint32_t pred = ClampedAddSubtractHalf_SSE2(left, top0, top-1); +static uint32_t Predictor13_SSE2(const uint32_t* const left, + const uint32_t* const top) { + const uint32_t pred = ClampedAddSubtractHalf_SSE2(*left, top0, top-1); return pred; } @@ -183,7 +188,7 @@ static void PredictorAdd0_SSE2(const uint32_t* in, const uint32_t* upper, int num_pixels, uint32_t* out) { int i; - const __m128i black = _mm_set1_epi32(ARGB_BLACK); + const __m128i black = _mm_set1_epi32((int)ARGB_BLACK); for (i = 0; i + 4 <= num_pixels; i += 4) { const __m128i src = _mm_loadu_si128((const __m128i*)&ini); const __m128i res = _mm_add_epi8(src, black); @@ -199,7 +204,7 @@ static void PredictorAdd1_SSE2(const uint32_t* in, const uint32_t* upper, int num_pixels, uint32_t* out) { int i; - __m128i prev = _mm_set1_epi32(out-1); + __m128i prev = _mm_set1_epi32((int)out-1); for (i = 0; i + 4 <= num_pixels; i += 4) { // a | b | c | d const __m128i src = _mm_loadu_si128((const __m128i*)&ini); @@ -276,12 +281,12 @@ #undef GENERATE_PREDICTOR_2 // Predictor10: average of (average of (L,TL), average of (T, TR)). -#define DO_PRED10(OUT) do { \ - __m128i avgLTL, avg; \ - Average2_m128i(&L, &TL, &avgLTL); \ - Average2_m128i(&avgTTR, &avgLTL, &avg); \ - L = _mm_add_epi8(avg, src); \ - outi + (OUT) = _mm_cvtsi128_si32(L); \ +#define DO_PRED10(OUT) do { \ + __m128i avgLTL, avg; \
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/lossless_sse41.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/lossless_sse41.c
Changed
@@ -25,11 +25,12 @@ int num_pixels, uint32_t* dst) { // sign-extended multiplying constants, pre-shifted by 5. #define CST(X) (((int16_t)(m->X << 8)) >> 5) // sign-extend - const __m128i mults_rb = _mm_set1_epi32((uint32_t)CST(green_to_red_) << 16 | - (CST(green_to_blue_) & 0xffff)); + const __m128i mults_rb = + _mm_set1_epi32((int)((uint32_t)CST(green_to_red_) << 16 | + (CST(green_to_blue_) & 0xffff))); const __m128i mults_b2 = _mm_set1_epi32(CST(red_to_blue_)); #undef CST - const __m128i mask_ag = _mm_set1_epi32(0xff00ff00); + const __m128i mask_ag = _mm_set1_epi32((int)0xff00ff00); const __m128i perm1 = _mm_setr_epi8(-1, 1, -1, 1, -1, 5, -1, 5, -1, 9, -1, 9, -1, 13, -1, 13); const __m128i perm2 = _mm_setr_epi8(-1, 2, -1, -1, -1, 6, -1, -1,
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/msa_macro.h -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/msa_macro.h
Changed
@@ -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 @@ } while (0) #define AVER_UB2_UB(...) AVER_UB2(v16u8, __VA_ARGS__) +#endif // WEBP_USE_MSA #endif // WEBP_DSP_MSA_MACRO_H_
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/neon.h -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/neon.h
Changed
@@ -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 @@ } while (0) #endif +#endif // WEBP_USE_NEON #endif // WEBP_DSP_NEON_H_
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/quant.h -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/quant.h
Changed
@@ -21,10 +21,15 @@ #define IsFlat IsFlat_NEON -static uint32x2_t horizontal_add_uint32x4(const uint32x4_t a) { +static uint32_t horizontal_add_uint32x4(const uint32x4_t a) { +#if defined(__aarch64__) + return vaddvq_u32(a); +#else const uint64x2_t b = vpaddlq_u32(a); - return vadd_u32(vreinterpret_u32_u64(vget_low_u64(b)), - vreinterpret_u32_u64(vget_high_u64(b))); + const uint32x2_t c = vadd_u32(vreinterpret_u32_u64(vget_low_u64(b)), + vreinterpret_u32_u64(vget_high_u64(b))); + return vget_lane_u32(c, 0); +#endif } static WEBP_INLINE int IsFlat(const int16_t* levels, int num_blocks, @@ -45,7 +50,7 @@ levels += 16; } - return thresh >= (int32_t)vget_lane_u32(horizontal_add_uint32x4(sum), 0); + return thresh >= (int)horizontal_add_uint32x4(sum); } #else
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/rescaler_sse2.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/rescaler_sse2.c
Changed
@@ -85,7 +85,7 @@ const __m128i mult = _mm_cvtsi32_si128(((x_add - accum) << 16) | accum); const __m128i out = _mm_madd_epi16(cur_pixels, mult); assert(sizeof(*frow) == sizeof(uint32_t)); - WebPUint32ToMem((uint8_t*)frow, _mm_cvtsi128_si32(out)); + WebPInt32ToMem((uint8_t*)frow, _mm_cvtsi128_si32(out)); frow += 1; if (frow >= frow_end) break; accum -= wrk->x_sub; @@ -132,7 +132,7 @@ __m128i base = zero; accum += wrk->x_add; while (accum > 0) { - const __m128i A = _mm_cvtsi32_si128(WebPMemToUint32(src)); + const __m128i A = _mm_cvtsi32_si128(WebPMemToInt32(src)); src += 4; base = _mm_unpacklo_epi8(A, zero); // To avoid overflow, we need: base * x_add / x_sub < 32768 @@ -198,7 +198,7 @@ const __m128i* const mult, uint8_t* const dst) { const __m128i rounder = _mm_set_epi32(0, ROUNDER, 0, ROUNDER); - const __m128i mask = _mm_set_epi32(0xffffffffu, 0, 0xffffffffu, 0); + const __m128i mask = _mm_set_epi32(~0, 0, ~0, 0); const __m128i B0 = _mm_mul_epu32(*A0, *mult); const __m128i B1 = _mm_mul_epu32(*A1, *mult); const __m128i B2 = _mm_mul_epu32(*A2, *mult);
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/upsampling_sse2.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/upsampling_sse2.c
Changed
@@ -121,7 +121,7 @@ int uv_pos, pos; \ /* 16byte-aligned array to cache reconstructed u and v */ \ uint8_t uv_buf14 * 32 + 15 = { 0 }; \ - uint8_t* const r_u = (uint8_t*)((uintptr_t)(uv_buf + 15) & ~15); \ + uint8_t* const r_u = (uint8_t*)((uintptr_t)(uv_buf + 15) & ~(uintptr_t)15); \ uint8_t* const r_v = r_u + 32; \ \ assert(top_y != NULL); \
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/yuv.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/yuv.c
Changed
@@ -194,50 +194,6 @@ //----------------------------------------------------------------------------- -#if !WEBP_NEON_OMIT_C_CODE -#define MAX_Y ((1 << 10) - 1) // 10b precision over 16b-arithmetic -static uint16_t clip_y(int v) { - return (v < 0) ? 0 : (v > MAX_Y) ? MAX_Y : (uint16_t)v; -} - -static uint64_t SharpYUVUpdateY_C(const uint16_t* ref, const uint16_t* src, - uint16_t* dst, int len) { - uint64_t diff = 0; - int i; - for (i = 0; i < len; ++i) { - const int diff_y = refi - srci; - const int new_y = (int)dsti + diff_y; - dsti = clip_y(new_y); - diff += (uint64_t)abs(diff_y); - } - return diff; -} - -static void SharpYUVUpdateRGB_C(const int16_t* ref, const int16_t* src, - int16_t* dst, int len) { - int i; - for (i = 0; i < len; ++i) { - const int diff_uv = refi - srci; - dsti += diff_uv; - } -} - -static void SharpYUVFilterRow_C(const int16_t* A, const int16_t* B, int len, - const uint16_t* best_y, uint16_t* out) { - int i; - for (i = 0; i < len; ++i, ++A, ++B) { - const int v0 = (A0 * 9 + A1 * 3 + B0 * 3 + B1 + 8) >> 4; - const int v1 = (A1 * 9 + A0 * 3 + B1 * 3 + B0 + 8) >> 4; - out2 * i + 0 = clip_y(best_y2 * i + 0 + v0); - out2 * i + 1 = clip_y(best_y2 * i + 1 + v1); - } -} -#endif // !WEBP_NEON_OMIT_C_CODE - -#undef MAX_Y - -//----------------------------------------------------------------------------- - void (*WebPConvertRGB24ToY)(const uint8_t* rgb, uint8_t* y, int width); void (*WebPConvertBGR24ToY)(const uint8_t* bgr, uint8_t* y, int width); void (*WebPConvertRGBA32ToUV)(const uint16_t* rgb, @@ -247,18 +203,9 @@ void (*WebPConvertARGBToUV)(const uint32_t* argb, uint8_t* u, uint8_t* v, int src_width, int do_store); -uint64_t (*WebPSharpYUVUpdateY)(const uint16_t* ref, const uint16_t* src, - uint16_t* dst, int len); -void (*WebPSharpYUVUpdateRGB)(const int16_t* ref, const int16_t* src, - int16_t* dst, int len); -void (*WebPSharpYUVFilterRow)(const int16_t* A, const int16_t* B, int len, - const uint16_t* best_y, uint16_t* out); - extern void WebPInitConvertARGBToYUVSSE2(void); extern void WebPInitConvertARGBToYUVSSE41(void); extern void WebPInitConvertARGBToYUVNEON(void); -extern void WebPInitSharpYUVSSE2(void); -extern void WebPInitSharpYUVNEON(void); WEBP_DSP_INIT_FUNC(WebPInitConvertARGBToYUV) { WebPConvertARGBToY = ConvertARGBToY_C; @@ -269,17 +216,10 @@ WebPConvertRGBA32ToUV = WebPConvertRGBA32ToUV_C; -#if !WEBP_NEON_OMIT_C_CODE - WebPSharpYUVUpdateY = SharpYUVUpdateY_C; - WebPSharpYUVUpdateRGB = SharpYUVUpdateRGB_C; - WebPSharpYUVFilterRow = SharpYUVFilterRow_C; -#endif - if (VP8GetCPUInfo != NULL) { #if defined(WEBP_HAVE_SSE2) if (VP8GetCPUInfo(kSSE2)) { WebPInitConvertARGBToYUVSSE2(); - WebPInitSharpYUVSSE2(); } #endif // WEBP_HAVE_SSE2 #if defined(WEBP_HAVE_SSE41) @@ -293,7 +233,6 @@ if (WEBP_NEON_OMIT_C_CODE || (VP8GetCPUInfo != NULL && VP8GetCPUInfo(kNEON))) { WebPInitConvertARGBToYUVNEON(); - WebPInitSharpYUVNEON(); } #endif // WEBP_HAVE_NEON @@ -302,7 +241,4 @@ assert(WebPConvertRGB24ToY != NULL); assert(WebPConvertBGR24ToY != NULL); assert(WebPConvertRGBA32ToUV != NULL); - assert(WebPSharpYUVUpdateY != NULL); - assert(WebPSharpYUVUpdateRGB != NULL); - assert(WebPSharpYUVFilterRow != NULL); }
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/yuv.h -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/yuv.h
Changed
@@ -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
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/yuv_neon.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/yuv_neon.c
Changed
@@ -173,116 +173,8 @@ WebPConvertRGBA32ToUV = ConvertRGBA32ToUV_NEON; } -//------------------------------------------------------------------------------ - -#define MAX_Y ((1 << 10) - 1) // 10b precision over 16b-arithmetic -static uint16_t clip_y_NEON(int v) { - return (v < 0) ? 0 : (v > MAX_Y) ? MAX_Y : (uint16_t)v; -} - -static uint64_t SharpYUVUpdateY_NEON(const uint16_t* ref, const uint16_t* src, - uint16_t* dst, int len) { - int i; - const int16x8_t zero = vdupq_n_s16(0); - const int16x8_t max = vdupq_n_s16(MAX_Y); - uint64x2_t sum = vdupq_n_u64(0); - uint64_t diff; - - for (i = 0; i + 8 <= len; i += 8) { - const int16x8_t A = vreinterpretq_s16_u16(vld1q_u16(ref + i)); - const int16x8_t B = vreinterpretq_s16_u16(vld1q_u16(src + i)); - const int16x8_t C = vreinterpretq_s16_u16(vld1q_u16(dst + i)); - const int16x8_t D = vsubq_s16(A, B); // diff_y - const int16x8_t F = vaddq_s16(C, D); // new_y - const uint16x8_t H = - vreinterpretq_u16_s16(vmaxq_s16(vminq_s16(F, max), zero)); - const int16x8_t I = vabsq_s16(D); // abs(diff_y) - vst1q_u16(dst + i, H); - sum = vpadalq_u32(sum, vpaddlq_u16(vreinterpretq_u16_s16(I))); - } - diff = vgetq_lane_u64(sum, 0) + vgetq_lane_u64(sum, 1); - for (; i < len; ++i) { - const int diff_y = refi - srci; - const int new_y = (int)(dsti) + diff_y; - dsti = clip_y_NEON(new_y); - diff += (uint64_t)(abs(diff_y)); - } - return diff; -} - -static void SharpYUVUpdateRGB_NEON(const int16_t* ref, const int16_t* src, - int16_t* dst, int len) { - int i; - for (i = 0; i + 8 <= len; i += 8) { - const int16x8_t A = vld1q_s16(ref + i); - const int16x8_t B = vld1q_s16(src + i); - const int16x8_t C = vld1q_s16(dst + i); - const int16x8_t D = vsubq_s16(A, B); // diff_uv - const int16x8_t E = vaddq_s16(C, D); // new_uv - vst1q_s16(dst + i, E); - } - for (; i < len; ++i) { - const int diff_uv = refi - srci; - dsti += diff_uv; - } -} - -static void SharpYUVFilterRow_NEON(const int16_t* A, const int16_t* B, int len, - const uint16_t* best_y, uint16_t* out) { - int i; - const int16x8_t max = vdupq_n_s16(MAX_Y); - const int16x8_t zero = vdupq_n_s16(0); - for (i = 0; i + 8 <= len; i += 8) { - const int16x8_t a0 = vld1q_s16(A + i + 0); - const int16x8_t a1 = vld1q_s16(A + i + 1); - const int16x8_t b0 = vld1q_s16(B + i + 0); - const int16x8_t b1 = vld1q_s16(B + i + 1); - const int16x8_t a0b1 = vaddq_s16(a0, b1); - const int16x8_t a1b0 = vaddq_s16(a1, b0); - const int16x8_t a0a1b0b1 = vaddq_s16(a0b1, a1b0); // A0+A1+B0+B1 - const int16x8_t a0b1_2 = vaddq_s16(a0b1, a0b1); // 2*(A0+B1) - const int16x8_t a1b0_2 = vaddq_s16(a1b0, a1b0); // 2*(A1+B0) - const int16x8_t c0 = vshrq_n_s16(vaddq_s16(a0b1_2, a0a1b0b1), 3); - const int16x8_t c1 = vshrq_n_s16(vaddq_s16(a1b0_2, a0a1b0b1), 3); - const int16x8_t d0 = vaddq_s16(c1, a0); - const int16x8_t d1 = vaddq_s16(c0, a1); - const int16x8_t e0 = vrshrq_n_s16(d0, 1); - const int16x8_t e1 = vrshrq_n_s16(d1, 1); - const int16x8x2_t f = vzipq_s16(e0, e1); - const int16x8_t g0 = vreinterpretq_s16_u16(vld1q_u16(best_y + 2 * i + 0)); - const int16x8_t g1 = vreinterpretq_s16_u16(vld1q_u16(best_y + 2 * i + 8)); - const int16x8_t h0 = vaddq_s16(g0, f.val0); - const int16x8_t h1 = vaddq_s16(g1, f.val1); - const int16x8_t i0 = vmaxq_s16(vminq_s16(h0, max), zero); - const int16x8_t i1 = vmaxq_s16(vminq_s16(h1, max), zero); - vst1q_u16(out + 2 * i + 0, vreinterpretq_u16_s16(i0)); - vst1q_u16(out + 2 * i + 8, vreinterpretq_u16_s16(i1)); - } - for (; i < len; ++i) { - const int a0b1 = Ai + 0 + Bi + 1; - const int a1b0 = Ai + 1 + Bi + 0; - const int a0a1b0b1 = a0b1 + a1b0 + 8; - const int v0 = (8 * Ai + 0 + 2 * a1b0 + a0a1b0b1) >> 4; - const int v1 = (8 * Ai + 1 + 2 * a0b1 + a0a1b0b1) >> 4; - out2 * i + 0 = clip_y_NEON(best_y2 * i + 0 + v0); - out2 * i + 1 = clip_y_NEON(best_y2 * i + 1 + v1); - } -} -#undef MAX_Y - -//------------------------------------------------------------------------------ - -extern void WebPInitSharpYUVNEON(void); - -WEBP_TSAN_IGNORE_FUNCTION void WebPInitSharpYUVNEON(void) { - WebPSharpYUVUpdateY = SharpYUVUpdateY_NEON; - WebPSharpYUVUpdateRGB = SharpYUVUpdateRGB_NEON; - WebPSharpYUVFilterRow = SharpYUVFilterRow_NEON; -} - #else // !WEBP_USE_NEON WEBP_DSP_INIT_STUB(WebPInitConvertARGBToYUVNEON) -WEBP_DSP_INIT_STUB(WebPInitSharpYUVNEON) #endif // WEBP_USE_NEON
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/yuv_sse2.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/yuv_sse2.c
Changed
@@ -15,10 +15,12 @@ #if defined(WEBP_USE_SSE2) -#include "src/dsp/common_sse2.h" #include <stdlib.h> #include <emmintrin.h> +#include "src/dsp/common_sse2.h" +#include "src/utils/utils.h" + //----------------------------------------------------------------------------- // Convert spans of 32 pixels to various RGB formats for the fancy upsampler. @@ -74,7 +76,7 @@ // Load and replicate the U/V samples static WEBP_INLINE __m128i Load_UV_HI_8_SSE2(const uint8_t* src) { const __m128i zero = _mm_setzero_si128(); - const __m128i tmp0 = _mm_cvtsi32_si128(*(const uint32_t*)src); + const __m128i tmp0 = _mm_cvtsi32_si128(WebPMemToInt32(src)); const __m128i tmp1 = _mm_unpacklo_epi8(zero, tmp0); return _mm_unpacklo_epi16(tmp1, tmp1); // replicate samples } @@ -130,7 +132,7 @@ const __m128i rg0 = _mm_packus_epi16(*B, *A); const __m128i ba0 = _mm_packus_epi16(*R, *G); #endif - const __m128i mask_0xf0 = _mm_set1_epi8(0xf0); + const __m128i mask_0xf0 = _mm_set1_epi8((char)0xf0); const __m128i rb1 = _mm_unpacklo_epi8(rg0, ba0); // rbrbrbrbrb... const __m128i ga1 = _mm_unpackhi_epi8(rg0, ba0); // gagagagaga... const __m128i rb2 = _mm_and_si128(rb1, mask_0xf0); @@ -147,9 +149,10 @@ const __m128i r0 = _mm_packus_epi16(*R, *R); const __m128i g0 = _mm_packus_epi16(*G, *G); const __m128i b0 = _mm_packus_epi16(*B, *B); - const __m128i r1 = _mm_and_si128(r0, _mm_set1_epi8(0xf8)); + const __m128i r1 = _mm_and_si128(r0, _mm_set1_epi8((char)0xf8)); const __m128i b1 = _mm_and_si128(_mm_srli_epi16(b0, 3), _mm_set1_epi8(0x1f)); - const __m128i g1 = _mm_srli_epi16(_mm_and_si128(g0, _mm_set1_epi8(0xe0)), 5); + const __m128i g1 = + _mm_srli_epi16(_mm_and_si128(g0, _mm_set1_epi8((char)0xe0)), 5); const __m128i g2 = _mm_slli_epi16(_mm_and_si128(g0, _mm_set1_epi8(0x1c)), 3); const __m128i rg = _mm_or_si128(r1, g1); const __m128i gb = _mm_or_si128(g2, b1); @@ -747,128 +750,9 @@ WebPConvertRGBA32ToUV = ConvertRGBA32ToUV_SSE2; } -//------------------------------------------------------------------------------ - -#define MAX_Y ((1 << 10) - 1) // 10b precision over 16b-arithmetic -static uint16_t clip_y(int v) { - return (v < 0) ? 0 : (v > MAX_Y) ? MAX_Y : (uint16_t)v; -} - -static uint64_t SharpYUVUpdateY_SSE2(const uint16_t* ref, const uint16_t* src, - uint16_t* dst, int len) { - uint64_t diff = 0; - uint32_t tmp4; - int i; - const __m128i zero = _mm_setzero_si128(); - const __m128i max = _mm_set1_epi16(MAX_Y); - const __m128i one = _mm_set1_epi16(1); - __m128i sum = zero; - - for (i = 0; i + 8 <= len; i += 8) { - const __m128i A = _mm_loadu_si128((const __m128i*)(ref + i)); - const __m128i B = _mm_loadu_si128((const __m128i*)(src + i)); - const __m128i C = _mm_loadu_si128((const __m128i*)(dst + i)); - const __m128i D = _mm_sub_epi16(A, B); // diff_y - const __m128i E = _mm_cmpgt_epi16(zero, D); // sign (-1 or 0) - const __m128i F = _mm_add_epi16(C, D); // new_y - const __m128i G = _mm_or_si128(E, one); // -1 or 1 - const __m128i H = _mm_max_epi16(_mm_min_epi16(F, max), zero); - const __m128i I = _mm_madd_epi16(D, G); // sum(abs(...)) - _mm_storeu_si128((__m128i*)(dst + i), H); - sum = _mm_add_epi32(sum, I); - } - _mm_storeu_si128((__m128i*)tmp, sum); - diff = tmp3 + tmp2 + tmp1 + tmp0; - for (; i < len; ++i) { - const int diff_y = refi - srci; - const int new_y = (int)dsti + diff_y; - dsti = clip_y(new_y); - diff += (uint64_t)abs(diff_y); - } - return diff; -} - -static void SharpYUVUpdateRGB_SSE2(const int16_t* ref, const int16_t* src, - int16_t* dst, int len) { - int i = 0; - for (i = 0; i + 8 <= len; i += 8) { - const __m128i A = _mm_loadu_si128((const __m128i*)(ref + i)); - const __m128i B = _mm_loadu_si128((const __m128i*)(src + i)); - const __m128i C = _mm_loadu_si128((const __m128i*)(dst + i)); - const __m128i D = _mm_sub_epi16(A, B); // diff_uv - const __m128i E = _mm_add_epi16(C, D); // new_uv - _mm_storeu_si128((__m128i*)(dst + i), E); - } - for (; i < len; ++i) { - const int diff_uv = refi - srci; - dsti += diff_uv; - } -} - -static void SharpYUVFilterRow_SSE2(const int16_t* A, const int16_t* B, int len, - const uint16_t* best_y, uint16_t* out) { - int i; - const __m128i kCst8 = _mm_set1_epi16(8); - const __m128i max = _mm_set1_epi16(MAX_Y); - const __m128i zero = _mm_setzero_si128(); - for (i = 0; i + 8 <= len; i += 8) { - const __m128i a0 = _mm_loadu_si128((const __m128i*)(A + i + 0)); - const __m128i a1 = _mm_loadu_si128((const __m128i*)(A + i + 1)); - const __m128i b0 = _mm_loadu_si128((const __m128i*)(B + i + 0)); - const __m128i b1 = _mm_loadu_si128((const __m128i*)(B + i + 1)); - const __m128i a0b1 = _mm_add_epi16(a0, b1); - const __m128i a1b0 = _mm_add_epi16(a1, b0); - const __m128i a0a1b0b1 = _mm_add_epi16(a0b1, a1b0); // A0+A1+B0+B1 - const __m128i a0a1b0b1_8 = _mm_add_epi16(a0a1b0b1, kCst8); - const __m128i a0b1_2 = _mm_add_epi16(a0b1, a0b1); // 2*(A0+B1) - const __m128i a1b0_2 = _mm_add_epi16(a1b0, a1b0); // 2*(A1+B0) - const __m128i c0 = _mm_srai_epi16(_mm_add_epi16(a0b1_2, a0a1b0b1_8), 3); - const __m128i c1 = _mm_srai_epi16(_mm_add_epi16(a1b0_2, a0a1b0b1_8), 3); - const __m128i d0 = _mm_add_epi16(c1, a0); - const __m128i d1 = _mm_add_epi16(c0, a1); - const __m128i e0 = _mm_srai_epi16(d0, 1); - const __m128i e1 = _mm_srai_epi16(d1, 1); - const __m128i f0 = _mm_unpacklo_epi16(e0, e1); - const __m128i f1 = _mm_unpackhi_epi16(e0, e1); - const __m128i g0 = _mm_loadu_si128((const __m128i*)(best_y + 2 * i + 0)); - const __m128i g1 = _mm_loadu_si128((const __m128i*)(best_y + 2 * i + 8)); - const __m128i h0 = _mm_add_epi16(g0, f0); - const __m128i h1 = _mm_add_epi16(g1, f1); - const __m128i i0 = _mm_max_epi16(_mm_min_epi16(h0, max), zero); - const __m128i i1 = _mm_max_epi16(_mm_min_epi16(h1, max), zero); - _mm_storeu_si128((__m128i*)(out + 2 * i + 0), i0); - _mm_storeu_si128((__m128i*)(out + 2 * i + 8), i1); - } - for (; i < len; ++i) { - // (9 * A0 + 3 * A1 + 3 * B0 + B1 + 8) >> 4 = - // = (8 * A0 + 2 * (A1 + B0) + (A0 + A1 + B0 + B1 + 8)) >> 4 - // We reuse the common sub-expressions. - const int a0b1 = Ai + 0 + Bi + 1; - const int a1b0 = Ai + 1 + Bi + 0; - const int a0a1b0b1 = a0b1 + a1b0 + 8; - const int v0 = (8 * Ai + 0 + 2 * a1b0 + a0a1b0b1) >> 4; - const int v1 = (8 * Ai + 1 + 2 * a0b1 + a0a1b0b1) >> 4; - out2 * i + 0 = clip_y(best_y2 * i + 0 + v0); - out2 * i + 1 = clip_y(best_y2 * i + 1 + v1); - } -} - -#undef MAX_Y - -//------------------------------------------------------------------------------ - -extern void WebPInitSharpYUVSSE2(void); - -WEBP_TSAN_IGNORE_FUNCTION void WebPInitSharpYUVSSE2(void) { - WebPSharpYUVUpdateY = SharpYUVUpdateY_SSE2; - WebPSharpYUVUpdateRGB = SharpYUVUpdateRGB_SSE2; - WebPSharpYUVFilterRow = SharpYUVFilterRow_SSE2; -} - #else // !WEBP_USE_SSE2 WEBP_DSP_INIT_STUB(WebPInitSamplersSSE2) WEBP_DSP_INIT_STUB(WebPInitConvertARGBToYUVSSE2) -WEBP_DSP_INIT_STUB(WebPInitSharpYUVSSE2) #endif // WEBP_USE_SSE2
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/dsp/yuv_sse41.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/dsp/yuv_sse41.c
Changed
@@ -15,10 +15,12 @@ #if defined(WEBP_USE_SSE41) -#include "src/dsp/common_sse41.h" #include <stdlib.h> #include <smmintrin.h> +#include "src/dsp/common_sse41.h" +#include "src/utils/utils.h" + //----------------------------------------------------------------------------- // Convert spans of 32 pixels to various RGB formats for the fancy upsampler. @@ -74,7 +76,7 @@ // Load and replicate the U/V samples static WEBP_INLINE __m128i Load_UV_HI_8_SSE41(const uint8_t* src) { const __m128i zero = _mm_setzero_si128(); - const __m128i tmp0 = _mm_cvtsi32_si128(*(const uint32_t*)src); + const __m128i tmp0 = _mm_cvtsi32_si128(WebPMemToInt32(src)); const __m128i tmp1 = _mm_unpacklo_epi8(zero, tmp0); return _mm_unpacklo_epi16(tmp1, tmp1); // replicate samples }
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/enc/Makefile.am -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/enc/Makefile.am
Changed
@@ -37,6 +37,7 @@ noinst_HEADERS = noinst_HEADERS += ../webp/format_constants.h +libwebpencode_la_LIBADD = ../../sharpyuv/libsharpyuv.la libwebpencode_la_LDFLAGS = -lm libwebpencode_la_CPPFLAGS = $(AM_CPPFLAGS) libwebpencodeincludedir = $(includedir)/webp
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/enc/Makefile.in -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/enc/Makefile.in
Changed
@@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -104,7 +104,7 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) -libwebpencode_la_LIBADD = +libwebpencode_la_DEPENDENCIES = ../../sharpyuv/libsharpyuv.la am_libwebpencode_la_OBJECTS = libwebpencode_la-alpha_enc.lo \ libwebpencode_la-analysis_enc.lo \ libwebpencode_la-backward_references_cost_enc.lo \ @@ -242,8 +242,6 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ @@ -259,8 +257,9 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -271,8 +270,10 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +FILECMD = @FILECMD@ GIF_INCLUDES = @GIF_INCLUDES@ GIF_LIBS = @GIF_LIBS@ GL_INCLUDES = @GL_INCLUDES@ @@ -387,6 +388,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +webp_libname_prefix = @webp_libname_prefix@ noinst_LTLIBRARIES = libwebpencode.la libwebpencode_la_SOURCES = alpha_enc.c analysis_enc.c \ backward_references_cost_enc.c backward_references_enc.c \ @@ -399,6 +401,7 @@ webp_enc.c libwebpencodeinclude_HEADERS = ../webp/encode.h ../webp/types.h noinst_HEADERS = ../webp/format_constants.h +libwebpencode_la_LIBADD = ../../sharpyuv/libsharpyuv.la libwebpencode_la_LDFLAGS = -lm libwebpencode_la_CPPFLAGS = $(AM_CPPFLAGS) libwebpencodeincludedir = $(includedir)/webp @@ -749,7 +752,6 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/enc/alpha_enc.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/enc/alpha_enc.c
Changed
@@ -86,7 +86,7 @@ // a decoder bug related to alpha with color cache. // See: https://code.google.com/p/webp/issues/detail?id=239 // Need to re-enable this later. - ok = (VP8LEncodeStream(&config, &picture, bw, 0 /*use_cache*/) == VP8_ENC_OK); + ok = VP8LEncodeStream(&config, &picture, bw, /*use_cache=*/0); WebPPictureFree(&picture); ok = ok && !bw->error_; if (!ok) {
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/enc/analysis_enc.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/enc/analysis_enc.c
Changed
@@ -391,12 +391,14 @@ return ok; } +#ifdef WEBP_USE_THREAD static void MergeJobs(const SegmentJob* const src, SegmentJob* const dst) { int i; for (i = 0; i <= MAX_ALPHA; ++i) dst->alphasi += src->alphasi; dst->alpha += src->alpha; dst->uv_alpha += src->uv_alpha; } +#endif // initialize the job struct with some tasks to perform static void InitSegmentJob(VP8Encoder* const enc, SegmentJob* const job, @@ -425,10 +427,10 @@ (enc->method_ <= 1); // for method 0 - 1, we need preds_ to be filled. if (do_segments) { const int last_row = enc->mb_h_; - // We give a little more than a half work to the main thread. - const int split_row = (9 * last_row + 15) >> 4; const int total_mb = last_row * enc->mb_w_; #ifdef WEBP_USE_THREAD + // We give a little more than a half work to the main thread. + const int split_row = (9 * last_row + 15) >> 4; const int kMinSplitRow = 2; // minimal rows needed for mt to be worth it const int do_mt = (enc->thread_level_ > 0) && (split_row >= kMinSplitRow); #else @@ -438,6 +440,7 @@ WebPGetWorkerInterface(); SegmentJob main_job; if (do_mt) { +#ifdef WEBP_USE_THREAD SegmentJob side_job; // Note the use of '&' instead of '&&' because we must call the functions // no matter what. @@ -455,6 +458,7 @@ } worker_interface->End(&side_job.worker); if (ok) MergeJobs(&side_job, &main_job); // merge results together +#endif // WEBP_USE_THREAD } else { // Even for single-thread case, we use the generic Worker tools. InitSegmentJob(enc, &main_job, 0, last_row);
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/enc/backward_references_cost_enc.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/enc/backward_references_cost_enc.c
Changed
@@ -15,10 +15,11 @@ // #include <assert.h> +#include <float.h> +#include "src/dsp/lossless_common.h" #include "src/enc/backward_references_enc.h" #include "src/enc/histogram_enc.h" -#include "src/dsp/lossless_common.h" #include "src/utils/color_cache_utils.h" #include "src/utils/utils.h" @@ -30,15 +31,15 @@ const PixOrCopy v); typedef struct { - double alpha_VALUES_IN_BYTE; - double red_VALUES_IN_BYTE; - double blue_VALUES_IN_BYTE; - double distance_NUM_DISTANCE_CODES; - double* literal_; + float alpha_VALUES_IN_BYTE; + float red_VALUES_IN_BYTE; + float blue_VALUES_IN_BYTE; + float distance_NUM_DISTANCE_CODES; + float* literal_; } CostModel; static void ConvertPopulationCountTableToBitEstimates( - int num_symbols, const uint32_t population_counts, double output) { + int num_symbols, const uint32_t population_counts, float output) { uint32_t sum = 0; int nonzeros = 0; int i; @@ -51,7 +52,7 @@ if (nonzeros <= 1) { memset(output, 0, num_symbols * sizeof(*output)); } else { - const double logsum = VP8LFastLog2(sum); + const float logsum = VP8LFastLog2(sum); for (i = 0; i < num_symbols; ++i) { outputi = logsum - VP8LFastLog2(population_countsi); } @@ -75,8 +76,8 @@ } ConvertPopulationCountTableToBitEstimates( - VP8LHistogramNumCodes(histo->palette_code_bits_), - histo->literal_, m->literal_); + VP8LHistogramNumCodes(histo->palette_code_bits_), histo->literal_, + m->literal_); ConvertPopulationCountTableToBitEstimates( VALUES_IN_BYTE, histo->red_, m->red_); ConvertPopulationCountTableToBitEstimates( @@ -92,27 +93,27 @@ return ok; } -static WEBP_INLINE double GetLiteralCost(const CostModel* const m, uint32_t v) { +static WEBP_INLINE float GetLiteralCost(const CostModel* const m, uint32_t v) { return m->alpha_v >> 24 + m->red_(v >> 16) & 0xff + m->literal_(v >> 8) & 0xff + m->blue_v & 0xff; } -static WEBP_INLINE double GetCacheCost(const CostModel* const m, uint32_t idx) { +static WEBP_INLINE float GetCacheCost(const CostModel* const m, uint32_t idx) { const int literal_idx = VALUES_IN_BYTE + NUM_LENGTH_CODES + idx; return m->literal_literal_idx; } -static WEBP_INLINE double GetLengthCost(const CostModel* const m, - uint32_t length) { +static WEBP_INLINE float GetLengthCost(const CostModel* const m, + uint32_t length) { int code, extra_bits; VP8LPrefixEncodeBits(length, &code, &extra_bits); return m->literal_VALUES_IN_BYTE + code + extra_bits; } -static WEBP_INLINE double GetDistanceCost(const CostModel* const m, - uint32_t distance) { +static WEBP_INLINE float GetDistanceCost(const CostModel* const m, + uint32_t distance) { int code, extra_bits; VP8LPrefixEncodeBits(distance, &code, &extra_bits); return m->distance_code + extra_bits; @@ -122,20 +123,20 @@ const uint32_t* const argb, VP8LColorCache* const hashers, const CostModel* const cost_model, int idx, int use_color_cache, float prev_cost, float* const cost, uint16_t* const dist_array) { - double cost_val = prev_cost; + float cost_val = prev_cost; const uint32_t color = argbidx; const int ix = use_color_cache ? VP8LColorCacheContains(hashers, color) : -1; if (ix >= 0) { // use_color_cache is true and hashers contains color - const double mul0 = 0.68; + const float mul0 = 0.68f; cost_val += GetCacheCost(cost_model, ix) * mul0; } else { - const double mul1 = 0.82; + const float mul1 = 0.82f; if (use_color_cache) VP8LColorCacheInsert(hashers, color); cost_val += GetLiteralCost(cost_model, color) * mul1; } if (costidx > cost_val) { - costidx = (float)cost_val; + costidx = cost_val; dist_arrayidx = 1; // only one is inserted. } } @@ -172,7 +173,7 @@ // The GetLengthCost(cost_model, k) are cached in a CostCacheInterval. typedef struct { - double cost_; + float cost_; int start_; int end_; // Exclusive. } CostCacheInterval; @@ -187,7 +188,7 @@ int count_; // The number of stored intervals. CostCacheInterval* cache_intervals_; size_t cache_intervals_size_; - double cost_cache_MAX_LENGTH; // Contains the GetLengthCost(cost_model, k). + float cost_cache_MAX_LENGTH; // Contains the GetLengthCost(cost_model, k). float* costs_; uint16_t* dist_array_; // Most of the time, we only need few intervals -> use a free-list, to avoid @@ -262,10 +263,13 @@ CostManagerInitFreeList(manager); // Fill in the cost_cache_. + // Has to be done in two passes due to a GCC bug on i686 + // related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=323 + for (i = 0; i < cost_cache_size; ++i) { + manager->cost_cache_i = GetLengthCost(cost_model, i); + } manager->cache_intervals_size_ = 1; - manager->cost_cache_0 = GetLengthCost(cost_model, 0); for (i = 1; i < cost_cache_size; ++i) { - manager->cost_cache_i = GetLengthCost(cost_model, i); // Get the number of bound intervals. if (manager->cost_cache_i != manager->cost_cache_i - 1) { ++manager->cache_intervals_size_; @@ -294,7 +298,7 @@ cur->end_ = 1; cur->cost_ = manager->cost_cache_0; for (i = 1; i < cost_cache_size; ++i) { - const double cost_val = manager->cost_cache_i; + const float cost_val = manager->cost_cache_i; if (cost_val != cur->cost_) { ++cur; // Initialize an interval. @@ -303,6 +307,8 @@ } cur->end_ = i + 1; } + assert((size_t)(cur - manager->cache_intervals_) + 1 == + manager->cache_intervals_size_); } manager->costs_ = (float*)WebPSafeMalloc(pix_count, sizeof(*manager->costs_)); @@ -311,7 +317,7 @@ return 0; } // Set the initial costs_ high for every pixel as we will keep the minimum. - for (i = 0; i < pix_count; ++i) manager->costs_i = 1e38f; + for (i = 0; i < pix_count; ++i) manager->costs_i = FLT_MAX; return 1; } @@ -457,7 +463,7 @@ // If handling the interval or one of its subintervals becomes to heavy, its // contribution is added to the costs right away. static WEBP_INLINE void PushInterval(CostManager* const manager, - double distance_cost, int position, + float distance_cost, int position, int len) { size_t i; CostInterval* interval = manager->head_; @@ -474,7 +480,7 @@ const int k = j - position; float cost_tmp; assert(k >= 0 && k < MAX_LENGTH); - cost_tmp = (float)(distance_cost + manager->cost_cache_k); + cost_tmp = distance_cost + manager->cost_cache_k; if (manager->costs_j > cost_tmp) { manager->costs_j = cost_tmp; @@ -492,7 +498,7 @@ const int end = position + (cost_cache_intervalsi.end_ > len ? len : cost_cache_intervalsi.end_); - const float cost = (float)(distance_cost + cost_cache_intervalsi.cost_); + const float cost = distance_cost + cost_cache_intervalsi.cost_;
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/enc/backward_references_enc.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/enc/backward_references_enc.c
Changed
@@ -10,6 +10,8 @@ // Author: Jyrki Alakuijala (jyrki@google.com) // +#include "src/enc/backward_references_enc.h" + #include <assert.h> #include <float.h> #include <math.h> @@ -17,10 +19,11 @@ #include "src/dsp/dsp.h" #include "src/dsp/lossless.h" #include "src/dsp/lossless_common.h" -#include "src/enc/backward_references_enc.h" #include "src/enc/histogram_enc.h" +#include "src/enc/vp8i_enc.h" #include "src/utils/color_cache_utils.h" #include "src/utils/utils.h" +#include "src/webp/encode.h" #define MIN_BLOCK_SIZE 256 // minimum block size for backward references @@ -255,10 +258,13 @@ int VP8LHashChainFill(VP8LHashChain* const p, int quality, const uint32_t* const argb, int xsize, int ysize, - int low_effort) { + int low_effort, const WebPPicture* const pic, + int percent_range, int* const percent) { const int size = xsize * ysize; const int iter_max = GetMaxItersForQuality(quality); const uint32_t window_size = GetWindowSizeForHashChain(quality, xsize); + int remaining_percent = percent_range; + int percent_start = *percent; int pos; int argb_comp; uint32_t base_position; @@ -276,7 +282,13 @@ hash_to_first_index = (int32_t*)WebPSafeMalloc(HASH_SIZE, sizeof(*hash_to_first_index)); - if (hash_to_first_index == NULL) return 0; + if (hash_to_first_index == NULL) { + WebPEncodingSetError(pic, VP8_ENC_ERROR_OUT_OF_MEMORY); + return 0; + } + + percent_range = remaining_percent / 2; + remaining_percent -= percent_range; // Set the int32_t array to -1. memset(hash_to_first_index, 0xff, HASH_SIZE * sizeof(*hash_to_first_index)); @@ -323,12 +335,22 @@ hash_to_first_indexhash_code = pos++; argb_comp = argb_comp_next; } + + if (!WebPReportProgress( + pic, percent_start + percent_range * pos / (size - 2), percent)) { + WebPSafeFree(hash_to_first_index); + return 0; + } } // Process the penultimate pixel. chainpos = hash_to_first_indexGetPixPairHash64(argb + pos); WebPSafeFree(hash_to_first_index); + percent_start += percent_range; + if (!WebPReportProgress(pic, percent_start, percent)) return 0; + percent_range = remaining_percent; + // Find the best match interval at each pixel, defined by an offset to the // pixel and a length. The right-most pixel cannot match anything to the right // (hence a best length of 0) and the left-most pixel nothing to the left @@ -417,8 +439,17 @@ max_base_position = base_position; } } + + if (!WebPReportProgress(pic, + percent_start + percent_range * + (size - 2 - base_position) / + (size - 2), + percent)) { + return 0; + } } - return 1; + + return WebPReportProgress(pic, percent_start + percent_range, percent); } static WEBP_INLINE void AddSingleLiteral(uint32_t pixel, int use_color_cache, @@ -728,7 +759,7 @@ int* const best_cache_bits) { int i; const int cache_bits_max = (quality <= 25) ? 0 : *best_cache_bits; - double entropy_min = MAX_ENTROPY; + float entropy_min = MAX_ENTROPY; int cc_initMAX_COLOR_CACHE_BITS + 1 = { 0 }; VP8LColorCache hashersMAX_COLOR_CACHE_BITS + 1; VP8LRefsCursor c = VP8LRefsCursorInit(refs); @@ -813,14 +844,14 @@ } for (i = 0; i <= cache_bits_max; ++i) { - const double entropy = VP8LHistogramEstimateBits(histosi); + const float entropy = VP8LHistogramEstimateBits(histosi); if (i == 0 || entropy < entropy_min) { entropy_min = entropy; *best_cache_bits = i; } } ok = 1; -Error: + Error: for (i = 0; i <= cache_bits_max; ++i) { if (cc_initi) VP8LColorCacheClear(&hashersi); VP8LFreeHistogram(histosi); @@ -890,7 +921,7 @@ int i, lz77_type; // Index 0 is for a color cache, index 1 for no cache (if needed). int lz77_types_best2 = {0, 0}; - double bit_costs_best2 = {DBL_MAX, DBL_MAX}; + float bit_costs_best2 = {FLT_MAX, FLT_MAX}; VP8LHashChain hash_chain_box; VP8LBackwardRefs* const refs_tmp = &refsdo_no_cache ? 2 : 1; int status = 0; @@ -902,7 +933,7 @@ for (lz77_type = 1; lz77_types_to_try; lz77_types_to_try &= ~lz77_type, lz77_type <<= 1) { int res = 0; - double bit_cost = 0.; + float bit_cost = 0.f; if ((lz77_types_to_try & lz77_type) == 0) continue; switch (lz77_type) { case kLZ77RLE: @@ -976,15 +1007,16 @@ const VP8LHashChain* const hash_chain_tmp = (lz77_types_besti == kLZ77Standard) ? hash_chain : &hash_chain_box; const int cache_bits = (i == 1) ? 0 : *cache_bits_best; - if (VP8LBackwardReferencesTraceBackwards(width, height, argb, cache_bits, - hash_chain_tmp, &refsi, - refs_tmp)) { - double bit_cost_trace; - VP8LHistogramCreate(histo, refs_tmp, cache_bits); - bit_cost_trace = VP8LHistogramEstimateBits(histo); - if (bit_cost_trace < bit_costs_besti) { - BackwardRefsSwap(refs_tmp, &refsi); - } + float bit_cost_trace; + if (!VP8LBackwardReferencesTraceBackwards(width, height, argb, cache_bits, + hash_chain_tmp, &refsi, + refs_tmp)) { + goto Error; + } + VP8LHistogramCreate(histo, refs_tmp, cache_bits); + bit_cost_trace = VP8LHistogramEstimateBits(histo); + if (bit_cost_trace < bit_costs_besti) { + BackwardRefsSwap(refs_tmp, &refsi); } } @@ -1000,31 +1032,37 @@ } status = 1; -Error: + Error: VP8LHashChainClear(&hash_chain_box); VP8LFreeHistogram(histo); return status; } -WebPEncodingError VP8LGetBackwardReferences( +int VP8LGetBackwardReferences( int width, int height, const uint32_t* const argb, int quality, int low_effort, int lz77_types_to_try, int cache_bits_max, int do_no_cache, const VP8LHashChain* const hash_chain, VP8LBackwardRefs* const refs, - int* const cache_bits_best) { + int* const cache_bits_best, const WebPPicture* const pic, int percent_range, + int* const percent) { if (low_effort) { VP8LBackwardRefs* refs_best; *cache_bits_best = cache_bits_max; refs_best = GetBackwardReferencesLowEffort( width, height, argb, cache_bits_best, hash_chain, refs); - if (refs_best == NULL) return VP8_ENC_ERROR_OUT_OF_MEMORY; + if (refs_best == NULL) { + WebPEncodingSetError(pic, VP8_ENC_ERROR_OUT_OF_MEMORY); + return 0; + } // Set it in first position. BackwardRefsSwap(refs_best, &refs0); } else { if (!GetBackwardReferences(width, height, argb, quality, lz77_types_to_try, cache_bits_max, do_no_cache, hash_chain, refs, cache_bits_best)) { - return VP8_ENC_ERROR_OUT_OF_MEMORY;
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/enc/backward_references_enc.h -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/enc/backward_references_enc.h
Changed
@@ -134,10 +134,11 @@ // Must be called first, to set size. int VP8LHashChainInit(VP8LHashChain* const p, int size); -// Pre-compute the best matches for argb. +// Pre-compute the best matches for argb. pic and percent are for progress. int VP8LHashChainFill(VP8LHashChain* const p, int quality, const uint32_t* const argb, int xsize, int ysize, - int low_effort); + int low_effort, const WebPPicture* const pic, + int percent_range, int* const percent); void VP8LHashChainClear(VP8LHashChain* const p); // release memory static WEBP_INLINE int VP8LHashChainFindOffset(const VP8LHashChain* const p, @@ -227,11 +228,14 @@ // VP8LBackwardRefs is put in the first element, the best value with no-cache in // the second element. // In both cases, the last element is used as temporary internally. -WebPEncodingError VP8LGetBackwardReferences( +// pic and percent are for progress. +// Returns false in case of error (stored in pic->error_code). +int VP8LGetBackwardReferences( int width, int height, const uint32_t* const argb, int quality, int low_effort, int lz77_types_to_try, int cache_bits_max, int do_no_cache, const VP8LHashChain* const hash_chain, VP8LBackwardRefs* const refs, - int* const cache_bits_best); + int* const cache_bits_best, const WebPPicture* const pic, int percent_range, + int* const percent); #ifdef __cplusplus }
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/enc/frame_enc.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/enc/frame_enc.c
Changed
@@ -778,6 +778,7 @@ // Roughly refresh the proba eight times per pass int max_count = (enc->mb_w_ * enc->mb_h_) >> 3; int num_pass_left = enc->config_->pass; + int remaining_progress = 40; // percents const int do_search = enc->do_search_; VP8EncIterator it; VP8EncProba* const proba = &enc->proba_; @@ -805,6 +806,9 @@ uint64_t size_p0 = 0; uint64_t distortion = 0; int cnt = max_count; + // The final number of passes is not trivial to know in advance. + const int pass_progress = remaining_progress / (2 + num_pass_left); + remaining_progress -= pass_progress; VP8IteratorInit(enc, &it); SetLoopParams(enc, stats.q); if (is_last_pass) { @@ -832,7 +836,7 @@ StoreSideInfo(&it); VP8StoreFilterStats(&it); VP8IteratorExport(&it); - ok = VP8IteratorProgress(&it, 20); + ok = VP8IteratorProgress(&it, pass_progress); } VP8IteratorSaveBoundary(&it); } while (ok && VP8IteratorNext(&it)); @@ -878,7 +882,8 @@ ok = VP8EmitTokens(&enc->tokens_, enc->parts_ + 0, (const uint8_t*)proba->coeffs_, 1); } - ok = ok && WebPReportProgress(enc->pic_, enc->percent_ + 20, &enc->percent_); + ok = ok && WebPReportProgress(enc->pic_, enc->percent_ + remaining_progress, + &enc->percent_); return PostLoopFinalize(&it, ok); }
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/enc/histogram_enc.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/enc/histogram_enc.c
Changed
@@ -13,15 +13,17 @@ #include "src/webp/config.h" #endif +#include <float.h> #include <math.h> -#include "src/enc/backward_references_enc.h" -#include "src/enc/histogram_enc.h" #include "src/dsp/lossless.h" #include "src/dsp/lossless_common.h" +#include "src/enc/backward_references_enc.h" +#include "src/enc/histogram_enc.h" +#include "src/enc/vp8i_enc.h" #include "src/utils/utils.h" -#define MAX_COST 1.e38 +#define MAX_BIT_COST FLT_MAX // Number of partitions for the three dominant (literal, red and blue) symbol // costs. @@ -228,8 +230,8 @@ // ----------------------------------------------------------------------------- // Entropy-related functions. -static WEBP_INLINE double BitsEntropyRefine(const VP8LBitEntropy* entropy) { - double mix; +static WEBP_INLINE float BitsEntropyRefine(const VP8LBitEntropy* entropy) { + float mix; if (entropy->nonzeros < 5) { if (entropy->nonzeros <= 1) { return 0; @@ -238,67 +240,67 @@ // Let's mix in a bit of entropy to favor good clustering when // distributions of these are combined. if (entropy->nonzeros == 2) { - return 0.99 * entropy->sum + 0.01 * entropy->entropy; + return 0.99f * entropy->sum + 0.01f * entropy->entropy; } // No matter what the entropy says, we cannot be better than min_limit // with Huffman coding. I am mixing a bit of entropy into the // min_limit since it produces much better (~0.5 %) compression results // perhaps because of better entropy clustering. if (entropy->nonzeros == 3) { - mix = 0.95; + mix = 0.95f; } else { - mix = 0.7; // nonzeros == 4. + mix = 0.7f; // nonzeros == 4. } } else { - mix = 0.627; + mix = 0.627f; } { - double min_limit = 2 * entropy->sum - entropy->max_val; - min_limit = mix * min_limit + (1.0 - mix) * entropy->entropy; + float min_limit = 2.f * entropy->sum - entropy->max_val; + min_limit = mix * min_limit + (1.f - mix) * entropy->entropy; return (entropy->entropy < min_limit) ? min_limit : entropy->entropy; } } -double VP8LBitsEntropy(const uint32_t* const array, int n) { +float VP8LBitsEntropy(const uint32_t* const array, int n) { VP8LBitEntropy entropy; VP8LBitsEntropyUnrefined(array, n, &entropy); return BitsEntropyRefine(&entropy); } -static double InitialHuffmanCost(void) { +static float InitialHuffmanCost(void) { // Small bias because Huffman code length is typically not stored in // full length. static const int kHuffmanCodeOfHuffmanCodeSize = CODE_LENGTH_CODES * 3; - static const double kSmallBias = 9.1; + static const float kSmallBias = 9.1f; return kHuffmanCodeOfHuffmanCodeSize - kSmallBias; } // Finalize the Huffman cost based on streak numbers and length type (<3 or >=3) -static double FinalHuffmanCost(const VP8LStreaks* const stats) { +static float FinalHuffmanCost(const VP8LStreaks* const stats) { // The constants in this function are experimental and got rounded from // their original values in 1/8 when switched to 1/1024. - double retval = InitialHuffmanCost(); + float retval = InitialHuffmanCost(); // Second coefficient: Many zeros in the histogram are covered efficiently // by a run-length encode. Originally 2/8. - retval += stats->counts0 * 1.5625 + 0.234375 * stats->streaks01; + retval += stats->counts0 * 1.5625f + 0.234375f * stats->streaks01; // Second coefficient: Constant values are encoded less efficiently, but still // RLE'ed. Originally 6/8. - retval += stats->counts1 * 2.578125 + 0.703125 * stats->streaks11; + retval += stats->counts1 * 2.578125f + 0.703125f * stats->streaks11; // 0s are usually encoded more efficiently than non-0s. // Originally 15/8. - retval += 1.796875 * stats->streaks00; + retval += 1.796875f * stats->streaks00; // Originally 26/8. - retval += 3.28125 * stats->streaks10; + retval += 3.28125f * stats->streaks10; return retval; } // Get the symbol entropy for the distribution 'population'. // Set 'trivial_sym', if there's only one symbol present in the distribution. -static double PopulationCost(const uint32_t* const population, int length, - uint32_t* const trivial_sym, - uint8_t* const is_used) { +static float PopulationCost(const uint32_t* const population, int length, + uint32_t* const trivial_sym, + uint8_t* const is_used) { VP8LBitEntropy bit_entropy; VP8LStreaks stats; VP8LGetEntropyUnrefined(population, length, &bit_entropy, &stats); @@ -314,11 +316,10 @@ // trivial_at_end is 1 if the two histograms only have one element that is // non-zero: both the zero-th one, or both the last one. -static WEBP_INLINE double GetCombinedEntropy(const uint32_t* const X, - const uint32_t* const Y, - int length, int is_X_used, - int is_Y_used, - int trivial_at_end) { +static WEBP_INLINE float GetCombinedEntropy(const uint32_t* const X, + const uint32_t* const Y, int length, + int is_X_used, int is_Y_used, + int trivial_at_end) { VP8LStreaks stats; if (trivial_at_end) { // This configuration is due to palettization that transforms an indexed @@ -356,7 +357,7 @@ } // Estimates the Entropy + Huffman + other block overhead size cost. -double VP8LHistogramEstimateBits(VP8LHistogram* const p) { +float VP8LHistogramEstimateBits(VP8LHistogram* const p) { return PopulationCost(p->literal_, VP8LHistogramNumCodes(p->palette_code_bits_), NULL, &p->is_used_0) @@ -373,8 +374,7 @@ static int GetCombinedHistogramEntropy(const VP8LHistogram* const a, const VP8LHistogram* const b, - double cost_threshold, - double* cost) { + float cost_threshold, float* cost) { const int palette_code_bits = a->palette_code_bits_; int trivial_at_end = 0; assert(a->palette_code_bits_ == b->palette_code_bits_); @@ -439,12 +439,11 @@ // Since the previous score passed is 'cost_threshold', we only need to compare // the partial cost against 'cost_threshold + C(a) + C(b)' to possibly bail-out // early. -static double HistogramAddEval(const VP8LHistogram* const a, - const VP8LHistogram* const b, - VP8LHistogram* const out, - double cost_threshold) { - double cost = 0; - const double sum_cost = a->bit_cost_ + b->bit_cost_; +static float HistogramAddEval(const VP8LHistogram* const a, + const VP8LHistogram* const b, + VP8LHistogram* const out, float cost_threshold) { + float cost = 0; + const float sum_cost = a->bit_cost_ + b->bit_cost_; cost_threshold += sum_cost; if (GetCombinedHistogramEntropy(a, b, cost_threshold, &cost)) { @@ -459,10 +458,10 @@ // Same as HistogramAddEval(), except that the resulting histogram // is not stored. Only the cost C(a+b) - C(a) is evaluated. We omit // the term C(b) which is constant over all the evaluations. -static double HistogramAddThresh(const VP8LHistogram* const a, - const VP8LHistogram* const b, - double cost_threshold) { - double cost; +static float HistogramAddThresh(const VP8LHistogram* const a, + const VP8LHistogram* const b, + float cost_threshold) { + float cost; assert(a != NULL && b != NULL); cost = -a->bit_cost_; GetCombinedHistogramEntropy(a, b, cost_threshold, &cost); @@ -473,24 +472,22 @@ // The structure to keep track of cost range for the three dominant entropy // symbols. -// TODO(skal): Evaluate if float can be used here instead of double for -// representing the entropy costs. typedef struct { - double literal_max_; - double literal_min_; - double red_max_; - double red_min_; - double blue_max_; - double blue_min_; + float literal_max_;
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/enc/histogram_enc.h -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/enc/histogram_enc.h
Changed
@@ -40,10 +40,10 @@ int palette_code_bits_; uint32_t trivial_symbol_; // True, if histograms for Red, Blue & Alpha // literal symbols are single valued. - double bit_cost_; // cached value of bit cost. - double literal_cost_; // Cached values of dominant entropy costs: - double red_cost_; // literal, red & blue. - double blue_cost_; + float bit_cost_; // cached value of bit cost. + float literal_cost_; // Cached values of dominant entropy costs: + float red_cost_; // literal, red & blue. + float blue_cost_; uint8_t is_used_5; // 5 for literal, red, blue, alpha, distance } VP8LHistogram; @@ -105,21 +105,23 @@ ((palette_code_bits > 0) ? (1 << palette_code_bits) : 0); } -// Builds the histogram image. +// Builds the histogram image. pic and percent are for progress. +// Returns false in case of error (stored in pic->error_code). int VP8LGetHistoImageSymbols(int xsize, int ysize, - const VP8LBackwardRefs* const refs, - int quality, int low_effort, - int histogram_bits, int cache_bits, + const VP8LBackwardRefs* const refs, int quality, + int low_effort, int histogram_bits, int cache_bits, VP8LHistogramSet* const image_histo, VP8LHistogram* const tmp_histo, - uint16_t* const histogram_symbols); + uint16_t* const histogram_symbols, + const WebPPicture* const pic, int percent_range, + int* const percent); // Returns the entropy for the symbols in the input array. -double VP8LBitsEntropy(const uint32_t* const array, int n); +float VP8LBitsEntropy(const uint32_t* const array, int n); // Estimate how many bits the combined entropy of literals and distance // approximately maps to. -double VP8LHistogramEstimateBits(VP8LHistogram* const p); +float VP8LHistogramEstimateBits(VP8LHistogram* const p); #ifdef __cplusplus }
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/enc/picture_csp_enc.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/enc/picture_csp_enc.c
Changed
@@ -15,12 +15,19 @@ #include <stdlib.h> #include <math.h> +#include "sharpyuv/sharpyuv.h" +#include "sharpyuv/sharpyuv_csp.h" #include "src/enc/vp8i_enc.h" #include "src/utils/random_utils.h" #include "src/utils/utils.h" #include "src/dsp/dsp.h" #include "src/dsp/lossless.h" #include "src/dsp/yuv.h" +#include "src/dsp/cpu.h" + +#if defined(WEBP_USE_THREAD) && !defined(_WIN32) +#include <pthread.h> +#endif // Uncomment to disable gamma-compression during RGB->U/V averaging #define USE_GAMMA_COMPRESSION @@ -62,10 +69,12 @@ int WebPPictureHasTransparency(const WebPPicture* picture) { if (picture == NULL) return 0; if (picture->use_argb) { - const int alpha_offset = ALPHA_OFFSET; - return CheckNonOpaque((const uint8_t*)picture->argb + alpha_offset, - picture->width, picture->height, - 4, picture->argb_stride * sizeof(*picture->argb)); + if (picture->argb != NULL) { + return CheckNonOpaque((const uint8_t*)picture->argb + ALPHA_OFFSET, + picture->width, picture->height, + 4, picture->argb_stride * sizeof(*picture->argb)); + } + return 0; } return CheckNonOpaque(picture->a, picture->width, picture->height, 1, picture->a_stride); @@ -76,16 +85,16 @@ #if defined(USE_GAMMA_COMPRESSION) -// gamma-compensates loss of resolution during chroma subsampling -#define kGamma 0.80 // for now we use a different gamma value than kGammaF -#define kGammaFix 12 // fixed-point precision for linear values -#define kGammaScale ((1 << kGammaFix) - 1) -#define kGammaTabFix 7 // fixed-point fractional bits precision -#define kGammaTabScale (1 << kGammaTabFix) -#define kGammaTabRounder (kGammaTabScale >> 1) -#define kGammaTabSize (1 << (kGammaFix - kGammaTabFix)) +// Gamma correction compensates loss of resolution during chroma subsampling. +#define GAMMA_FIX 12 // fixed-point precision for linear values +#define GAMMA_TAB_FIX 7 // fixed-point fractional bits precision +#define GAMMA_TAB_SIZE (1 << (GAMMA_FIX - GAMMA_TAB_FIX)) +static const double kGamma = 0.80; +static const int kGammaScale = ((1 << GAMMA_FIX) - 1); +static const int kGammaTabScale = (1 << GAMMA_TAB_FIX); +static const int kGammaTabRounder = (1 << GAMMA_TAB_FIX >> 1); -static int kLinearToGammaTabkGammaTabSize + 1; +static int kLinearToGammaTabGAMMA_TAB_SIZE + 1; static uint16_t kGammaToLinearTab256; static volatile int kGammaTablesOk = 0; static void InitGammaTables(void); @@ -93,13 +102,13 @@ WEBP_DSP_INIT_FUNC(InitGammaTables) { if (!kGammaTablesOk) { int v; - const double scale = (double)(1 << kGammaTabFix) / kGammaScale; + const double scale = (double)(1 << GAMMA_TAB_FIX) / kGammaScale; const double norm = 1. / 255.; for (v = 0; v <= 255; ++v) { kGammaToLinearTabv = (uint16_t)(pow(norm * v, kGamma) * kGammaScale + .5); } - for (v = 0; v <= kGammaTabSize; ++v) { + for (v = 0; v <= GAMMA_TAB_SIZE; ++v) { kLinearToGammaTabv = (int)(255. * pow(scale * v, 1. / kGamma) + .5); } kGammaTablesOk = 1; @@ -111,12 +120,12 @@ } static WEBP_INLINE int Interpolate(int v) { - const int tab_pos = v >> (kGammaTabFix + 2); // integer part + const int tab_pos = v >> (GAMMA_TAB_FIX + 2); // integer part const int x = v & ((kGammaTabScale << 2) - 1); // fractional part const int v0 = kLinearToGammaTabtab_pos; const int v1 = kLinearToGammaTabtab_pos + 1; const int y = v1 * x + v0 * ((kGammaTabScale << 2) - x); // interpolate - assert(tab_pos + 1 < kGammaTabSize + 1); + assert(tab_pos + 1 < GAMMA_TAB_SIZE + 1); return y; } @@ -124,7 +133,7 @@ // U/V value, suitable for RGBToU/V calls. static WEBP_INLINE int LinearToGamma(uint32_t base_value, int shift) { const int y = Interpolate(base_value << shift); // final uplifted value - return (y + kGammaTabRounder) >> kGammaTabFix; // descale + return (y + kGammaTabRounder) >> GAMMA_TAB_FIX; // descale } #else @@ -158,415 +167,26 @@ //------------------------------------------------------------------------------ // Sharp RGB->YUV conversion -static const int kNumIterations = 4; static const int kMinDimensionIterativeConversion = 4; -// We could use SFIX=0 and only uint8_t for fixed_y_t, but it produces some -// banding sometimes. Better use extra precision. -#define SFIX 2 // fixed-point precision of RGB and Y/W -typedef int16_t fixed_t; // signed type with extra SFIX precision for UV -typedef uint16_t fixed_y_t; // unsigned type with extra SFIX precision for W - -#define SHALF (1 << SFIX >> 1) -#define MAX_Y_T ((256 << SFIX) - 1) -#define SROUNDER (1 << (YUV_FIX + SFIX - 1)) - -#if defined(USE_GAMMA_COMPRESSION) - -// We use tables of different size and precision for the Rec709 / BT2020 -// transfer function. -#define kGammaF (1./0.45) -static uint32_t kLinearToGammaTabSkGammaTabSize + 2; -#define GAMMA_TO_LINEAR_BITS 14 -static uint32_t kGammaToLinearTabSMAX_Y_T + 1; // size scales with Y_FIX -static volatile int kGammaTablesSOk = 0; -static void InitGammaTablesS(void); - -WEBP_DSP_INIT_FUNC(InitGammaTablesS) { - assert(2 * GAMMA_TO_LINEAR_BITS < 32); // we use uint32_t intermediate values - if (!kGammaTablesSOk) { - int v; - const double norm = 1. / MAX_Y_T; - const double scale = 1. / kGammaTabSize; - const double a = 0.09929682680944; - const double thresh = 0.018053968510807; - const double final_scale = 1 << GAMMA_TO_LINEAR_BITS; - for (v = 0; v <= MAX_Y_T; ++v) { - const double g = norm * v; - double value; - if (g <= thresh * 4.5) { - value = g / 4.5; - } else { - const double a_rec = 1. / (1. + a); - value = pow(a_rec * (g + a), kGammaF); - } - kGammaToLinearTabSv = (uint32_t)(value * final_scale + .5); - } - for (v = 0; v <= kGammaTabSize; ++v) { - const double g = scale * v; - double value; - if (g <= thresh) { - value = 4.5 * g; - } else { - value = (1. + a) * pow(g, 1. / kGammaF) - a; - } - // we already incorporate the 1/2 rounding constant here - kLinearToGammaTabSv = - (uint32_t)(MAX_Y_T * value) + (1 << GAMMA_TO_LINEAR_BITS >> 1); - } - // to prevent small rounding errors to cause read-overflow: - kLinearToGammaTabSkGammaTabSize + 1 = kLinearToGammaTabSkGammaTabSize; - kGammaTablesSOk = 1; - } -} - -// return value has a fixed-point precision of GAMMA_TO_LINEAR_BITS -static WEBP_INLINE uint32_t GammaToLinearS(int v) { - return kGammaToLinearTabSv; -} - -static WEBP_INLINE uint32_t LinearToGammaS(uint32_t value) { - // 'value' is in GAMMA_TO_LINEAR_BITS fractional precision - const uint32_t v = value * kGammaTabSize; - const uint32_t tab_pos = v >> GAMMA_TO_LINEAR_BITS; - // fractional part, in GAMMA_TO_LINEAR_BITS fixed-point precision - const uint32_t x = v - (tab_pos << GAMMA_TO_LINEAR_BITS); // fractional part - // v0 / v1 are in GAMMA_TO_LINEAR_BITS fixed-point precision (range 0..1) - const uint32_t v0 = kLinearToGammaTabStab_pos + 0; - const uint32_t v1 = kLinearToGammaTabStab_pos + 1; - // Final interpolation. Note that rounding is already included. - const uint32_t v2 = (v1 - v0) * x; // note: v1 >= v0. - const uint32_t result = v0 + (v2 >> GAMMA_TO_LINEAR_BITS); - return result; -} - -#else - -static void InitGammaTablesS(void) {} -static WEBP_INLINE uint32_t GammaToLinearS(int v) { - return (v << GAMMA_TO_LINEAR_BITS) / MAX_Y_T; -} -static WEBP_INLINE uint32_t LinearToGammaS(uint32_t value) { - return (MAX_Y_T * value) >> GAMMA_TO_LINEAR_BITS; -} - -#endif // USE_GAMMA_COMPRESSION
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/enc/picture_enc.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/enc/picture_enc.c
Changed
@@ -45,6 +45,22 @@ //------------------------------------------------------------------------------ +int WebPValidatePicture(const WebPPicture* const picture) { + if (picture == NULL) return 0; + if (picture->width <= 0 || picture->height <= 0) { + return WebPEncodingSetError(picture, VP8_ENC_ERROR_BAD_DIMENSION); + } + if (picture->width <= 0 || picture->width / 4 > INT_MAX / 4 || + picture->height <= 0 || picture->height / 4 > INT_MAX / 4) { + return WebPEncodingSetError(picture, VP8_ENC_ERROR_BAD_DIMENSION); + } + if (picture->colorspace != WEBP_YUV420 && + picture->colorspace != WEBP_YUV420A) { + return WebPEncodingSetError(picture, VP8_ENC_ERROR_INVALID_CONFIGURATION); + } + return 1; +} + static void WebPPictureResetBufferARGB(WebPPicture* const picture) { picture->memory_argb_ = NULL; picture->argb = NULL; @@ -63,18 +79,17 @@ WebPPictureResetBufferYUVA(picture); } -int WebPPictureAllocARGB(WebPPicture* const picture, int width, int height) { +int WebPPictureAllocARGB(WebPPicture* const picture) { void* memory; + const int width = picture->width; + const int height = picture->height; const uint64_t argb_size = (uint64_t)width * height; - assert(picture != NULL); + if (!WebPValidatePicture(picture)) return 0; WebPSafeFree(picture->memory_argb_); WebPPictureResetBufferARGB(picture); - if (width <= 0 || height <= 0) { - return WebPEncodingSetError(picture, VP8_ENC_ERROR_BAD_DIMENSION); - } // allocate a new buffer. memory = WebPSafeMalloc(argb_size + WEBP_ALIGN_CST, sizeof(*picture->argb)); if (memory == NULL) { @@ -86,10 +101,10 @@ return 1; } -int WebPPictureAllocYUVA(WebPPicture* const picture, int width, int height) { - const WebPEncCSP uv_csp = - (WebPEncCSP)((int)picture->colorspace & WEBP_CSP_UV_MASK); +int WebPPictureAllocYUVA(WebPPicture* const picture) { const int has_alpha = (int)picture->colorspace & WEBP_CSP_ALPHA_BIT; + const int width = picture->width; + const int height = picture->height; const int y_stride = width; const int uv_width = (int)(((int64_t)width + 1) >> 1); const int uv_height = (int)(((int64_t)height + 1) >> 1); @@ -98,15 +113,11 @@ uint64_t y_size, uv_size, a_size, total_size; uint8_t* mem; - assert(picture != NULL); + if (!WebPValidatePicture(picture)) return 0; WebPSafeFree(picture->memory_); WebPPictureResetBufferYUVA(picture); - if (uv_csp != WEBP_YUV420) { - return WebPEncodingSetError(picture, VP8_ENC_ERROR_INVALID_CONFIGURATION); - } - // alpha a_width = has_alpha ? width : 0; a_stride = a_width; @@ -152,15 +163,12 @@ int WebPPictureAlloc(WebPPicture* picture) { if (picture != NULL) { - const int width = picture->width; - const int height = picture->height; - WebPPictureFree(picture); // erase previous buffer if (!picture->use_argb) { - return WebPPictureAllocYUVA(picture, width, height); + return WebPPictureAllocYUVA(picture); } else { - return WebPPictureAllocARGB(picture, width, height); + return WebPPictureAllocARGB(picture); } } return 1;
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/enc/picture_rescale_enc.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/enc/picture_rescale_enc.c
Changed
@@ -13,14 +13,15 @@ #include "src/webp/encode.h" -#if !defined(WEBP_REDUCE_SIZE) - #include <assert.h> #include <stdlib.h> #include "src/enc/vp8i_enc.h" + +#if !defined(WEBP_REDUCE_SIZE) #include "src/utils/rescaler_utils.h" #include "src/utils/utils.h" +#endif // !defined(WEBP_REDUCE_SIZE) #define HALVE(x) (((x) + 1) >> 1) @@ -56,6 +57,7 @@ return 1; } +#if !defined(WEBP_REDUCE_SIZE) int WebPPictureCopy(const WebPPicture* src, WebPPicture* dst) { if (src == NULL || dst == NULL) return 0; if (src == dst) return 1; @@ -81,6 +83,7 @@ } return 1; } +#endif // !defined(WEBP_REDUCE_SIZE) int WebPPictureIsView(const WebPPicture* picture) { if (picture == NULL) return 0; @@ -120,6 +123,7 @@ return 1; } +#if !defined(WEBP_REDUCE_SIZE) //------------------------------------------------------------------------------ // Picture cropping @@ -198,34 +202,34 @@ } } -int WebPPictureRescale(WebPPicture* pic, int width, int height) { +int WebPPictureRescale(WebPPicture* picture, int width, int height) { WebPPicture tmp; int prev_width, prev_height; rescaler_t* work; - if (pic == NULL) return 0; - prev_width = pic->width; - prev_height = pic->height; + if (picture == NULL) return 0; + prev_width = picture->width; + prev_height = picture->height; if (!WebPRescalerGetScaledDimensions( prev_width, prev_height, &width, &height)) { return 0; } - PictureGrabSpecs(pic, &tmp); + PictureGrabSpecs(picture, &tmp); tmp.width = width; tmp.height = height; if (!WebPPictureAlloc(&tmp)) return 0; - if (!pic->use_argb) { + if (!picture->use_argb) { work = (rescaler_t*)WebPSafeMalloc(2ULL * width, sizeof(*work)); if (work == NULL) { WebPPictureFree(&tmp); return 0; } // If present, we need to rescale alpha first (for AlphaMultiplyY). - if (pic->a != NULL) { + if (picture->a != NULL) { WebPInitAlphaProcessing(); - if (!RescalePlane(pic->a, prev_width, prev_height, pic->a_stride, + if (!RescalePlane(picture->a, prev_width, prev_height, picture->a_stride, tmp.a, width, height, tmp.a_stride, work, 1)) { return 0; } @@ -233,17 +237,15 @@ // We take transparency into account on the luma plane only. That's not // totally exact blending, but still is a good approximation. - AlphaMultiplyY(pic, 0); - if (!RescalePlane(pic->y, prev_width, prev_height, pic->y_stride, + AlphaMultiplyY(picture, 0); + if (!RescalePlane(picture->y, prev_width, prev_height, picture->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(width), HALVE(height), tmp.uv_stride, work, 1) || - !RescalePlane(pic->v, - HALVE(prev_width), HALVE(prev_height), pic->uv_stride, - tmp.v, - HALVE(width), HALVE(height), tmp.uv_stride, work, 1)) { + !RescalePlane(picture->u, HALVE(prev_width), HALVE(prev_height), + picture->uv_stride, tmp.u, HALVE(width), HALVE(height), + tmp.uv_stride, work, 1) || + !RescalePlane(picture->v, HALVE(prev_width), HALVE(prev_height), + picture->uv_stride, tmp.v, HALVE(width), HALVE(height), + tmp.uv_stride, work, 1)) { return 0; } AlphaMultiplyY(&tmp, 1); @@ -257,18 +259,17 @@ // weighting first (black-matting), scale the RGB values, and remove // the premultiplication afterward (while preserving the alpha channel). 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, - tmp.argb_stride * 4, work, 4)) { + AlphaMultiplyARGB(picture, 0); + if (!RescalePlane((const uint8_t*)picture->argb, prev_width, prev_height, + picture->argb_stride * 4, (uint8_t*)tmp.argb, width, + height, tmp.argb_stride * 4, work, 4)) { return 0; } AlphaMultiplyARGB(&tmp, 1); } - WebPPictureFree(pic); + WebPPictureFree(picture); WebPSafeFree(work); - *pic = tmp; + *picture = tmp; return 1; } @@ -280,23 +281,6 @@ return 0; } -int WebPPictureIsView(const WebPPicture* picture) { - (void)picture; - return 0; -} - -int WebPPictureView(const WebPPicture* src, - int left, int top, int width, int height, - WebPPicture* dst) { - (void)src; - (void)left; - (void)top; - (void)width; - (void)height; - (void)dst; - return 0; -} - int WebPPictureCrop(WebPPicture* pic, int left, int top, int width, int height) { (void)pic;
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/enc/picture_tools_enc.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/enc/picture_tools_enc.c
Changed
@@ -190,27 +190,28 @@ return (0xff000000u | (r << 16) | (g << 8) | b); } -void WebPBlendAlpha(WebPPicture* pic, uint32_t background_rgb) { +void WebPBlendAlpha(WebPPicture* picture, uint32_t background_rgb) { const int red = (background_rgb >> 16) & 0xff; const int green = (background_rgb >> 8) & 0xff; const int blue = (background_rgb >> 0) & 0xff; int x, y; - if (pic == NULL) return; - if (!pic->use_argb) { - const int uv_width = (pic->width >> 1); // omit last pixel during u/v loop + if (picture == NULL) return; + if (!picture->use_argb) { + // omit last pixel during u/v loop + const int uv_width = (picture->width >> 1); const int Y0 = VP8RGBToY(red, green, blue, YUV_HALF); // VP8RGBToU/V expects the u/v values summed over four pixels const int U0 = VP8RGBToU(4 * red, 4 * green, 4 * blue, 4 * YUV_HALF); const int V0 = VP8RGBToV(4 * red, 4 * green, 4 * blue, 4 * YUV_HALF); - const int has_alpha = pic->colorspace & WEBP_CSP_ALPHA_BIT; - uint8_t* y_ptr = pic->y; - uint8_t* u_ptr = pic->u; - uint8_t* v_ptr = pic->v; - uint8_t* a_ptr = pic->a; + const int has_alpha = picture->colorspace & WEBP_CSP_ALPHA_BIT; + uint8_t* y_ptr = picture->y; + uint8_t* u_ptr = picture->u; + uint8_t* v_ptr = picture->v; + uint8_t* a_ptr = picture->a; if (!has_alpha || a_ptr == NULL) return; // nothing to do - for (y = 0; y < pic->height; ++y) { + for (y = 0; y < picture->height; ++y) { // Luma blending - for (x = 0; x < pic->width; ++x) { + for (x = 0; x < picture->width; ++x) { const uint8_t alpha = a_ptrx; if (alpha < 0xff) { y_ptrx = BLEND(Y0, y_ptrx, alpha); @@ -219,7 +220,7 @@ // Chroma blending every even line if ((y & 1) == 0) { uint8_t* const a_ptr2 = - (y + 1 == pic->height) ? a_ptr : a_ptr + pic->a_stride; + (y + 1 == picture->height) ? a_ptr : a_ptr + picture->a_stride; for (x = 0; x < uv_width; ++x) { // Average four alpha values into a single blending weight. // TODO(skal): might lead to visible contouring. Can we do better? @@ -229,24 +230,24 @@ u_ptrx = BLEND_10BIT(U0, u_ptrx, alpha); v_ptrx = BLEND_10BIT(V0, v_ptrx, alpha); } - if (pic->width & 1) { // rightmost pixel + if (picture->width & 1) { // rightmost pixel const uint32_t alpha = 2 * (a_ptr2 * x + 0 + a_ptr22 * x + 0); u_ptrx = BLEND_10BIT(U0, u_ptrx, alpha); v_ptrx = BLEND_10BIT(V0, v_ptrx, alpha); } } else { - u_ptr += pic->uv_stride; - v_ptr += pic->uv_stride; + u_ptr += picture->uv_stride; + v_ptr += picture->uv_stride; } - memset(a_ptr, 0xff, pic->width); // reset alpha value to opaque - a_ptr += pic->a_stride; - y_ptr += pic->y_stride; + memset(a_ptr, 0xff, picture->width); // reset alpha value to opaque + a_ptr += picture->a_stride; + y_ptr += picture->y_stride; } } else { - uint32_t* argb = pic->argb; + uint32_t* argb = picture->argb; const uint32_t background = MakeARGB32(red, green, blue); - for (y = 0; y < pic->height; ++y) { - for (x = 0; x < pic->width; ++x) { + for (y = 0; y < picture->height; ++y) { + for (x = 0; x < picture->width; ++x) { const int alpha = (argbx >> 24) & 0xff; if (alpha != 0xff) { if (alpha > 0) { @@ -262,7 +263,7 @@ } } } - argb += pic->argb_stride; + argb += picture->argb_stride; } } }
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/enc/predictor_enc.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/enc/predictor_enc.c
Changed
@@ -16,6 +16,7 @@ #include "src/dsp/lossless.h" #include "src/dsp/lossless_common.h" +#include "src/enc/vp8i_enc.h" #include "src/enc/vp8li_enc.h" #define MAX_DIFF_COST (1e30f) @@ -31,10 +32,10 @@ // Methods to calculate Entropy (Shannon). static float PredictionCostSpatial(const int counts256, int weight_0, - double exp_val) { + float exp_val) { const int significant_symbols = 256 >> 4; - const double exp_decay_factor = 0.6; - double bits = weight_0 * counts0; + const float exp_decay_factor = 0.6f; + float bits = (float)weight_0 * counts0; int i; for (i = 1; i < significant_symbols; ++i) { bits += exp_val * (countsi + counts256 - i); @@ -46,9 +47,9 @@ static float PredictionCostSpatialHistogram(const int accumulated4256, const int tile4256) { int i; - double retval = 0; + float retval = 0.f; for (i = 0; i < 4; ++i) { - const double kExpValue = 0.94; + const float kExpValue = 0.94f; retval += PredictionCostSpatial(tilei, 1, kExpValue); retval += VP8LCombinedShannonEntropy(tilei, accumulatedi); } @@ -249,7 +250,7 @@ } else if (x == 0) { predict = upper_rowx; // Top. } else { - predict = pred_func(current_rowx - 1, upper_row + x); + predict = pred_func(¤t_rowx - 1, upper_row + x); } #if (WEBP_NEAR_LOSSLESS == 1) if (max_quantization == 1 || mode == 0 || y == 0 || y == height - 1 || @@ -472,12 +473,15 @@ // with respect to predictions. If near_lossless_quality < 100, applies // near lossless processing, shaving off more bits of residuals for lower // qualities. -void VP8LResidualImage(int width, int height, int bits, int low_effort, - uint32_t* const argb, uint32_t* const argb_scratch, - uint32_t* const image, int near_lossless_quality, - int exact, int used_subtract_green) { +int VP8LResidualImage(int width, int height, int bits, int low_effort, + uint32_t* const argb, uint32_t* const argb_scratch, + uint32_t* const image, int near_lossless_quality, + int exact, int used_subtract_green, + const WebPPicture* const pic, int percent_range, + int* const percent) { const int tiles_per_row = VP8LSubSampleSize(width, bits); const int tiles_per_col = VP8LSubSampleSize(height, bits); + int percent_start = *percent; int tile_y; int histo4256; const int max_quantization = 1 << VP8LNearLosslessBits(near_lossless_quality); @@ -491,17 +495,24 @@ for (tile_y = 0; tile_y < tiles_per_col; ++tile_y) { int tile_x; for (tile_x = 0; tile_x < tiles_per_row; ++tile_x) { - const int pred = GetBestPredictorForTile(width, height, tile_x, tile_y, - bits, histo, argb_scratch, argb, max_quantization, exact, - used_subtract_green, image); + const int pred = GetBestPredictorForTile( + width, height, tile_x, tile_y, bits, histo, argb_scratch, argb, + max_quantization, exact, used_subtract_green, image); imagetile_y * tiles_per_row + tile_x = ARGB_BLACK | (pred << 8); } + + if (!WebPReportProgress( + pic, percent_start + percent_range * tile_y / tiles_per_col, + percent)) { + return 0; + } } } CopyImageWithPrediction(width, height, bits, image, argb_scratch, argb, low_effort, max_quantization, exact, used_subtract_green); + return WebPReportProgress(pic, percent_start + percent_range, percent); } //------------------------------------------------------------------------------ @@ -532,7 +543,7 @@ const int counts256) { // Favor low entropy, locally and globally. // Favor small absolute values for PredictionCostSpatial - static const double kExpValue = 2.4; + static const float kExpValue = 2.4f; return VP8LCombinedShannonEntropy(counts, accumulated) + PredictionCostSpatial(counts, 3, kExpValue); } @@ -714,11 +725,14 @@ } } -void VP8LColorSpaceTransform(int width, int height, int bits, int quality, - uint32_t* const argb, uint32_t* image) { +int VP8LColorSpaceTransform(int width, int height, int bits, int quality, + uint32_t* const argb, uint32_t* image, + const WebPPicture* const pic, int percent_range, + int* const percent) { const int max_tile_size = 1 << bits; const int tile_xsize = VP8LSubSampleSize(width, bits); const int tile_ysize = VP8LSubSampleSize(height, bits); + int percent_start = *percent; int accumulated_red_histo256 = { 0 }; int accumulated_blue_histo256 = { 0 }; int tile_x, tile_y; @@ -768,5 +782,11 @@ } } } + if (!WebPReportProgress( + pic, percent_start + percent_range * tile_y / tile_ysize, + percent)) { + return 0; + } } + return 1; }
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/enc/quant_enc.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/enc/quant_enc.c
Changed
@@ -533,7 +533,8 @@ rd->score = MAX_COST; } -static void CopyScore(VP8ModeScore* const dst, const VP8ModeScore* const src) { +static void CopyScore(VP8ModeScore* WEBP_RESTRICT const dst, + const VP8ModeScore* WEBP_RESTRICT const src) { dst->D = src->D; dst->SD = src->SD; dst->R = src->R; @@ -542,7 +543,8 @@ dst->score = src->score; } -static void AddScore(VP8ModeScore* const dst, const VP8ModeScore* const src) { +static void AddScore(VP8ModeScore* WEBP_RESTRICT const dst, + const VP8ModeScore* WEBP_RESTRICT const src) { dst->D += src->D; dst->SD += src->SD; dst->R += src->R; @@ -585,15 +587,18 @@ return rate * lambda + RD_DISTO_MULT * distortion; } -static int TrellisQuantizeBlock(const VP8Encoder* const enc, +// Coefficient type. +enum { TYPE_I16_AC = 0, TYPE_I16_DC = 1, TYPE_CHROMA_A = 2, TYPE_I4_AC = 3 }; + +static int TrellisQuantizeBlock(const VP8Encoder* WEBP_RESTRICT const enc, int16_t in16, int16_t out16, int ctx0, int coeff_type, - const VP8Matrix* const mtx, + const VP8Matrix* WEBP_RESTRICT const mtx, int lambda) { 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 nodes16NUM_NODES; ScoreState score_states2NUM_NODES; ScoreState* ss_cur = &SCORE_STATE(0, MIN_DELTA); @@ -657,16 +662,17 @@ // 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 = VP8EncBandsn + 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_curm.score = MAX_COST; ss_curm.costs = costsn + 1ctx; if (level < 0 || level > thresh_level) { + ss_curm.score = MAX_COST; // Node is dead. continue; } @@ -682,18 +688,24 @@ } // 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_prevp.score >= MAX_COST) are automatically // eliminated since their score can't be better than the current best. - const score_t cost = VP8LevelCost(ss_prevp.costs, level); + cost = VP8LevelCost(ss_prevp.costs, level); // Examine node assuming it's a non-terminal one. - const score_t score = - base_score + ss_prevp.score + RDScoreTrellis(lambda, cost, 0); + score = ss_prevp.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 +713,11 @@ ss_curm.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, probasbandctx0) : 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_path0 = n; // best eob position @@ -717,10 +729,16 @@ } // Fresh start - memset(in + first, 0, (16 - first) * sizeof(*in)); - memset(out + first, 0, (16 - first) * sizeof(*out)); + // Beware! We must preserve in0/out0 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_path0 == -1) { - return 0; // skip! + return 0; // skip! } { @@ -751,9 +769,9 @@ // all at once. Output is the reconstructed block in *yuv_out, and the // quantized levels in *levels. -static int ReconstructIntra16(VP8EncIterator* const it, - VP8ModeScore* const rd, - uint8_t* const yuv_out, +static int ReconstructIntra16(VP8EncIterator* WEBP_RESTRICT const it, + VP8ModeScore* WEBP_RESTRICT const rd, + uint8_t* WEBP_RESTRICT const yuv_out, int mode) { const VP8Encoder* const enc = it->enc_; const uint8_t* const ref = it->yuv_p_ + VP8I16ModeOffsetsmode; @@ -775,9 +793,9 @@ 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, tmpn, rd->y_ac_levelsn, ctx, 0, - &dqm->y1_, dqm->lambda_trellis_i16_); + const int non_zero = TrellisQuantizeBlock( + enc, tmpn, rd->y_ac_levelsn, ctx, TYPE_I16_AC, &dqm->y1_, + dqm->lambda_trellis_i16_); it->top_nz_x = it->left_nz_y = non_zero; rd->y_ac_levelsn0 = 0; nz |= non_zero << n; @@ -803,10 +821,10 @@ return nz; } -static int ReconstructIntra4(VP8EncIterator* const it, +static int ReconstructIntra4(VP8EncIterator* WEBP_RESTRICT const it, int16_t levels16, - const uint8_t* const src, - uint8_t* const yuv_out, + const uint8_t* WEBP_RESTRICT const src, + uint8_t* WEBP_RESTRICT const yuv_out, int mode) { const VP8Encoder* const enc = it->enc_; const uint8_t* const ref = it->yuv_p_ + VP8I4ModeOffsetsmode; @@ -818,7 +836,7 @@ 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_); @@ -839,7 +857,8 @@ // Quantize as usual, but also compute and return the quantization error. // Error is already divided by DSHIFT. -static int QuantizeSingle(int16_t* const v, const VP8Matrix* const mtx) { +static int QuantizeSingle(int16_t* WEBP_RESTRICT const v, + const VP8Matrix* WEBP_RESTRICT const mtx) { int V = *v; const int sign = (V < 0); if (sign) V = -V; @@ -853,9 +872,10 @@ return (sign ? -V : V) >> DSCALE; } -static void CorrectDCValues(const VP8EncIterator* const it, - const VP8Matrix* const mtx, - int16_t tmp16, VP8ModeScore* const rd) { +static void CorrectDCValues(const VP8EncIterator* WEBP_RESTRICT const it, + const VP8Matrix* WEBP_RESTRICT const mtx, + int16_t tmp16, + VP8ModeScore* WEBP_RESTRICT const rd) { // | top0 | top1 // --------+--------+--------- // left0 | tmp0 tmp1 <-> err0 err1
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/enc/vp8i_enc.h -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/enc/vp8i_enc.h
Changed
@@ -31,8 +31,8 @@ // version numbers #define ENC_MAJ_VERSION 1 -#define ENC_MIN_VERSION 2 -#define ENC_REV_VERSION 1 +#define ENC_MIN_VERSION 3 +#define ENC_REV_VERSION 0 enum { MAX_LF_LEVELS = 64, // Maximum loop filter level MAX_VARIABLE_LEVEL = 67, // last (inclusive) level with variable cost @@ -470,7 +470,8 @@ // Sets up segment's quantization values, base_quant_ and filter strengths. void VP8SetSegmentParams(VP8Encoder* const enc, float quality); // Pick best modes and fills the levels. Returns true if skipped. -int VP8Decimate(VP8EncIterator* const it, VP8ModeScore* const rd, +int VP8Decimate(VP8EncIterator* WEBP_RESTRICT const it, + VP8ModeScore* WEBP_RESTRICT const rd, VP8RDLevel rd_opt); // in alpha.c @@ -490,19 +491,24 @@ // misc utils for picture_*.c: +// Returns true if 'picture' is non-NULL and dimensions/colorspace are within +// their valid ranges. If returning false, the 'error_code' in 'picture' is +// updated. +int WebPValidatePicture(const WebPPicture* const picture); + // Remove reference to the ARGB/YUVA buffer (doesn't free anything). void WebPPictureResetBuffers(WebPPicture* const picture); -// Allocates ARGB buffer of given dimension (previous one is always free'd). -// Preserves the YUV(A) buffer. Returns false in case of error (invalid param, -// out-of-memory). -int WebPPictureAllocARGB(WebPPicture* const picture, int width, int height); +// Allocates ARGB buffer according to set width/height (previous one is +// always free'd). Preserves the YUV(A) buffer. Returns false in case of error +// (invalid param, out-of-memory). +int WebPPictureAllocARGB(WebPPicture* const picture); -// Allocates YUVA buffer of given dimension (previous one is always free'd). -// Uses picture->csp to determine whether an alpha buffer is needed. +// Allocates YUVA buffer according to set width/height (previous one is always +// free'd). Uses picture->csp to determine whether an alpha buffer is needed. // Preserves the ARGB buffer. // Returns false in case of error (invalid param, out-of-memory). -int WebPPictureAllocYUVA(WebPPicture* const picture, int width, int height); +int WebPPictureAllocYUVA(WebPPicture* const picture); // Replace samples that are fully transparent by 'color' to help compressibility // (no guarantee, though). Assumes pic->use_argb is true.
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/enc/vp8l_enc.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/enc/vp8l_enc.c
Changed
@@ -15,15 +15,16 @@ #include <assert.h> #include <stdlib.h> +#include "src/dsp/lossless.h" +#include "src/dsp/lossless_common.h" #include "src/enc/backward_references_enc.h" #include "src/enc/histogram_enc.h" #include "src/enc/vp8i_enc.h" #include "src/enc/vp8li_enc.h" -#include "src/dsp/lossless.h" -#include "src/dsp/lossless_common.h" #include "src/utils/bit_writer_utils.h" #include "src/utils/huffman_encode_utils.h" #include "src/utils/utils.h" +#include "src/webp/encode.h" #include "src/webp/format_constants.h" // Maximum number of histogram images (sub-blocks). @@ -183,10 +184,9 @@ } // Builds the cooccurrence matrix -static WebPEncodingError CoOccurrenceBuild(const WebPPicture* const pic, - const uint32_t* const palette, - uint32_t num_colors, - uint32_t* cooccurrence) { +static int CoOccurrenceBuild(const WebPPicture* const pic, + const uint32_t* const palette, uint32_t num_colors, + uint32_t* cooccurrence) { uint32_t *lines, *line_top, *line_current, *line_tmp; int x, y; const uint32_t* src = pic->argb; @@ -195,7 +195,10 @@ uint32_t idx_mapMAX_PALETTE_SIZE = {0}; uint32_t palette_sortedMAX_PALETTE_SIZE; lines = (uint32_t*)WebPSafeMalloc(2 * pic->width, sizeof(*lines)); - if (lines == NULL) return VP8_ENC_ERROR_OUT_OF_MEMORY; + if (lines == NULL) { + WebPEncodingSetError(pic, VP8_ENC_ERROR_OUT_OF_MEMORY); + return 0; + } line_top = &lines0; line_current = &linespic->width; PrepareMapToPalette(palette, num_colors, palette_sorted, idx_map); @@ -226,7 +229,7 @@ src += pic->argb_stride; } WebPSafeFree(lines); - return VP8_ENC_OK; + return 1; } struct Sum { @@ -237,7 +240,7 @@ // Implements the modified Zeng method from "A Survey on Palette Reordering // Methods for Improving the Compression of Color-Indexed Images" by Armando J. // Pinho and Antonio J. R. Neves. -static WebPEncodingError PaletteSortModifiedZeng( +static int PaletteSortModifiedZeng( const WebPPicture* const pic, const uint32_t* const palette_sorted, uint32_t num_colors, uint32_t* const palette) { uint32_t i, j, ind; @@ -247,15 +250,16 @@ uint32_t first, last; uint32_t num_sums; // TODO(vrabaud) check whether one color images should use palette or not. - if (num_colors <= 1) return VP8_ENC_OK; + if (num_colors <= 1) return 1; // Build the co-occurrence matrix. cooccurrence = (uint32_t*)WebPSafeCalloc(num_colors * num_colors, sizeof(*cooccurrence)); - if (cooccurrence == NULL) return VP8_ENC_ERROR_OUT_OF_MEMORY; - if (CoOccurrenceBuild(pic, palette_sorted, num_colors, cooccurrence) != - VP8_ENC_OK) { - WebPSafeFree(cooccurrence); - return VP8_ENC_ERROR_OUT_OF_MEMORY; + if (cooccurrence == NULL) { + WebPEncodingSetError(pic, VP8_ENC_ERROR_OUT_OF_MEMORY); + return 0; + } + if (!CoOccurrenceBuild(pic, palette_sorted, num_colors, cooccurrence)) { + return 0; } // Initialize the mapping list with the two best indices. @@ -316,7 +320,7 @@ for (i = 0; i < num_colors; ++i) { palettei = palette_sortedremapping(first + i) % num_colors; } - return VP8_ENC_OK; + return 1; } // ----------------------------------------------------------------------------- @@ -357,10 +361,11 @@ kHistoTotal // Must be last. } HistoIx; -static void AddSingleSubGreen(int p, uint32_t* const r, uint32_t* const b) { - const int green = p >> 8; // The upper bits are masked away later. - ++r((p >> 16) - green) & 0xff; - ++b((p >> 0) - green) & 0xff; +static void AddSingleSubGreen(uint32_t p, + uint32_t* const r, uint32_t* const b) { + const int green = (int)p >> 8; // The upper bits are masked away later. + ++r(((int)p >> 16) - green) & 0xff; + ++b(((int)p >> 0) - green) & 0xff; } static void AddSingle(uint32_t p, @@ -434,8 +439,8 @@ curr_row += argb_stride; } { - double entropy_compkHistoTotal; - double entropykNumEntropyIx; + float entropy_compkHistoTotal; + float entropykNumEntropyIx; int k; int last_mode_to_analyze = use_palette ? kPalette : kSpatialSubGreen; int j; @@ -949,11 +954,11 @@ VP8LPutBits(bw, (bits << depth) | symbol, depth + n_bits); } -static WebPEncodingError StoreImageToBitMask( +static int StoreImageToBitMask( VP8LBitWriter* const bw, int width, int histo_bits, const VP8LBackwardRefs* const refs, const uint16_t* histogram_symbols, - const HuffmanTreeCode* const huffman_codes) { + const HuffmanTreeCode* const huffman_codes, const WebPPicture* const pic) { const int histo_xsize = histo_bits ? VP8LSubSampleSize(width, histo_bits) : 1; const int tile_mask = (histo_bits == 0) ? 0 : -(1 << histo_bits); // x and y trace the position in the image. @@ -1006,44 +1011,53 @@ } VP8LRefsCursorNext(&c); } - return bw->error_ ? VP8_ENC_ERROR_OUT_OF_MEMORY : VP8_ENC_OK; + if (bw->error_) { + WebPEncodingSetError(pic, VP8_ENC_ERROR_OUT_OF_MEMORY); + return 0; + } + return 1; } -// Special case of EncodeImageInternal() for cache-bits=0, histo_bits=31 -static WebPEncodingError EncodeImageNoHuffman( - VP8LBitWriter* const bw, const uint32_t* const argb, - VP8LHashChain* const hash_chain, VP8LBackwardRefs* const refs_array, - int width, int height, int quality, int low_effort) { +// Special case of EncodeImageInternal() for cache-bits=0, histo_bits=31. +// pic and percent are for progress. +static int EncodeImageNoHuffman(VP8LBitWriter* const bw, + const uint32_t* const argb, + VP8LHashChain* const hash_chain, + VP8LBackwardRefs* const refs_array, int width, + int height, int quality, int low_effort, + const WebPPicture* const pic, int percent_range, + int* const percent) { int i; int max_tokens = 0; - WebPEncodingError err = VP8_ENC_OK; VP8LBackwardRefs* refs; HuffmanTreeToken* tokens = NULL; - HuffmanTreeCode huffman_codes5 = { { 0, NULL, NULL } }; - const uint16_t histogram_symbols1 = { 0 }; // only one tree, one symbol + HuffmanTreeCode huffman_codes5 = {{0, NULL, NULL}}; + const uint16_t histogram_symbols1 = {0}; // only one tree, one symbol int cache_bits = 0; VP8LHistogramSet* histogram_image = NULL; HuffmanTree* const huff_tree = (HuffmanTree*)WebPSafeMalloc( - 3ULL * CODE_LENGTH_CODES, sizeof(*huff_tree)); + 3ULL * CODE_LENGTH_CODES, sizeof(*huff_tree)); if (huff_tree == NULL) { - err = VP8_ENC_ERROR_OUT_OF_MEMORY; + WebPEncodingSetError(pic, VP8_ENC_ERROR_OUT_OF_MEMORY); goto Error; } // Calculate backward references from ARGB image. - if (!VP8LHashChainFill(hash_chain, quality, argb, width, height, - low_effort)) { - err = VP8_ENC_ERROR_OUT_OF_MEMORY; + if (!VP8LHashChainFill(hash_chain, quality, argb, width, height, low_effort, + pic, percent_range / 2, percent)) { + goto Error; + } + if (!VP8LGetBackwardReferences(width, height, argb, quality, /*low_effort=*/0, + kLZ77Standard | kLZ77RLE, cache_bits, + /*do_no_cache=*/0, hash_chain, refs_array, + &cache_bits, pic, + percent_range - percent_range / 2, percent)) { goto Error; } - err = VP8LGetBackwardReferences( - width, height, argb, quality, /*low_effort=*/0, kLZ77Standard | kLZ77RLE, - cache_bits, /*do_no_cache=*/0, hash_chain, refs_array, &cache_bits);
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/enc/vp8li_enc.h -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/enc/vp8li_enc.h
Changed
@@ -89,9 +89,10 @@ // Encodes the main image stream using the supplied bit writer. // If 'use_cache' is false, disables the use of color cache. -WebPEncodingError VP8LEncodeStream(const WebPConfig* const config, - const WebPPicture* const picture, - VP8LBitWriter* const bw, int use_cache); +// Returns false in case of error (stored in picture->error_code). +int VP8LEncodeStream(const WebPConfig* const config, + const WebPPicture* const picture, VP8LBitWriter* const bw, + int use_cache); #if (WEBP_NEAR_LOSSLESS == 1) // in near_lossless.c @@ -103,13 +104,18 @@ //------------------------------------------------------------------------------ // Image transforms in predictor.c. -void VP8LResidualImage(int width, int height, int bits, int low_effort, - uint32_t* const argb, uint32_t* const argb_scratch, - uint32_t* const image, int near_lossless, int exact, - int used_subtract_green); - -void VP8LColorSpaceTransform(int width, int height, int bits, int quality, - uint32_t* const argb, uint32_t* image); +// pic and percent are for progress. +// Returns false in case of error (stored in pic->error_code). +int VP8LResidualImage(int width, int height, int bits, int low_effort, + uint32_t* const argb, uint32_t* const argb_scratch, + uint32_t* const image, int near_lossless, int exact, + int used_subtract_green, const WebPPicture* const pic, + int percent_range, int* const percent); + +int VP8LColorSpaceTransform(int width, int height, int bits, int quality, + uint32_t* const argb, uint32_t* image, + const WebPPicture* const pic, int percent_range, + int* const percent); //------------------------------------------------------------------------------
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/enc/webp_enc.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/enc/webp_enc.c
Changed
@@ -336,9 +336,7 @@ if (!WebPValidateConfig(config)) { return WebPEncodingSetError(pic, VP8_ENC_ERROR_INVALID_CONFIGURATION); } - if (pic->width <= 0 || pic->height <= 0) { - return WebPEncodingSetError(pic, VP8_ENC_ERROR_BAD_DIMENSION); - } + if (!WebPValidatePicture(pic)) return 0; if (pic->width > WEBP_MAX_DIMENSION || pic->height > WEBP_MAX_DIMENSION) { return WebPEncodingSetError(pic, VP8_ENC_ERROR_BAD_DIMENSION); }
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/libwebp.pc.in -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/libwebp.pc.in
Changed
@@ -6,6 +6,7 @@ Name: libwebp Description: Library for the WebP graphics format Version: @PACKAGE_VERSION@ +Requires: libsharpyuv Cflags: -I${includedir} -Libs: -L${libdir} -lwebp +Libs: -L${libdir} -l@webp_libname_prefix@webp Libs.private: -lm @PTHREAD_CFLAGS@ @PTHREAD_LIBS@
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/libwebp.rc -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/libwebp.rc
Changed
@@ -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,3,0 + PRODUCTVERSION 1,0,3,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -24,12 +24,12 @@ BEGIN VALUE "CompanyName", "Google, Inc." VALUE "FileDescription", "libwebp DLL" - VALUE "FileVersion", "1.2.1" + VALUE "FileVersion", "1.3.0" VALUE "InternalName", "libwebp.dll" - VALUE "LegalCopyright", "Copyright (C) 2021" + VALUE "LegalCopyright", "Copyright (C) 2022" VALUE "OriginalFilename", "libwebp.dll" VALUE "ProductName", "WebP Image Codec" - VALUE "ProductVersion", "1.2.1" + VALUE "ProductVersion", "1.3.0" END END BLOCK "VarFileInfo"
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/libwebpdecoder.pc.in -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/libwebpdecoder.pc.in
Changed
@@ -7,5 +7,5 @@ Description: Library for the WebP graphics format (decode only) Version: @PACKAGE_VERSION@ Cflags: -I${includedir} -Libs: -L${libdir} -lwebpdecoder +Libs: -L${libdir} -l@webp_libname_prefix@webpdecoder Libs.private: -lm @PTHREAD_CFLAGS@ @PTHREAD_LIBS@
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/libwebpdecoder.rc -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/libwebpdecoder.rc
Changed
@@ -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,3,0 + PRODUCTVERSION 1,0,3,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -24,12 +24,12 @@ BEGIN VALUE "CompanyName", "Google, Inc." VALUE "FileDescription", "libwebpdecoder DLL" - VALUE "FileVersion", "1.2.1" + VALUE "FileVersion", "1.3.0" VALUE "InternalName", "libwebpdecoder.dll" - VALUE "LegalCopyright", "Copyright (C) 2021" + VALUE "LegalCopyright", "Copyright (C) 2022" VALUE "OriginalFilename", "libwebpdecoder.dll" VALUE "ProductName", "WebP Image Decoder" - VALUE "ProductVersion", "1.2.1" + VALUE "ProductVersion", "1.3.0" END END BLOCK "VarFileInfo"
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/mux/Makefile.am -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/mux/Makefile.am
Changed
@@ -17,6 +17,6 @@ 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:11:0 -lm libwebpmuxincludedir = $(includedir)/webp pkgconfig_DATA = libwebpmux.pc
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/mux/Makefile.in -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/mux/Makefile.in
Changed
@@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -208,8 +208,6 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/libwebpmux.pc.in \ $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -226,8 +224,9 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -238,8 +237,10 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +FILECMD = @FILECMD@ GIF_INCLUDES = @GIF_INCLUDES@ GIF_LIBS = @GIF_LIBS@ GL_INCLUDES = @GL_INCLUDES@ @@ -354,6 +355,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +webp_libname_prefix = @webp_libname_prefix@ lib_LTLIBRARIES = libwebpmux.la libwebpmux_la_SOURCES = anim_encode.c animi.h muxedit.c muxi.h \ muxinternal.c muxread.c @@ -361,7 +363,7 @@ ../webp/types.h 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:11:0 -lm libwebpmuxincludedir = $(includedir)/webp pkgconfig_DATA = libwebpmux.pc all: all-am @@ -578,7 +580,6 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/mux/libwebpmux.pc.in -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/mux/libwebpmux.pc.in
Changed
@@ -8,5 +8,5 @@ Version: @PACKAGE_VERSION@ Requires: libwebp >= 0.2.0 Cflags: -I${includedir} -Libs: -L${libdir} -lwebpmux +Libs: -L${libdir} -l@webp_libname_prefix@webpmux Libs.private: -lm
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/mux/libwebpmux.rc -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/mux/libwebpmux.rc
Changed
@@ -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,3,0 + PRODUCTVERSION 1,0,3,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -24,12 +24,12 @@ BEGIN VALUE "CompanyName", "Google, Inc." VALUE "FileDescription", "libwebpmux DLL" - VALUE "FileVersion", "1.2.1" + VALUE "FileVersion", "1.3.0" VALUE "InternalName", "libwebpmux.dll" - VALUE "LegalCopyright", "Copyright (C) 2021" + VALUE "LegalCopyright", "Copyright (C) 2022" VALUE "OriginalFilename", "libwebpmux.dll" VALUE "ProductName", "WebP Image Muxer" - VALUE "ProductVersion", "1.2.1" + VALUE "ProductVersion", "1.3.0" END END BLOCK "VarFileInfo"
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/mux/muxedit.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/mux/muxedit.c
Changed
@@ -70,6 +70,7 @@ err = ChunkAssignData(&chunk, data, copy_data, tag); \ if (err == WEBP_MUX_OK) { \ err = ChunkSetHead(&chunk, (LIST)); \ + if (err != WEBP_MUX_OK) ChunkRelease(&chunk); \ } \ return err; \ }
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/mux/muxi.h -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/mux/muxi.h
Changed
@@ -28,8 +28,8 @@ // Defines and constants. #define MUX_MAJ_VERSION 1 -#define MUX_MIN_VERSION 2 -#define MUX_REV_VERSION 1 +#define MUX_MIN_VERSION 3 +#define MUX_REV_VERSION 0 // Chunk object. typedef struct WebPChunk WebPChunk;
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/mux/muxinternal.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/mux/muxinternal.c
Changed
@@ -155,17 +155,18 @@ WebPMuxError ChunkAppend(WebPChunk* const chunk, WebPChunk*** const chunk_list) { + WebPMuxError err; assert(chunk_list != NULL && *chunk_list != NULL); if (**chunk_list == NULL) { - ChunkSetHead(chunk, *chunk_list); + err = ChunkSetHead(chunk, *chunk_list); } else { WebPChunk* last_chunk = **chunk_list; while (last_chunk->next_ != NULL) last_chunk = last_chunk->next_; - ChunkSetHead(chunk, &last_chunk->next_); - *chunk_list = &last_chunk->next_; + err = ChunkSetHead(chunk, &last_chunk->next_); + if (err == WEBP_MUX_OK) *chunk_list = &last_chunk->next_; } - return WEBP_MUX_OK; + return err; } //------------------------------------------------------------------------------
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/utils/Makefile.am -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/utils/Makefile.am
Changed
@@ -9,6 +9,7 @@ commondir = $(includedir)/webp noinst_HEADERS = +noinst_HEADERS += ../dsp/cpu.h noinst_HEADERS += ../dsp/dsp.h noinst_HEADERS += ../webp/decode.h noinst_HEADERS += ../webp/encode.h
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/utils/Makefile.in -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/utils/Makefile.in
Changed
@@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -227,8 +227,6 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ @@ -244,8 +242,9 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -256,8 +255,10 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +FILECMD = @FILECMD@ GIF_INCLUDES = @GIF_INCLUDES@ GIF_LIBS = @GIF_LIBS@ GL_INCLUDES = @GL_INCLUDES@ @@ -372,11 +373,12 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +webp_libname_prefix = @webp_libname_prefix@ noinst_LTLIBRARIES = libwebputils.la $(am__append_1) common_HEADERS = ../webp/types.h commondir = $(includedir)/webp -noinst_HEADERS = ../dsp/dsp.h ../webp/decode.h ../webp/encode.h \ - ../webp/format_constants.h +noinst_HEADERS = ../dsp/cpu.h ../dsp/dsp.h ../webp/decode.h \ + ../webp/encode.h ../webp/format_constants.h COMMON_SOURCES = bit_reader_utils.c bit_reader_utils.h \ bit_reader_inl_utils.h color_cache_utils.c color_cache_utils.h \ endian_inl_utils.h filters_utils.c filters_utils.h \ @@ -567,7 +569,6 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/utils/bit_reader_inl_utils.h -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/utils/bit_reader_inl_utils.h
Changed
@@ -148,9 +148,9 @@ const range_t value = (range_t)(br->value_ >> pos); const int32_t mask = (int32_t)(split - value) >> 31; // -1 or 0 br->bits_ -= 1; - br->range_ += mask; + br->range_ += (range_t)mask; br->range_ |= 1; - br->value_ -= (bit_t)((split + 1) & mask) << pos; + br->value_ -= (bit_t)((split + 1) & (uint32_t)mask) << pos; BT_TRACK(br); return (v ^ mask) - mask; }
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/utils/huffman_encode_utils.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/utils/huffman_encode_utils.c
Changed
@@ -161,7 +161,7 @@ // 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,
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/utils/huffman_utils.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/utils/huffman_utils.c
Changed
@@ -142,7 +142,7 @@ { int step; // step size to replicate values in current table - uint32_t low = -1; // low bits for current root entry + uint32_t low = 0xffffffffu; // low bits for current root entry uint32_t mask = total_size - 1; // mask for low bits uint32_t key = 0; // reversed prefix code int num_nodes = 1; // number of Huffman tree nodes
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/utils/quant_levels_dec_utils.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/utils/quant_levels_dec_utils.c
Changed
@@ -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 kOrderedDitherDSIZEDSIZE = { { 0, 8, 2, 10 }, // coefficients are in DFIX fixed-point precision { 12, 4, 14, 6 },
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/utils/utils.c -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/utils/utils.c
Changed
@@ -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
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/utils/utils.h -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/utils/utils.h
Changed
@@ -64,7 +64,8 @@ // Alignment #define WEBP_ALIGN_CST 31 -#define WEBP_ALIGN(PTR) (((uintptr_t)(PTR) + WEBP_ALIGN_CST) & ~WEBP_ALIGN_CST) +#define WEBP_ALIGN(PTR) (((uintptr_t)(PTR) + WEBP_ALIGN_CST) & \ + ~(uintptr_t)WEBP_ALIGN_CST) #include <string.h> // memcpy() is the safe way of moving potentially unaligned 32b memory. @@ -73,10 +74,19 @@ memcpy(&A, ptr, sizeof(A)); return A; } + +static WEBP_INLINE int32_t WebPMemToInt32(const uint8_t* const ptr) { + return (int32_t)WebPMemToUint32(ptr); +} + static WEBP_INLINE void WebPUint32ToMem(uint8_t* const ptr, uint32_t val) { memcpy(ptr, &val, sizeof(val)); } +static WEBP_INLINE void WebPInt32ToMem(uint8_t* const ptr, int val) { + WebPUint32ToMem(ptr, (uint32_t)val); +} + //------------------------------------------------------------------------------ // Reading/writing data.
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/webp/config.h.in -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/webp/config.h.in
Changed
@@ -27,9 +27,6 @@ /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H -/* Define to 1 if you have the <memory.h> header file. */ -#undef HAVE_MEMORY_H - /* Define to 1 if you have the <OpenGL/glut.h> header file. */ #undef HAVE_OPENGL_GLUT_H @@ -42,6 +39,9 @@ /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H +/* Define to 1 if you have the <stdio.h> header file. */ +#undef HAVE_STDIO_H + /* Define to 1 if you have the <stdlib.h> header file. */ #undef HAVE_STDLIB_H @@ -94,7 +94,9 @@ your system. */ #undef PTHREAD_CREATE_JOINABLE -/* Define to 1 if you have the ANSI C header files. */ +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ #undef STDC_HEADERS /* Version number of package */
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/webp/decode.h -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/webp/decode.h
Changed
@@ -85,7 +85,7 @@ // 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,
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/webp/encode.h -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/webp/encode.h
Changed
@@ -441,7 +441,7 @@ // the original dimension will be lost). Picture 'dst' need not be initialized // with WebPPictureInit() if it is different from 'src', since its content will // be overwritten. -// Returns false in case of memory allocation error or invalid parameters. +// Returns false in case of invalid parameters. WEBP_EXTERN int WebPPictureView(const WebPPicture* src, int left, int top, int width, int height, WebPPicture* dst); @@ -455,7 +455,7 @@ // dimension will be calculated preserving the aspect ratio. // No gamma correction is applied. // Returns false in case of error (invalid parameter or insufficient memory). -WEBP_EXTERN int WebPPictureRescale(WebPPicture* pic, int width, int height); +WEBP_EXTERN int WebPPictureRescale(WebPPicture* picture, int width, int height); // Colorspace conversion function to import RGB samples. // Previous buffer will be free'd, if any. @@ -526,7 +526,7 @@ // Remove the transparency information (if present) by blending the color with // the background color 'background_rgb' (specified as 24bit RGB triplet). // After this call, all alpha values are reset to 0xff. -WEBP_EXTERN void WebPBlendAlpha(WebPPicture* pic, uint32_t background_rgb); +WEBP_EXTERN void WebPBlendAlpha(WebPPicture* picture, uint32_t background_rgb); //------------------------------------------------------------------------------ // Main call
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/webp/format_constants.h -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/webp/format_constants.h
Changed
@@ -55,7 +55,7 @@ typedef enum { PREDICTOR_TRANSFORM = 0, CROSS_COLOR_TRANSFORM = 1, - SUBTRACT_GREEN = 2, + SUBTRACT_GREEN_TRANSFORM = 2, COLOR_INDEXING_TRANSFORM = 3 } VP8LImageTransformType;
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/src/webp/types.h -> _service:tar_scm:libwebp-1.3.0.tar.gz/src/webp/types.h
Changed
@@ -42,7 +42,11 @@ # if defined(__GNUC__) && __GNUC__ >= 4 # define WEBP_EXTERN extern __attribute__ ((visibility ("default"))) # else -# define WEBP_EXTERN extern +# if defined(_MSC_VER) && defined(WEBP_DLL) +# define WEBP_EXTERN __declspec(dllexport) +# else +# define WEBP_EXTERN extern +# endif # endif /* __GNUC__ >= 4 */ #endif /* WEBP_EXTERN */
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/swig/README.md
Added
@@ -0,0 +1,67 @@ +# SWIG bindings + +## Building + +### JNI SWIG bindings + +```shell + $ gcc -shared -fPIC -fno-strict-aliasing -O2 \ + -I/path/to/your/jdk/includes \ + libwebp_java_wrap.c \ + -lwebp \ + -o libwebp_jni.so +``` + +Example usage: + +```java +import com.google.webp.libwebp; + +import java.lang.reflect.Method; + +public class libwebp_jni_example { + static { + System.loadLibrary("webp_jni"); + } + + /** + * usage: java -cp libwebp.jar:. libwebp_jni_example + */ + public static void main(String argv) { + final int version = libwebp.WebPGetDecoderVersion(); + System.out.println("libwebp version: " + Integer.toHexString(version)); + + System.out.println("libwebp methods:"); + final Method libwebpMethods = libwebp.class.getDeclaredMethods(); + for (int i = 0; i < libwebpMethods.length; i++) { + System.out.println(libwebpMethodsi); + } + } +} +``` + +```shell + $ javac -cp libwebp.jar libwebp_jni_example.java + $ java -Djava.library.path=. -cp libwebp.jar:. libwebp_jni_example +``` + +### Python SWIG bindings: + +```shell + $ python setup.py build_ext + $ python setup.py install --prefix=pylocal +``` + +Example usage: + +```python +import glob +import sys +sys.path.append(glob.glob('pylocal/lib/python*/site-packages')0) + +from com.google.webp import libwebp +print "libwebp decoder version: %x" % libwebp.WebPGetDecoderVersion() + +print "libwebp attributes:" +for attr in dir(libwebp): print attr +```
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/tests/README.md
Added
@@ -0,0 +1,18 @@ +# Tests + +This is a collection of tests for the libwebp libraries, currently covering +fuzzing through the APIs. Additional test vector coverage can be found at: +https://chromium.googlesource.com/webm/libwebp-test-data + +## Building + +### Fuzzers + +Follow the build instructions(../doc/building.md) for libwebp, optionally +adding build flags for various sanitizers (e.g., -fsanitize=address). + +`fuzzer/makefile.unix` can then be used to compile the fuzzer targets: + +```shell +$ make -C fuzzer -f makefile.unix +```
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/tests/fuzzer/makefile.unix -> _service:tar_scm:libwebp-1.3.0.tar.gz/tests/fuzzer/makefile.unix
Changed
@@ -9,6 +9,7 @@ LDFLAGS = -fsanitize=fuzzer LDLIBS = ../../src/mux/libwebpmux.a ../../src/demux/libwebpdemux.a LDLIBS += ../../src/libwebp.a ../../imageio/libimageio_util.a +LDLIBS += ../../sharpyuv/libsharpyuv.a FUZZERS = advanced_api_fuzzer animation_api_fuzzer animencoder_fuzzer FUZZERS += animdecoder_fuzzer mux_demux_api_fuzzer enc_dec_fuzzer
View file
_service:tar_scm:libwebp-1.3.0.tar.gz/webp_js/README.md
Added
@@ -0,0 +1,81 @@ +# WebP JavaScript decoder + +``` + __ __ ____ ____ ____ __ ____ +/ \\/ \ _ \ _ \ _ \ (__)/ __\ +\ / __/ _ \ __/ _) \_ \ + \__\__/_____/____/_/ /____/____/ +``` + +This file describes the compilation of libwebp into a JavaScript decoder using +Emscripten and CMake. + +- install the Emscripten SDK following the procedure described at: + https://emscripten.org/docs/getting_started/downloads.html#installation-instructions-using-the-emsdk-recommended + After installation, you should have some global variable positioned to the + location of the SDK. In particular, $EMSDK should point to the top-level + directory containing Emscripten tools. + +- configure the project 'WEBP_JS' with CMake using: + + ```shell + cd webp_js && \ + emcmake cmake -DWEBP_BUILD_WEBP_JS=ON \ + ../ + ``` + +- compile webp.js using 'emmake make'. + +- that's it! Upon completion, you should have the 'webp.js', 'webp.js.mem', + 'webp_wasm.js' and 'webp_wasm.wasm' files generated. + +The callable JavaScript function is WebPToSDL(), which decodes a raw WebP +bitstream into a canvas. See webp_js/index.html for a simple usage sample (see +below for instructions). + +## Demo HTML page + +The HTML page webp_js/index.html requires the built files 'webp.js' and +'webp.js.mem' to be copied to webp_js/. An HTTP server to serve the WebP image +example is also needed. With Python, just run: + +```shell +cd webp_js && python3 -m http.server 8080 +``` + +and then navigate to http://localhost:8080 in your favorite browser. + +## Web-Assembly (WASM) version: + +CMakeLists.txt is configured to build the WASM version when using the option +WEBP_BUILD_WEBP_JS=ON. The compilation step will assemble the files +'webp_wasm.js' and 'webp_wasm.wasm' that you then need to copy to the webp_js/ +directory. + +See webp_js/index_wasm.html for a simple demo page using the WASM version of the +library. + +You will need a fairly recent version of Emscripten (at least 2.0.18, +latest-upstream is recommended) and of your WASM-enabled browser to run this +version. + +## Caveats + +- First decoding using the library is usually slower, due to just-in-time + compilation. + +- Some versions of llvm produce the following compile error when SSE2 is + enabled. + + ``` + "Unsupported: %516 = bitcast <8 x i16> %481 to i128 + LLVM ERROR: BitCast Instruction not yet supported for integer types larger than 64 bits" + ``` + + The corresponding Emscripten bug is at: + https://github.com/kripken/emscripten/issues/3788 + + Therefore, SSE2 optimization is currently disabled in CMakeLists.txt. + +- If WEBP_ENABLE_SIMD is set to 1 the JavaScript version (webp.js) will be + disabled as wasm2js does not support SIMD.
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/webp_js/index.html -> _service:tar_scm:libwebp-1.3.0.tar.gz/webp_js/index.html
Changed
@@ -18,7 +18,7 @@ var WebpToCanvas; function init() { - WebpToCanvas = Module.cwrap('WebpToSDL', 'number', 'array', 'number'); + WebpToCanvas = Module.cwrap('WebPToSDL', 'number', 'array', 'number'); } window.onload = init;
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/webp_js/index_wasm.html -> _service:tar_scm:libwebp-1.3.0.tar.gz/webp_js/index_wasm.html
Changed
@@ -34,7 +34,7 @@ var result; if (Module"asm" != undefined) { // wrapper for the function decoding a WebP into a canvas object - WebpToCanvas = Module.cwrap('WebpToSDL', 'number', 'array', 'number'); + WebpToCanvas = Module.cwrap('WebPToSDL', 'number', 'array', 'number'); // get the canvas to decode into var canvas = document.getElementById(canvas_id); if (canvas == null) return;
View file
_service:tar_scm:libwebp-1.2.1.tar.gz/xcframeworkbuild.sh -> _service:tar_scm:libwebp-1.3.0.tar.gz/xcframeworkbuild.sh
Changed
@@ -15,7 +15,7 @@ # Set these variables based on the desired minimum deployment target. readonly IOS_MIN_VERSION=6.0 readonly MACOSX_MIN_VERSION=10.15 -readonly MACOSX_CATALYST_MIN_VERSION=13.0 +readonly MACOSX_CATALYST_MIN_VERSION=14.0 # Extract Xcode version. readonly XCODE=$(xcodebuild -version | grep Xcode | cut -d " " -f2) @@ -79,6 +79,26 @@ 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 @@ 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 @@ -166,10 +186,9 @@ CFLAGS="${CFLAGS}" set +x - # run make only in the src/ directory to create libwebp.a/libwebpdecoder.a - cd src/ - make V=0 - make install + # Build only the libraries, skip the examples. + make V=0 -C sharpyuv + make V=0 -C src install LIBLIST+=("${ROOTDIR}/lib/libwebp.a") DECLIBLIST+=("${ROOTDIR}/lib/libwebpdecoder.a") @@ -177,17 +196,16 @@ DEMUXLIBLIST+=("${ROOTDIR}/lib/libwebpdemux.a") # xcodebuild requires a directory for the -headers option, these will match # for all builds. - make install-data DESTDIR="${ROOTDIR}/lib-headers" - make install-commonHEADERS DESTDIR="${ROOTDIR}/dec-headers" - make -C demux install-data DESTDIR="${ROOTDIR}/demux-headers" - make -C mux install-data DESTDIR="${ROOTDIR}/mux-headers" + make -C src install-data DESTDIR="${ROOTDIR}/lib-headers" + make -C src install-commonHEADERS DESTDIR="${ROOTDIR}/dec-headers" + make -C src/demux install-data DESTDIR="${ROOTDIR}/demux-headers" + make -C src/mux install-data DESTDIR="${ROOTDIR}/mux-headers" LIB_HEADERS="${ROOTDIR}/lib-headers/${ROOTDIR}/include/webp" DEC_HEADERS="${ROOTDIR}/dec-headers/${ROOTDIR}/include/webp" DEMUX_HEADERS="${ROOTDIR}/demux-headers/${ROOTDIR}/include/webp" MUX_HEADERS="${ROOTDIR}/mux-headers/${ROOTDIR}/include/webp" make distclean - cd .. export PATH=${OLDPATH} done @@ -228,6 +246,10 @@ -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"
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2