diff --git a/media/libjxl/moz.yaml b/media/libjxl/moz.yaml --- a/media/libjxl/moz.yaml +++ b/media/libjxl/moz.yaml @@ -18,16 +18,16 @@ # Usually different from repository url url: https://gitlab.com/wg1/jpeg-xl # Human-readable identifier for this version/release # Generally "version NNN", "tag SSS", "bookmark SSS" - release: commit 30ea86ab4c1f1b98c21967a2e3d72a51fe77e454 (2021-05-12T21:50:20.000+02:00). + release: commit bdde644b94c125a15e532b2572b96306371a7d4e (2021-05-25T19:02:18.000+02:00). # Revision to pull in # Must be a long or short commit SHA (long preferred) # NOTE(krosylight): Update highway together when updating this! - revision: 30ea86ab4c1f1b98c21967a2e3d72a51fe77e454 + revision: bdde644b94c125a15e532b2572b96306371a7d4e # The package's license, where possible using the mnemonic from # https://spdx.org/licenses/ # Multiple licenses can be specified (as a YAML list) # A "LICENSE" file must exist containing the full license text diff --git a/third_party/jpeg-xl/AUTHORS b/third_party/jpeg-xl/AUTHORS new file mode 100644 --- /dev/null +++ b/third_party/jpeg-xl/AUTHORS @@ -0,0 +1,20 @@ +# List of the project authors for copyright purposes. When contributing to the +# project add your name or your organization's name to this list. See +# CONTRIBUTING.md for details. +# +# For organizations: +# Organization +# +# For individuals: +# Name +# +# Please keep each list sorted. If you wish to change your email address please +# send a pull request. + +# Organizations: +Cloudinary Ltd. <*@cloudinary.com> +Google LLC <*@google.com> + +# Individuals: +Jon Sneyers +Pieter Wuille diff --git a/third_party/jpeg-xl/CMakeLists.txt b/third_party/jpeg-xl/CMakeLists.txt --- a/third_party/jpeg-xl/CMakeLists.txt +++ b/third_party/jpeg-xl/CMakeLists.txt @@ -1,18 +1,9 @@ -# Copyright (c) the JPEG XL Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Copyright (c) the JPEG XL Project Authors. All rights reserved. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. # Ubuntu bionic ships with cmake 3.10. cmake_minimum_required(VERSION 3.10) # Honor VISIBILITY_INLINES_HIDDEN on all types of targets. diff --git a/third_party/jpeg-xl/CODE_OF_CONDUCT.md b/third_party/jpeg-xl/CODE_OF_CONDUCT.md new file mode 100644 --- /dev/null +++ b/third_party/jpeg-xl/CODE_OF_CONDUCT.md @@ -0,0 +1,93 @@ +# Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of +experience, education, socio-economic status, nationality, personal appearance, +race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, or to ban temporarily or permanently any +contributor for other behaviors that they deem inappropriate, threatening, +offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +This Code of Conduct also applies outside the project spaces when the Project +Steward has a reasonable belief that an individual's behavior may have a +negative impact on the project or its community. + +## Conflict Resolution + +We do not believe that all conflict is bad; healthy debate and disagreement +often yield positive results. However, it is never okay to be disrespectful or +to engage in behavior that violates the project’s code of conduct. + +If you see someone violating the code of conduct, you are encouraged to address +the behavior directly with those involved. Many issues can be resolved quickly +and easily, and this gives people more control over the outcome of their +dispute. If you are unable to resolve the matter for any reason, or if the +behavior is threatening or harassing, report it. We are dedicated to providing +an environment where participants feel welcome and safe. + +Reports should be directed to Jyrki Alakuijala , the +Project Steward(s) for JPEG XL. It is the Project Steward’s duty to +receive and address reported violations of the code of conduct. They will then +work with a committee consisting of representatives from the Open Source +Programs Office and the Google Open Source Strategy team. If for any reason you +are uncomfortable reaching out to the Project Steward, please email +opensource@google.com. + +We will investigate every complaint, but you may not receive a direct response. +We will use our discretion in determining when and how to follow up on reported +incidents, which may range from not taking action to permanent expulsion from +the project and project-sponsored spaces. We will notify the accused of the +report and provide them an opportunity to discuss it before any action is taken. +The identity of the reporter will be omitted from the details of the report +supplied to the accused. In potentially harmful situations, such as ongoing +harassment or threats to anyone's safety, we may take action without notice. + +## Attribution + +This Code of Conduct is adapted from the Contributor Covenant, version 1.4, +available at +https://www.contributor-covenant.org/version/1/4/code-of-conduct.html diff --git a/third_party/jpeg-xl/CONTRIBUTING.md b/third_party/jpeg-xl/CONTRIBUTING.md --- a/third_party/jpeg-xl/CONTRIBUTING.md +++ b/third_party/jpeg-xl/CONTRIBUTING.md @@ -1,10 +1,115 @@ -# How to Contribute +# Contributing to libjxl + +## Contributing with bug reports + +For security-related issues please see [SECURITY.md](SECURITY.md). + +We welcome suggestions, feature requests and bug reports. Before opening a new +issue please take a look if there is already an existing one in the following +link: + + * https://github.com/libjxl/libjxl/issues + +## Contributing with patches and Pull Requests + +We'd love to accept your contributions to the JPEG XL Project. Please read +through this section before sending a Pull Request. + +### Contributor License Agreements + +Our project is open source under the terms outlined in the [LICENSE](LICENSE) +and [PATENTS](PATENTS) files. Before we can accept your contributions, even for +small changes, there are just a few small guidelines you need to follow: + +Please fill out either the individual or corporate Contributor License Agreement +(CLA) with Google. JPEG XL Project is an an effort by multiple individuals and +companies, including the initial contributors Cloudinary and Google, but Google +is the legal entity in charge of receiving these CLA and relicensing this +software: + + * If you are an individual writing original source code and you're sure you + own the intellectual property, then you'll need to sign an [individual + CLA](https://code.google.com/legal/individual-cla-v1.0.html). + + * If you work for a company that wants to allow you to contribute your work, + then you'll need to sign a [corporate + CLA](https://code.google.com/legal/corporate-cla-v1.0.html). + +Follow either of the two links above to access the appropriate CLA and +instructions for how to sign and return it. Once we receive it, we'll be able +to accept your pull requests. + +***NOTE***: Only original source code from you and other people that have signed +the CLA can be accepted into the main repository. + +### Code Reviews + +All submissions, including submissions by project members, require review. We +use GitHub pull requests for this purpose. Consult +[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more +information on using pull requests. + +### Contribution philosophy -We are currently unable to accept patches to this project, but we'd very much -appreciate if you open a Gitlab issue for any bug reports/feature requests. -We will be happy to investigate and hopefully fix any issues. + * Prefer small changes, even if they don't implement a complete feature. Small + changes are easier to review and can be submitted faster. Think about what's + the smallest unit you can send that makes sense to review and submit in + isolation. For example, new modules that are not yet used by the tools but + have their own unittests are ok. If you have unrelated changes that + you discovered while working on something else, please send them in a + different Pull Request. If your are refactoring code and changing + functionality try to send the refactor first without any change in + functionality. Reviewers may ask you to split a Pull Request and it is + easier to create a smaller change from the beginning. + + * Describe your commits. Add a meaningful description to your commit message, explain what you are changing if it is not trivially obvious, but more importantly explain *why* you are making those changes. For example "Fix + build" is not a good commit message, describe what build and if it makes sense + why is this fixing it or why was it failing without this. It is very likely + that people far in the future without any context you have right now will be + looking at your commit trying to figure out why was the change introduced. If + related to an issue in this or another repository include a link to it. + + * Code Style: We follow the [Google C++ Coding + Style](https://google.github.io/styleguide/cppguide.html). A + [clang-format](https://clang.llvm.org/docs/ClangFormat.html) configuration + file is available to automatically format your code, you can invoke it with + the `./ci.sh lint` helper tool. + + * Testing: Test your change and explain in the commit message *how* your + commit was tested. For example adding unittests or in some cases just testing + with the existing ones is enough. In any case, mention what testing was + performed so reviewers can evaluate whether that's enough testing. In many + cases, testing that the Continuous Integration workflow passes is enough. + + * Make one commit per Pull Request / review, unless there's a good reason not + to. If you have multiple changes send multiple Pull Requests and each one can + have its own review. + + * When addressing comments from reviewers prefer to squash or fixup your + edits and force-push your commit. When merging changes into the repository we + don't want to include the history of code review back and forth changes or + typos. Reviewers can click on the "force-pushed" automatic comment on a Pull + Request to see the changes between versions. We use "Rebase and merge" policy + to keep a linear git history which is easier to reason about. + +### Contributing checklist. + + * Sign the CLA (only needed once per user, see above). + + * AUTHORS: If this is your first contribution, add your name or your + company name to the [AUTHORS](AUTHORS) file for copyright tracking purposes. + + * Style guide. Check `./ci.sh lint`. + + * Meaningful commit description: What and *why*, links to issues, testing + procedure. + + * Squashed multiple edits into a single commit. + + * Upload your changes to your fork and [create a Pull + Request](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request). # Community Guidelines -This project follows -[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/). +This project follows [Google's Open Source Community +Guidelines](https://opensource.google.com/conduct/). diff --git a/third_party/jpeg-xl/LICENSE b/third_party/jpeg-xl/LICENSE --- a/third_party/jpeg-xl/LICENSE +++ b/third_party/jpeg-xl/LICENSE @@ -1,203 +1,27 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. +Copyright (c) the JPEG XL Project Authors. +All rights reserved. - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and +2. 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. - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - +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. diff --git a/third_party/jpeg-xl/PATENTS b/third_party/jpeg-xl/PATENTS new file mode 100644 --- /dev/null +++ b/third_party/jpeg-xl/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the JPEG XL project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of JPEG XL, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of JPEG XL. This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation. If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of JPEG XL or any code incorporated within this +implementation of JPEG XL constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of JPEG XL +shall terminate as of the date such litigation is filed. diff --git a/third_party/jpeg-xl/README.md b/third_party/jpeg-xl/README.md --- a/third_party/jpeg-xl/README.md +++ b/third_party/jpeg-xl/README.md @@ -192,12 +192,18 @@ figure of merit for the codec (lower is better). `Errors` is nonzero if errors occurred while loading or encoding/decoding the image. ## License -This software is available under Apache 2.0 license which can be found in the -[LICENSE](LICENSE) file. +This software is available under a 3-clause BSD license which can be found in +the [LICENSE](LICENSE) file, with an "Additional IP Rights Grant" as outlined in +the [PATENTS](PATENTS) file. + +Please note that the PATENTS file only mentions Google since Google is the legal +entity receiving the Contributor License Agreements (CLA) from all contributors +to the JPEG XL Project, including the initial main contributors to the JPEG XL +format: Cloudinary and Google. ## Additional documentation ### Codec description @@ -210,11 +216,11 @@ ### Development process * [Docker setup - **start here**](doc/developing_in_docker.md) * [Building on Debian](doc/developing_in_debian.md) - for experts only * [Building on Windows](doc/developing_in_windows.md) - for experts only * [More information on testing/build options](doc/building_and_testing.md) -* [Git guide for JPEG XL](doc/developing_in_gitlab.md) - for developers only +* [Git guide for JPEG XL](doc/developing_in_github.md) - for developers only * [Building Web Assembly artifacts](doc/building_wasm.md) ### Contact If you encounter a bug or other issue with the software, please open an Issue here. diff --git a/third_party/jpeg-xl/bash_test.sh b/third_party/jpeg-xl/bash_test.sh --- a/third_party/jpeg-xl/bash_test.sh +++ b/third_party/jpeg-xl/bash_test.sh @@ -1,19 +1,10 @@ #!/bin/bash -# Copyright (c) the JPEG XL Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Copyright (c) the JPEG XL Project Authors. All rights reserved. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. # Tests implemented in bash. These typically will run checks about the source # code rather than the compiled one. MYDIR=$(dirname $(realpath "$0")) @@ -70,18 +61,26 @@ } test_copyright() { local ret=0 local f - for f in $(git ls-files | grep -E '(\.cc|\.cpp|\.h|\.sh|\.m|\.py)$'); do + for f in $( + git ls-files | grep -E \ + '(Dockerfile.*|\.c|\.cc|\.cpp|\.gni|\.h|\.java|\.sh|\.m|\.py|\.ui)$'); do if [[ "${f#third_party/}" == "$f" ]]; then # $f is not in third_party/ if ! head -n 10 "$f" | - grep -F 'Copyright (c) the JPEG XL Project' >/dev/null ; then + grep -F 'Copyright (c) the JPEG XL Project Authors.' >/dev/null ; then echo "$f: Missing Copyright blob near the top of the file." >&2 ret=1 fi + if ! head -n 10 "$f" | + grep -F 'Use of this source code is governed by a BSD-style' \ + >/dev/null ; then + echo "$f: Missing License blob near the top of the file." >&2 + ret=1 + fi fi done return ${ret} } diff --git a/third_party/jpeg-xl/ci.sh b/third_party/jpeg-xl/ci.sh --- a/third_party/jpeg-xl/ci.sh +++ b/third_party/jpeg-xl/ci.sh @@ -1,19 +1,10 @@ #!/usr/bin/env bash -# Copyright (c) the JPEG XL Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Copyright (c) the JPEG XL Project Authors. All rights reserved. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. # Continuous integration helper module. This module is meant to be called from # the .gitlab-ci.yml file during the continuous integration build, as well as # from the command line for developers. @@ -231,33 +222,50 @@ MR_ANCESTOR_SHA="" # Populate MR_HEAD_SHA and MR_ANCESTOR_SHA. merge_request_commits() { { set +x; } 2>/dev/null - # CI_BUILD_REF is the reference currently being build in the CI workflow. - MR_HEAD_SHA=$(git -C "${MYDIR}" rev-parse -q "${CI_BUILD_REF:-HEAD}") - if [[ -z "${CI_MERGE_REQUEST_IID:-}" ]]; then - # We are in a local branch, not a merge request. - MR_ANCESTOR_SHA=$(git -C "${MYDIR}" rev-parse -q HEAD@{upstream} || true) + # GITHUB_SHA is the current reference being build in GitHub Actions. + if [[ -n "${GITHUB_SHA:-}" ]]; then + git -C "${MYDIR}" fetch -q origin "${GITHUB_SHA}" + MR_HEAD_SHA="${GITHUB_SHA}" else + # CI_BUILD_REF is the reference currently being build in the CI workflow. + MR_HEAD_SHA=$(git -C "${MYDIR}" rev-parse -q "${CI_BUILD_REF:-HEAD}") + fi + + if [[ -n "${CI_MERGE_REQUEST_IID:-}" ]]; then # Merge request pipeline in CI. In this case the upstream is called "origin" # but it refers to the forked project that's the source of the merge # request. We need to get the target of the merge request, for which we need # to query that repository using our CI_JOB_TOKEN. echo "machine gitlab.com login gitlab-ci-token password ${CI_JOB_TOKEN}" \ >> "${HOME}/.netrc" git -C "${MYDIR}" fetch "${CI_MERGE_REQUEST_PROJECT_URL}" \ "${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}" MR_ANCESTOR_SHA=$(git -C "${MYDIR}" rev-parse -q FETCH_HEAD) + elif [[ -n "${GITHUB_BASE_REF:-}" ]]; then + # Pull request workflow in GitHub Actions. GitHub checkout action uses + # "origin" as the remote for the git checkout. + git -C "${MYDIR}" fetch -q origin "${GITHUB_BASE_REF}" + MR_ANCESTOR_SHA=$(git -C "${MYDIR}" rev-parse -q FETCH_HEAD) + else + # We are in a local branch, not a merge request. + MR_ANCESTOR_SHA=$(git -C "${MYDIR}" rev-parse -q HEAD@{upstream} || true) fi + if [[ -z "${MR_ANCESTOR_SHA}" ]]; then echo "Warning, not tracking any branch, using the last commit in HEAD.">&2 # This prints the return value with just HEAD. MR_ANCESTOR_SHA=$(git -C "${MYDIR}" rev-parse -q "${MR_HEAD_SHA}^") else - MR_ANCESTOR_SHA=$(git -C "${MYDIR}" merge-base --all \ - "${MR_ANCESTOR_SHA}" "${MR_HEAD_SHA}") + # GitHub runs the pipeline on a merge commit, no need to look for the common + # ancestor in that case. + if [[ -z "${GITHUB_BASE_REF:-}" ]]; then + MR_ANCESTOR_SHA=$(git -C "${MYDIR}" merge-base \ + "${MR_ANCESTOR_SHA}" "${MR_HEAD_SHA}") + fi fi set -x } # Load the MR iid from the landed commit message when running not from a diff --git a/third_party/jpeg-xl/debian/copyright b/third_party/jpeg-xl/debian/copyright --- a/third_party/jpeg-xl/debian/copyright +++ b/third_party/jpeg-xl/debian/copyright @@ -1,11 +1,11 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: jpeg-xl Files: * Copyright: 2020 the JPEG XL Project -License: Apache-2.0 +License: BSD-3-clause Files: third_party/sjpeg/* Copyright: 2017 Google, Inc License: Apache-2.0 diff --git a/third_party/jpeg-xl/deps.sh b/third_party/jpeg-xl/deps.sh --- a/third_party/jpeg-xl/deps.sh +++ b/third_party/jpeg-xl/deps.sh @@ -1,19 +1,10 @@ #!/usr/bin/env bash -# Copyright (c) the JPEG XL Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Copyright (c) the JPEG XL Project Authors. All rights reserved. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. # This file downloads the dependencies needed to build JPEG XL into third_party. # These dependencies are normally pulled by gtest. set -eu diff --git a/third_party/jpeg-xl/docker/Dockerfile.jpegxl-builder b/third_party/jpeg-xl/docker/Dockerfile.jpegxl-builder --- a/third_party/jpeg-xl/docker/Dockerfile.jpegxl-builder +++ b/third_party/jpeg-xl/docker/Dockerfile.jpegxl-builder @@ -1,18 +1,9 @@ -# Copyright (c) the JPEG XL Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Copyright (c) the JPEG XL Project Authors. All rights reserved. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. # Build an Ubuntu-based docker image with the installed software needed to # develop and test JPEG XL. FROM ubuntu:bionic diff --git a/third_party/jpeg-xl/docker/Dockerfile.jpegxl-builder-run-aarch64 b/third_party/jpeg-xl/docker/Dockerfile.jpegxl-builder-run-aarch64 --- a/third_party/jpeg-xl/docker/Dockerfile.jpegxl-builder-run-aarch64 +++ b/third_party/jpeg-xl/docker/Dockerfile.jpegxl-builder-run-aarch64 @@ -1,18 +1,9 @@ -# Copyright (c) the JPEG XL Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Copyright (c) the JPEG XL Project Authors. All rights reserved. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. # Build an Ubuntu-based docker image for aarch64 with the installed software # needed to run JPEG XL. This is only useful when running on actual aarch64 # hardware. diff --git a/third_party/jpeg-xl/docker/build.sh b/third_party/jpeg-xl/docker/build.sh --- a/third_party/jpeg-xl/docker/build.sh +++ b/third_party/jpeg-xl/docker/build.sh @@ -1,19 +1,10 @@ #!/usr/bin/env bash -# Copyright (c) the JPEG XL Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Copyright (c) the JPEG XL Project Authors. All rights reserved. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. set -eu MYDIR=$(dirname $(realpath "$0")) diff --git a/third_party/jpeg-xl/docker/scripts/emsdk_install.sh b/third_party/jpeg-xl/docker/scripts/emsdk_install.sh --- a/third_party/jpeg-xl/docker/scripts/emsdk_install.sh +++ b/third_party/jpeg-xl/docker/scripts/emsdk_install.sh @@ -1,19 +1,10 @@ #!/usr/bin/env bash -# Copyright (c) the JPEG XL Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Copyright (c) the JPEG XL Project Authors. All rights reserved. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. EMSDK_URL="https://github.com/emscripten-core/emsdk/archive/master.tar.gz" EMSDK_DIR="/opt/emsdk" EMSDK_RELEASE="2.0.4" diff --git a/third_party/jpeg-xl/docker/scripts/jpegxl_builder.sh b/third_party/jpeg-xl/docker/scripts/jpegxl_builder.sh --- a/third_party/jpeg-xl/docker/scripts/jpegxl_builder.sh +++ b/third_party/jpeg-xl/docker/scripts/jpegxl_builder.sh @@ -1,19 +1,10 @@ #!/usr/bin/env bash -# Copyright (c) the JPEG XL Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Copyright (c) the JPEG XL Project Authors. All rights reserved. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. # Main entry point for all the Dockerfile for jpegxl-builder. This centralized # file helps sharing code and configuration between Dockerfiles. set -eux diff --git a/third_party/jpeg-xl/docker/scripts/msan_install.sh b/third_party/jpeg-xl/docker/scripts/msan_install.sh --- a/third_party/jpeg-xl/docker/scripts/msan_install.sh +++ b/third_party/jpeg-xl/docker/scripts/msan_install.sh @@ -1,19 +1,10 @@ #!/usr/bin/env bash -# Copyright (c) the JPEG XL Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Copyright (c) the JPEG XL Project Authors. All rights reserved. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. set -eu MYDIR=$(dirname $(realpath "$0")) diff --git a/third_party/jpeg-xl/docker/scripts/qemu_install.sh b/third_party/jpeg-xl/docker/scripts/qemu_install.sh --- a/third_party/jpeg-xl/docker/scripts/qemu_install.sh +++ b/third_party/jpeg-xl/docker/scripts/qemu_install.sh @@ -1,19 +1,10 @@ #!/usr/bin/env bash -# Copyright (c) the JPEG XL Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Copyright (c) the JPEG XL Project Authors. All rights reserved. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. QEMU_RELEASE="4.1.0" QEMU_URL="https://download.qemu.org/qemu-${QEMU_RELEASE}.tar.xz" QEMU_ARCHS=( aarch64 diff --git a/third_party/jpeg-xl/examples/CMakeLists.txt b/third_party/jpeg-xl/examples/CMakeLists.txt --- a/third_party/jpeg-xl/examples/CMakeLists.txt +++ b/third_party/jpeg-xl/examples/CMakeLists.txt @@ -1,18 +1,9 @@ -# Copyright (c) the JPEG XL Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Copyright (c) the JPEG XL Project Authors. All rights reserved. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. add_executable(decode_oneshot decode_oneshot.cc) target_link_libraries(decode_oneshot jxl_dec jxl_threads) add_executable(encode_oneshot encode_oneshot.cc) target_link_libraries(encode_oneshot jxl jxl_threads) diff --git a/third_party/jpeg-xl/examples/decode_oneshot.cc b/third_party/jpeg-xl/examples/decode_oneshot.cc --- a/third_party/jpeg-xl/examples/decode_oneshot.cc +++ b/third_party/jpeg-xl/examples/decode_oneshot.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // This C++ example decodes a JPEG XL image in one shot (all input bytes // available at once). The example outputs the pixels and color information to a // floating point image and an ICC profile on disk. diff --git a/third_party/jpeg-xl/examples/encode_oneshot.cc b/third_party/jpeg-xl/examples/encode_oneshot.cc --- a/third_party/jpeg-xl/examples/encode_oneshot.cc +++ b/third_party/jpeg-xl/examples/encode_oneshot.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // This example encodes a file containing a floating point image to another // file containing JPEG XL image with a single frame. #include diff --git a/third_party/jpeg-xl/examples/jxlinfo.c b/third_party/jpeg-xl/examples/jxlinfo.c --- a/third_party/jpeg-xl/examples/jxlinfo.c +++ b/third_party/jpeg-xl/examples/jxlinfo.c @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // This example prints information from the main codestream header. #include #include @@ -44,20 +35,20 @@ JxlBasicInfo info; int seen_basic_info = 0; for (;;) { - // The firs time, this will output JXL_DEC_NEED_MORE_INPUT because no + // The first time, this will output JXL_DEC_NEED_MORE_INPUT because no // input is set yet, this is ok since the input is set when handling this // event. JxlDecoderStatus status = JxlDecoderProcessInput(dec); if (status == JXL_DEC_ERROR) { fprintf(stderr, "Decoder error\n"); break; } else if (status == JXL_DEC_NEED_MORE_INPUT) { - // The firstt time there is nothing to release and it returns 0, but that + // The first time there is nothing to release and it returns 0, but that // is ok. size_t remaining = JxlDecoderReleaseInput(dec); // move any remaining bytes to the front if necessary if (remaining != 0) { memmove(data, data + data_size - remaining, remaining); @@ -65,10 +56,14 @@ // resize the buffer to append one more chunk of data // TODO(lode): avoid unnecessary reallocations data = (uint8_t*)realloc(data, remaining + chunk_size); // append bytes read from the file behind the remaining bytes size_t read_size = fread(data + remaining, 1, chunk_size, file); + if (read_size == 0 && feof(file)) { + fprintf(stderr, "Unexpected EOF\n"); + break; + } data_size = remaining + read_size; JxlDecoderSetInput(dec, data, data_size); } else if (status == JXL_DEC_SUCCESS) { // Finished all processing. break; diff --git a/third_party/jpeg-xl/js-wasm-wrapper.sh b/third_party/jpeg-xl/js-wasm-wrapper.sh --- a/third_party/jpeg-xl/js-wasm-wrapper.sh +++ b/third_party/jpeg-xl/js-wasm-wrapper.sh @@ -1,19 +1,10 @@ #!/usr/bin/env bash -# Copyright (c) the JPEG XL Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Copyright (c) the JPEG XL Project Authors. All rights reserved. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. # Continuous integration helper module. This module is meant to be called from # the .gitlab-ci.yml file during the continuous integration build, as well as # from the command line for developers. diff --git a/third_party/jpeg-xl/lib/CMakeLists.txt b/third_party/jpeg-xl/lib/CMakeLists.txt --- a/third_party/jpeg-xl/lib/CMakeLists.txt +++ b/third_party/jpeg-xl/lib/CMakeLists.txt @@ -1,18 +1,9 @@ -# Copyright (c) the JPEG XL Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Copyright (c) the JPEG XL Project Authors. All rights reserved. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. set(JPEGXL_MAJOR_VERSION 0) set(JPEGXL_MINOR_VERSION 3) set(JPEGXL_PATCH_VERSION 7) set(JPEGXL_LIBRARY_VERSION diff --git a/third_party/jpeg-xl/lib/extras/codec.h b/third_party/jpeg-xl/lib/extras/codec.h --- a/third_party/jpeg-xl/lib/extras/codec.h +++ b/third_party/jpeg-xl/lib/extras/codec.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_EXTRAS_CODEC_H_ #define LIB_EXTRAS_CODEC_H_ // Facade for image encoders/decoders (PNG, PNM, ...). diff --git a/third_party/jpeg-xl/lib/extras/codec.cc b/third_party/jpeg-xl/lib/extras/codec.cc --- a/third_party/jpeg-xl/lib/extras/codec.cc +++ b/third_party/jpeg-xl/lib/extras/codec.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/extras/codec.h" #include "lib/jxl/base/file_io.h" #if JPEGXL_ENABLE_APNG diff --git a/third_party/jpeg-xl/lib/extras/codec_apng.h b/third_party/jpeg-xl/lib/extras/codec_apng.h --- a/third_party/jpeg-xl/lib/extras/codec_apng.h +++ b/third_party/jpeg-xl/lib/extras/codec_apng.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_EXTRAS_CODEC_APNG_H_ #define LIB_EXTRAS_CODEC_APNG_H_ // Decodes APNG images in memory. diff --git a/third_party/jpeg-xl/lib/extras/codec_apng.cc b/third_party/jpeg-xl/lib/extras/codec_apng.cc --- a/third_party/jpeg-xl/lib/extras/codec_apng.cc +++ b/third_party/jpeg-xl/lib/extras/codec_apng.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/extras/codec_apng.h" // Parts of this code are taken from apngdis, which has the following license: /* APNG Disassembler 2.8 @@ -220,10 +211,11 @@ CHUNK chunkIHDR; std::vector chunksInfo; bool isAnimated = false; bool skipFirst = false; bool hasInfo = false; + bool all_dispose_bg = true; APNGFrame frameRaw = {}; if (!(f = fmemopen((void*)bytes.data(), bytes.size(), "rb"))) { return JXL_FAILURE("Failed to fmemopen"); } @@ -290,23 +282,25 @@ ImageBundle bundle(&io->metadata.m); bundle.duration = delay_num * 1000 / delay_den; bundle.origin.x0 = x0; bundle.origin.y0 = y0; // TODO(veluca): this could in principle be implemented. - if (last_base_was_none && + if (last_base_was_none && !all_dispose_bg && (x0 != 0 || y0 != 0 || w0 != w || h0 != h || bop != 0)) { return JXL_FAILURE( "APNG with dispose-to-0 is not supported for non-full or " "blended frames"); } switch (dop) { case 0: bundle.use_for_next_frame = true; last_base_was_none = false; + all_dispose_bg = false; break; case 2: bundle.use_for_next_frame = false; + all_dispose_bg = false; break; default: bundle.use_for_next_frame = false; last_base_was_none = true; } diff --git a/third_party/jpeg-xl/lib/extras/codec_exr.h b/third_party/jpeg-xl/lib/extras/codec_exr.h --- a/third_party/jpeg-xl/lib/extras/codec_exr.h +++ b/third_party/jpeg-xl/lib/extras/codec_exr.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_EXTRAS_CODEC_EXR_H_ #define LIB_EXTRAS_CODEC_EXR_H_ // Encodes OpenEXR images in memory. diff --git a/third_party/jpeg-xl/lib/extras/codec_exr.cc b/third_party/jpeg-xl/lib/extras/codec_exr.cc --- a/third_party/jpeg-xl/lib/extras/codec_exr.cc +++ b/third_party/jpeg-xl/lib/extras/codec_exr.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/extras/codec_exr.h" #include #include diff --git a/third_party/jpeg-xl/lib/extras/codec_gif.h b/third_party/jpeg-xl/lib/extras/codec_gif.h --- a/third_party/jpeg-xl/lib/extras/codec_gif.h +++ b/third_party/jpeg-xl/lib/extras/codec_gif.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_EXTRAS_CODEC_GIF_H_ #define LIB_EXTRAS_CODEC_GIF_H_ // Decodes GIF images in memory. diff --git a/third_party/jpeg-xl/lib/extras/codec_gif.cc b/third_party/jpeg-xl/lib/extras/codec_gif.cc --- a/third_party/jpeg-xl/lib/extras/codec_gif.cc +++ b/third_party/jpeg-xl/lib/extras/codec_gif.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/extras/codec_gif.h" #include #include diff --git a/third_party/jpeg-xl/lib/extras/codec_jpg.h b/third_party/jpeg-xl/lib/extras/codec_jpg.h --- a/third_party/jpeg-xl/lib/extras/codec_jpg.h +++ b/third_party/jpeg-xl/lib/extras/codec_jpg.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_EXTRAS_CODEC_JPG_H_ #define LIB_EXTRAS_CODEC_JPG_H_ // Encodes JPG pixels and metadata in memory. diff --git a/third_party/jpeg-xl/lib/extras/codec_jpg.cc b/third_party/jpeg-xl/lib/extras/codec_jpg.cc --- a/third_party/jpeg-xl/lib/extras/codec_jpg.cc +++ b/third_party/jpeg-xl/lib/extras/codec_jpg.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/extras/codec_jpg.h" #include #include diff --git a/third_party/jpeg-xl/lib/extras/codec_pgx.h b/third_party/jpeg-xl/lib/extras/codec_pgx.h --- a/third_party/jpeg-xl/lib/extras/codec_pgx.h +++ b/third_party/jpeg-xl/lib/extras/codec_pgx.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_EXTRAS_CODEC_PGX_H_ #define LIB_EXTRAS_CODEC_PGX_H_ // Encodes/decodes PGX pixels in memory. diff --git a/third_party/jpeg-xl/lib/extras/codec_pgx.cc b/third_party/jpeg-xl/lib/extras/codec_pgx.cc --- a/third_party/jpeg-xl/lib/extras/codec_pgx.cc +++ b/third_party/jpeg-xl/lib/extras/codec_pgx.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/extras/codec_pgx.h" #include #include diff --git a/third_party/jpeg-xl/lib/extras/codec_png.h b/third_party/jpeg-xl/lib/extras/codec_png.h --- a/third_party/jpeg-xl/lib/extras/codec_png.h +++ b/third_party/jpeg-xl/lib/extras/codec_png.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_EXTRAS_CODEC_PNG_H_ #define LIB_EXTRAS_CODEC_PNG_H_ // Encodes/decodes PNG pixels and metadata in memory. diff --git a/third_party/jpeg-xl/lib/extras/codec_png.cc b/third_party/jpeg-xl/lib/extras/codec_png.cc --- a/third_party/jpeg-xl/lib/extras/codec_png.cc +++ b/third_party/jpeg-xl/lib/extras/codec_png.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/extras/codec_png.h" #include #include @@ -788,10 +779,11 @@ io->metadata.m.bit_depth.bits_per_sample, endianness, /*flipped_y=*/false, pool, &io->Main()); JXL_RETURN_IF_ERROR(ok); io->dec_pixels = w * h; io->metadata.m.bit_depth.bits_per_sample = io->Main().DetectRealBitdepth(); + io->metadata.m.xyb_encoded = false; SetIntensityTarget(io); if (!reader.HaveColorProfile()) { JXL_RETURN_IF_ERROR(ApplyHints(is_gray, io)); } else { (void)io->dec_hints.Foreach( diff --git a/third_party/jpeg-xl/lib/extras/codec_pnm.h b/third_party/jpeg-xl/lib/extras/codec_pnm.h --- a/third_party/jpeg-xl/lib/extras/codec_pnm.h +++ b/third_party/jpeg-xl/lib/extras/codec_pnm.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_EXTRAS_CODEC_PNM_H_ #define LIB_EXTRAS_CODEC_PNM_H_ // Encodes/decodes PBM/PGM/PPM/PFM pixels in memory. diff --git a/third_party/jpeg-xl/lib/extras/codec_pnm.cc b/third_party/jpeg-xl/lib/extras/codec_pnm.cc --- a/third_party/jpeg-xl/lib/extras/codec_pnm.cc +++ b/third_party/jpeg-xl/lib/extras/codec_pnm.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/extras/codec_pnm.h" #include #include diff --git a/third_party/jpeg-xl/lib/extras/codec_psd.h b/third_party/jpeg-xl/lib/extras/codec_psd.h --- a/third_party/jpeg-xl/lib/extras/codec_psd.h +++ b/third_party/jpeg-xl/lib/extras/codec_psd.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_EXTRAS_CODEC_PSD_H_ #define LIB_EXTRAS_CODEC_PSD_H_ // Decodes Photoshop PSD/PSB, preserving the layers diff --git a/third_party/jpeg-xl/lib/extras/codec_psd.cc b/third_party/jpeg-xl/lib/extras/codec_psd.cc --- a/third_party/jpeg-xl/lib/extras/codec_psd.cc +++ b/third_party/jpeg-xl/lib/extras/codec_psd.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/extras/codec_psd.h" #include #include @@ -575,22 +566,30 @@ } ImageBundle& layer = io->frames[0]; std::vector chan_id(real_nb_channels); std::iota(chan_id.begin(), chan_id.end(), 0); std::vector invert(real_nb_channels, false); + if (static_cast(spotcolor.size()) + colormodel + 1 < + real_nb_channels) { + return JXL_FAILURE("Inconsistent layer configuration"); + } if (!merged_has_alpha) { + if (colormodel <= real_nb_channels) { + return JXL_FAILURE("Inconsistent layer configuration"); + } chan_id.erase(chan_id.begin() + colormodel); invert.erase(invert.begin() + colormodel); - } else + } else { colormodel++; + } for (size_t i = colormodel; i < invert.size(); i++) { if (spotcolor[i - colormodel][5] == 2) invert[i] = true; if (spotcolor[i - colormodel][5] == 0) invert[i] = true; } - JXL_RETURN_IF_ERROR(decode_layer(pos, maxpos, layer, chan_id, invert, - layer.xsize(), layer.ysize(), version, - (have_only_merged ? 0 : colormodel), false, bitdepth)); + JXL_RETURN_IF_ERROR(decode_layer( + pos, maxpos, layer, chan_id, invert, layer.xsize(), layer.ysize(), + version, (have_only_merged ? 0 : colormodel), false, bitdepth)); } if (io->frames.empty()) return JXL_FAILURE("PSD: no layers"); io->SetSize(xsize, ysize); diff --git a/third_party/jpeg-xl/lib/extras/codec_test.cc b/third_party/jpeg-xl/lib/extras/codec_test.cc --- a/third_party/jpeg-xl/lib/extras/codec_test.cc +++ b/third_party/jpeg-xl/lib/extras/codec_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/extras/codec.h" #include #include diff --git a/third_party/jpeg-xl/lib/extras/tone_mapping.h b/third_party/jpeg-xl/lib/extras/tone_mapping.h --- a/third_party/jpeg-xl/lib/extras/tone_mapping.h +++ b/third_party/jpeg-xl/lib/extras/tone_mapping.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_EXTRAS_TONE_MAPPING_H_ #define LIB_EXTRAS_TONE_MAPPING_H_ #include "lib/jxl/codec_in_out.h" diff --git a/third_party/jpeg-xl/lib/extras/tone_mapping.cc b/third_party/jpeg-xl/lib/extras/tone_mapping.cc --- a/third_party/jpeg-xl/lib/extras/tone_mapping.cc +++ b/third_party/jpeg-xl/lib/extras/tone_mapping.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/extras/tone_mapping.h" #undef HWY_TARGET_INCLUDE #define HWY_TARGET_INCLUDE "lib/extras/tone_mapping.cc" diff --git a/third_party/jpeg-xl/lib/extras/tone_mapping_gbench.cc b/third_party/jpeg-xl/lib/extras/tone_mapping_gbench.cc --- a/third_party/jpeg-xl/lib/extras/tone_mapping_gbench.cc +++ b/third_party/jpeg-xl/lib/extras/tone_mapping_gbench.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "benchmark/benchmark.h" #include "lib/extras/codec.h" #include "lib/extras/tone_mapping.h" #include "lib/jxl/testdata.h" diff --git a/third_party/jpeg-xl/lib/include/jxl/butteraugli.h b/third_party/jpeg-xl/lib/include/jxl/butteraugli.h --- a/third_party/jpeg-xl/lib/include/jxl/butteraugli.h +++ b/third_party/jpeg-xl/lib/include/jxl/butteraugli.h @@ -1,18 +1,9 @@ -/* Copyright (c) the JPEG XL Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/* Copyright (c) the JPEG XL Project Authors. All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. */ /** @file butteraugli.h * @brief Butteraugli API for JPEG XL. */ diff --git a/third_party/jpeg-xl/lib/include/jxl/butteraugli_cxx.h b/third_party/jpeg-xl/lib/include/jxl/butteraugli_cxx.h --- a/third_party/jpeg-xl/lib/include/jxl/butteraugli_cxx.h +++ b/third_party/jpeg-xl/lib/include/jxl/butteraugli_cxx.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. /// @file butteraugli_cxx.h /// @brief C++ header-only helper for @ref butteraugli.h. /// /// There's no binary library associated with the header since this is a header diff --git a/third_party/jpeg-xl/lib/include/jxl/codestream_header.h b/third_party/jpeg-xl/lib/include/jxl/codestream_header.h --- a/third_party/jpeg-xl/lib/include/jxl/codestream_header.h +++ b/third_party/jpeg-xl/lib/include/jxl/codestream_header.h @@ -1,18 +1,9 @@ -/* Copyright (c) the JPEG XL Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/* Copyright (c) the JPEG XL Project Authors. All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. */ /** @file codestream_header.h * @brief Definitions of structs and enums for the metadata from the JPEG XL * codestream headers (signature, metadata, preview dimensions, ...), excluding diff --git a/third_party/jpeg-xl/lib/include/jxl/color_encoding.h b/third_party/jpeg-xl/lib/include/jxl/color_encoding.h --- a/third_party/jpeg-xl/lib/include/jxl/color_encoding.h +++ b/third_party/jpeg-xl/lib/include/jxl/color_encoding.h @@ -1,18 +1,9 @@ -/* Copyright (c) the JPEG XL Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/* Copyright (c) the JPEG XL Project Authors. All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. */ /** @file color_encoding.h * @brief Color Encoding definitions used by JPEG XL. * All CIE units are for the standard 1931 2 degree observer. diff --git a/third_party/jpeg-xl/lib/include/jxl/decode.h b/third_party/jpeg-xl/lib/include/jxl/decode.h --- a/third_party/jpeg-xl/lib/include/jxl/decode.h +++ b/third_party/jpeg-xl/lib/include/jxl/decode.h @@ -1,18 +1,9 @@ -/* Copyright (c) the JPEG XL Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/* Copyright (c) the JPEG XL Project Authors. All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. */ /** @file decode.h * @brief Decoding API for JPEG XL. */ @@ -133,14 +124,18 @@ /** An error occured, for example invalid input file or out of memory. * TODO(lode): add function to get error information from decoder. */ JXL_DEC_ERROR = 1, - /** The decoder needs more input bytes to continue. In the next - * JxlDecoderProcessInput call, next_in and avail_in must point to more - * bytes to continue. If *avail_in is not 0, the new bytes must be appended to - * the *avail_in last previous bytes. + /** The decoder needs more input bytes to continue. Before the next + * JxlDecoderProcessInput call, more input data must be set, by calling + * JxlDecoderReleaseInput (if input was set previously) and then calling + * JxlDecoderSetInput. JxlDecoderReleaseInput returns how many bytes are + * not yet processed, before a next call to JxlDecoderProcessInput all + * unprocessed bytes must be provided again (the address need not match, but + * the contents must), and more bytes must be concatenated after the + * unprocessed bytes. */ JXL_DEC_NEED_MORE_INPUT = 2, /** The decoder is able to decode a preview image and requests setting a * preview output buffer using JxlDecoderSetPreviewOutBuffer. This occurs if @@ -193,12 +188,10 @@ /** Informative event by JxlDecoderProcessInput: Preview image, a small * frame, decoded. This event can only happen if the image has a preview * frame encoded. This event occurs max once for the codestream and always * later than JXL_DEC_COLOR_ENCODING and before JXL_DEC_FRAME. - * This event is different than JXL_DEC_PREVIEW_HEADER because the latter only - * outputs the dimensions of the preview image. */ JXL_DEC_PREVIEW_IMAGE = 0x200, /** Informative event by JxlDecoderProcessInput: Beginning of a frame. * JxlDecoderGetFrameHeader can be used at this point. A note on frames: @@ -275,12 +268,12 @@ /** * Returns a hint indicating how many more bytes the decoder is expected to * need to make JxlDecoderGetBasicInfo available after the next * JxlDecoderProcessInput call. This is a suggested large enough value for - * the *avail_in parameter, but it is not guaranteed to be an upper bound nor - * a lower bound. + * the amount of bytes to provide in the next JxlDecoderSetInput call, but it is + * not guaranteed to be an upper bound nor a lower bound. * Can be used before the first JxlDecoderProcessInput call, and is correct * the first time in most cases. If not, JxlDecoderSizeHintBasicInfo can be * called again to get an updated hint. * * @param dec decoder object diff --git a/third_party/jpeg-xl/lib/include/jxl/decode_cxx.h b/third_party/jpeg-xl/lib/include/jxl/decode_cxx.h --- a/third_party/jpeg-xl/lib/include/jxl/decode_cxx.h +++ b/third_party/jpeg-xl/lib/include/jxl/decode_cxx.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. /// @file decode_cxx.h /// @brief C++ header-only helper for @ref decode.h. /// /// There's no binary library associated with the header since this is a header diff --git a/third_party/jpeg-xl/lib/include/jxl/encode.h b/third_party/jpeg-xl/lib/include/jxl/encode.h --- a/third_party/jpeg-xl/lib/include/jxl/encode.h +++ b/third_party/jpeg-xl/lib/include/jxl/encode.h @@ -1,18 +1,9 @@ -/* Copyright (c) the JPEG XL Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/* Copyright (c) the JPEG XL Project Authors. All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. */ /** @file encode.h * @brief Encoding API for JPEG XL. */ diff --git a/third_party/jpeg-xl/lib/include/jxl/encode_cxx.h b/third_party/jpeg-xl/lib/include/jxl/encode_cxx.h --- a/third_party/jpeg-xl/lib/include/jxl/encode_cxx.h +++ b/third_party/jpeg-xl/lib/include/jxl/encode_cxx.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. /// @file encode_cxx.h /// @brief C++ header-only helper for @ref encode.h. /// /// There's no binary library associated with the header since this is a header diff --git a/third_party/jpeg-xl/lib/include/jxl/memory_manager.h b/third_party/jpeg-xl/lib/include/jxl/memory_manager.h --- a/third_party/jpeg-xl/lib/include/jxl/memory_manager.h +++ b/third_party/jpeg-xl/lib/include/jxl/memory_manager.h @@ -1,18 +1,9 @@ -/* Copyright (c) the JPEG XL Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/* Copyright (c) the JPEG XL Project Authors. All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. */ /** @file memory_manager.h * @brief Abstraction functions used by JPEG XL to allocate memory. */ diff --git a/third_party/jpeg-xl/lib/include/jxl/parallel_runner.h b/third_party/jpeg-xl/lib/include/jxl/parallel_runner.h --- a/third_party/jpeg-xl/lib/include/jxl/parallel_runner.h +++ b/third_party/jpeg-xl/lib/include/jxl/parallel_runner.h @@ -1,18 +1,9 @@ -/* Copyright (c) the JPEG XL Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/* Copyright (c) the JPEG XL Project Authors. All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. */ /** * @file parallel_runner.h */ diff --git a/third_party/jpeg-xl/lib/include/jxl/thread_parallel_runner.h b/third_party/jpeg-xl/lib/include/jxl/thread_parallel_runner.h --- a/third_party/jpeg-xl/lib/include/jxl/thread_parallel_runner.h +++ b/third_party/jpeg-xl/lib/include/jxl/thread_parallel_runner.h @@ -1,18 +1,9 @@ -/* Copyright (c) the JPEG XL Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/* Copyright (c) the JPEG XL Project Authors. All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. */ /** @file thread_parallel_runner.h * @brief implementation using std::thread of a ::JxlParallelRunner. */ diff --git a/third_party/jpeg-xl/lib/include/jxl/thread_parallel_runner_cxx.h b/third_party/jpeg-xl/lib/include/jxl/thread_parallel_runner_cxx.h --- a/third_party/jpeg-xl/lib/include/jxl/thread_parallel_runner_cxx.h +++ b/third_party/jpeg-xl/lib/include/jxl/thread_parallel_runner_cxx.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. /// @file thread_parallel_runner_cxx.h /// @brief C++ header-only helper for @ref thread_parallel_runner.h. /// /// There's no binary library associated with the header since this is a header diff --git a/third_party/jpeg-xl/lib/include/jxl/types.h b/third_party/jpeg-xl/lib/include/jxl/types.h --- a/third_party/jpeg-xl/lib/include/jxl/types.h +++ b/third_party/jpeg-xl/lib/include/jxl/types.h @@ -1,18 +1,9 @@ -/* Copyright (c) the JPEG XL Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/* Copyright (c) the JPEG XL Project Authors. All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. */ /** @file types.h * @brief Data types for the JPEG XL API, for both encoding and decoding. */ diff --git a/third_party/jpeg-xl/lib/jxl.cmake b/third_party/jpeg-xl/lib/jxl.cmake --- a/third_party/jpeg-xl/lib/jxl.cmake +++ b/third_party/jpeg-xl/lib/jxl.cmake @@ -1,18 +1,9 @@ -# Copyright (c) the JPEG XL Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Copyright (c) the JPEG XL Project Authors. All rights reserved. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. # Lists all source files for the JPEG XL decoder library. These are also used # by the encoder: the encoder uses both dec and enc ourse files, while the # decoder uses only dec source files. # TODO(lode): further prune these files and move to JPEGXL_INTERNAL_SOURCES_ENC: diff --git a/third_party/jpeg-xl/lib/jxl/ac_context.h b/third_party/jpeg-xl/lib/jxl/ac_context.h --- a/third_party/jpeg-xl/lib/jxl/ac_context.h +++ b/third_party/jpeg-xl/lib/jxl/ac_context.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_AC_CONTEXT_H_ #define LIB_JXL_AC_CONTEXT_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/ac_strategy.h b/third_party/jpeg-xl/lib/jxl/ac_strategy.h --- a/third_party/jpeg-xl/lib/jxl/ac_strategy.h +++ b/third_party/jpeg-xl/lib/jxl/ac_strategy.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_AC_STRATEGY_H_ #define LIB_JXL_AC_STRATEGY_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/ac_strategy.cc b/third_party/jpeg-xl/lib/jxl/ac_strategy.cc --- a/third_party/jpeg-xl/lib/jxl/ac_strategy.cc +++ b/third_party/jpeg-xl/lib/jxl/ac_strategy.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/ac_strategy.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/ac_strategy_test.cc b/third_party/jpeg-xl/lib/jxl/ac_strategy_test.cc --- a/third_party/jpeg-xl/lib/jxl/ac_strategy_test.cc +++ b/third_party/jpeg-xl/lib/jxl/ac_strategy_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/ac_strategy.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/adaptive_reconstruction_test.cc b/third_party/jpeg-xl/lib/jxl/adaptive_reconstruction_test.cc --- a/third_party/jpeg-xl/lib/jxl/adaptive_reconstruction_test.cc +++ b/third_party/jpeg-xl/lib/jxl/adaptive_reconstruction_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include #include #include diff --git a/third_party/jpeg-xl/lib/jxl/alpha.h b/third_party/jpeg-xl/lib/jxl/alpha.h --- a/third_party/jpeg-xl/lib/jxl/alpha.h +++ b/third_party/jpeg-xl/lib/jxl/alpha.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ALPHA_H_ #define LIB_JXL_ALPHA_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/alpha.cc b/third_party/jpeg-xl/lib/jxl/alpha.cc --- a/third_party/jpeg-xl/lib/jxl/alpha.cc +++ b/third_party/jpeg-xl/lib/jxl/alpha.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/alpha.h" #include @@ -72,11 +63,11 @@ } void PerformAlphaWeightedAdd(const float* bg, const float* fg, const float* fga, float* out, size_t num_pixels, bool clamp) { if (fg == fga) { - memcpy(out, bg, num_pixels * sizeof(out)); + memcpy(out, bg, num_pixels * sizeof(*out)); } else { for (size_t x = 0; x < num_pixels; ++x) { out[x] = bg[x] + fg[x] * Clamp(fga[x]); } } diff --git a/third_party/jpeg-xl/lib/jxl/alpha_test.cc b/third_party/jpeg-xl/lib/jxl/alpha_test.cc --- a/third_party/jpeg-xl/lib/jxl/alpha_test.cc +++ b/third_party/jpeg-xl/lib/jxl/alpha_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/alpha.h" #include "gmock/gmock.h" #include "gtest/gtest.h" diff --git a/third_party/jpeg-xl/lib/jxl/ans_common.h b/third_party/jpeg-xl/lib/jxl/ans_common.h --- a/third_party/jpeg-xl/lib/jxl/ans_common.h +++ b/third_party/jpeg-xl/lib/jxl/ans_common.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ANS_COMMON_H_ #define LIB_JXL_ANS_COMMON_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/ans_common.cc b/third_party/jpeg-xl/lib/jxl/ans_common.cc --- a/third_party/jpeg-xl/lib/jxl/ans_common.cc +++ b/third_party/jpeg-xl/lib/jxl/ans_common.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/ans_common.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/ans_common_test.cc b/third_party/jpeg-xl/lib/jxl/ans_common_test.cc --- a/third_party/jpeg-xl/lib/jxl/ans_common_test.cc +++ b/third_party/jpeg-xl/lib/jxl/ans_common_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/ans_common.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/ans_params.h b/third_party/jpeg-xl/lib/jxl/ans_params.h --- a/third_party/jpeg-xl/lib/jxl/ans_params.h +++ b/third_party/jpeg-xl/lib/jxl/ans_params.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ANS_PARAMS_H_ #define LIB_JXL_ANS_PARAMS_H_ // Common parameters that are needed for both the ANS entropy encoding and diff --git a/third_party/jpeg-xl/lib/jxl/ans_test.cc b/third_party/jpeg-xl/lib/jxl/ans_test.cc --- a/third_party/jpeg-xl/lib/jxl/ans_test.cc +++ b/third_party/jpeg-xl/lib/jxl/ans_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include #include #include @@ -193,7 +184,97 @@ EXPECT_EQ(uint_config[i].lsb_in_token, uint_config_dec[i].lsb_in_token); } } } +void TestCheckpointing(bool ans, bool lz77) { + std::vector> input_values(1); + for (size_t i = 0; i < 1024; i++) { + input_values[0].push_back(Token(0, i % 4)); + } + // up to lz77 window size. + for (size_t i = 0; i < (1 << 20) - 1022; i++) { + input_values[0].push_back(Token(0, (i % 5) + 4)); + } + // Ensure that when the window wraps around, new values are different. + input_values[0].push_back(Token(0, 0)); + for (size_t i = 0; i < 1024; i++) { + input_values[0].push_back(Token(0, i % 4)); + } + + std::vector context_map; + EntropyEncodingData codes; + HistogramParams params; + params.lz77_method = lz77 ? HistogramParams::LZ77Method::kLZ77 + : HistogramParams::LZ77Method::kNone; + params.force_huffman = !ans; + + BitWriter writer; + { + auto input_values_copy = input_values; + BuildAndEncodeHistograms(params, 1, input_values_copy, &codes, &context_map, + &writer, 0, nullptr); + WriteTokens(input_values_copy[0], codes, context_map, &writer, 0, nullptr); + writer.ZeroPadToByte(); + } + + // We do not truncate the output. Reading past the end reads out zeroes + // anyway. + BitReader br(writer.GetSpan()); + Status status = true; + { + BitReaderScopedCloser bc(&br, &status); + + std::vector dec_context_map; + ANSCode decoded_codes; + ASSERT_TRUE(DecodeHistograms(&br, 1, &decoded_codes, &dec_context_map)); + ASSERT_EQ(dec_context_map, context_map); + ANSSymbolReader reader(&decoded_codes, &br); + + ANSSymbolReader::Checkpoint checkpoint; + size_t br_pos; + constexpr size_t kInterval = ANSSymbolReader::kMaxCheckpointInterval - 2; + for (size_t i = 0; i < input_values[0].size(); i++) { + if (i % kInterval == 0 && i > 0) { + reader.Restore(checkpoint); + ASSERT_TRUE(br.Close()); + br = BitReader(writer.GetSpan()); + br.SkipBits(br_pos); + for (size_t j = i - kInterval; j < i; j++) { + Token symbol = input_values[0][j]; + uint32_t read_symbol = + reader.ReadHybridUint(symbol.context, &br, dec_context_map); + ASSERT_EQ(read_symbol, symbol.value) << "j = " << j; + } + } + if (i % kInterval == 0) { + reader.Save(&checkpoint); + br_pos = br.TotalBitsConsumed(); + } + Token symbol = input_values[0][i]; + uint32_t read_symbol = + reader.ReadHybridUint(symbol.context, &br, dec_context_map); + ASSERT_EQ(read_symbol, symbol.value) << "i = " << i; + } + ASSERT_TRUE(reader.CheckANSFinalState()); + } + EXPECT_TRUE(status); +} + +TEST(ANSTest, TestCheckpointingANS) { + TestCheckpointing(/*ans=*/true, /*lz77=*/false); +} + +TEST(ANSTest, TestCheckpointingPrefix) { + TestCheckpointing(/*ans=*/false, /*lz77=*/false); +} + +TEST(ANSTest, TestCheckpointingANSLZ77) { + TestCheckpointing(/*ans=*/true, /*lz77=*/true); +} + +TEST(ANSTest, TestCheckpointingPrefixLZ77) { + TestCheckpointing(/*ans=*/false, /*lz77=*/true); +} + } // namespace } // namespace jxl diff --git a/third_party/jpeg-xl/lib/jxl/aux_out.h b/third_party/jpeg-xl/lib/jxl/aux_out.h --- a/third_party/jpeg-xl/lib/jxl/aux_out.h +++ b/third_party/jpeg-xl/lib/jxl/aux_out.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_AUX_OUT_H_ #define LIB_JXL_AUX_OUT_H_ // Optional output information for debugging and analyzing size usage. diff --git a/third_party/jpeg-xl/lib/jxl/aux_out.cc b/third_party/jpeg-xl/lib/jxl/aux_out.cc --- a/third_party/jpeg-xl/lib/jxl/aux_out.cc +++ b/third_party/jpeg-xl/lib/jxl/aux_out.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/aux_out.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/aux_out_fwd.h b/third_party/jpeg-xl/lib/jxl/aux_out_fwd.h --- a/third_party/jpeg-xl/lib/jxl/aux_out_fwd.h +++ b/third_party/jpeg-xl/lib/jxl/aux_out_fwd.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_AUX_OUT_FWD_H_ #define LIB_JXL_AUX_OUT_FWD_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/base/arch_macros.h b/third_party/jpeg-xl/lib/jxl/base/arch_macros.h --- a/third_party/jpeg-xl/lib/jxl/base/arch_macros.h +++ b/third_party/jpeg-xl/lib/jxl/base/arch_macros.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_BASE_ARCH_MACROS_H_ #define LIB_JXL_BASE_ARCH_MACROS_H_ // Defines the JXL_ARCH_* macros. diff --git a/third_party/jpeg-xl/lib/jxl/base/bits.h b/third_party/jpeg-xl/lib/jxl/base/bits.h --- a/third_party/jpeg-xl/lib/jxl/base/bits.h +++ b/third_party/jpeg-xl/lib/jxl/base/bits.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_BASE_BITS_H_ #define LIB_JXL_BASE_BITS_H_ // Specialized instructions for processing register-sized bit arrays. diff --git a/third_party/jpeg-xl/lib/jxl/base/byte_order.h b/third_party/jpeg-xl/lib/jxl/base/byte_order.h --- a/third_party/jpeg-xl/lib/jxl/base/byte_order.h +++ b/third_party/jpeg-xl/lib/jxl/base/byte_order.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_BASE_BYTE_ORDER_H_ #define LIB_JXL_BASE_BYTE_ORDER_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/base/cache_aligned.h b/third_party/jpeg-xl/lib/jxl/base/cache_aligned.h --- a/third_party/jpeg-xl/lib/jxl/base/cache_aligned.h +++ b/third_party/jpeg-xl/lib/jxl/base/cache_aligned.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_BASE_CACHE_ALIGNED_H_ #define LIB_JXL_BASE_CACHE_ALIGNED_H_ // Memory allocator with support for alignment + misalignment. diff --git a/third_party/jpeg-xl/lib/jxl/base/cache_aligned.cc b/third_party/jpeg-xl/lib/jxl/base/cache_aligned.cc --- a/third_party/jpeg-xl/lib/jxl/base/cache_aligned.cc +++ b/third_party/jpeg-xl/lib/jxl/base/cache_aligned.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/base/cache_aligned.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/base/compiler_specific.h b/third_party/jpeg-xl/lib/jxl/base/compiler_specific.h --- a/third_party/jpeg-xl/lib/jxl/base/compiler_specific.h +++ b/third_party/jpeg-xl/lib/jxl/base/compiler_specific.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_BASE_COMPILER_SPECIFIC_H_ #define LIB_JXL_BASE_COMPILER_SPECIFIC_H_ // Macros for compiler version + nonstandard keywords, e.g. __builtin_expect. diff --git a/third_party/jpeg-xl/lib/jxl/base/data_parallel.h b/third_party/jpeg-xl/lib/jxl/base/data_parallel.h --- a/third_party/jpeg-xl/lib/jxl/base/data_parallel.h +++ b/third_party/jpeg-xl/lib/jxl/base/data_parallel.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_BASE_DATA_PARALLEL_H_ #define LIB_JXL_BASE_DATA_PARALLEL_H_ // Portable, low-overhead C++11 ThreadPool alternative to OpenMP for diff --git a/third_party/jpeg-xl/lib/jxl/base/data_parallel.cc b/third_party/jpeg-xl/lib/jxl/base/data_parallel.cc --- a/third_party/jpeg-xl/lib/jxl/base/data_parallel.cc +++ b/third_party/jpeg-xl/lib/jxl/base/data_parallel.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/base/data_parallel.h" #define DATA_PARALLEL_TRACE 0 diff --git a/third_party/jpeg-xl/lib/jxl/base/descriptive_statistics.h b/third_party/jpeg-xl/lib/jxl/base/descriptive_statistics.h --- a/third_party/jpeg-xl/lib/jxl/base/descriptive_statistics.h +++ b/third_party/jpeg-xl/lib/jxl/base/descriptive_statistics.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_BASE_DESCRIPTIVE_STATISTICS_H_ #define LIB_JXL_BASE_DESCRIPTIVE_STATISTICS_H_ // For analyzing the range/distribution of scalars. diff --git a/third_party/jpeg-xl/lib/jxl/base/descriptive_statistics.cc b/third_party/jpeg-xl/lib/jxl/base/descriptive_statistics.cc --- a/third_party/jpeg-xl/lib/jxl/base/descriptive_statistics.cc +++ b/third_party/jpeg-xl/lib/jxl/base/descriptive_statistics.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/base/descriptive_statistics.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/base/file_io.h b/third_party/jpeg-xl/lib/jxl/base/file_io.h --- a/third_party/jpeg-xl/lib/jxl/base/file_io.h +++ b/third_party/jpeg-xl/lib/jxl/base/file_io.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_BASE_FILE_IO_H_ #define LIB_JXL_BASE_FILE_IO_H_ // Helper functions for reading/writing files. diff --git a/third_party/jpeg-xl/lib/jxl/base/iaca.h b/third_party/jpeg-xl/lib/jxl/base/iaca.h --- a/third_party/jpeg-xl/lib/jxl/base/iaca.h +++ b/third_party/jpeg-xl/lib/jxl/base/iaca.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_BASE_IACA_H_ #define LIB_JXL_BASE_IACA_H_ #include "lib/jxl/base/compiler_specific.h" diff --git a/third_party/jpeg-xl/lib/jxl/base/os_macros.h b/third_party/jpeg-xl/lib/jxl/base/os_macros.h --- a/third_party/jpeg-xl/lib/jxl/base/os_macros.h +++ b/third_party/jpeg-xl/lib/jxl/base/os_macros.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_BASE_OS_MACROS_H_ #define LIB_JXL_BASE_OS_MACROS_H_ // Defines the JXL_OS_* macros. diff --git a/third_party/jpeg-xl/lib/jxl/base/override.h b/third_party/jpeg-xl/lib/jxl/base/override.h --- a/third_party/jpeg-xl/lib/jxl/base/override.h +++ b/third_party/jpeg-xl/lib/jxl/base/override.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_BASE_OVERRIDE_H_ #define LIB_JXL_BASE_OVERRIDE_H_ // 'Trool' for command line arguments: force enable/disable, or use default. diff --git a/third_party/jpeg-xl/lib/jxl/base/padded_bytes.h b/third_party/jpeg-xl/lib/jxl/base/padded_bytes.h --- a/third_party/jpeg-xl/lib/jxl/base/padded_bytes.h +++ b/third_party/jpeg-xl/lib/jxl/base/padded_bytes.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_BASE_PADDED_BYTES_H_ #define LIB_JXL_BASE_PADDED_BYTES_H_ // std::vector replacement with padding to reduce bounds checks in WriteBits diff --git a/third_party/jpeg-xl/lib/jxl/base/padded_bytes.cc b/third_party/jpeg-xl/lib/jxl/base/padded_bytes.cc --- a/third_party/jpeg-xl/lib/jxl/base/padded_bytes.cc +++ b/third_party/jpeg-xl/lib/jxl/base/padded_bytes.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/base/padded_bytes.h" namespace jxl { diff --git a/third_party/jpeg-xl/lib/jxl/base/profiler.h b/third_party/jpeg-xl/lib/jxl/base/profiler.h --- a/third_party/jpeg-xl/lib/jxl/base/profiler.h +++ b/third_party/jpeg-xl/lib/jxl/base/profiler.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_BASE_PROFILER_H_ #define LIB_JXL_BASE_PROFILER_H_ // High precision, low overhead time measurements. Returns exact call counts and diff --git a/third_party/jpeg-xl/lib/jxl/base/robust_statistics.h b/third_party/jpeg-xl/lib/jxl/base/robust_statistics.h --- a/third_party/jpeg-xl/lib/jxl/base/robust_statistics.h +++ b/third_party/jpeg-xl/lib/jxl/base/robust_statistics.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_BASE_ROBUST_STATISTICS_H_ #define LIB_JXL_BASE_ROBUST_STATISTICS_H_ // Robust statistics: Mode, Median, MedianAbsoluteDeviation. diff --git a/third_party/jpeg-xl/lib/jxl/base/span.h b/third_party/jpeg-xl/lib/jxl/base/span.h --- a/third_party/jpeg-xl/lib/jxl/base/span.h +++ b/third_party/jpeg-xl/lib/jxl/base/span.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_BASE_SPAN_H_ #define LIB_JXL_BASE_SPAN_H_ // Span (array view) is a non-owning container that provides cheap "cut" diff --git a/third_party/jpeg-xl/lib/jxl/base/status.h b/third_party/jpeg-xl/lib/jxl/base/status.h --- a/third_party/jpeg-xl/lib/jxl/base/status.h +++ b/third_party/jpeg-xl/lib/jxl/base/status.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_BASE_STATUS_H_ #define LIB_JXL_BASE_STATUS_H_ // Error handling: Status return type + helper macros. diff --git a/third_party/jpeg-xl/lib/jxl/base/status.cc b/third_party/jpeg-xl/lib/jxl/base/status.cc --- a/third_party/jpeg-xl/lib/jxl/base/status.cc +++ b/third_party/jpeg-xl/lib/jxl/base/status.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/base/status.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/base/thread_pool_internal.h b/third_party/jpeg-xl/lib/jxl/base/thread_pool_internal.h --- a/third_party/jpeg-xl/lib/jxl/base/thread_pool_internal.h +++ b/third_party/jpeg-xl/lib/jxl/base/thread_pool_internal.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_BASE_THREAD_POOL_INTERNAL_H_ #define LIB_JXL_BASE_THREAD_POOL_INTERNAL_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/base/time.h b/third_party/jpeg-xl/lib/jxl/base/time.h --- a/third_party/jpeg-xl/lib/jxl/base/time.h +++ b/third_party/jpeg-xl/lib/jxl/base/time.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_BASE_TIME_H_ #define LIB_JXL_BASE_TIME_H_ // OS-specific function for timing. diff --git a/third_party/jpeg-xl/lib/jxl/base/time.cc b/third_party/jpeg-xl/lib/jxl/base/time.cc --- a/third_party/jpeg-xl/lib/jxl/base/time.cc +++ b/third_party/jpeg-xl/lib/jxl/base/time.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/base/time.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/bit_reader_test.cc b/third_party/jpeg-xl/lib/jxl/bit_reader_test.cc --- a/third_party/jpeg-xl/lib/jxl/bit_reader_test.cc +++ b/third_party/jpeg-xl/lib/jxl/bit_reader_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include #include #include diff --git a/third_party/jpeg-xl/lib/jxl/bits_test.cc b/third_party/jpeg-xl/lib/jxl/bits_test.cc --- a/third_party/jpeg-xl/lib/jxl/bits_test.cc +++ b/third_party/jpeg-xl/lib/jxl/bits_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/base/bits.h" #include "gtest/gtest.h" diff --git a/third_party/jpeg-xl/lib/jxl/blending.h b/third_party/jpeg-xl/lib/jxl/blending.h --- a/third_party/jpeg-xl/lib/jxl/blending.h +++ b/third_party/jpeg-xl/lib/jxl/blending.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_BLENDING_H_ #define LIB_JXL_BLENDING_H_ #include "lib/jxl/dec_cache.h" #include "lib/jxl/dec_patch_dictionary.h" @@ -43,14 +34,17 @@ explicit RectBlender(bool done) : done_(done) {} bool done_; Rect current_overlap_; Rect current_cropbox_; - ImageBundle foreground_; ImageBundle* dest_; std::vector fg_ptrs_; + std::vector fg_strides_; std::vector bg_ptrs_; + std::vector bg_strides_; + std::vector fg_row_ptrs_; + std::vector bg_row_ptrs_; std::vector blending_info_; }; static bool NeedsBlending(PassesDecoderState* dec_state); diff --git a/third_party/jpeg-xl/lib/jxl/blending.cc b/third_party/jpeg-xl/lib/jxl/blending.cc --- a/third_party/jpeg-xl/lib/jxl/blending.cc +++ b/third_party/jpeg-xl/lib/jxl/blending.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/blending.h" #include "lib/jxl/alpha.h" #include "lib/jxl/image_ops.h" @@ -159,43 +150,28 @@ blender.current_overlap_.ysize() == 0) { blender.done_ = true; return blender; } - const Rect actual_input_rect( - input_rect.x0() + (blender.current_overlap_.x0() - rect.x0()), - input_rect.y0() + (blender.current_overlap_.y0() - rect.y0()), - blender.current_overlap_.xsize(), blender.current_overlap_.ysize()); - blender.current_cropbox_ = Rect(o_.x0 + blender.current_overlap_.x0(), o_.y0 + blender.current_overlap_.y0(), blender.current_overlap_.xsize(), blender.current_overlap_.ysize()); - Image3F cropped_foreground(actual_input_rect.xsize(), - actual_input_rect.ysize()); - CopyImageTo(actual_input_rect, foreground, &cropped_foreground); - blender.foreground_ = ImageBundle(dest_->metadata()); - blender.foreground_.SetFromImage( - std::move(cropped_foreground), - ColorEncoding::LinearSRGB() /* likely incorrect but unused anyway */); - if (!extra_channels.empty()) { - std::vector ec; - for (const auto& extra_channel : extra_channels) { - ImageF ec_image(actual_input_rect.xsize(), actual_input_rect.ysize()); - CopyImageTo(actual_input_rect, extra_channel, &ec_image); - ec.push_back(std::move(ec_image)); - } - blender.foreground_.SetExtraChannels(std::move(ec)); - } // Turn current_overlap_ from being relative to the full foreground to being - // relative to the rect. + // relative to the rect or input_rect. blender.current_overlap_ = Rect(blender.current_overlap_.x0() - rect.x0(), blender.current_overlap_.y0() - rect.y0(), blender.current_overlap_.xsize(), blender.current_overlap_.ysize()); + // And this one is relative to the `foreground` subimage. + const Rect input_overlap(blender.current_overlap_.x0() + input_rect.x0(), + blender.current_overlap_.y0() + input_rect.y0(), + blender.current_overlap_.xsize(), + blender.current_overlap_.ysize()); + blender.blending_info_.resize(extra_channels.size() + 1); auto make_blending = [&](const BlendingInfo& info, PatchBlending* pb) { pb->alpha_channel = info.alpha_channel; pb->clamp = info.clamp; switch (info.mode) { @@ -220,17 +196,37 @@ break; } default: { JXL_ABORT("Invalid blend mode"); // should have failed to decode } - }; + } }; make_blending(info_, &blender.blending_info_[0]); for (size_t i = 0; i < extra_channels.size(); i++) { make_blending((*ec_info_)[i], &blender.blending_info_[1 + i]); } + Rect cropbox_row = blender.current_cropbox_.Line(0); + Rect overlap_row = input_overlap.Line(0); + const auto num_ptrs = 3 + extra_channels.size(); + blender.fg_ptrs_.reserve(num_ptrs); + blender.fg_strides_.reserve(num_ptrs); + blender.bg_ptrs_.reserve(num_ptrs); + blender.bg_strides_.reserve(num_ptrs); + for (size_t c = 0; c < 3; c++) { + blender.fg_ptrs_.push_back(overlap_row.ConstPlaneRow(foreground, c, 0)); + blender.fg_strides_.push_back(foreground.PixelsPerRow()); + blender.bg_ptrs_.push_back(cropbox_row.PlaneRow(dest_->color(), c, 0)); + blender.bg_strides_.push_back(dest_->color()->PixelsPerRow()); + } + for (size_t c = 0; c < extra_channels.size(); c++) { + blender.fg_ptrs_.push_back(overlap_row.ConstRow(extra_channels[c], 0)); + blender.fg_strides_.push_back(extra_channels[c].PixelsPerRow()); + blender.bg_ptrs_.push_back(cropbox_row.Row(&dest_->extra_channels()[c], 0)); + blender.bg_strides_.push_back(dest_->extra_channels()[c].PixelsPerRow()); + } + return blender; } Status PerformBlending( const float* const* bg, const float* const* fg, float* const* out, @@ -353,24 +349,18 @@ if (done_ || y < current_overlap_.y0() || y >= current_overlap_.y0() + current_overlap_.ysize()) { return true; } y -= current_overlap_.y0(); - Rect cropbox_row = current_cropbox_.Line(y); - Rect overlap_row = Rect(0, y, current_overlap_.xsize(), 1); - fg_ptrs_.resize(3 + foreground_.extra_channels().size()); - bg_ptrs_.resize(3 + foreground_.extra_channels().size()); - for (size_t c = 0; c < 3; c++) { - fg_ptrs_[c] = overlap_row.ConstPlaneRow(*foreground_.color(), c, 0); - bg_ptrs_[c] = cropbox_row.PlaneRow(dest_->color(), c, 0); + fg_row_ptrs_.resize(fg_ptrs_.size()); + bg_row_ptrs_.resize(bg_ptrs_.size()); + for (size_t c = 0; c < fg_row_ptrs_.size(); c++) { + fg_row_ptrs_[c] = fg_ptrs_[c] + y * fg_strides_[c]; + bg_row_ptrs_[c] = bg_ptrs_[c] + y * bg_strides_[c]; } - for (size_t c = 0; c < foreground_.extra_channels().size(); c++) { - fg_ptrs_[c + 3] = overlap_row.ConstRow(foreground_.extra_channels()[c], 0); - bg_ptrs_[c + 3] = cropbox_row.Row(&dest_->extra_channels()[c], 0); - } - return PerformBlending(bg_ptrs_.data(), fg_ptrs_.data(), bg_ptrs_.data(), - current_overlap_.xsize(), blending_info_[0], - blending_info_.data() + 1, + return PerformBlending(bg_row_ptrs_.data(), fg_row_ptrs_.data(), + bg_row_ptrs_.data(), current_overlap_.xsize(), + blending_info_[0], blending_info_.data() + 1, dest_->metadata()->extra_channel_info); } } // namespace jxl diff --git a/third_party/jpeg-xl/lib/jxl/blending_test.cc b/third_party/jpeg-xl/lib/jxl/blending_test.cc --- a/third_party/jpeg-xl/lib/jxl/blending_test.cc +++ b/third_party/jpeg-xl/lib/jxl/blending_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/blending.h" #include "gmock/gmock.h" #include "gtest/gtest.h" @@ -46,7 +37,58 @@ EXPECT_TRUE(SamePixels(ib.color(), *frame.Main().color())); ++i; } } +TEST(BlendingTest, Offset) { + const PaddedBytes background_bytes = ReadTestData("jxl/splines.png"); + CodecInOut background; + ASSERT_TRUE(SetFromBytes(Span(background_bytes), &background)); + const PaddedBytes foreground_bytes = + ReadTestData("jxl/grayscale_patches.png"); + CodecInOut foreground; + ASSERT_TRUE(SetFromBytes(Span(foreground_bytes), &foreground)); + + ImageBlender blender; + ImageBundle output; + CodecMetadata nonserialized_metadata; + ASSERT_TRUE( + nonserialized_metadata.size.Set(background.xsize(), background.ysize())); + PassesSharedState state; + state.frame_header.blending_info.mode = BlendMode::kReplace; + state.frame_header.blending_info.source = 0; + state.frame_header.nonserialized_metadata = &nonserialized_metadata; + state.metadata = &background.metadata; + state.reference_frames[0].frame = &background.Main(); + PassesDecoderState dec_state; + dec_state.shared = &state; + const FrameOrigin foreground_origin = {-50, -50}; + ASSERT_TRUE(blender.PrepareBlending(&dec_state, foreground_origin, + foreground.xsize(), foreground.ysize(), + background.Main().c_current(), &output)); + + static constexpr int kStep = 20; + for (size_t x0 = 0; x0 < foreground.xsize(); x0 += kStep) { + for (size_t y0 = 0; y0 < foreground.ysize(); y0 += kStep) { + const Rect rect = + Rect(x0, y0, kStep, kStep).Intersection(Rect(foreground.Main())); + Image3F foreground_crop(rect.xsize(), rect.ysize()); + CopyImageTo(rect, *foreground.Main().color(), Rect(foreground_crop), + &foreground_crop); + auto rect_blender = + blender.PrepareRect(rect, foreground_crop, {}, Rect(foreground_crop)); + for (size_t y = 0; y < rect.ysize(); ++y) { + ASSERT_TRUE(rect_blender.DoBlending(y)); + } + } + } + + const PaddedBytes expected_bytes = + ReadTestData("jxl/blending/grayscale_patches_on_splines.png"); + CodecInOut expected; + ASSERT_TRUE(SetFromBytes(Span(expected_bytes), &expected)); + VerifyRelativeError(*expected.Main().color(), *output.color(), 1. / (2 * 255), + 0); +} + } // namespace } // namespace jxl diff --git a/third_party/jpeg-xl/lib/jxl/butteraugli/butteraugli.h b/third_party/jpeg-xl/lib/jxl/butteraugli/butteraugli.h --- a/third_party/jpeg-xl/lib/jxl/butteraugli/butteraugli.h +++ b/third_party/jpeg-xl/lib/jxl/butteraugli/butteraugli.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // // Author: Jyrki Alakuijala (jyrki.alakuijala@gmail.com) #ifndef LIB_JXL_BUTTERAUGLI_BUTTERAUGLI_H_ #define LIB_JXL_BUTTERAUGLI_BUTTERAUGLI_H_ diff --git a/third_party/jpeg-xl/lib/jxl/butteraugli/butteraugli.cc b/third_party/jpeg-xl/lib/jxl/butteraugli/butteraugli.cc --- a/third_party/jpeg-xl/lib/jxl/butteraugli/butteraugli.cc +++ b/third_party/jpeg-xl/lib/jxl/butteraugli/butteraugli.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // // Author: Jyrki Alakuijala (jyrki.alakuijala@gmail.com) // // The physical architecture of butteraugli is based on the following naming // convention: diff --git a/third_party/jpeg-xl/lib/jxl/butteraugli_test.cc b/third_party/jpeg-xl/lib/jxl/butteraugli_test.cc --- a/third_party/jpeg-xl/lib/jxl/butteraugli_test.cc +++ b/third_party/jpeg-xl/lib/jxl/butteraugli_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "jxl/butteraugli.h" #include "gtest/gtest.h" #include "jxl/butteraugli_cxx.h" diff --git a/third_party/jpeg-xl/lib/jxl/butteraugli_wrapper.cc b/third_party/jpeg-xl/lib/jxl/butteraugli_wrapper.cc --- a/third_party/jpeg-xl/lib/jxl/butteraugli_wrapper.cc +++ b/third_party/jpeg-xl/lib/jxl/butteraugli_wrapper.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include #include #include diff --git a/third_party/jpeg-xl/lib/jxl/byte_order_test.cc b/third_party/jpeg-xl/lib/jxl/byte_order_test.cc --- a/third_party/jpeg-xl/lib/jxl/byte_order_test.cc +++ b/third_party/jpeg-xl/lib/jxl/byte_order_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/base/byte_order.h" #include "gtest/gtest.h" diff --git a/third_party/jpeg-xl/lib/jxl/chroma_from_luma.h b/third_party/jpeg-xl/lib/jxl/chroma_from_luma.h --- a/third_party/jpeg-xl/lib/jxl/chroma_from_luma.h +++ b/third_party/jpeg-xl/lib/jxl/chroma_from_luma.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_CHROMA_FROM_LUMA_H_ #define LIB_JXL_CHROMA_FROM_LUMA_H_ // Chroma-from-luma, computed using heuristics to determine the best linear @@ -59,11 +50,11 @@ // since the CfL denominator is 84, this leaves 12 bits of mantissa to be used. // For extra caution, we use 11. static constexpr uint8_t kCFLFixedPointPrecision = 11; static constexpr U32Enc kColorFactorDist(Val(kDefaultColorFactor), Val(256), - BitsOffset(2, 8), BitsOffset(258, 12)); + BitsOffset(8, 2), BitsOffset(16, 258)); struct ColorCorrelationMap { ColorCorrelationMap() = default; // xsize/ysize are in pixels // set XYB=false to do something close to no-op cmap (needed for now since diff --git a/third_party/jpeg-xl/lib/jxl/chroma_from_luma.cc b/third_party/jpeg-xl/lib/jxl/chroma_from_luma.cc --- a/third_party/jpeg-xl/lib/jxl/chroma_from_luma.cc +++ b/third_party/jpeg-xl/lib/jxl/chroma_from_luma.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/chroma_from_luma.h" namespace jxl { diff --git a/third_party/jpeg-xl/lib/jxl/codec_in_out.h b/third_party/jpeg-xl/lib/jxl/codec_in_out.h --- a/third_party/jpeg-xl/lib/jxl/codec_in_out.h +++ b/third_party/jpeg-xl/lib/jxl/codec_in_out.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_CODEC_IN_OUT_H_ #define LIB_JXL_CODEC_IN_OUT_H_ // Holds inputs/outputs for decoding/encoding images. diff --git a/third_party/jpeg-xl/lib/jxl/coeff_order.h b/third_party/jpeg-xl/lib/jxl/coeff_order.h --- a/third_party/jpeg-xl/lib/jxl/coeff_order.h +++ b/third_party/jpeg-xl/lib/jxl/coeff_order.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_COEFF_ORDER_H_ #define LIB_JXL_COEFF_ORDER_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/coeff_order.cc b/third_party/jpeg-xl/lib/jxl/coeff_order.cc --- a/third_party/jpeg-xl/lib/jxl/coeff_order.cc +++ b/third_party/jpeg-xl/lib/jxl/coeff_order.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/coeff_order.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/coeff_order_fwd.h b/third_party/jpeg-xl/lib/jxl/coeff_order_fwd.h --- a/third_party/jpeg-xl/lib/jxl/coeff_order_fwd.h +++ b/third_party/jpeg-xl/lib/jxl/coeff_order_fwd.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_COEFF_ORDER_FWD_H_ #define LIB_JXL_COEFF_ORDER_FWD_H_ // Breaks circular dependency between ac_strategy and coeff_order. diff --git a/third_party/jpeg-xl/lib/jxl/coeff_order_test.cc b/third_party/jpeg-xl/lib/jxl/coeff_order_test.cc --- a/third_party/jpeg-xl/lib/jxl/coeff_order_test.cc +++ b/third_party/jpeg-xl/lib/jxl/coeff_order_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/coeff_order.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/color_encoding_internal.h b/third_party/jpeg-xl/lib/jxl/color_encoding_internal.h --- a/third_party/jpeg-xl/lib/jxl/color_encoding_internal.h +++ b/third_party/jpeg-xl/lib/jxl/color_encoding_internal.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_COLOR_ENCODING_INTERNAL_H_ #define LIB_JXL_COLOR_ENCODING_INTERNAL_H_ // Metadata for color space conversions. diff --git a/third_party/jpeg-xl/lib/jxl/color_encoding_internal.cc b/third_party/jpeg-xl/lib/jxl/color_encoding_internal.cc --- a/third_party/jpeg-xl/lib/jxl/color_encoding_internal.cc +++ b/third_party/jpeg-xl/lib/jxl/color_encoding_internal.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/color_encoding_internal.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/color_encoding_internal_test.cc b/third_party/jpeg-xl/lib/jxl/color_encoding_internal_test.cc --- a/third_party/jpeg-xl/lib/jxl/color_encoding_internal_test.cc +++ b/third_party/jpeg-xl/lib/jxl/color_encoding_internal_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/color_encoding_internal.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/color_management.h b/third_party/jpeg-xl/lib/jxl/color_management.h --- a/third_party/jpeg-xl/lib/jxl/color_management.h +++ b/third_party/jpeg-xl/lib/jxl/color_management.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_COLOR_MANAGEMENT_H_ #define LIB_JXL_COLOR_MANAGEMENT_H_ // ICC profiles and color space conversions. diff --git a/third_party/jpeg-xl/lib/jxl/color_management.cc b/third_party/jpeg-xl/lib/jxl/color_management.cc --- a/third_party/jpeg-xl/lib/jxl/color_management.cc +++ b/third_party/jpeg-xl/lib/jxl/color_management.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // Defined by build system; this avoids IDE warnings. Must come before // color_management.h (affects header definitions). #ifndef JPEGXL_ENABLE_SKCMS #define JPEGXL_ENABLE_SKCMS 0 diff --git a/third_party/jpeg-xl/lib/jxl/color_management_test.cc b/third_party/jpeg-xl/lib/jxl/color_management_test.cc --- a/third_party/jpeg-xl/lib/jxl/color_management_test.cc +++ b/third_party/jpeg-xl/lib/jxl/color_management_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/color_management.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/common.h b/third_party/jpeg-xl/lib/jxl/common.h --- a/third_party/jpeg-xl/lib/jxl/common.h +++ b/third_party/jpeg-xl/lib/jxl/common.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_COMMON_H_ #define LIB_JXL_COMMON_H_ // Shared constants and helper functions. @@ -85,11 +76,11 @@ // Maximum number of passes in an image. constexpr size_t kMaxNumPasses = 11; // Maximum number of reference frames. -constexpr size_t kMaxNumReferenceFrames = 3; +constexpr size_t kMaxNumReferenceFrames = 4; // Dimensions of a frame, in pixels, and other derived dimensions. // Computed from FrameHeader. // TODO(veluca): add extra channels. struct FrameDimensions { diff --git a/third_party/jpeg-xl/lib/jxl/compressed_dc.h b/third_party/jpeg-xl/lib/jxl/compressed_dc.h --- a/third_party/jpeg-xl/lib/jxl/compressed_dc.h +++ b/third_party/jpeg-xl/lib/jxl/compressed_dc.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_COMPRESSED_DC_H_ #define LIB_JXL_COMPRESSED_DC_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/compressed_dc.cc b/third_party/jpeg-xl/lib/jxl/compressed_dc.cc --- a/third_party/jpeg-xl/lib/jxl/compressed_dc.cc +++ b/third_party/jpeg-xl/lib/jxl/compressed_dc.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/compressed_dc.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/compressed_image_test.cc b/third_party/jpeg-xl/lib/jxl/compressed_image_test.cc --- a/third_party/jpeg-xl/lib/jxl/compressed_image_test.cc +++ b/third_party/jpeg-xl/lib/jxl/compressed_image_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include #include #include diff --git a/third_party/jpeg-xl/lib/jxl/convolve-inl.h b/third_party/jpeg-xl/lib/jxl/convolve-inl.h --- a/third_party/jpeg-xl/lib/jxl/convolve-inl.h +++ b/third_party/jpeg-xl/lib/jxl/convolve-inl.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #if defined(LIB_JXL_CONVOLVE_INL_H_) == defined(HWY_TARGET_TOGGLE) #ifdef LIB_JXL_CONVOLVE_INL_H_ #undef LIB_JXL_CONVOLVE_INL_H_ #else diff --git a/third_party/jpeg-xl/lib/jxl/convolve.h b/third_party/jpeg-xl/lib/jxl/convolve.h --- a/third_party/jpeg-xl/lib/jxl/convolve.h +++ b/third_party/jpeg-xl/lib/jxl/convolve.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_CONVOLVE_H_ #define LIB_JXL_CONVOLVE_H_ // 2D convolution. diff --git a/third_party/jpeg-xl/lib/jxl/convolve.cc b/third_party/jpeg-xl/lib/jxl/convolve.cc --- a/third_party/jpeg-xl/lib/jxl/convolve.cc +++ b/third_party/jpeg-xl/lib/jxl/convolve.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/convolve.h" #undef HWY_TARGET_INCLUDE #define HWY_TARGET_INCLUDE "lib/jxl/convolve.cc" diff --git a/third_party/jpeg-xl/lib/jxl/convolve_test.cc b/third_party/jpeg-xl/lib/jxl/convolve_test.cc --- a/third_party/jpeg-xl/lib/jxl/convolve_test.cc +++ b/third_party/jpeg-xl/lib/jxl/convolve_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/convolve.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/data_parallel_test.cc b/third_party/jpeg-xl/lib/jxl/data_parallel_test.cc --- a/third_party/jpeg-xl/lib/jxl/data_parallel_test.cc +++ b/third_party/jpeg-xl/lib/jxl/data_parallel_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/base/data_parallel.h" #include "gtest/gtest.h" #include "lib/jxl/base/thread_pool_internal.h" diff --git a/third_party/jpeg-xl/lib/jxl/dct-inl.h b/third_party/jpeg-xl/lib/jxl/dct-inl.h --- a/third_party/jpeg-xl/lib/jxl/dct-inl.h +++ b/third_party/jpeg-xl/lib/jxl/dct-inl.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // Fast SIMD floating-point (I)DCT, any power of two. #if defined(LIB_JXL_DCT_INL_H_) == defined(HWY_TARGET_TOGGLE) #ifdef LIB_JXL_DCT_INL_H_ diff --git a/third_party/jpeg-xl/lib/jxl/dct_block-inl.h b/third_party/jpeg-xl/lib/jxl/dct_block-inl.h --- a/third_party/jpeg-xl/lib/jxl/dct_block-inl.h +++ b/third_party/jpeg-xl/lib/jxl/dct_block-inl.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // Adapters for DCT input/output: from/to contiguous blocks or image rows. #if defined(LIB_JXL_DCT_BLOCK_INL_H_) == defined(HWY_TARGET_TOGGLE) #ifdef LIB_JXL_DCT_BLOCK_INL_H_ diff --git a/third_party/jpeg-xl/lib/jxl/dct_for_test.h b/third_party/jpeg-xl/lib/jxl/dct_for_test.h --- a/third_party/jpeg-xl/lib/jxl/dct_for_test.h +++ b/third_party/jpeg-xl/lib/jxl/dct_for_test.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_DCT_FOR_TEST_H_ #define LIB_JXL_DCT_FOR_TEST_H_ // Unoptimized DCT only for use in tests. diff --git a/third_party/jpeg-xl/lib/jxl/dct_scales.h b/third_party/jpeg-xl/lib/jxl/dct_scales.h --- a/third_party/jpeg-xl/lib/jxl/dct_scales.h +++ b/third_party/jpeg-xl/lib/jxl/dct_scales.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_DCT_SCALES_H_ #define LIB_JXL_DCT_SCALES_H_ // Scaling factors. diff --git a/third_party/jpeg-xl/lib/jxl/dct_scales.cc b/third_party/jpeg-xl/lib/jxl/dct_scales.cc --- a/third_party/jpeg-xl/lib/jxl/dct_scales.cc +++ b/third_party/jpeg-xl/lib/jxl/dct_scales.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/dct_scales.h" namespace jxl { diff --git a/third_party/jpeg-xl/lib/jxl/dct_test.cc b/third_party/jpeg-xl/lib/jxl/dct_test.cc --- a/third_party/jpeg-xl/lib/jxl/dct_test.cc +++ b/third_party/jpeg-xl/lib/jxl/dct_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include #include #include diff --git a/third_party/jpeg-xl/lib/jxl/dct_util.h b/third_party/jpeg-xl/lib/jxl/dct_util.h --- a/third_party/jpeg-xl/lib/jxl/dct_util.h +++ b/third_party/jpeg-xl/lib/jxl/dct_util.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_DCT_UTIL_H_ #define LIB_JXL_DCT_UTIL_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/dec_ans.h b/third_party/jpeg-xl/lib/jxl/dec_ans.h --- a/third_party/jpeg-xl/lib/jxl/dec_ans.h +++ b/third_party/jpeg-xl/lib/jxl/dec_ans.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_DEC_ANS_H_ #define LIB_JXL_DEC_ANS_H_ // Library to decode the ANS population counts from the bit-stream and build a @@ -351,10 +342,59 @@ } } return true; } + static constexpr size_t kMaxCheckpointInterval = 512; + struct Checkpoint { + uint32_t state; + uint32_t num_to_copy; + uint32_t copy_pos; + uint32_t num_decoded; + uint32_t lz77_window[kMaxCheckpointInterval]; + }; + void Save(Checkpoint* checkpoint) { + checkpoint->state = state_; + checkpoint->num_decoded = num_decoded_; + checkpoint->num_to_copy = num_to_copy_; + checkpoint->copy_pos = copy_pos_; + if (lz77_window_) { + size_t win_start = num_decoded_ & kWindowMask; + size_t win_end = (num_decoded_ + kMaxCheckpointInterval) & kWindowMask; + if (win_end > win_start) { + memcpy(checkpoint->lz77_window, lz77_window_ + win_start, + (win_end - win_start) * sizeof(*lz77_window_)); + } else { + memcpy(checkpoint->lz77_window, lz77_window_ + win_start, + (kWindowSize - win_start) * sizeof(*lz77_window_)); + memcpy(checkpoint->lz77_window + (kWindowSize - win_start), + lz77_window_, win_end * sizeof(*lz77_window_)); + } + } + } + void Restore(const Checkpoint& checkpoint) { + state_ = checkpoint.state; + JXL_DASSERT(num_decoded_ <= + checkpoint.num_decoded + kMaxCheckpointInterval); + num_decoded_ = checkpoint.num_decoded; + num_to_copy_ = checkpoint.num_to_copy; + copy_pos_ = checkpoint.copy_pos; + if (lz77_window_) { + size_t win_start = num_decoded_ & kWindowMask; + size_t win_end = (num_decoded_ + kMaxCheckpointInterval) & kWindowMask; + if (win_end > win_start) { + memcpy(lz77_window_ + win_start, checkpoint.lz77_window, + (win_end - win_start) * sizeof(*lz77_window_)); + } else { + memcpy(lz77_window_ + win_start, checkpoint.lz77_window, + (kWindowSize - win_start) * sizeof(*lz77_window_)); + memcpy(lz77_window_, checkpoint.lz77_window + (kWindowSize - win_start), + win_end * sizeof(*lz77_window_)); + } + } + } + private: const AliasTable::Entry* JXL_RESTRICT alias_tables_; // not owned const HuffmanDecodingData* huffman_data_; bool use_prefix_code_; uint32_t state_ = ANS_SIGNATURE << 16u; diff --git a/third_party/jpeg-xl/lib/jxl/dec_ans.cc b/third_party/jpeg-xl/lib/jxl/dec_ans.cc --- a/third_party/jpeg-xl/lib/jxl/dec_ans.cc +++ b/third_party/jpeg-xl/lib/jxl/dec_ans.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/dec_ans.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/dec_bit_reader.h b/third_party/jpeg-xl/lib/jxl/dec_bit_reader.h --- a/third_party/jpeg-xl/lib/jxl/dec_bit_reader.h +++ b/third_party/jpeg-xl/lib/jxl/dec_bit_reader.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_DEC_BIT_READER_H_ #define LIB_JXL_DEC_BIT_READER_H_ // Bounds-checked bit reader; 64-bit buffer with support for deferred refills diff --git a/third_party/jpeg-xl/lib/jxl/dec_cache.h b/third_party/jpeg-xl/lib/jxl/dec_cache.h --- a/third_party/jpeg-xl/lib/jxl/dec_cache.h +++ b/third_party/jpeg-xl/lib/jxl/dec_cache.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_DEC_CACHE_H_ #define LIB_JXL_DEC_CACHE_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/dec_context_map.h b/third_party/jpeg-xl/lib/jxl/dec_context_map.h --- a/third_party/jpeg-xl/lib/jxl/dec_context_map.h +++ b/third_party/jpeg-xl/lib/jxl/dec_context_map.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_DEC_CONTEXT_MAP_H_ #define LIB_JXL_DEC_CONTEXT_MAP_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/dec_context_map.cc b/third_party/jpeg-xl/lib/jxl/dec_context_map.cc --- a/third_party/jpeg-xl/lib/jxl/dec_context_map.cc +++ b/third_party/jpeg-xl/lib/jxl/dec_context_map.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/dec_context_map.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/dec_external_image.h b/third_party/jpeg-xl/lib/jxl/dec_external_image.h --- a/third_party/jpeg-xl/lib/jxl/dec_external_image.h +++ b/third_party/jpeg-xl/lib/jxl/dec_external_image.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_DEC_EXTERNAL_IMAGE_H_ #define LIB_JXL_DEC_EXTERNAL_IMAGE_H_ // Interleaved image for color transforms and Codec. diff --git a/third_party/jpeg-xl/lib/jxl/dec_external_image.cc b/third_party/jpeg-xl/lib/jxl/dec_external_image.cc --- a/third_party/jpeg-xl/lib/jxl/dec_external_image.cc +++ b/third_party/jpeg-xl/lib/jxl/dec_external_image.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/dec_external_image.h" #include @@ -57,20 +48,17 @@ const auto one = Set(d, 1.0f); const auto scale = Set(d, mul); for (size_t x = 0; x < vec_num; x += Lanes(d)) { auto v = Load(d, in + x); - // Check for NaNs. - JXL_DASSERT(AllTrue(v == v)); // Clamp turns NaN to 'min'. v = Clamp(v, Zero(d), one); auto i = NearestInt(v * scale); Store(BitCast(du, i), du, out + x); } for (size_t x = vec_num; x < num; x++) { float v = in[x]; - JXL_DASSERT(!std::isnan(v)); // Inverted condition grants that NaN is mapped to 0.0f. v = (v >= 0.0f) ? (v > 1.0f ? mul : (v * mul)) : 0.0f; out[x] = static_cast(v + 0.5f); } } diff --git a/third_party/jpeg-xl/lib/jxl/dec_external_image_gbench.cc b/third_party/jpeg-xl/lib/jxl/dec_external_image_gbench.cc --- a/third_party/jpeg-xl/lib/jxl/dec_external_image_gbench.cc +++ b/third_party/jpeg-xl/lib/jxl/dec_external_image_gbench.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "benchmark/benchmark.h" #include "lib/jxl/dec_external_image.h" #include "lib/jxl/image_ops.h" diff --git a/third_party/jpeg-xl/lib/jxl/dec_file.h b/third_party/jpeg-xl/lib/jxl/dec_file.h --- a/third_party/jpeg-xl/lib/jxl/dec_file.h +++ b/third_party/jpeg-xl/lib/jxl/dec_file.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_DEC_FILE_H_ #define LIB_JXL_DEC_FILE_H_ // Top-level interface for JXL decoding. diff --git a/third_party/jpeg-xl/lib/jxl/dec_file.cc b/third_party/jpeg-xl/lib/jxl/dec_file.cc --- a/third_party/jpeg-xl/lib/jxl/dec_file.cc +++ b/third_party/jpeg-xl/lib/jxl/dec_file.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/dec_file.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/dec_frame.h b/third_party/jpeg-xl/lib/jxl/dec_frame.h --- a/third_party/jpeg-xl/lib/jxl/dec_frame.h +++ b/third_party/jpeg-xl/lib/jxl/dec_frame.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_DEC_FRAME_H_ #define LIB_JXL_DEC_FRAME_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/dec_frame.cc b/third_party/jpeg-xl/lib/jxl/dec_frame.cc --- a/third_party/jpeg-xl/lib/jxl/dec_frame.cc +++ b/third_party/jpeg-xl/lib/jxl/dec_frame.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/dec_frame.h" #include #include @@ -369,10 +360,12 @@ "Cannot use extra channels in patches if color channels are " "subsampled differently from extra channels"); } } } + } else { + shared.image_features.patches.Clear(); } if (shared.frame_header.flags & FrameHeader::kSplines) { JXL_RETURN_IF_ERROR(shared.image_features.splines.Decode( br, frame_dim_.xsize * frame_dim_.ysize)); } diff --git a/third_party/jpeg-xl/lib/jxl/dec_group.h b/third_party/jpeg-xl/lib/jxl/dec_group.h --- a/third_party/jpeg-xl/lib/jxl/dec_group.h +++ b/third_party/jpeg-xl/lib/jxl/dec_group.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_DEC_GROUP_H_ #define LIB_JXL_DEC_GROUP_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/dec_group.cc b/third_party/jpeg-xl/lib/jxl/dec_group.cc --- a/third_party/jpeg-xl/lib/jxl/dec_group.cc +++ b/third_party/jpeg-xl/lib/jxl/dec_group.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/dec_group.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/dec_group_border.h b/third_party/jpeg-xl/lib/jxl/dec_group_border.h --- a/third_party/jpeg-xl/lib/jxl/dec_group_border.h +++ b/third_party/jpeg-xl/lib/jxl/dec_group_border.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_DEC_GROUP_BORDER_H_ #define LIB_JXL_DEC_GROUP_BORDER_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/dec_group_border.cc b/third_party/jpeg-xl/lib/jxl/dec_group_border.cc --- a/third_party/jpeg-xl/lib/jxl/dec_group_border.cc +++ b/third_party/jpeg-xl/lib/jxl/dec_group_border.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/dec_group_border.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/dec_huffman.h b/third_party/jpeg-xl/lib/jxl/dec_huffman.h --- a/third_party/jpeg-xl/lib/jxl/dec_huffman.h +++ b/third_party/jpeg-xl/lib/jxl/dec_huffman.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_DEC_HUFFMAN_H_ #define LIB_JXL_DEC_HUFFMAN_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/dec_huffman.cc b/third_party/jpeg-xl/lib/jxl/dec_huffman.cc --- a/third_party/jpeg-xl/lib/jxl/dec_huffman.cc +++ b/third_party/jpeg-xl/lib/jxl/dec_huffman.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/dec_huffman.h" #include /* for memset */ diff --git a/third_party/jpeg-xl/lib/jxl/dec_modular.h b/third_party/jpeg-xl/lib/jxl/dec_modular.h --- a/third_party/jpeg-xl/lib/jxl/dec_modular.h +++ b/third_party/jpeg-xl/lib/jxl/dec_modular.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_DEC_MODULAR_H_ #define LIB_JXL_DEC_MODULAR_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/dec_modular.cc b/third_party/jpeg-xl/lib/jxl/dec_modular.cc --- a/third_party/jpeg-xl/lib/jxl/dec_modular.cc +++ b/third_party/jpeg-xl/lib/jxl/dec_modular.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/dec_modular.h" #include @@ -475,41 +466,44 @@ } // TODO(eustas): could we detect it on earlier stage? if (gi.channel[c_in].w == 0 || gi.channel[c_in].h == 0) { return JXL_FAILURE("Empty image"); } + size_t xsize_shifted = DivCeil(xsize, 1 << gi.channel[c_in].hshift); + size_t ysize_shifted = DivCeil(ysize, 1 << gi.channel[c_in].vshift); + if (ysize_shifted != gi.channel[c_in].h || xsize_shifted != gi.channel[c_in].w) { + return JXL_FAILURE("Dimension mismatch"); + } if (frame_header.color_transform == ColorTransform::kXYB && c == 2) { JXL_ASSERT(!fp); RunOnPool( - pool, 0, ysize, jxl::ThreadPool::SkipInit(), + pool, 0, ysize_shifted, jxl::ThreadPool::SkipInit(), [&](const int task, const int thread) { const size_t y = task; const pixel_type* const JXL_RESTRICT row_in = gi.channel[c_in].Row(y); const pixel_type* const JXL_RESTRICT row_in_Y = gi.channel[0].Row(y); float* const JXL_RESTRICT row_out = decoded.PlaneRow(c, y); HWY_DYNAMIC_DISPATCH(MultiplySum) - (xsize, row_in, row_in_Y, factor, row_out); + (xsize_shifted, row_in, row_in_Y, factor, row_out); }, "ModularIntToFloat"); } else if (fp) { int bits = metadata->m.bit_depth.bits_per_sample; int exp_bits = metadata->m.bit_depth.exponent_bits_per_sample; RunOnPool( - pool, 0, ysize, jxl::ThreadPool::SkipInit(), + pool, 0, ysize_shifted, jxl::ThreadPool::SkipInit(), [&](const int task, const int thread) { const size_t y = task; const pixel_type* const JXL_RESTRICT row_in = gi.channel[c_in].Row(y); float* const JXL_RESTRICT row_out = decoded.PlaneRow(c, y); - int_to_float(row_in, row_out, xsize, bits, exp_bits); + int_to_float(row_in, row_out, xsize_shifted, bits, exp_bits); }, "ModularIntToFloat_losslessfloat"); } else { - size_t xsize_shifted = DivCeil(xsize, 1 << gi.channel[c_in].hshift); - size_t ysize_shifted = DivCeil(ysize, 1 << gi.channel[c_in].vshift); RunOnPool( pool, 0, ysize_shifted, jxl::ThreadPool::SkipInit(), [&](const int task, const int thread) { const size_t y = task; const pixel_type* const JXL_RESTRICT row_in = diff --git a/third_party/jpeg-xl/lib/jxl/dec_noise.h b/third_party/jpeg-xl/lib/jxl/dec_noise.h --- a/third_party/jpeg-xl/lib/jxl/dec_noise.h +++ b/third_party/jpeg-xl/lib/jxl/dec_noise.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_DEC_NOISE_H_ #define LIB_JXL_DEC_NOISE_H_ // Noise synthesis. Currently disabled. diff --git a/third_party/jpeg-xl/lib/jxl/dec_noise.cc b/third_party/jpeg-xl/lib/jxl/dec_noise.cc --- a/third_party/jpeg-xl/lib/jxl/dec_noise.cc +++ b/third_party/jpeg-xl/lib/jxl/dec_noise.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/dec_noise.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/dec_params.h b/third_party/jpeg-xl/lib/jxl/dec_params.h --- a/third_party/jpeg-xl/lib/jxl/dec_params.h +++ b/third_party/jpeg-xl/lib/jxl/dec_params.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_DEC_PARAMS_H_ #define LIB_JXL_DEC_PARAMS_H_ // Parameters and flags that govern JXL decompression. diff --git a/third_party/jpeg-xl/lib/jxl/dec_patch_dictionary.h b/third_party/jpeg-xl/lib/jxl/dec_patch_dictionary.h --- a/third_party/jpeg-xl/lib/jxl/dec_patch_dictionary.h +++ b/third_party/jpeg-xl/lib/jxl/dec_patch_dictionary.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_DEC_PATCH_DICTIONARY_H_ #define LIB_JXL_DEC_PATCH_DICTIONARY_H_ // Chooses reference patches, and avoids encoding them once per occurrence. @@ -167,10 +158,15 @@ bool HasAny() const { return !positions_.empty(); } Status Decode(BitReader* br, size_t xsize, size_t ysize, bool* uses_extra_channels); + void Clear() { + positions_.clear(); + ComputePatchCache(); + } + // Only adds patches that belong to the `image_rect` area of the decoded // image, writing them to the `opsin_rect` area of `opsin`. Status AddTo(Image3F* opsin, const Rect& opsin_rect, float* const* extra_channels, const Rect& image_rect) const; diff --git a/third_party/jpeg-xl/lib/jxl/dec_patch_dictionary.cc b/third_party/jpeg-xl/lib/jxl/dec_patch_dictionary.cc --- a/third_party/jpeg-xl/lib/jxl/dec_patch_dictionary.cc +++ b/third_party/jpeg-xl/lib/jxl/dec_patch_dictionary.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/dec_patch_dictionary.h" #include #include @@ -46,10 +37,11 @@ constexpr int kMaxPatches = 1 << 24; Status PatchDictionary::Decode(BitReader* br, size_t xsize, size_t ysize, bool* uses_extra_channels) { + positions_.clear(); std::vector context_map; ANSCode code; JXL_RETURN_IF_ERROR( DecodeHistograms(br, kNumPatchDictionaryContexts, &code, &context_map)); ANSSymbolReader decoder(&code, br); @@ -160,10 +152,12 @@ ComputePatchCache(); return true; } void PatchDictionary::ComputePatchCache() { + patch_starts_.clear(); + sorted_patches_.clear(); if (positions_.empty()) return; std::vector> sorted_patches_y; for (size_t i = 0; i < positions_.size(); i++) { const PatchPosition& pos = positions_[i]; for (size_t y = pos.y; y < pos.y + pos.ref_pos.ysize; y++) { @@ -191,12 +185,10 @@ const Rect& image_rect) const { JXL_CHECK(SameSize(opsin_rect, image_rect)); size_t num_ec = shared_->metadata->m.num_extra_channels; std::vector fg_ptrs(3 + num_ec); std::vector bg_ptrs(3 + num_ec); - BlendingInfo color_blending; - std::vector ec_blending(num_ec); for (size_t y = image_rect.y0(); y < image_rect.y0() + image_rect.ysize(); y++) { if (y + 1 >= patch_starts_.size()) continue; for (size_t id = patch_starts_[y]; id < patch_starts_[y + 1]; id++) { const PatchPosition& pos = positions_[sorted_patches_[id]]; diff --git a/third_party/jpeg-xl/lib/jxl/dec_reconstruct.h b/third_party/jpeg-xl/lib/jxl/dec_reconstruct.h --- a/third_party/jpeg-xl/lib/jxl/dec_reconstruct.h +++ b/third_party/jpeg-xl/lib/jxl/dec_reconstruct.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_DEC_RECONSTRUCT_H_ #define LIB_JXL_DEC_RECONSTRUCT_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/dec_reconstruct.cc b/third_party/jpeg-xl/lib/jxl/dec_reconstruct.cc --- a/third_party/jpeg-xl/lib/jxl/dec_reconstruct.cc +++ b/third_party/jpeg-xl/lib/jxl/dec_reconstruct.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/dec_reconstruct.h" #include #include @@ -152,13 +143,20 @@ return IfThenZeroElse( v <= Set(d, 1e-5f), FastPowf(d, v, Set(d, output_encoding_info.inverse_gamma))); }; for (size_t x = 0; x < rect.xsize(); x += Lanes(d)) { +#if MEMORY_SANITIZER + const auto mask = Iota(d, x) < Set(d, rect.xsize()); + const auto in_opsin_x = IfThenElseZero(mask, Load(d, row0 + x)); + const auto in_opsin_y = IfThenElseZero(mask, Load(d, row1 + x)); + const auto in_opsin_b = IfThenElseZero(mask, Load(d, row2 + x)); +#else const auto in_opsin_x = Load(d, row0 + x); const auto in_opsin_y = Load(d, row1 + x); const auto in_opsin_b = Load(d, row2 + x); +#endif JXL_COMPILER_FENCE; auto linear_r = Undefined(d); auto linear_g = Undefined(d); auto linear_b = Undefined(d); XybToRgb(d, in_opsin_x, in_opsin_y, in_opsin_b, @@ -818,12 +816,11 @@ if (upsampled_available_y + num_ys >= upsampled_frame_rect.ysize()) { num_ys = upsampled_frame_rect.ysize() - upsampled_available_y; } - Rect upsample_input_rect = - rect_for_upsampling.Lines(input_y, num_input_rows); + Rect upsample_input_rect = rect_for_upsampling.Lines(input_y, 1); color_upsampler->UpsampleRect( *storage_for_if, upsample_input_rect, output_pixel_data_storage, upsampled_frame_rect_for_storage.Lines(upsampled_available_y, num_ys), static_cast(frame_rect.y0()) - static_cast(rect_for_upsampling.y0()), @@ -971,11 +968,14 @@ 1 << frame_header.chroma_subsampling.HShift(c)), DivCeil(frame_dim.ysize_padded, 1 << frame_header.chroma_subsampling.VShift(c))); for (size_t i = 0; i < frame_header.chroma_subsampling.HShift(c); i++) { plane.InitializePaddingForUnalignedAccesses(); - plane = UpsampleH2(plane, pool); + const size_t output_xsize = + DivCeil(frame_dim.xsize_padded, + 1 << (frame_header.chroma_subsampling.HShift(c) - i - 1)); + plane = UpsampleH2(plane, output_xsize, pool); } for (size_t i = 0; i < frame_header.chroma_subsampling.VShift(c); i++) { plane.InitializePaddingForUnalignedAccesses(); plane = UpsampleV2(plane, pool); } diff --git a/third_party/jpeg-xl/lib/jxl/dec_transforms-inl.h b/third_party/jpeg-xl/lib/jxl/dec_transforms-inl.h --- a/third_party/jpeg-xl/lib/jxl/dec_transforms-inl.h +++ b/third_party/jpeg-xl/lib/jxl/dec_transforms-inl.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #if defined(LIB_JXL_DEC_TRANSFORMS_INL_H_) == defined(HWY_TARGET_TOGGLE) #ifdef LIB_JXL_DEC_TRANSFORMS_INL_H_ #undef LIB_JXL_DEC_TRANSFORMS_INL_H_ #else diff --git a/third_party/jpeg-xl/lib/jxl/dec_transforms_testonly.h b/third_party/jpeg-xl/lib/jxl/dec_transforms_testonly.h --- a/third_party/jpeg-xl/lib/jxl/dec_transforms_testonly.h +++ b/third_party/jpeg-xl/lib/jxl/dec_transforms_testonly.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_DEC_TRANSFORMS_TESTONLY_H_ #define LIB_JXL_DEC_TRANSFORMS_TESTONLY_H_ // Facade for (non-inlined) inverse integral transforms. diff --git a/third_party/jpeg-xl/lib/jxl/dec_transforms_testonly.cc b/third_party/jpeg-xl/lib/jxl/dec_transforms_testonly.cc --- a/third_party/jpeg-xl/lib/jxl/dec_transforms_testonly.cc +++ b/third_party/jpeg-xl/lib/jxl/dec_transforms_testonly.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/dec_transforms_testonly.h" #undef HWY_TARGET_INCLUDE #define HWY_TARGET_INCLUDE "lib/jxl/dec_transforms_testonly.cc" diff --git a/third_party/jpeg-xl/lib/jxl/dec_upsample.h b/third_party/jpeg-xl/lib/jxl/dec_upsample.h --- a/third_party/jpeg-xl/lib/jxl/dec_upsample.h +++ b/third_party/jpeg-xl/lib/jxl/dec_upsample.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_DEC_UPSAMPLE_H_ #define LIB_JXL_DEC_UPSAMPLE_H_ #include "lib/jxl/image.h" diff --git a/third_party/jpeg-xl/lib/jxl/dec_upsample.cc b/third_party/jpeg-xl/lib/jxl/dec_upsample.cc --- a/third_party/jpeg-xl/lib/jxl/dec_upsample.cc +++ b/third_party/jpeg-xl/lib/jxl/dec_upsample.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/dec_upsample.h" #include "lib/jxl/image_ops.h" @@ -101,11 +92,11 @@ void Upsampler::UpsampleRect(const ImageF& src, const Rect& src_rect, ImageF* dst, const Rect& dst_rect, ssize_t image_y_offset, size_t image_ysize) const { if (upsampling_ == 1) return; JXL_ASSERT(DivCeil(dst_rect.xsize(), upsampling_) <= src_rect.xsize()); - JXL_ASSERT(DivCeil(dst_rect.ysize(), upsampling_) <= src_rect.ysize()); + // TODO(eustas): add proper (src|dst) ysize check that accounts for mirroring. if (upsampling_ == 2) { Upsample<2>(src, src_rect, dst, dst_rect, kernel_, image_y_offset, image_ysize); } else if (upsampling_ == 4) { Upsample<4>(src, src_rect, dst, dst_rect, kernel_, image_y_offset, diff --git a/third_party/jpeg-xl/lib/jxl/dec_xyb-inl.h b/third_party/jpeg-xl/lib/jxl/dec_xyb-inl.h --- a/third_party/jpeg-xl/lib/jxl/dec_xyb-inl.h +++ b/third_party/jpeg-xl/lib/jxl/dec_xyb-inl.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // XYB -> linear sRGB helper function. #if defined(LIB_JXL_DEC_XYB_INL_H_) == defined(HWY_TARGET_TOGGLE) #ifdef LIB_JXL_DEC_XYB_INL_H_ diff --git a/third_party/jpeg-xl/lib/jxl/dec_xyb.h b/third_party/jpeg-xl/lib/jxl/dec_xyb.h --- a/third_party/jpeg-xl/lib/jxl/dec_xyb.h +++ b/third_party/jpeg-xl/lib/jxl/dec_xyb.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_DEC_XYB_H_ #define LIB_JXL_DEC_XYB_H_ // XYB -> linear sRGB. @@ -67,11 +58,11 @@ ImageF UpsampleV2(const ImageF& src, ThreadPool* pool); // WARNING: this uses unaligned accesses, so the caller must first call // src.InitializePaddingForUnalignedAccesses() to avoid msan crashes. -ImageF UpsampleH2(const ImageF& src, ThreadPool* pool); +ImageF UpsampleH2(const ImageF& src, size_t output_xsize, ThreadPool* pool); bool HasFastXYBTosRGB8(); void FastXYBTosRGB8(const Image3F& input, const Rect& input_rect, const Rect& output_buf_rect, const ImageF* alpha, const Rect& alpha_rect, bool is_rgba, diff --git a/third_party/jpeg-xl/lib/jxl/dec_xyb.cc b/third_party/jpeg-xl/lib/jxl/dec_xyb.cc --- a/third_party/jpeg-xl/lib/jxl/dec_xyb.cc +++ b/third_party/jpeg-xl/lib/jxl/dec_xyb.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/dec_xyb.h" #include @@ -220,16 +211,21 @@ * o := 3 * b + l * e := 3 * b + r * output: * |o1 e1 o2 e2 o3 e3 o4 e4| =: (o, e) */ -ImageF UpsampleH2(const ImageF& src, ThreadPool* pool) { +ImageF UpsampleH2(const ImageF& src, size_t output_xsize, ThreadPool* pool) { const size_t xsize = src.xsize(); const size_t ysize = src.ysize(); JXL_ASSERT(xsize != 0); JXL_ASSERT(ysize != 0); - ImageF dst(xsize * 2, ysize); + JXL_ASSERT(DivCeil(output_xsize, 2) == xsize); + // Extra pixel in output might cause the whole extra vector overhead; thus + // we request specific output size. Should be safe, because the last 2 values + // are processed in non-vectorized form, and the "Plane" row padding concerns + // only about the case when unaligned vector store is applied at last pixel. + ImageF dst(output_xsize, ysize); constexpr size_t kGroupArea = kGroupDim * kGroupDim; const size_t lines_per_group = DivCeil(kGroupArea, xsize); const size_t num_stripes = DivCeil(ysize, lines_per_group); @@ -304,12 +300,12 @@ ImageF UpsampleV2(const ImageF& src, ThreadPool* pool) { return HWY_DYNAMIC_DISPATCH(UpsampleV2)(src, pool); } HWY_EXPORT(UpsampleH2); -ImageF UpsampleH2(const ImageF& src, ThreadPool* pool) { - return HWY_DYNAMIC_DISPATCH(UpsampleH2)(src, pool); +ImageF UpsampleH2(const ImageF& src, size_t output_xsize, ThreadPool* pool) { + return HWY_DYNAMIC_DISPATCH(UpsampleH2)(src, output_xsize, pool); } HWY_EXPORT(HasFastXYBTosRGB8); bool HasFastXYBTosRGB8() { return HWY_DYNAMIC_DISPATCH(HasFastXYBTosRGB8)(); } diff --git a/third_party/jpeg-xl/lib/jxl/decode.cc b/third_party/jpeg-xl/lib/jxl/decode.cc --- a/third_party/jpeg-xl/lib/jxl/decode.cc +++ b/third_party/jpeg-xl/lib/jxl/decode.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "jxl/decode.h" #include "lib/jxl/base/byte_order.h" #include "lib/jxl/base/span.h" @@ -293,10 +284,11 @@ std::vector section_info; std::vector section_status; std::vector section_received; }; +// NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding) struct JxlDecoderStruct { JxlDecoderStruct() = default; JxlMemoryManager memory_manager; std::unique_ptr thread_pool; @@ -310,11 +302,13 @@ // guaranteed to be true for the last box because a jxl file may have multiple // "jxlp" boxes and it is possible (and permitted) that the last one is not a // final box that uses size 0 to indicate the end. bool last_codestream_seen; bool got_basic_info; - bool got_all_headers; // Codestream metadata headers + size_t header_except_icc_bits = 0; // To skip everything before ICC. + bool got_all_headers; // Codestream metadata headers + jxl::ICCReader icc_reader; // This means either we actually got the preview image, or determined we // cannot get it or there is none. bool got_preview_image; @@ -449,11 +443,13 @@ dec->stage = DecoderStage::kInited; dec->got_signature = false; dec->first_codestream_seen = false; dec->last_codestream_seen = false; dec->got_basic_info = false; + dec->header_except_icc_bits = 0; dec->got_all_headers = false; + dec->icc_reader.Reset(); dec->got_preview_image = false; dec->last_frame_reached = false; dec->file_pos = 0; dec->codestream_pos = 0; dec->codestream_begin = 0; @@ -654,24 +650,31 @@ return JXL_API_ERROR("invalid signature"); } Span span(in + pos, size - pos); auto reader = GetBitReader(span); - SizeHeader dummy_size_header; - JXL_API_RETURN_IF_ERROR(ReadBundle(span, reader.get(), &dummy_size_header)); + + if (dec->header_except_icc_bits != 0) { + // Headers were decoded already. + reader->SkipBits(dec->header_except_icc_bits); + } else { + SizeHeader dummy_size_header; + JXL_API_RETURN_IF_ERROR(ReadBundle(span, reader.get(), &dummy_size_header)); - // We already decoded the metadata to dec->metadata.m, no reason to - // overwrite it, use a dummy metadata instead. - ImageMetadata dummy_metadata; - JXL_API_RETURN_IF_ERROR(ReadBundle(span, reader.get(), &dummy_metadata)); + // We already decoded the metadata to dec->metadata.m, no reason to + // overwrite it, use a dummy metadata instead. + ImageMetadata dummy_metadata; + JXL_API_RETURN_IF_ERROR(ReadBundle(span, reader.get(), &dummy_metadata)); - JXL_API_RETURN_IF_ERROR( - ReadBundle(span, reader.get(), &dec->metadata.transform_data)); + JXL_API_RETURN_IF_ERROR( + ReadBundle(span, reader.get(), &dec->metadata.transform_data)); + } + + dec->header_except_icc_bits = reader->TotalBitsConsumed(); if (dec->metadata.m.color_encoding.WantICC()) { - PaddedBytes icc; - jxl::Status status = ReadICC(reader.get(), &icc, memory_limit_base_); + jxl::Status status = dec->icc_reader.Init(reader.get(), memory_limit_base_); // Always check AllReadsWithinBounds, not all the C++ decoder implementation // handles reader out of bounds correctly yet (e.g. context map). Not // checking AllReadsWithinBounds can cause reader->Close() to trigger an // assert, but we don't want library to quit program for invalid codestream. if (!reader->AllReadsWithinBounds()) { @@ -682,10 +685,19 @@ return JXL_DEC_NEED_MORE_INPUT; } // Other non-successful status is an error return JXL_DEC_ERROR; } + PaddedBytes icc; + status = dec->icc_reader.Process(reader.get(), &icc); + if (!status) { + if (status.code() == StatusCode::kNotEnoughBytes) { + return JXL_DEC_NEED_MORE_INPUT; + } + // Other non-successful status is an error + return JXL_DEC_ERROR; + } if (!dec->metadata.m.color_encoding.SetICCRaw(std::move(icc))) { return JXL_DEC_ERROR; } } @@ -761,10 +773,13 @@ JxlDecoderStatus ParseFrameHeader(JxlDecoder* dec, jxl::FrameHeader* frame_header, const uint8_t* in, size_t size, size_t pos, bool is_preview, size_t* frame_size, size_t* dc_size) { + if (pos >= size) { + return JXL_DEC_NEED_MORE_INPUT; + } Span span(in + pos, size - pos); auto reader = GetBitReader(span); frame_header->nonserialized_is_preview = is_preview; jxl::Status status = DecodeFrameHeader(reader.get(), frame_header); @@ -981,10 +996,13 @@ } } if (dec->frame_stage == FrameStage::kTOC) { size_t pos = dec->frame_start - dec->codestream_pos; + if (pos >= size) { + return JXL_DEC_NEED_MORE_INPUT; + } Span span(in + pos, size - pos); auto reader = GetBitReader(span); if (!dec->passes_state) { dec->passes_state.reset(new jxl::PassesDecoderState()); @@ -1018,12 +1036,18 @@ dec->sections.reset( new Sections(dec->frame_dec.get(), dec->frame_size, sections_begin)); JXL_API_RETURN_IF_ERROR(dec->sections->Init()); - dec->frame_dec_in_progress = true; - dec->frame_stage = FrameStage::kDC; + // If we don't need pixels, we can skip actually decoding the frames + // (kFull / kDC / kFullOut / kDCOut). By not updating frame_stage, none of + // these stages will execute, and the loop will continue from the next + // frame. + if (dec->events_wanted & (JXL_DEC_DC_IMAGE | JXL_DEC_FULL_IMAGE)) { + dec->frame_dec_in_progress = true; + dec->frame_stage = FrameStage::kDC; + } } if (dec->frame_stage == FrameStage::kDC) { if (!(dec->events_wanted & JXL_DEC_DC_IMAGE)) { dec->frame_stage = FrameStage::kFull; @@ -1075,10 +1099,13 @@ }, is_rgba); } size_t pos = dec->frame_start - dec->codestream_pos; + if (pos >= size) { + return JXL_DEC_NEED_MORE_INPUT; + } bool get_dc = dec->is_last_of_still && (dec->frame_stage == FrameStage::kDC) && dec->dc_size != 0; dec->sections->SetInput(in + pos, size - pos); jxl::Status status = @@ -1936,14 +1963,20 @@ if (dec->frame_dec->HasRGBBuffer()) { return JXL_DEC_SUCCESS; } + // Temporarily shrink `dec->ib` to the actual size of the full image to call + // ConvertImageInternal. + size_t xsize = dec->ib->xsize(); + size_t ysize = dec->ib->ysize(); + dec->ib->ShrinkTo(dec->metadata.size.xsize(), dec->metadata.size.ysize()); JxlDecoderStatus status = jxl::ConvertImageInternal( dec, *dec->ib, dec->image_out_format, dec->image_out_buffer, dec->image_out_size, /*out_callback=*/nullptr, /*out_opaque=*/nullptr); + dec->ib->ShrinkTo(xsize, ysize); if (status != JXL_DEC_SUCCESS) return status; return JXL_DEC_SUCCESS; } JXL_EXPORT JxlDecoderStatus JxlDecoderPreviewOutBufferSize( diff --git a/third_party/jpeg-xl/lib/jxl/decode_test.cc b/third_party/jpeg-xl/lib/jxl/decode_test.cc --- a/third_party/jpeg-xl/lib/jxl/decode_test.cc +++ b/third_party/jpeg-xl/lib/jxl/decode_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "jxl/decode.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/descriptive_statistics_test.cc b/third_party/jpeg-xl/lib/jxl/descriptive_statistics_test.cc --- a/third_party/jpeg-xl/lib/jxl/descriptive_statistics_test.cc +++ b/third_party/jpeg-xl/lib/jxl/descriptive_statistics_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/base/descriptive_statistics.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_ac_strategy.h b/third_party/jpeg-xl/lib/jxl/enc_ac_strategy.h --- a/third_party/jpeg-xl/lib/jxl/enc_ac_strategy.h +++ b/third_party/jpeg-xl/lib/jxl/enc_ac_strategy.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_AC_STRATEGY_H_ #define LIB_JXL_ENC_AC_STRATEGY_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_ac_strategy.cc b/third_party/jpeg-xl/lib/jxl/enc_ac_strategy.cc --- a/third_party/jpeg-xl/lib/jxl/enc_ac_strategy.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_ac_strategy.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_ac_strategy.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_adaptive_quantization.h b/third_party/jpeg-xl/lib/jxl/enc_adaptive_quantization.h --- a/third_party/jpeg-xl/lib/jxl/enc_adaptive_quantization.h +++ b/third_party/jpeg-xl/lib/jxl/enc_adaptive_quantization.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_ADAPTIVE_QUANTIZATION_H_ #define LIB_JXL_ENC_ADAPTIVE_QUANTIZATION_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_adaptive_quantization.cc b/third_party/jpeg-xl/lib/jxl/enc_adaptive_quantization.cc --- a/third_party/jpeg-xl/lib/jxl/enc_adaptive_quantization.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_adaptive_quantization.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_adaptive_quantization.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_ans.h b/third_party/jpeg-xl/lib/jxl/enc_ans.h --- a/third_party/jpeg-xl/lib/jxl/enc_ans.h +++ b/third_party/jpeg-xl/lib/jxl/enc_ans.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_ANS_H_ #define LIB_JXL_ENC_ANS_H_ // Library to encode the ANS population counts to the bit-stream and encode diff --git a/third_party/jpeg-xl/lib/jxl/enc_ans.cc b/third_party/jpeg-xl/lib/jxl/enc_ans.cc --- a/third_party/jpeg-xl/lib/jxl/enc_ans.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_ans.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_ans.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_ans_params.h b/third_party/jpeg-xl/lib/jxl/enc_ans_params.h --- a/third_party/jpeg-xl/lib/jxl/enc_ans_params.h +++ b/third_party/jpeg-xl/lib/jxl/enc_ans_params.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_ANS_PARAMS_H_ #define LIB_JXL_ENC_ANS_PARAMS_H_ // Encoder-only parameter needed for ANS entropy encoding methods. diff --git a/third_party/jpeg-xl/lib/jxl/enc_ar_control_field.h b/third_party/jpeg-xl/lib/jxl/enc_ar_control_field.h --- a/third_party/jpeg-xl/lib/jxl/enc_ar_control_field.h +++ b/third_party/jpeg-xl/lib/jxl/enc_ar_control_field.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_AR_CONTROL_FIELD_H_ #define LIB_JXL_ENC_AR_CONTROL_FIELD_H_ #include "lib/jxl/ac_strategy.h" diff --git a/third_party/jpeg-xl/lib/jxl/enc_ar_control_field.cc b/third_party/jpeg-xl/lib/jxl/enc_ar_control_field.cc --- a/third_party/jpeg-xl/lib/jxl/enc_ar_control_field.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_ar_control_field.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_ar_control_field.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_bit_writer.h b/third_party/jpeg-xl/lib/jxl/enc_bit_writer.h --- a/third_party/jpeg-xl/lib/jxl/enc_bit_writer.h +++ b/third_party/jpeg-xl/lib/jxl/enc_bit_writer.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_BIT_WRITER_H_ #define LIB_JXL_ENC_BIT_WRITER_H_ // BitWriter class: unbuffered writes using unaligned 64-bit stores. diff --git a/third_party/jpeg-xl/lib/jxl/enc_bit_writer.cc b/third_party/jpeg-xl/lib/jxl/enc_bit_writer.cc --- a/third_party/jpeg-xl/lib/jxl/enc_bit_writer.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_bit_writer.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_bit_writer.h" #include // memcpy diff --git a/third_party/jpeg-xl/lib/jxl/enc_butteraugli_comparator.h b/third_party/jpeg-xl/lib/jxl/enc_butteraugli_comparator.h --- a/third_party/jpeg-xl/lib/jxl/enc_butteraugli_comparator.h +++ b/third_party/jpeg-xl/lib/jxl/enc_butteraugli_comparator.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_BUTTERAUGLI_COMPARATOR_H_ #define LIB_JXL_ENC_BUTTERAUGLI_COMPARATOR_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_butteraugli_comparator.cc b/third_party/jpeg-xl/lib/jxl/enc_butteraugli_comparator.cc --- a/third_party/jpeg-xl/lib/jxl/enc_butteraugli_comparator.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_butteraugli_comparator.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_butteraugli_comparator.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_butteraugli_pnorm.h b/third_party/jpeg-xl/lib/jxl/enc_butteraugli_pnorm.h --- a/third_party/jpeg-xl/lib/jxl/enc_butteraugli_pnorm.h +++ b/third_party/jpeg-xl/lib/jxl/enc_butteraugli_pnorm.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_BUTTERAUGLI_PNORM_H_ #define LIB_JXL_ENC_BUTTERAUGLI_PNORM_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_butteraugli_pnorm.cc b/third_party/jpeg-xl/lib/jxl/enc_butteraugli_pnorm.cc --- a/third_party/jpeg-xl/lib/jxl/enc_butteraugli_pnorm.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_butteraugli_pnorm.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_butteraugli_pnorm.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_cache.h b/third_party/jpeg-xl/lib/jxl/enc_cache.h --- a/third_party/jpeg-xl/lib/jxl/enc_cache.h +++ b/third_party/jpeg-xl/lib/jxl/enc_cache.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_CACHE_H_ #define LIB_JXL_ENC_CACHE_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_cache.cc b/third_party/jpeg-xl/lib/jxl/enc_cache.cc --- a/third_party/jpeg-xl/lib/jxl/enc_cache.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_cache.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_cache.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_chroma_from_luma.h b/third_party/jpeg-xl/lib/jxl/enc_chroma_from_luma.h --- a/third_party/jpeg-xl/lib/jxl/enc_chroma_from_luma.h +++ b/third_party/jpeg-xl/lib/jxl/enc_chroma_from_luma.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_CHROMA_FROM_LUMA_H_ #define LIB_JXL_ENC_CHROMA_FROM_LUMA_H_ // Chroma-from-luma, computed using heuristics to determine the best linear diff --git a/third_party/jpeg-xl/lib/jxl/enc_chroma_from_luma.cc b/third_party/jpeg-xl/lib/jxl/enc_chroma_from_luma.cc --- a/third_party/jpeg-xl/lib/jxl/enc_chroma_from_luma.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_chroma_from_luma.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_chroma_from_luma.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_cluster.h b/third_party/jpeg-xl/lib/jxl/enc_cluster.h --- a/third_party/jpeg-xl/lib/jxl/enc_cluster.h +++ b/third_party/jpeg-xl/lib/jxl/enc_cluster.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // Functions for clustering similar histograms together. #ifndef LIB_JXL_ENC_CLUSTER_H_ #define LIB_JXL_ENC_CLUSTER_H_ diff --git a/third_party/jpeg-xl/lib/jxl/enc_cluster.cc b/third_party/jpeg-xl/lib/jxl/enc_cluster.cc --- a/third_party/jpeg-xl/lib/jxl/enc_cluster.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_cluster.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_cluster.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_coeff_order.h b/third_party/jpeg-xl/lib/jxl/enc_coeff_order.h --- a/third_party/jpeg-xl/lib/jxl/enc_coeff_order.h +++ b/third_party/jpeg-xl/lib/jxl/enc_coeff_order.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_COEFF_ORDER_H_ #define LIB_JXL_ENC_COEFF_ORDER_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_coeff_order.cc b/third_party/jpeg-xl/lib/jxl/enc_coeff_order.cc --- a/third_party/jpeg-xl/lib/jxl/enc_coeff_order.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_coeff_order.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include #include #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_color_management.h b/third_party/jpeg-xl/lib/jxl/enc_color_management.h --- a/third_party/jpeg-xl/lib/jxl/enc_color_management.h +++ b/third_party/jpeg-xl/lib/jxl/enc_color_management.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_COLOR_MANAGEMENT_H_ #define LIB_JXL_ENC_COLOR_MANAGEMENT_H_ // ICC profiles and color space conversions. diff --git a/third_party/jpeg-xl/lib/jxl/enc_color_management.cc b/third_party/jpeg-xl/lib/jxl/enc_color_management.cc --- a/third_party/jpeg-xl/lib/jxl/enc_color_management.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_color_management.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // Defined by build system; this avoids IDE warnings. Must come before // color_management.h (affects header definitions). #ifndef JPEGXL_ENABLE_SKCMS #define JPEGXL_ENABLE_SKCMS 0 diff --git a/third_party/jpeg-xl/lib/jxl/enc_comparator.h b/third_party/jpeg-xl/lib/jxl/enc_comparator.h --- a/third_party/jpeg-xl/lib/jxl/enc_comparator.h +++ b/third_party/jpeg-xl/lib/jxl/enc_comparator.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_COMPARATOR_H_ #define LIB_JXL_ENC_COMPARATOR_H_ #include "lib/jxl/base/data_parallel.h" diff --git a/third_party/jpeg-xl/lib/jxl/enc_comparator.cc b/third_party/jpeg-xl/lib/jxl/enc_comparator.cc --- a/third_party/jpeg-xl/lib/jxl/enc_comparator.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_comparator.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_comparator.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_context_map.h b/third_party/jpeg-xl/lib/jxl/enc_context_map.h --- a/third_party/jpeg-xl/lib/jxl/enc_context_map.h +++ b/third_party/jpeg-xl/lib/jxl/enc_context_map.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_CONTEXT_MAP_H_ #define LIB_JXL_ENC_CONTEXT_MAP_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_context_map.cc b/third_party/jpeg-xl/lib/jxl/enc_context_map.cc --- a/third_party/jpeg-xl/lib/jxl/enc_context_map.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_context_map.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // Library to encode the context map. #include "lib/jxl/enc_context_map.h" diff --git a/third_party/jpeg-xl/lib/jxl/enc_detect_dots.h b/third_party/jpeg-xl/lib/jxl/enc_detect_dots.h --- a/third_party/jpeg-xl/lib/jxl/enc_detect_dots.h +++ b/third_party/jpeg-xl/lib/jxl/enc_detect_dots.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // We attempt to remove dots, or speckle from images using Gaussian blur. #ifndef LIB_JXL_ENC_DETECT_DOTS_H_ #define LIB_JXL_ENC_DETECT_DOTS_H_ diff --git a/third_party/jpeg-xl/lib/jxl/enc_detect_dots.cc b/third_party/jpeg-xl/lib/jxl/enc_detect_dots.cc --- a/third_party/jpeg-xl/lib/jxl/enc_detect_dots.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_detect_dots.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_detect_dots.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_dot_dictionary.h b/third_party/jpeg-xl/lib/jxl/enc_dot_dictionary.h --- a/third_party/jpeg-xl/lib/jxl/enc_dot_dictionary.h +++ b/third_party/jpeg-xl/lib/jxl/enc_dot_dictionary.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_DOT_DICTIONARY_H_ #define LIB_JXL_ENC_DOT_DICTIONARY_H_ // Dots are stored in a dictionary to avoid storing similar dots multiple diff --git a/third_party/jpeg-xl/lib/jxl/enc_dot_dictionary.cc b/third_party/jpeg-xl/lib/jxl/enc_dot_dictionary.cc --- a/third_party/jpeg-xl/lib/jxl/enc_dot_dictionary.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_dot_dictionary.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_dot_dictionary.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_entropy_coder.h b/third_party/jpeg-xl/lib/jxl/enc_entropy_coder.h --- a/third_party/jpeg-xl/lib/jxl/enc_entropy_coder.h +++ b/third_party/jpeg-xl/lib/jxl/enc_entropy_coder.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_ENTROPY_CODER_H_ #define LIB_JXL_ENC_ENTROPY_CODER_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_entropy_coder.cc b/third_party/jpeg-xl/lib/jxl/enc_entropy_coder.cc --- a/third_party/jpeg-xl/lib/jxl/enc_entropy_coder.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_entropy_coder.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_entropy_coder.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_external_image.h b/third_party/jpeg-xl/lib/jxl/enc_external_image.h --- a/third_party/jpeg-xl/lib/jxl/enc_external_image.h +++ b/third_party/jpeg-xl/lib/jxl/enc_external_image.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_EXTERNAL_IMAGE_H_ #define LIB_JXL_ENC_EXTERNAL_IMAGE_H_ // Interleaved image for color transforms and Codec. diff --git a/third_party/jpeg-xl/lib/jxl/enc_external_image.cc b/third_party/jpeg-xl/lib/jxl/enc_external_image.cc --- a/third_party/jpeg-xl/lib/jxl/enc_external_image.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_external_image.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_external_image.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_external_image_gbench.cc b/third_party/jpeg-xl/lib/jxl/enc_external_image_gbench.cc --- a/third_party/jpeg-xl/lib/jxl/enc_external_image_gbench.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_external_image_gbench.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "benchmark/benchmark.h" #include "lib/jxl/enc_external_image.h" #include "lib/jxl/image_ops.h" diff --git a/third_party/jpeg-xl/lib/jxl/enc_external_image_test.cc b/third_party/jpeg-xl/lib/jxl/enc_external_image_test.cc --- a/third_party/jpeg-xl/lib/jxl/enc_external_image_test.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_external_image_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_external_image.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_fast_heuristics.cc b/third_party/jpeg-xl/lib/jxl/enc_fast_heuristics.cc --- a/third_party/jpeg-xl/lib/jxl/enc_fast_heuristics.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_fast_heuristics.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include #include #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_file.h b/third_party/jpeg-xl/lib/jxl/enc_file.h --- a/third_party/jpeg-xl/lib/jxl/enc_file.h +++ b/third_party/jpeg-xl/lib/jxl/enc_file.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_FILE_H_ #define LIB_JXL_ENC_FILE_H_ // Facade for JXL encoding. diff --git a/third_party/jpeg-xl/lib/jxl/enc_file.cc b/third_party/jpeg-xl/lib/jxl/enc_file.cc --- a/third_party/jpeg-xl/lib/jxl/enc_file.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_file.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_file.h" #include @@ -122,12 +113,14 @@ Status PrepareCodecMetadataFromIO(const CompressParams& cparams, const CodecInOut* io, CodecMetadata* metadata) { *metadata = io->metadata; + size_t ups = 1; + if (cparams.already_downsampled) ups = cparams.resampling; - JXL_RETURN_IF_ERROR(metadata->size.Set(io->xsize(), io->ysize())); + JXL_RETURN_IF_ERROR(metadata->size.Set(io->xsize() * ups, io->ysize() * ups)); // Keep ICC profile in lossless modes because a reconstructed profile may be // slightly different (quantization). // Also keep ICC in JPEG reconstruction mode as we need byte-exact profiles. const bool lossless_modular = diff --git a/third_party/jpeg-xl/lib/jxl/enc_frame.h b/third_party/jpeg-xl/lib/jxl/enc_frame.h --- a/third_party/jpeg-xl/lib/jxl/enc_frame.h +++ b/third_party/jpeg-xl/lib/jxl/enc_frame.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_FRAME_H_ #define LIB_JXL_ENC_FRAME_H_ #include "lib/jxl/aux_out.h" diff --git a/third_party/jpeg-xl/lib/jxl/enc_frame.cc b/third_party/jpeg-xl/lib/jxl/enc_frame.cc --- a/third_party/jpeg-xl/lib/jxl/enc_frame.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_frame.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_frame.h" #include #include @@ -338,15 +329,17 @@ return JXL_FAILURE("Invalid ec_resampling factor"); } // Resized frames. if (frame_info.frame_type != FrameType::kDCFrame) { frame_header->frame_origin = ib.origin; - frame_header->frame_size.xsize = ib.xsize(); - frame_header->frame_size.ysize = ib.ysize(); + size_t ups = 1; + if (cparams.already_downsampled) ups = cparams.resampling; + frame_header->frame_size.xsize = ib.xsize() * ups; + frame_header->frame_size.ysize = ib.ysize() * ups; if (ib.origin.x0 != 0 || ib.origin.y0 != 0 || - ib.xsize() != frame_header->default_xsize() || - ib.ysize() != frame_header->default_ysize()) { + frame_header->frame_size.xsize != frame_header->default_xsize() || + frame_header->frame_size.ysize != frame_header->default_ysize()) { frame_header->custom_size_or_origin = true; } } // Upsampling. frame_header->upsampling = cparams.resampling; @@ -371,16 +364,16 @@ } } } frame_header->blending_info.alpha_channel = index; frame_header->blending_info.mode = - ib.blend ? BlendMode::kBlend : BlendMode::kReplace; + ib.blend ? ib.blendmode : BlendMode::kReplace; // previous frames are saved with ID 1. frame_header->blending_info.source = 1; for (size_t i = 0; i < extra_channels.size(); i++) { frame_header->extra_channel_blending_info[i].alpha_channel = index; - BlendMode default_blend = BlendMode::kBlend; + BlendMode default_blend = ib.blendmode; if (extra_channels[i].type != ExtraChannel::kBlack && i != index) { // K needs to be blended, spot colors and other stuff gets added default_blend = BlendMode::kAdd; } frame_header->extra_channel_blending_info[i].mode = @@ -1014,10 +1007,12 @@ const FrameInfo& frame_info, const CodecMetadata* metadata, const ImageBundle& ib, PassesEncoderState* passes_enc_state, ThreadPool* pool, BitWriter* writer, AuxOut* aux_out) { ib.VerifyMetadata(); + passes_enc_state->special_frames.clear(); + CompressParams cparams = cparams_orig; if (cparams.progressive_dc < 0) { if (cparams.progressive_dc != -1) { return JXL_FAILURE("Invalid progressive DC setting value (%d)", cparams.progressive_dc); @@ -1053,13 +1048,11 @@ cparams.gaborish = Override::kOff; cparams.epf = 0; cparams.modular_mode = false; } - const size_t xsize = ib.xsize(); - const size_t ysize = ib.ysize(); - if (xsize == 0 || ysize == 0) return JXL_FAILURE("Empty image"); + if (ib.xsize() == 0 || ib.ysize() == 0) return JXL_FAILURE("Empty image"); // Assert that this metadata is correctly set up for the compression params, // this should have been done by enc_file.cc JXL_ASSERT(metadata->m.xyb_encoded == (cparams.color_transform == ColorTransform::kXYB)); @@ -1182,21 +1175,21 @@ if (frame_header->encoding == FrameEncoding::kVarDCT) { PadImageToBlockMultipleInPlace(&opsin); JXL_RETURN_IF_ERROR(lossy_frame_encoder.ComputeEncodingData( ib_or_linear, &opsin, pool, modular_frame_encoder.get(), writer, frame_header.get())); - } else if (frame_header->upsampling != 1) { + } else if (frame_header->upsampling != 1 && !cparams.already_downsampled) { // In VarDCT mode, LossyFrameHeuristics takes care of running downsampling // after noise, if necessary. DownsampleImage(&opsin, frame_header->upsampling); } } else { JXL_RETURN_IF_ERROR(lossy_frame_encoder.ComputeEncodingData( &ib, &opsin, pool, modular_frame_encoder.get(), writer, frame_header.get())); } - if (cparams.ec_resampling != 1) { + if (cparams.ec_resampling != 1 && !cparams.already_downsampled) { extra_channels = &extra_channels_storage; for (size_t i = 0; i < ib.extra_channels().size(); i++) { extra_channels_storage.emplace_back(CopyImage(ib.extra_channels()[i])); DownsampleImage(&extra_channels_storage.back(), cparams.ec_resampling); } diff --git a/third_party/jpeg-xl/lib/jxl/enc_gamma_correct.h b/third_party/jpeg-xl/lib/jxl/enc_gamma_correct.h --- a/third_party/jpeg-xl/lib/jxl/enc_gamma_correct.h +++ b/third_party/jpeg-xl/lib/jxl/enc_gamma_correct.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_GAMMA_CORRECT_H_ #define LIB_JXL_ENC_GAMMA_CORRECT_H_ // Deprecated: sRGB transfer function. Use color_management.h instead. diff --git a/third_party/jpeg-xl/lib/jxl/enc_group.h b/third_party/jpeg-xl/lib/jxl/enc_group.h --- a/third_party/jpeg-xl/lib/jxl/enc_group.h +++ b/third_party/jpeg-xl/lib/jxl/enc_group.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_GROUP_H_ #define LIB_JXL_ENC_GROUP_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_group.cc b/third_party/jpeg-xl/lib/jxl/enc_group.cc --- a/third_party/jpeg-xl/lib/jxl/enc_group.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_group.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_group.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_heuristics.h b/third_party/jpeg-xl/lib/jxl/enc_heuristics.h --- a/third_party/jpeg-xl/lib/jxl/enc_heuristics.h +++ b/third_party/jpeg-xl/lib/jxl/enc_heuristics.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_HEURISTICS_H_ #define LIB_JXL_ENC_HEURISTICS_H_ // Hook for custom encoder heuristics (VarDCT only for now). diff --git a/third_party/jpeg-xl/lib/jxl/enc_heuristics.cc b/third_party/jpeg-xl/lib/jxl/enc_heuristics.cc --- a/third_party/jpeg-xl/lib/jxl/enc_heuristics.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_heuristics.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_heuristics.h" #include #include @@ -250,11 +241,11 @@ if (!GetNoiseParameter(*opsin, &shared.image_features.noise_params, quality_coef)) { shared.frame_header.flags &= ~FrameHeader::kNoise; } } - if (enc_state->shared.frame_header.upsampling != 1) { + if (enc_state->shared.frame_header.upsampling != 1 && !cparams.already_downsampled) { // In VarDCT mode, LossyFrameHeuristics takes care of running downsampling // after noise, if necessary. DownsampleImage(opsin, cparams.resampling); PadImageToBlockMultipleInPlace(opsin); } diff --git a/third_party/jpeg-xl/lib/jxl/enc_huffman.h b/third_party/jpeg-xl/lib/jxl/enc_huffman.h --- a/third_party/jpeg-xl/lib/jxl/enc_huffman.h +++ b/third_party/jpeg-xl/lib/jxl/enc_huffman.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_HUFFMAN_H_ #define LIB_JXL_ENC_HUFFMAN_H_ #include "lib/jxl/enc_bit_writer.h" diff --git a/third_party/jpeg-xl/lib/jxl/enc_huffman.cc b/third_party/jpeg-xl/lib/jxl/enc_huffman.cc --- a/third_party/jpeg-xl/lib/jxl/enc_huffman.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_huffman.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_huffman.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_icc_codec.h b/third_party/jpeg-xl/lib/jxl/enc_icc_codec.h --- a/third_party/jpeg-xl/lib/jxl/enc_icc_codec.h +++ b/third_party/jpeg-xl/lib/jxl/enc_icc_codec.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_ICC_CODEC_H_ #define LIB_JXL_ENC_ICC_CODEC_H_ // Compressed representation of ICC profiles. diff --git a/third_party/jpeg-xl/lib/jxl/enc_icc_codec.cc b/third_party/jpeg-xl/lib/jxl/enc_icc_codec.cc --- a/third_party/jpeg-xl/lib/jxl/enc_icc_codec.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_icc_codec.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_icc_codec.h" #include @@ -423,11 +414,12 @@ tokens[0].emplace_back( ICCANSContext(i, i > 0 ? enc[i - 1] : 0, i > 1 ? enc[i - 2] : 0), enc[i]); } HistogramParams params; - params.lz77_method = HistogramParams::LZ77Method::kOptimal; + params.lz77_method = enc.size() < 4096 ? HistogramParams::LZ77Method::kOptimal + : HistogramParams::LZ77Method::kLZ77; EntropyEncodingData code; std::vector context_map; params.force_huffman = true; BuildAndEncodeHistograms(params, kNumICCContexts, tokens, &code, &context_map, writer, layer, aux_out); diff --git a/third_party/jpeg-xl/lib/jxl/enc_image_bundle.h b/third_party/jpeg-xl/lib/jxl/enc_image_bundle.h --- a/third_party/jpeg-xl/lib/jxl/enc_image_bundle.h +++ b/third_party/jpeg-xl/lib/jxl/enc_image_bundle.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_IMAGE_BUNDLE_H_ #define LIB_JXL_ENC_IMAGE_BUNDLE_H_ #include "lib/jxl/image_bundle.h" diff --git a/third_party/jpeg-xl/lib/jxl/enc_image_bundle.cc b/third_party/jpeg-xl/lib/jxl/enc_image_bundle.cc --- a/third_party/jpeg-xl/lib/jxl/enc_image_bundle.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_image_bundle.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_image_bundle.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_modular.h b/third_party/jpeg-xl/lib/jxl/enc_modular.h --- a/third_party/jpeg-xl/lib/jxl/enc_modular.h +++ b/third_party/jpeg-xl/lib/jxl/enc_modular.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_MODULAR_H_ #define LIB_JXL_ENC_MODULAR_H_ #include "lib/jxl/aux_out.h" diff --git a/third_party/jpeg-xl/lib/jxl/enc_modular.cc b/third_party/jpeg-xl/lib/jxl/enc_modular.cc --- a/third_party/jpeg-xl/lib/jxl/enc_modular.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_modular.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_modular.h" #include #include @@ -300,10 +291,35 @@ ModularFrameEncoder::ModularFrameEncoder(const FrameHeader& frame_header, const CompressParams& cparams_orig) : frame_dim(frame_header.ToFrameDimensions()), cparams(cparams_orig) { size_t num_streams = ModularStreamId::Num(frame_dim, frame_header.passes.num_passes); + if (cparams.modular_mode && + cparams.quality_pair == std::pair{100.0, 100.0}) { + switch (cparams.decoding_speed_tier) { + case 0: + break; + case 1: + cparams.options.wp_tree_mode = ModularOptions::TreeMode::kWPOnly; + break; + case 2: { + cparams.options.wp_tree_mode = ModularOptions::TreeMode::kGradientOnly; + cparams.options.predictor = Predictor::Gradient; + break; + } + case 3: { // LZ77, no Gradient. + cparams.options.nb_repeats = 0; + cparams.options.predictor = Predictor::Gradient; + break; + } + default: { // LZ77, no predictor. + cparams.options.nb_repeats = 0; + cparams.options.predictor = Predictor::Zero; + break; + } + } + } stream_images.resize(num_streams); if (cquality > 100) cquality = quality; // use a sensible default if nothing explicit is specified: // Squeeze for lossy, no squeeze for lossless @@ -1024,11 +1040,15 @@ HistogramParams params; if (cparams.speed_tier > SpeedTier::kKitten) { params.clustering = HistogramParams::ClusteringType::kFast; params.ans_histogram_strategy = HistogramParams::ANSHistogramStrategy::kApproximate; - params.lz77_method = HistogramParams::LZ77Method::kNone; + params.lz77_method = cparams.decoding_speed_tier >= 3 + ? (cparams.speed_tier == SpeedTier::kFalcon + ? HistogramParams::LZ77Method::kRLE + : HistogramParams::LZ77Method::kLZ77) + : HistogramParams::LZ77Method::kNone; // Near-lossless DC, as well as modular mode, require choosing hybrid uint // more carefully. if ((!extra_dc_precision.empty() && extra_dc_precision[0] != 0) || (cparams.modular_mode && cparams.speed_tier < SpeedTier::kCheetah)) { params.uint_method = HistogramParams::HybridUintMethod::kFast; @@ -1413,11 +1433,11 @@ float mul = 1 << extra_dc_precision[group_index]; size_t stream_id = ModularStreamId::VarDCTDC(group_index).ID(frame_dim); stream_options[stream_id].max_chan_size = 0xFFFFFF; stream_options[stream_id].predictor = Predictor::Weighted; - stream_options[stream_id].wp_tree_mode = ModularOptions::WPTreeMode::kWPOnly; + stream_options[stream_id].wp_tree_mode = ModularOptions::TreeMode::kWPOnly; if (cparams.speed_tier >= SpeedTier::kSquirrel) { stream_options[stream_id].tree_kind = ModularOptions::TreeKind::kWPFixedDC; } if (cparams.decoding_speed_tier >= 1) { stream_options[stream_id].tree_kind = @@ -1548,11 +1568,11 @@ void ModularFrameEncoder::AddACMetadata(size_t group_index, bool jpeg_transcode, PassesEncoderState* enc_state) { const Rect r = enc_state->shared.DCGroupRect(group_index); size_t stream_id = ModularStreamId::ACMetadata(group_index).ID(frame_dim); stream_options[stream_id].max_chan_size = 0xFFFFFF; - stream_options[stream_id].wp_tree_mode = ModularOptions::WPTreeMode::kNoWP; + stream_options[stream_id].wp_tree_mode = ModularOptions::TreeMode::kNoWP; if (jpeg_transcode) { stream_options[stream_id].tree_kind = ModularOptions::TreeKind::kJpegTranscodeACMeta; } else if (cparams.speed_tier == SpeedTier::kFalcon) { stream_options[stream_id].tree_kind = diff --git a/third_party/jpeg-xl/lib/jxl/enc_noise.h b/third_party/jpeg-xl/lib/jxl/enc_noise.h --- a/third_party/jpeg-xl/lib/jxl/enc_noise.h +++ b/third_party/jpeg-xl/lib/jxl/enc_noise.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_NOISE_H_ #define LIB_JXL_ENC_NOISE_H_ // Noise parameter estimation. diff --git a/third_party/jpeg-xl/lib/jxl/enc_noise.cc b/third_party/jpeg-xl/lib/jxl/enc_noise.cc --- a/third_party/jpeg-xl/lib/jxl/enc_noise.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_noise.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_noise.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_params.h b/third_party/jpeg-xl/lib/jxl/enc_params.h --- a/third_party/jpeg-xl/lib/jxl/enc_params.h +++ b/third_party/jpeg-xl/lib/jxl/enc_params.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_PARAMS_H_ #define LIB_JXL_ENC_PARAMS_H_ // Parameters and flags that govern JXL compression. @@ -231,10 +222,12 @@ bool use_new_heuristics = false; // Down/upsample the image before encoding / after decoding by this factor. size_t resampling = 1; size_t ec_resampling = 1; + // Skip the downsampling before encoding if this is true. + bool already_downsampled = false; }; static constexpr float kMinButteraugliForDynamicAR = 0.5f; static constexpr float kMinButteraugliForDots = 3.0f; static constexpr float kMinButteraugliToSubtractOriginalPatches = 3.0f; diff --git a/third_party/jpeg-xl/lib/jxl/enc_patch_dictionary.h b/third_party/jpeg-xl/lib/jxl/enc_patch_dictionary.h --- a/third_party/jpeg-xl/lib/jxl/enc_patch_dictionary.h +++ b/third_party/jpeg-xl/lib/jxl/enc_patch_dictionary.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_PATCH_DICTIONARY_H_ #define LIB_JXL_ENC_PATCH_DICTIONARY_H_ // Chooses reference patches, and avoids encoding them once per occurrence. diff --git a/third_party/jpeg-xl/lib/jxl/enc_patch_dictionary.cc b/third_party/jpeg-xl/lib/jxl/enc_patch_dictionary.cc --- a/third_party/jpeg-xl/lib/jxl/enc_patch_dictionary.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_patch_dictionary.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_patch_dictionary.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_quant_weights.h b/third_party/jpeg-xl/lib/jxl/enc_quant_weights.h --- a/third_party/jpeg-xl/lib/jxl/enc_quant_weights.h +++ b/third_party/jpeg-xl/lib/jxl/enc_quant_weights.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_QUANT_WEIGHTS_H_ #define LIB_JXL_ENC_QUANT_WEIGHTS_H_ #include "lib/jxl/quant_weights.h" diff --git a/third_party/jpeg-xl/lib/jxl/enc_quant_weights.cc b/third_party/jpeg-xl/lib/jxl/enc_quant_weights.cc --- a/third_party/jpeg-xl/lib/jxl/enc_quant_weights.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_quant_weights.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_quant_weights.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_splines.h b/third_party/jpeg-xl/lib/jxl/enc_splines.h --- a/third_party/jpeg-xl/lib/jxl/enc_splines.h +++ b/third_party/jpeg-xl/lib/jxl/enc_splines.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_SPLINES_H_ #define LIB_JXL_ENC_SPLINES_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_splines.cc b/third_party/jpeg-xl/lib/jxl/enc_splines.cc --- a/third_party/jpeg-xl/lib/jxl/enc_splines.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_splines.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include #include "lib/jxl/ans_params.h" #include "lib/jxl/base/status.h" diff --git a/third_party/jpeg-xl/lib/jxl/enc_toc.h b/third_party/jpeg-xl/lib/jxl/enc_toc.h --- a/third_party/jpeg-xl/lib/jxl/enc_toc.h +++ b/third_party/jpeg-xl/lib/jxl/enc_toc.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_TOC_H_ #define LIB_JXL_ENC_TOC_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_toc.cc b/third_party/jpeg-xl/lib/jxl/enc_toc.cc --- a/third_party/jpeg-xl/lib/jxl/enc_toc.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_toc.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_toc.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/enc_transforms-inl.h b/third_party/jpeg-xl/lib/jxl/enc_transforms-inl.h --- a/third_party/jpeg-xl/lib/jxl/enc_transforms-inl.h +++ b/third_party/jpeg-xl/lib/jxl/enc_transforms-inl.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #if defined(LIB_JXL_ENC_TRANSFORMS_INL_H_) == defined(HWY_TARGET_TOGGLE) #ifdef LIB_JXL_ENC_TRANSFORMS_INL_H_ #undef LIB_JXL_ENC_TRANSFORMS_INL_H_ #else diff --git a/third_party/jpeg-xl/lib/jxl/enc_transforms.h b/third_party/jpeg-xl/lib/jxl/enc_transforms.h --- a/third_party/jpeg-xl/lib/jxl/enc_transforms.h +++ b/third_party/jpeg-xl/lib/jxl/enc_transforms.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_TRANSFORMS_H_ #define LIB_JXL_ENC_TRANSFORMS_H_ // Facade for (non-inlined) integral transforms. diff --git a/third_party/jpeg-xl/lib/jxl/enc_transforms.cc b/third_party/jpeg-xl/lib/jxl/enc_transforms.cc --- a/third_party/jpeg-xl/lib/jxl/enc_transforms.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_transforms.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_transforms.h" #undef HWY_TARGET_INCLUDE #define HWY_TARGET_INCLUDE "lib/jxl/enc_transforms.cc" diff --git a/third_party/jpeg-xl/lib/jxl/enc_xyb.h b/third_party/jpeg-xl/lib/jxl/enc_xyb.h --- a/third_party/jpeg-xl/lib/jxl/enc_xyb.h +++ b/third_party/jpeg-xl/lib/jxl/enc_xyb.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENC_XYB_H_ #define LIB_JXL_ENC_XYB_H_ // Converts to XYB color space. diff --git a/third_party/jpeg-xl/lib/jxl/enc_xyb.cc b/third_party/jpeg-xl/lib/jxl/enc_xyb.cc --- a/third_party/jpeg-xl/lib/jxl/enc_xyb.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_xyb.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/enc_xyb.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/encode.cc b/third_party/jpeg-xl/lib/jxl/encode.cc --- a/third_party/jpeg-xl/lib/jxl/encode.cc +++ b/third_party/jpeg-xl/lib/jxl/encode.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "jxl/encode.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/encode_internal.h b/third_party/jpeg-xl/lib/jxl/encode_internal.h --- a/third_party/jpeg-xl/lib/jxl/encode_internal.h +++ b/third_party/jpeg-xl/lib/jxl/encode_internal.h @@ -1,18 +1,9 @@ -/* Copyright (c) the JPEG XL Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/* Copyright (c) the JPEG XL Project Authors. All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. */ #ifndef LIB_JXL_ENCODE_INTERNAL_H_ #define LIB_JXL_ENCODE_INTERNAL_H_ diff --git a/third_party/jpeg-xl/lib/jxl/encode_test.cc b/third_party/jpeg-xl/lib/jxl/encode_test.cc --- a/third_party/jpeg-xl/lib/jxl/encode_test.cc +++ b/third_party/jpeg-xl/lib/jxl/encode_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "jxl/encode.h" #include "gtest/gtest.h" #include "jxl/encode_cxx.h" diff --git a/third_party/jpeg-xl/lib/jxl/entropy_coder.h b/third_party/jpeg-xl/lib/jxl/entropy_coder.h --- a/third_party/jpeg-xl/lib/jxl/entropy_coder.h +++ b/third_party/jpeg-xl/lib/jxl/entropy_coder.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ENTROPY_CODER_H_ #define LIB_JXL_ENTROPY_CODER_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/entropy_coder.cc b/third_party/jpeg-xl/lib/jxl/entropy_coder.cc --- a/third_party/jpeg-xl/lib/jxl/entropy_coder.cc +++ b/third_party/jpeg-xl/lib/jxl/entropy_coder.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/entropy_coder.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/entropy_coder_test.cc b/third_party/jpeg-xl/lib/jxl/entropy_coder_test.cc --- a/third_party/jpeg-xl/lib/jxl/entropy_coder_test.cc +++ b/third_party/jpeg-xl/lib/jxl/entropy_coder_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // TODO(deymo): Move these tests to dec_ans.h and common.h #include diff --git a/third_party/jpeg-xl/lib/jxl/epf.h b/third_party/jpeg-xl/lib/jxl/epf.h --- a/third_party/jpeg-xl/lib/jxl/epf.h +++ b/third_party/jpeg-xl/lib/jxl/epf.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_EPF_H_ #define LIB_JXL_EPF_H_ // Fast SIMD "in-loop" edge preserving filter (adaptive, nonlinear). diff --git a/third_party/jpeg-xl/lib/jxl/epf.cc b/third_party/jpeg-xl/lib/jxl/epf.cc --- a/third_party/jpeg-xl/lib/jxl/epf.cc +++ b/third_party/jpeg-xl/lib/jxl/epf.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // Edge-preserving smoothing: weighted average based on L1 patch similarity. #include "lib/jxl/epf.h" diff --git a/third_party/jpeg-xl/lib/jxl/fast_math-inl.h b/third_party/jpeg-xl/lib/jxl/fast_math-inl.h --- a/third_party/jpeg-xl/lib/jxl/fast_math-inl.h +++ b/third_party/jpeg-xl/lib/jxl/fast_math-inl.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // Fast SIMD math ops (log2, encoder only, cos, erf for splines) #if defined(LIB_JXL_FAST_MATH_INL_H_) == defined(HWY_TARGET_TOGGLE) #ifdef LIB_JXL_FAST_MATH_INL_H_ diff --git a/third_party/jpeg-xl/lib/jxl/fast_math_test.cc b/third_party/jpeg-xl/lib/jxl/fast_math_test.cc --- a/third_party/jpeg-xl/lib/jxl/fast_math_test.cc +++ b/third_party/jpeg-xl/lib/jxl/fast_math_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include #include diff --git a/third_party/jpeg-xl/lib/jxl/field_encodings.h b/third_party/jpeg-xl/lib/jxl/field_encodings.h --- a/third_party/jpeg-xl/lib/jxl/field_encodings.h +++ b/third_party/jpeg-xl/lib/jxl/field_encodings.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_FIELD_ENCODINGS_H_ #define LIB_JXL_FIELD_ENCODINGS_H_ // Constants needed to encode/decode fields; avoids including the full fields.h. diff --git a/third_party/jpeg-xl/lib/jxl/fields.h b/third_party/jpeg-xl/lib/jxl/fields.h --- a/third_party/jpeg-xl/lib/jxl/fields.h +++ b/third_party/jpeg-xl/lib/jxl/fields.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_FIELDS_H_ #define LIB_JXL_FIELDS_H_ // Forward/backward-compatible 'bundles' with auto-serialized 'fields'. diff --git a/third_party/jpeg-xl/lib/jxl/fields.cc b/third_party/jpeg-xl/lib/jxl/fields.cc --- a/third_party/jpeg-xl/lib/jxl/fields.cc +++ b/third_party/jpeg-xl/lib/jxl/fields.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/fields.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/fields_test.cc b/third_party/jpeg-xl/lib/jxl/fields_test.cc --- a/third_party/jpeg-xl/lib/jxl/fields_test.cc +++ b/third_party/jpeg-xl/lib/jxl/fields_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/fields.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/filters.h b/third_party/jpeg-xl/lib/jxl/filters.h --- a/third_party/jpeg-xl/lib/jxl/filters.h +++ b/third_party/jpeg-xl/lib/jxl/filters.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_FILTERS_H_ #define LIB_JXL_FILTERS_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/filters.cc b/third_party/jpeg-xl/lib/jxl/filters.cc --- a/third_party/jpeg-xl/lib/jxl/filters.cc +++ b/third_party/jpeg-xl/lib/jxl/filters.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/filters.h" #include "lib/jxl/base/profiler.h" diff --git a/third_party/jpeg-xl/lib/jxl/filters_internal.h b/third_party/jpeg-xl/lib/jxl/filters_internal.h --- a/third_party/jpeg-xl/lib/jxl/filters_internal.h +++ b/third_party/jpeg-xl/lib/jxl/filters_internal.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_FILTERS_INTERNAL_H_ #define LIB_JXL_FILTERS_INTERNAL_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/filters_internal_test.cc b/third_party/jpeg-xl/lib/jxl/filters_internal_test.cc --- a/third_party/jpeg-xl/lib/jxl/filters_internal_test.cc +++ b/third_party/jpeg-xl/lib/jxl/filters_internal_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/filters_internal.h" #include "gtest/gtest.h" diff --git a/third_party/jpeg-xl/lib/jxl/frame_header.h b/third_party/jpeg-xl/lib/jxl/frame_header.h --- a/third_party/jpeg-xl/lib/jxl/frame_header.h +++ b/third_party/jpeg-xl/lib/jxl/frame_header.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_FRAME_HEADER_H_ #define LIB_JXL_FRAME_HEADER_H_ // Frame header with backward and forward-compatible extension capability and diff --git a/third_party/jpeg-xl/lib/jxl/frame_header.cc b/third_party/jpeg-xl/lib/jxl/frame_header.cc --- a/third_party/jpeg-xl/lib/jxl/frame_header.cc +++ b/third_party/jpeg-xl/lib/jxl/frame_header.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/frame_header.h" #include "lib/jxl/aux_out.h" #include "lib/jxl/base/status.h" diff --git a/third_party/jpeg-xl/lib/jxl/gaborish.h b/third_party/jpeg-xl/lib/jxl/gaborish.h --- a/third_party/jpeg-xl/lib/jxl/gaborish.h +++ b/third_party/jpeg-xl/lib/jxl/gaborish.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_GABORISH_H_ #define LIB_JXL_GABORISH_H_ // Linear smoothing (3x3 convolution) for deblocking without too much blur. diff --git a/third_party/jpeg-xl/lib/jxl/gaborish.cc b/third_party/jpeg-xl/lib/jxl/gaborish.cc --- a/third_party/jpeg-xl/lib/jxl/gaborish.cc +++ b/third_party/jpeg-xl/lib/jxl/gaborish.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/gaborish.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/gaborish_test.cc b/third_party/jpeg-xl/lib/jxl/gaborish_test.cc --- a/third_party/jpeg-xl/lib/jxl/gaborish_test.cc +++ b/third_party/jpeg-xl/lib/jxl/gaborish_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/gaborish.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/gamma_correct_test.cc b/third_party/jpeg-xl/lib/jxl/gamma_correct_test.cc --- a/third_party/jpeg-xl/lib/jxl/gamma_correct_test.cc +++ b/third_party/jpeg-xl/lib/jxl/gamma_correct_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include #include diff --git a/third_party/jpeg-xl/lib/jxl/gauss_blur.h b/third_party/jpeg-xl/lib/jxl/gauss_blur.h --- a/third_party/jpeg-xl/lib/jxl/gauss_blur.h +++ b/third_party/jpeg-xl/lib/jxl/gauss_blur.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_GAUSS_BLUR_H_ #define LIB_JXL_GAUSS_BLUR_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/gauss_blur.cc b/third_party/jpeg-xl/lib/jxl/gauss_blur.cc --- a/third_party/jpeg-xl/lib/jxl/gauss_blur.cc +++ b/third_party/jpeg-xl/lib/jxl/gauss_blur.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/gauss_blur.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/gauss_blur_test.cc b/third_party/jpeg-xl/lib/jxl/gauss_blur_test.cc --- a/third_party/jpeg-xl/lib/jxl/gauss_blur_test.cc +++ b/third_party/jpeg-xl/lib/jxl/gauss_blur_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/gauss_blur.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/gradient_test.cc b/third_party/jpeg-xl/lib/jxl/gradient_test.cc --- a/third_party/jpeg-xl/lib/jxl/gradient_test.cc +++ b/third_party/jpeg-xl/lib/jxl/gradient_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include #include #include diff --git a/third_party/jpeg-xl/lib/jxl/headers.h b/third_party/jpeg-xl/lib/jxl/headers.h --- a/third_party/jpeg-xl/lib/jxl/headers.h +++ b/third_party/jpeg-xl/lib/jxl/headers.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_HEADERS_H_ #define LIB_JXL_HEADERS_H_ // Codestream headers, also stored in CodecInOut. diff --git a/third_party/jpeg-xl/lib/jxl/headers.cc b/third_party/jpeg-xl/lib/jxl/headers.cc --- a/third_party/jpeg-xl/lib/jxl/headers.cc +++ b/third_party/jpeg-xl/lib/jxl/headers.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/headers.h" #include "lib/jxl/common.h" #include "lib/jxl/fields.h" diff --git a/third_party/jpeg-xl/lib/jxl/huffman_table.h b/third_party/jpeg-xl/lib/jxl/huffman_table.h --- a/third_party/jpeg-xl/lib/jxl/huffman_table.h +++ b/third_party/jpeg-xl/lib/jxl/huffman_table.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_HUFFMAN_TABLE_H_ #define LIB_JXL_HUFFMAN_TABLE_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/huffman_table.cc b/third_party/jpeg-xl/lib/jxl/huffman_table.cc --- a/third_party/jpeg-xl/lib/jxl/huffman_table.cc +++ b/third_party/jpeg-xl/lib/jxl/huffman_table.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/huffman_table.h" #include /* for memcpy */ #include diff --git a/third_party/jpeg-xl/lib/jxl/huffman_tree.h b/third_party/jpeg-xl/lib/jxl/huffman_tree.h --- a/third_party/jpeg-xl/lib/jxl/huffman_tree.h +++ b/third_party/jpeg-xl/lib/jxl/huffman_tree.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // Library for creating Huffman codes from population counts. #ifndef LIB_JXL_HUFFMAN_TREE_H_ #define LIB_JXL_HUFFMAN_TREE_H_ diff --git a/third_party/jpeg-xl/lib/jxl/huffman_tree.cc b/third_party/jpeg-xl/lib/jxl/huffman_tree.cc --- a/third_party/jpeg-xl/lib/jxl/huffman_tree.cc +++ b/third_party/jpeg-xl/lib/jxl/huffman_tree.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/huffman_tree.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/iaca_test.cc b/third_party/jpeg-xl/lib/jxl/iaca_test.cc --- a/third_party/jpeg-xl/lib/jxl/iaca_test.cc +++ b/third_party/jpeg-xl/lib/jxl/iaca_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/base/iaca.h" #include "gtest/gtest.h" diff --git a/third_party/jpeg-xl/lib/jxl/icc_codec.h b/third_party/jpeg-xl/lib/jxl/icc_codec.h --- a/third_party/jpeg-xl/lib/jxl/icc_codec.h +++ b/third_party/jpeg-xl/lib/jxl/icc_codec.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ICC_CODEC_H_ #define LIB_JXL_ICC_CODEC_H_ // Compressed representation of ICC profiles. @@ -23,19 +14,40 @@ #include "lib/jxl/aux_out.h" #include "lib/jxl/aux_out_fwd.h" #include "lib/jxl/base/compiler_specific.h" #include "lib/jxl/base/padded_bytes.h" #include "lib/jxl/base/status.h" +#include "lib/jxl/dec_ans.h" #include "lib/jxl/dec_bit_reader.h" #include "lib/jxl/enc_bit_writer.h" namespace jxl { // Should still be called if `icc.empty()` - if so, writes only 1 bit. Status WriteICC(const PaddedBytes& icc, BitWriter* JXL_RESTRICT writer, size_t layer, AuxOut* JXL_RESTRICT aux_out); +struct ICCReader { + Status Init(BitReader* reader, size_t output_limit); + Status Process(BitReader* reader, PaddedBytes* icc); + void Reset() { + bits_to_skip_ = 0; + decompressed_.clear(); + } + + private: + Status CheckEOI(BitReader* reader); + size_t i_ = 0; + size_t bits_to_skip_ = 0; + size_t used_bits_base_ = 0; + uint64_t enc_size_ = 0; + std::vector context_map_; + ANSCode code_; + ANSSymbolReader ans_reader_; + PaddedBytes decompressed_; +}; + // `icc` may be empty afterwards - if so, call CreateProfile. Does not append, // clears any original data that was in icc. // If `output_limit` is not 0, then returns error if resulting profile would be // longer than `output_limit` Status ReadICC(BitReader* JXL_RESTRICT reader, PaddedBytes* JXL_RESTRICT icc, diff --git a/third_party/jpeg-xl/lib/jxl/icc_codec.cc b/third_party/jpeg-xl/lib/jxl/icc_codec.cc --- a/third_party/jpeg-xl/lib/jxl/icc_codec.cc +++ b/third_party/jpeg-xl/lib/jxl/icc_codec.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/icc_codec.h" #include @@ -312,72 +303,102 @@ if (result->size() != osize) return JXL_FAILURE("Invalid result size"); return true; } -Status ReadICC(BitReader* JXL_RESTRICT reader, PaddedBytes* JXL_RESTRICT icc, - size_t output_limit) { - icc->clear(); - const auto checkEndOfInput = [&]() -> Status { - if (reader->AllReadsWithinBounds()) return true; - return JXL_STATUS(StatusCode::kNotEnoughBytes, - "Not enough bytes for reading ICC profile"); - }; - JXL_RETURN_IF_ERROR(checkEndOfInput()); - uint64_t enc_size = U64Coder::Read(reader); - if (enc_size > 268435456) { - // Avoid too large memory allocation for invalid file. - // TODO(lode): a more accurate limit would be the filesize of the JXL file, - // if we can have it available here. - return JXL_FAILURE("Too large encoded profile"); +Status ICCReader::Init(BitReader* reader, size_t output_limit) { + JXL_RETURN_IF_ERROR(CheckEOI(reader)); + used_bits_base_ = reader->TotalBitsConsumed(); + if (bits_to_skip_ == 0) { + enc_size_ = U64Coder::Read(reader); + if (enc_size_ > 268435456) { + // Avoid too large memory allocation for invalid file. + return JXL_FAILURE("Too large encoded profile"); + } + JXL_RETURN_IF_ERROR( + DecodeHistograms(reader, kNumICCContexts, &code_, &context_map_)); + ans_reader_ = ANSSymbolReader(&code_, reader); + i_ = 0; + decompressed_.resize(std::min(i_ + 0x400, enc_size_)); + for (; i_ < std::min(2, enc_size_); i_++) { + decompressed_[i_] = ans_reader_.ReadHybridUint( + ICCANSContext(i_, i_ > 0 ? decompressed_[i_ - 1] : 0, + i_ > 1 ? decompressed_[i_ - 2] : 0), + reader, context_map_); + } + if (enc_size_ > kPreambleSize) { + for (; i_ < kPreambleSize; i_++) { + decompressed_[i_] = ans_reader_.ReadHybridUint( + ICCANSContext(i_, decompressed_[i_ - 1], decompressed_[i_ - 2]), + reader, context_map_); + } + JXL_RETURN_IF_ERROR(CheckEOI(reader)); + JXL_RETURN_IF_ERROR( + CheckPreamble(decompressed_, enc_size_, output_limit)); + } + bits_to_skip_ = reader->TotalBitsConsumed() - used_bits_base_; + } else { + reader->SkipBits(bits_to_skip_); } - PaddedBytes decompressed; - std::vector context_map; - ANSCode code; - JXL_RETURN_IF_ERROR( - DecodeHistograms(reader, kNumICCContexts, &code, &context_map)); - ANSSymbolReader ans_reader(&code, reader); - size_t used_bits_base = reader->TotalBitsConsumed(); - size_t i = 0; - decompressed.resize(std::min(i + 0x400, enc_size)); + return true; +} - for (; i < std::min(2, enc_size); i++) { - decompressed[i] = ans_reader.ReadHybridUint( - ICCANSContext(i, i > 0 ? decompressed[i - 1] : 0, - i > 1 ? decompressed[i - 2] : 0), - reader, context_map); - } - if (enc_size > kPreambleSize) { - for (; i < kPreambleSize; i++) { - decompressed[i] = ans_reader.ReadHybridUint( - ICCANSContext(i, decompressed[i - 1], decompressed[i - 2]), reader, - context_map); +Status ICCReader::Process(BitReader* reader, PaddedBytes* icc) { + ANSSymbolReader::Checkpoint checkpoint; + size_t saved_i = 0; + auto save = [&]() { + ans_reader_.Save(&checkpoint); + bits_to_skip_ = reader->TotalBitsConsumed() - used_bits_base_; + saved_i = i_; + }; + save(); + auto check_and_restore = [&]() { + Status status = CheckEOI(reader); + if (!status) { + // not enough bytes. + ans_reader_.Restore(checkpoint); + i_ = saved_i; + return status; } - JXL_RETURN_IF_ERROR(checkEndOfInput()); - JXL_RETURN_IF_ERROR(CheckPreamble(decompressed, enc_size, output_limit)); + return Status(true); + }; + for (; i_ < enc_size_; i_++) { + if (i_ % ANSSymbolReader::kMaxCheckpointInterval == 0 && i_ > 0) { + JXL_RETURN_IF_ERROR(check_and_restore()); + save(); + if ((i_ > 0) && (((i_ & 0xFFFF) == 0))) { + float used_bytes = + (reader->TotalBitsConsumed() - used_bits_base_) / 8.0f; + if (i_ > used_bytes * 256) return JXL_FAILURE("Corrupted stream"); + } + decompressed_.resize(std::min(i_ + 0x400, enc_size_)); + } + JXL_DASSERT(i_ >= 2); + decompressed_[i_] = ans_reader_.ReadHybridUint( + ICCANSContext(i_, decompressed_[i_ - 1], decompressed_[i_ - 2]), reader, + context_map_); } - for (; i < enc_size; i++) { - if ((i & 0x3FF) == 0) { - JXL_RETURN_IF_ERROR(checkEndOfInput()); - if ((i > 0) && (((i & 0xFFFF) == 0))) { - float used_bytes = - (reader->TotalBitsConsumed() - used_bits_base) / 8.0f; - if (i > used_bytes * 256) return JXL_FAILURE("Corrupted stream"); - } - decompressed.resize(std::min(i + 0x400, enc_size)); - } - JXL_DASSERT(i >= 2); - decompressed[i] = ans_reader.ReadHybridUint( - ICCANSContext(i, decompressed[i - 1], decompressed[i - 2]), reader, - context_map); - } - JXL_RETURN_IF_ERROR(checkEndOfInput()); - if (!ans_reader.CheckANSFinalState()) { + JXL_RETURN_IF_ERROR(check_and_restore()); + bits_to_skip_ = reader->TotalBitsConsumed() - used_bits_base_; + if (!ans_reader_.CheckANSFinalState()) { return JXL_FAILURE("Corrupted ICC profile"); } - JXL_RETURN_IF_ERROR( - UnpredictICC(decompressed.data(), decompressed.size(), icc)); + icc->clear(); + return UnpredictICC(decompressed_.data(), decompressed_.size(), icc); +} + +Status ICCReader::CheckEOI(BitReader* reader) { + if (reader->AllReadsWithinBounds()) return true; + return JXL_STATUS(StatusCode::kNotEnoughBytes, + "Not enough bytes for reading ICC profile"); +} + +Status ReadICC(BitReader* JXL_RESTRICT reader, PaddedBytes* JXL_RESTRICT icc, + size_t output_limit) { + ICCReader icc_reader; + JXL_RETURN_IF_ERROR(icc_reader.Init(reader, output_limit)); + JXL_RETURN_IF_ERROR(icc_reader.Process(reader, icc)); return true; } } // namespace jxl diff --git a/third_party/jpeg-xl/lib/jxl/icc_codec_common.h b/third_party/jpeg-xl/lib/jxl/icc_codec_common.h --- a/third_party/jpeg-xl/lib/jxl/icc_codec_common.h +++ b/third_party/jpeg-xl/lib/jxl/icc_codec_common.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_ICC_CODEC_COMMON_H_ #define LIB_JXL_ICC_CODEC_COMMON_H_ // Compressed representation of ICC profiles. diff --git a/third_party/jpeg-xl/lib/jxl/icc_codec_common.cc b/third_party/jpeg-xl/lib/jxl/icc_codec_common.cc --- a/third_party/jpeg-xl/lib/jxl/icc_codec_common.cc +++ b/third_party/jpeg-xl/lib/jxl/icc_codec_common.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/icc_codec_common.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/icc_codec_test.cc b/third_party/jpeg-xl/lib/jxl/icc_codec_test.cc --- a/third_party/jpeg-xl/lib/jxl/icc_codec_test.cc +++ b/third_party/jpeg-xl/lib/jxl/icc_codec_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/icc_codec.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/image.h b/third_party/jpeg-xl/lib/jxl/image.h --- a/third_party/jpeg-xl/lib/jxl/image.h +++ b/third_party/jpeg-xl/lib/jxl/image.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_IMAGE_H_ #define LIB_JXL_IMAGE_H_ // SIMD/multicore-friendly planar image representation with row accessors. diff --git a/third_party/jpeg-xl/lib/jxl/image.cc b/third_party/jpeg-xl/lib/jxl/image.cc --- a/third_party/jpeg-xl/lib/jxl/image.cc +++ b/third_party/jpeg-xl/lib/jxl/image.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/image.h" #include // swap diff --git a/third_party/jpeg-xl/lib/jxl/image_bundle.h b/third_party/jpeg-xl/lib/jxl/image_bundle.h --- a/third_party/jpeg-xl/lib/jxl/image_bundle.h +++ b/third_party/jpeg-xl/lib/jxl/image_bundle.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_IMAGE_BUNDLE_H_ #define LIB_JXL_IMAGE_BUNDLE_H_ // The main image or frame consists of a bundle of associated images. @@ -222,10 +213,11 @@ FrameOrigin origin{0, 0}; // Animation-related information. This assumes GIF- and APNG- like animation. uint32_t duration = 0; bool use_for_next_frame = false; bool blend = false; + BlendMode blendmode = BlendMode::kBlend; std::string name; private: // Called after any Set* to ensure their sizes are compatible. void VerifySizes() const; diff --git a/third_party/jpeg-xl/lib/jxl/image_bundle.cc b/third_party/jpeg-xl/lib/jxl/image_bundle.cc --- a/third_party/jpeg-xl/lib/jxl/image_bundle.cc +++ b/third_party/jpeg-xl/lib/jxl/image_bundle.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/image_bundle.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/image_bundle_test.cc b/third_party/jpeg-xl/lib/jxl/image_bundle_test.cc --- a/third_party/jpeg-xl/lib/jxl/image_bundle_test.cc +++ b/third_party/jpeg-xl/lib/jxl/image_bundle_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/image_bundle.h" #include "gtest/gtest.h" #include "lib/jxl/aux_out.h" diff --git a/third_party/jpeg-xl/lib/jxl/image_metadata.h b/third_party/jpeg-xl/lib/jxl/image_metadata.h --- a/third_party/jpeg-xl/lib/jxl/image_metadata.h +++ b/third_party/jpeg-xl/lib/jxl/image_metadata.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // Main codestream header bundles, the metadata that applies to all frames. #ifndef LIB_JXL_IMAGE_METADATA_H_ #define LIB_JXL_IMAGE_METADATA_H_ diff --git a/third_party/jpeg-xl/lib/jxl/image_metadata.cc b/third_party/jpeg-xl/lib/jxl/image_metadata.cc --- a/third_party/jpeg-xl/lib/jxl/image_metadata.cc +++ b/third_party/jpeg-xl/lib/jxl/image_metadata.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/image_metadata.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/image_ops.h b/third_party/jpeg-xl/lib/jxl/image_ops.h --- a/third_party/jpeg-xl/lib/jxl/image_ops.h +++ b/third_party/jpeg-xl/lib/jxl/image_ops.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_IMAGE_OPS_H_ #define LIB_JXL_IMAGE_OPS_H_ // Operations on images. diff --git a/third_party/jpeg-xl/lib/jxl/image_ops_test.cc b/third_party/jpeg-xl/lib/jxl/image_ops_test.cc --- a/third_party/jpeg-xl/lib/jxl/image_ops_test.cc +++ b/third_party/jpeg-xl/lib/jxl/image_ops_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/image_ops.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/image_test_utils.h b/third_party/jpeg-xl/lib/jxl/image_test_utils.h --- a/third_party/jpeg-xl/lib/jxl/image_test_utils.h +++ b/third_party/jpeg-xl/lib/jxl/image_test_utils.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_IMAGE_TEST_UTILS_H_ #define LIB_JXL_IMAGE_TEST_UTILS_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/jpeg/dec_jpeg_data.h b/third_party/jpeg-xl/lib/jxl/jpeg/dec_jpeg_data.h --- a/third_party/jpeg-xl/lib/jxl/jpeg/dec_jpeg_data.h +++ b/third_party/jpeg-xl/lib/jxl/jpeg/dec_jpeg_data.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_JPEG_DEC_JPEG_DATA_H_ #define LIB_JXL_JPEG_DEC_JPEG_DATA_H_ #include "lib/jxl/base/span.h" diff --git a/third_party/jpeg-xl/lib/jxl/jpeg/dec_jpeg_data.cc b/third_party/jpeg-xl/lib/jxl/jpeg/dec_jpeg_data.cc --- a/third_party/jpeg-xl/lib/jxl/jpeg/dec_jpeg_data.cc +++ b/third_party/jpeg-xl/lib/jxl/jpeg/dec_jpeg_data.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/jpeg/dec_jpeg_data.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/jpeg/dec_jpeg_data_writer.h b/third_party/jpeg-xl/lib/jxl/jpeg/dec_jpeg_data_writer.h --- a/third_party/jpeg-xl/lib/jxl/jpeg/dec_jpeg_data_writer.h +++ b/third_party/jpeg-xl/lib/jxl/jpeg/dec_jpeg_data_writer.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // Functions for writing a JPEGData object into a jpeg byte stream. #ifndef LIB_JXL_JPEG_DEC_JPEG_DATA_WRITER_H_ #define LIB_JXL_JPEG_DEC_JPEG_DATA_WRITER_H_ diff --git a/third_party/jpeg-xl/lib/jxl/jpeg/dec_jpeg_data_writer.cc b/third_party/jpeg-xl/lib/jxl/jpeg/dec_jpeg_data_writer.cc --- a/third_party/jpeg-xl/lib/jxl/jpeg/dec_jpeg_data_writer.cc +++ b/third_party/jpeg-xl/lib/jxl/jpeg/dec_jpeg_data_writer.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/jpeg/dec_jpeg_data_writer.h" #include #include /* for memset, memcpy */ diff --git a/third_party/jpeg-xl/lib/jxl/jpeg/dec_jpeg_output_chunk.h b/third_party/jpeg-xl/lib/jxl/jpeg/dec_jpeg_output_chunk.h --- a/third_party/jpeg-xl/lib/jxl/jpeg/dec_jpeg_output_chunk.h +++ b/third_party/jpeg-xl/lib/jxl/jpeg/dec_jpeg_output_chunk.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_JPEG_DEC_JPEG_OUTPUT_CHUNK_H_ #define LIB_JXL_JPEG_DEC_JPEG_OUTPUT_CHUNK_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/jpeg/dec_jpeg_serialization_state.h b/third_party/jpeg-xl/lib/jxl/jpeg/dec_jpeg_serialization_state.h --- a/third_party/jpeg-xl/lib/jxl/jpeg/dec_jpeg_serialization_state.h +++ b/third_party/jpeg-xl/lib/jxl/jpeg/dec_jpeg_serialization_state.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_JPEG_DEC_JPEG_SERIALIZATION_STATE_H_ #define LIB_JXL_JPEG_DEC_JPEG_SERIALIZATION_STATE_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/jpeg/enc_jpeg_data.h b/third_party/jpeg-xl/lib/jxl/jpeg/enc_jpeg_data.h --- a/third_party/jpeg-xl/lib/jxl/jpeg/enc_jpeg_data.h +++ b/third_party/jpeg-xl/lib/jxl/jpeg/enc_jpeg_data.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_JPEG_ENC_JPEG_DATA_H_ #define LIB_JXL_JPEG_ENC_JPEG_DATA_H_ #include "lib/jxl/base/padded_bytes.h" diff --git a/third_party/jpeg-xl/lib/jxl/jpeg/enc_jpeg_data.cc b/third_party/jpeg-xl/lib/jxl/jpeg/enc_jpeg_data.cc --- a/third_party/jpeg-xl/lib/jxl/jpeg/enc_jpeg_data.cc +++ b/third_party/jpeg-xl/lib/jxl/jpeg/enc_jpeg_data.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/jpeg/enc_jpeg_data.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/jpeg/enc_jpeg_data_reader.h b/third_party/jpeg-xl/lib/jxl/jpeg/enc_jpeg_data_reader.h --- a/third_party/jpeg-xl/lib/jxl/jpeg/enc_jpeg_data_reader.h +++ b/third_party/jpeg-xl/lib/jxl/jpeg/enc_jpeg_data_reader.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // Functions for reading a jpeg byte stream into a JPEGData object. #ifndef LIB_JXL_JPEG_ENC_JPEG_DATA_READER_H_ #define LIB_JXL_JPEG_ENC_JPEG_DATA_READER_H_ diff --git a/third_party/jpeg-xl/lib/jxl/jpeg/enc_jpeg_data_reader.cc b/third_party/jpeg-xl/lib/jxl/jpeg/enc_jpeg_data_reader.cc --- a/third_party/jpeg-xl/lib/jxl/jpeg/enc_jpeg_data_reader.cc +++ b/third_party/jpeg-xl/lib/jxl/jpeg/enc_jpeg_data_reader.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/jpeg/enc_jpeg_data_reader.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/jpeg/enc_jpeg_huffman_decode.h b/third_party/jpeg-xl/lib/jxl/jpeg/enc_jpeg_huffman_decode.h --- a/third_party/jpeg-xl/lib/jxl/jpeg/enc_jpeg_huffman_decode.h +++ b/third_party/jpeg-xl/lib/jxl/jpeg/enc_jpeg_huffman_decode.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // Utility function for building a Huffman lookup table for the jpeg decoder. #ifndef LIB_JXL_JPEG_ENC_JPEG_HUFFMAN_DECODE_H_ #define LIB_JXL_JPEG_ENC_JPEG_HUFFMAN_DECODE_H_ diff --git a/third_party/jpeg-xl/lib/jxl/jpeg/enc_jpeg_huffman_decode.cc b/third_party/jpeg-xl/lib/jxl/jpeg/enc_jpeg_huffman_decode.cc --- a/third_party/jpeg-xl/lib/jxl/jpeg/enc_jpeg_huffman_decode.cc +++ b/third_party/jpeg-xl/lib/jxl/jpeg/enc_jpeg_huffman_decode.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/jpeg/enc_jpeg_huffman_decode.h" #include "lib/jxl/jpeg/jpeg_data.h" diff --git a/third_party/jpeg-xl/lib/jxl/jpeg/jpeg_data.h b/third_party/jpeg-xl/lib/jxl/jpeg/jpeg_data.h --- a/third_party/jpeg-xl/lib/jxl/jpeg/jpeg_data.h +++ b/third_party/jpeg-xl/lib/jxl/jpeg/jpeg_data.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // Data structures that represent the non-pixel contents of a jpeg file. #ifndef LIB_JXL_JPEG_JPEG_DATA_H_ #define LIB_JXL_JPEG_JPEG_DATA_H_ diff --git a/third_party/jpeg-xl/lib/jxl/jpeg/jpeg_data.cc b/third_party/jpeg-xl/lib/jxl/jpeg/jpeg_data.cc --- a/third_party/jpeg-xl/lib/jxl/jpeg/jpeg_data.cc +++ b/third_party/jpeg-xl/lib/jxl/jpeg/jpeg_data.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/jpeg/jpeg_data.h" #include "lib/jxl/base/status.h" diff --git a/third_party/jpeg-xl/lib/jxl/jxl_inspection.h b/third_party/jpeg-xl/lib/jxl/jxl_inspection.h --- a/third_party/jpeg-xl/lib/jxl/jxl_inspection.h +++ b/third_party/jpeg-xl/lib/jxl/jxl_inspection.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_JXL_INSPECTION_H_ #define LIB_JXL_JXL_INSPECTION_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/jxl_test.cc b/third_party/jpeg-xl/lib/jxl/jxl_test.cc --- a/third_party/jpeg-xl/lib/jxl/jxl_test.cc +++ b/third_party/jpeg-xl/lib/jxl/jxl_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include #include #include @@ -1456,7 +1447,28 @@ EXPECT_LE(ButteraugliDistance(io, io2, cparams.ba_params, /*distmap=*/nullptr, &pool), 4.0f); } +TEST(JxlTest, RoundtripAnimationPatches) { + ThreadPool* pool = nullptr; + const PaddedBytes orig = ReadTestData("jxl/animation_patches.gif"); + CodecInOut io; + ASSERT_TRUE(SetFromBytes(Span(orig), &io, pool)); + ASSERT_EQ(2, io.frames.size()); + + CompressParams cparams; + cparams.patches = Override::kOn; + DecompressParams dparams; + CodecInOut io2; + // 40k with no patches, 27k with patch frames encoded multiple times. + EXPECT_LE(Roundtrip(&io, cparams, dparams, pool, &io2), 24000); + + EXPECT_EQ(io2.frames.size(), io.frames.size()); + // >10 with broken patches + EXPECT_LE(ButteraugliDistance(io, io2, cparams.ba_params, + /*distmap=*/nullptr, pool), + 2.0); +} + } // namespace } // namespace jxl diff --git a/third_party/jpeg-xl/lib/jxl/lehmer_code.h b/third_party/jpeg-xl/lib/jxl/lehmer_code.h --- a/third_party/jpeg-xl/lib/jxl/lehmer_code.h +++ b/third_party/jpeg-xl/lib/jxl/lehmer_code.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_LEHMER_CODE_H_ #define LIB_JXL_LEHMER_CODE_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/lehmer_code_test.cc b/third_party/jpeg-xl/lib/jxl/lehmer_code_test.cc --- a/third_party/jpeg-xl/lib/jxl/lehmer_code_test.cc +++ b/third_party/jpeg-xl/lib/jxl/lehmer_code_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/lehmer_code.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/linalg.h b/third_party/jpeg-xl/lib/jxl/linalg.h --- a/third_party/jpeg-xl/lib/jxl/linalg.h +++ b/third_party/jpeg-xl/lib/jxl/linalg.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_LINALG_H_ #define LIB_JXL_LINALG_H_ // Linear algebra. diff --git a/third_party/jpeg-xl/lib/jxl/linalg.cc b/third_party/jpeg-xl/lib/jxl/linalg.cc --- a/third_party/jpeg-xl/lib/jxl/linalg.cc +++ b/third_party/jpeg-xl/lib/jxl/linalg.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/linalg.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/linalg_test.cc b/third_party/jpeg-xl/lib/jxl/linalg_test.cc --- a/third_party/jpeg-xl/lib/jxl/linalg_test.cc +++ b/third_party/jpeg-xl/lib/jxl/linalg_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/linalg.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/loop_filter.h b/third_party/jpeg-xl/lib/jxl/loop_filter.h --- a/third_party/jpeg-xl/lib/jxl/loop_filter.h +++ b/third_party/jpeg-xl/lib/jxl/loop_filter.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_LOOP_FILTER_H_ #define LIB_JXL_LOOP_FILTER_H_ // Parameters for loop filter(s), stored in each frame. diff --git a/third_party/jpeg-xl/lib/jxl/loop_filter.cc b/third_party/jpeg-xl/lib/jxl/loop_filter.cc --- a/third_party/jpeg-xl/lib/jxl/loop_filter.cc +++ b/third_party/jpeg-xl/lib/jxl/loop_filter.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/loop_filter.h" #include "lib/jxl/aux_out.h" #include "lib/jxl/base/status.h" diff --git a/third_party/jpeg-xl/lib/jxl/luminance.h b/third_party/jpeg-xl/lib/jxl/luminance.h --- a/third_party/jpeg-xl/lib/jxl/luminance.h +++ b/third_party/jpeg-xl/lib/jxl/luminance.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_LUMINANCE_H_ #define LIB_JXL_LUMINANCE_H_ namespace jxl { diff --git a/third_party/jpeg-xl/lib/jxl/luminance.cc b/third_party/jpeg-xl/lib/jxl/luminance.cc --- a/third_party/jpeg-xl/lib/jxl/luminance.cc +++ b/third_party/jpeg-xl/lib/jxl/luminance.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/luminance.h" #include "lib/jxl/codec_in_out.h" #include "lib/jxl/color_encoding_internal.h" diff --git a/third_party/jpeg-xl/lib/jxl/memory_manager_internal.h b/third_party/jpeg-xl/lib/jxl/memory_manager_internal.h --- a/third_party/jpeg-xl/lib/jxl/memory_manager_internal.h +++ b/third_party/jpeg-xl/lib/jxl/memory_manager_internal.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_MEMORY_MANAGER_INTERNAL_H_ #define LIB_JXL_MEMORY_MANAGER_INTERNAL_H_ // Memory allocator with support for alignment + misalignment. diff --git a/third_party/jpeg-xl/lib/jxl/memory_manager_internal.cc b/third_party/jpeg-xl/lib/jxl/memory_manager_internal.cc --- a/third_party/jpeg-xl/lib/jxl/memory_manager_internal.cc +++ b/third_party/jpeg-xl/lib/jxl/memory_manager_internal.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/memory_manager_internal.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/modular/encoding/context_predict.h b/third_party/jpeg-xl/lib/jxl/modular/encoding/context_predict.h --- a/third_party/jpeg-xl/lib/jxl/modular/encoding/context_predict.h +++ b/third_party/jpeg-xl/lib/jxl/modular/encoding/context_predict.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_MODULAR_ENCODING_CONTEXT_PREDICT_H_ #define LIB_JXL_MODULAR_ENCODING_CONTEXT_PREDICT_H_ #include @@ -464,10 +455,52 @@ kUseWP = 2, kForceComputeProperties = 4, kAllPredictions = 8, }; +JXL_INLINE pixel_type_w PredictOne(Predictor p, pixel_type_w left, + pixel_type_w top, pixel_type_w toptop, + pixel_type_w topleft, pixel_type_w topright, + pixel_type_w leftleft, + pixel_type_w toprightright, + pixel_type_w wp_pred) { + switch (p) { + case Predictor::Zero: + return pixel_type_w{0}; + case Predictor::Left: + return left; + case Predictor::Top: + return top; + case Predictor::Select: + return Select(left, top, topleft); + case Predictor::Weighted: + return wp_pred; + case Predictor::Gradient: + return pixel_type_w{ClampedGradient(left, top, topleft)}; + case Predictor::TopLeft: + return topleft; + case Predictor::TopRight: + return topright; + case Predictor::LeftLeft: + return leftleft; + case Predictor::Average0: + return (left + top) / 2; + case Predictor::Average1: + return (left + topleft) / 2; + case Predictor::Average2: + return (topleft + top) / 2; + case Predictor::Average3: + return (top + topright) / 2; + case Predictor::Average4: + return (6 * top - 2 * toptop + 7 * left + 1 * leftleft + + 1 * toprightright + 3 * topright + 8) / + 16; + default: + return pixel_type_w{0}; + } +} + template inline PredictionResult Predict( Properties *p, size_t w, const pixel_type *JXL_RESTRICT pp, const intptr_t onerow, const size_t x, const size_t y, Predictor predictor, const MATreeLookup *lookup, const Channel *references, @@ -526,32 +559,18 @@ result.context = lr.context; result.guess = lr.offset; result.multiplier = lr.multiplier; predictor = lr.predictor; } - pixel_type_w pred_storage[kNumModularPredictors]; - if (!(mode & kAllPredictions)) { - predictions = pred_storage; + if (mode & kAllPredictions) { + for (size_t i = 0; i < kNumModularPredictors; i++) { + predictions[i] = PredictOne((Predictor)i, left, top, toptop, topleft, + topright, leftleft, toprightright, wp_pred); + } } - predictions[(int)Predictor::Zero] = 0; - predictions[(int)Predictor::Left] = left; - predictions[(int)Predictor::Top] = top; - predictions[(int)Predictor::Select] = Select(left, top, topleft); - predictions[(int)Predictor::Weighted] = wp_pred; - predictions[(int)Predictor::Gradient] = ClampedGradient(left, top, topleft); - predictions[(int)Predictor::TopLeft] = topleft; - predictions[(int)Predictor::TopRight] = topright; - predictions[(int)Predictor::LeftLeft] = leftleft; - predictions[(int)Predictor::Average0] = (left + top) / 2; - predictions[(int)Predictor::Average1] = (left + topleft) / 2; - predictions[(int)Predictor::Average2] = (topleft + top) / 2; - predictions[(int)Predictor::Average3] = (top + topright) / 2; - predictions[(int)Predictor::Average4] = - (6 * top - 2 * toptop + 7 * left + 1 * leftleft + 1 * toprightright + - 3 * topright + 8) / - 16; - result.guess += predictions[(int)predictor]; + result.guess += PredictOne(predictor, left, top, toptop, topleft, topright, + leftleft, toprightright, wp_pred); result.predictor = predictor; return result; } } // namespace detail diff --git a/third_party/jpeg-xl/lib/jxl/modular/encoding/dec_ma.h b/third_party/jpeg-xl/lib/jxl/modular/encoding/dec_ma.h --- a/third_party/jpeg-xl/lib/jxl/modular/encoding/dec_ma.h +++ b/third_party/jpeg-xl/lib/jxl/modular/encoding/dec_ma.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_MODULAR_ENCODING_DEC_MA_H_ #define LIB_JXL_MODULAR_ENCODING_DEC_MA_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/modular/encoding/dec_ma.cc b/third_party/jpeg-xl/lib/jxl/modular/encoding/dec_ma.cc --- a/third_party/jpeg-xl/lib/jxl/modular/encoding/dec_ma.cc +++ b/third_party/jpeg-xl/lib/jxl/modular/encoding/dec_ma.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/modular/encoding/dec_ma.h" #include "lib/jxl/dec_ans.h" #include "lib/jxl/modular/encoding/ma_common.h" diff --git a/third_party/jpeg-xl/lib/jxl/modular/encoding/enc_encoding.h b/third_party/jpeg-xl/lib/jxl/modular/encoding/enc_encoding.h --- a/third_party/jpeg-xl/lib/jxl/modular/encoding/enc_encoding.h +++ b/third_party/jpeg-xl/lib/jxl/modular/encoding/enc_encoding.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_MODULAR_ENCODING_ENC_ENCODING_H_ #define LIB_JXL_MODULAR_ENCODING_ENC_ENCODING_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/modular/encoding/enc_encoding.cc b/third_party/jpeg-xl/lib/jxl/modular/encoding/enc_encoding.cc --- a/third_party/jpeg-xl/lib/jxl/modular/encoding/enc_encoding.cc +++ b/third_party/jpeg-xl/lib/jxl/modular/encoding/enc_encoding.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include #include #include diff --git a/third_party/jpeg-xl/lib/jxl/modular/encoding/enc_ma.h b/third_party/jpeg-xl/lib/jxl/modular/encoding/enc_ma.h --- a/third_party/jpeg-xl/lib/jxl/modular/encoding/enc_ma.h +++ b/third_party/jpeg-xl/lib/jxl/modular/encoding/enc_ma.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_MODULAR_ENCODING_ENC_MA_H_ #define LIB_JXL_MODULAR_ENCODING_ENC_MA_H_ #include @@ -32,14 +23,14 @@ } size_t NumDistinctSamples() const { return sample_counts.size(); } size_t NumSamples() const { return num_samples; } // Set the predictor to use. Must be called before adding any samples. Status SetPredictor(Predictor predictor, - ModularOptions::WPTreeMode wp_tree_mode); + ModularOptions::TreeMode wp_tree_mode); // Set the properties to use. Must be called before adding any samples. Status SetProperties(const std::vector &properties, - ModularOptions::WPTreeMode wp_tree_mode); + ModularOptions::TreeMode wp_tree_mode); size_t Token(size_t pred, size_t i) const { return residuals[pred][i].tok; } size_t NBits(size_t pred, size_t i) const { return residuals[pred][i].nbits; } size_t Count(size_t i) const { return sample_counts[i]; } size_t PredictorIndex(Predictor predictor) const { diff --git a/third_party/jpeg-xl/lib/jxl/modular/encoding/enc_ma.cc b/third_party/jpeg-xl/lib/jxl/modular/encoding/enc_ma.cc --- a/third_party/jpeg-xl/lib/jxl/modular/encoding/enc_ma.cc +++ b/third_party/jpeg-xl/lib/jxl/modular/encoding/enc_ma.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/modular/encoding/enc_ma.h" #include #include @@ -540,17 +531,17 @@ constexpr int TreeSamples::kPropertyRange; constexpr uint32_t TreeSamples::kDedupEntryUnused; Status TreeSamples::SetPredictor(Predictor predictor, - ModularOptions::WPTreeMode wp_tree_mode) { - if (wp_tree_mode == ModularOptions::WPTreeMode::kWPOnly) { + ModularOptions::TreeMode wp_tree_mode) { + if (wp_tree_mode == ModularOptions::TreeMode::kWPOnly) { predictors = {Predictor::Weighted}; residuals.resize(1); return true; } - if (wp_tree_mode == ModularOptions::WPTreeMode::kNoWP && + if (wp_tree_mode == ModularOptions::TreeMode::kNoWP && predictor == Predictor::Weighted) { return JXL_FAILURE("Invalid predictor settings"); } if (predictor == Predictor::Variable) { for (size_t i = 0; i < kNumModularPredictors; i++) { @@ -561,11 +552,11 @@ } else if (predictor == Predictor::Best) { predictors = {Predictor::Weighted, Predictor::Gradient}; } else { predictors = {predictor}; } - if (wp_tree_mode == ModularOptions::WPTreeMode::kNoWP) { + if (wp_tree_mode == ModularOptions::TreeMode::kNoWP) { auto wp_it = std::find(predictors.begin(), predictors.end(), Predictor::Weighted); if (wp_it != predictors.end()) { predictors.erase(wp_it); } @@ -573,16 +564,19 @@ residuals.resize(predictors.size()); return true; } Status TreeSamples::SetProperties(const std::vector &properties, - ModularOptions::WPTreeMode wp_tree_mode) { + ModularOptions::TreeMode wp_tree_mode) { props_to_use = properties; - if (wp_tree_mode == ModularOptions::WPTreeMode::kWPOnly) { + if (wp_tree_mode == ModularOptions::TreeMode::kWPOnly) { props_to_use = {kWPProp}; } - if (wp_tree_mode == ModularOptions::WPTreeMode::kNoWP) { + if (wp_tree_mode == ModularOptions::TreeMode::kGradientOnly) { + props_to_use = {kGradientProp}; + } + if (wp_tree_mode == ModularOptions::TreeMode::kNoWP) { auto it = std::find(props_to_use.begin(), props_to_use.end(), kWPProp); if (it != props_to_use.end()) { props_to_use.erase(it); } } diff --git a/third_party/jpeg-xl/lib/jxl/modular/encoding/encoding.h b/third_party/jpeg-xl/lib/jxl/modular/encoding/encoding.h --- a/third_party/jpeg-xl/lib/jxl/modular/encoding/encoding.h +++ b/third_party/jpeg-xl/lib/jxl/modular/encoding/encoding.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_MODULAR_ENCODING_ENCODING_H_ #define LIB_JXL_MODULAR_ENCODING_ENCODING_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/modular/encoding/encoding.cc b/third_party/jpeg-xl/lib/jxl/modular/encoding/encoding.cc --- a/third_party/jpeg-xl/lib/jxl/modular/encoding/encoding.cc +++ b/third_party/jpeg-xl/lib/jxl/modular/encoding/encoding.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/modular/encoding/encoding.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/modular/encoding/ma_common.h b/third_party/jpeg-xl/lib/jxl/modular/encoding/ma_common.h --- a/third_party/jpeg-xl/lib/jxl/modular/encoding/ma_common.h +++ b/third_party/jpeg-xl/lib/jxl/modular/encoding/ma_common.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_MODULAR_ENCODING_MA_COMMON_H_ #define LIB_JXL_MODULAR_ENCODING_MA_COMMON_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/modular/modular_image.h b/third_party/jpeg-xl/lib/jxl/modular/modular_image.h --- a/third_party/jpeg-xl/lib/jxl/modular/modular_image.h +++ b/third_party/jpeg-xl/lib/jxl/modular/modular_image.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_MODULAR_MODULAR_IMAGE_H_ #define LIB_JXL_MODULAR_MODULAR_IMAGE_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/modular/modular_image.cc b/third_party/jpeg-xl/lib/jxl/modular/modular_image.cc --- a/third_party/jpeg-xl/lib/jxl/modular/modular_image.cc +++ b/third_party/jpeg-xl/lib/jxl/modular/modular_image.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/modular/modular_image.h" #include "lib/jxl/base/status.h" #include "lib/jxl/common.h" diff --git a/third_party/jpeg-xl/lib/jxl/modular/options.h b/third_party/jpeg-xl/lib/jxl/modular/options.h --- a/third_party/jpeg-xl/lib/jxl/modular/options.h +++ b/third_party/jpeg-xl/lib/jxl/modular/options.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_MODULAR_OPTIONS_H_ #define LIB_JXL_MODULAR_OPTIONS_H_ #include @@ -147,13 +138,13 @@ int wp_mode = 0; float fast_decode_multiplier = 1.01f; // Forces the encoder to produce a tree that is compatible with the WP-only - // decode path (or with the no-wp path). - enum class WPTreeMode { kWPOnly, kNoWP, kDefault }; - WPTreeMode wp_tree_mode = WPTreeMode::kDefault; + // decode path (or with the no-wp path, or the gradient-only path). + enum class TreeMode { kGradientOnly, kWPOnly, kNoWP, kDefault }; + TreeMode wp_tree_mode = TreeMode::kDefault; // Skip fast paths in the encoder. bool skip_encoder_fast_path = false; // Kind of tree to use. diff --git a/third_party/jpeg-xl/lib/jxl/modular/transform/near-lossless.h b/third_party/jpeg-xl/lib/jxl/modular/transform/near-lossless.h --- a/third_party/jpeg-xl/lib/jxl/modular/transform/near-lossless.h +++ b/third_party/jpeg-xl/lib/jxl/modular/transform/near-lossless.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_MODULAR_TRANSFORM_NEAR_LOSSLESS_H_ #define LIB_JXL_MODULAR_TRANSFORM_NEAR_LOSSLESS_H_ // Very simple lossy preprocessing step. diff --git a/third_party/jpeg-xl/lib/jxl/modular/transform/palette.h b/third_party/jpeg-xl/lib/jxl/modular/transform/palette.h --- a/third_party/jpeg-xl/lib/jxl/modular/transform/palette.h +++ b/third_party/jpeg-xl/lib/jxl/modular/transform/palette.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_MODULAR_TRANSFORM_PALETTE_H_ #define LIB_JXL_MODULAR_TRANSFORM_PALETTE_H_ #include @@ -42,10 +33,14 @@ static constexpr int kLargeCubeOffset = kSmallCube * kSmallCube * kSmallCube; // Inclusive. static constexpr int kMinImplicitPaletteIndex = -(2 * 72 - 1); +static constexpr pixel_type Scale(int value, int bit_depth, int denom) { + return (static_cast(value) * ((1 << bit_depth) - 1)) / denom; +} + // The purpose of this function is solely to extend the interpretation of // palette indices to implicit values. If index < nb_deltas, indicating that the // result is a delta palette entry, it is the responsibility of the caller to // treat it as such. static pixel_type GetPaletteValue(const pixel_type *const palette, int index, @@ -94,12 +89,11 @@ for (size_t i = 1; i < c; ++i) { divisor *= kSmallCube; } index /= divisor; } - index %= kSmallCube; - return (index * ((1 << bit_depth) - 1)) / kSmallCube + + return Scale(index % kSmallCube, bit_depth, kSmallCube) + (1 << (std::max(0, bit_depth - 3))); } else if (palette_size + kLargeCubeOffset <= index) { if (c >= kCubePow) return 0; index -= palette_size + kLargeCubeOffset; // TODO(eustas): should we take care of ambiguity created by @@ -109,12 +103,11 @@ for (size_t i = 1; i < c; ++i) { divisor *= kLargeCube; } index /= divisor; } - index %= kLargeCube; - return (index * ((1 << bit_depth) - 1)) / (kLargeCube - 1); + return Scale(index % kLargeCube, bit_depth, kLargeCube - 1); } return palette[c * onerow + static_cast(index)]; } @@ -230,11 +223,11 @@ const Channel &palette = input.channel[0]; const pixel_type *JXL_RESTRICT p_palette = input.channel[0].Row(0); intptr_t onerow = input.channel[0].plane.PixelsPerRow(); intptr_t onerow_image = input.channel[c0].plane.PixelsPerRow(); const int bit_depth = - CeilLog2Nonzero(static_cast(input.maxval - input.minval + 1)); + CeilLog2Nonzero(static_cast(input.maxval) - input.minval + 1); if (w == 0) { // Nothing to do. // Avoid touching "empty" channels with non-zero height. } else if (nb_deltas == 0 && predictor == Predictor::Zero) { diff --git a/third_party/jpeg-xl/lib/jxl/modular/transform/squeeze.h b/third_party/jpeg-xl/lib/jxl/modular/transform/squeeze.h --- a/third_party/jpeg-xl/lib/jxl/modular/transform/squeeze.h +++ b/third_party/jpeg-xl/lib/jxl/modular/transform/squeeze.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_MODULAR_TRANSFORM_SQUEEZE_H_ #define LIB_JXL_MODULAR_TRANSFORM_SQUEEZE_H_ // Haar-like transform: halves the resolution in one direction diff --git a/third_party/jpeg-xl/lib/jxl/modular/transform/subtractgreen.h b/third_party/jpeg-xl/lib/jxl/modular/transform/subtractgreen.h --- a/third_party/jpeg-xl/lib/jxl/modular/transform/subtractgreen.h +++ b/third_party/jpeg-xl/lib/jxl/modular/transform/subtractgreen.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_MODULAR_TRANSFORM_SUBTRACTGREEN_H_ #define LIB_JXL_MODULAR_TRANSFORM_SUBTRACTGREEN_H_ #include "lib/jxl/base/status.h" diff --git a/third_party/jpeg-xl/lib/jxl/modular/transform/transform.h b/third_party/jpeg-xl/lib/jxl/modular/transform/transform.h --- a/third_party/jpeg-xl/lib/jxl/modular/transform/transform.h +++ b/third_party/jpeg-xl/lib/jxl/modular/transform/transform.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_MODULAR_TRANSFORM_TRANSFORM_H_ #define LIB_JXL_MODULAR_TRANSFORM_TRANSFORM_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/modular/transform/transform.cc b/third_party/jpeg-xl/lib/jxl/modular/transform/transform.cc --- a/third_party/jpeg-xl/lib/jxl/modular/transform/transform.cc +++ b/third_party/jpeg-xl/lib/jxl/modular/transform/transform.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/modular/transform/transform.h" #include "lib/jxl/fields.h" #include "lib/jxl/modular/modular_image.h" diff --git a/third_party/jpeg-xl/lib/jxl/modular_test.cc b/third_party/jpeg-xl/lib/jxl/modular_test.cc --- a/third_party/jpeg-xl/lib/jxl/modular_test.cc +++ b/third_party/jpeg-xl/lib/jxl/modular_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include #include #include diff --git a/third_party/jpeg-xl/lib/jxl/noise.h b/third_party/jpeg-xl/lib/jxl/noise.h --- a/third_party/jpeg-xl/lib/jxl/noise.h +++ b/third_party/jpeg-xl/lib/jxl/noise.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_NOISE_H_ #define LIB_JXL_NOISE_H_ // Noise parameters shared by encoder/decoder. diff --git a/third_party/jpeg-xl/lib/jxl/noise_distributions.h b/third_party/jpeg-xl/lib/jxl/noise_distributions.h --- a/third_party/jpeg-xl/lib/jxl/noise_distributions.h +++ b/third_party/jpeg-xl/lib/jxl/noise_distributions.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_NOISE_DISTRIBUTIONS_H_ #define LIB_JXL_NOISE_DISTRIBUTIONS_H_ // Noise distributions for testing partial_derivatives and robust_statistics. diff --git a/third_party/jpeg-xl/lib/jxl/opsin_image_test.cc b/third_party/jpeg-xl/lib/jxl/opsin_image_test.cc --- a/third_party/jpeg-xl/lib/jxl/opsin_image_test.cc +++ b/third_party/jpeg-xl/lib/jxl/opsin_image_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include #include diff --git a/third_party/jpeg-xl/lib/jxl/opsin_inverse_test.cc b/third_party/jpeg-xl/lib/jxl/opsin_inverse_test.cc --- a/third_party/jpeg-xl/lib/jxl/opsin_inverse_test.cc +++ b/third_party/jpeg-xl/lib/jxl/opsin_inverse_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "gtest/gtest.h" #include "lib/jxl/base/data_parallel.h" #include "lib/jxl/codec_in_out.h" #include "lib/jxl/color_encoding_internal.h" diff --git a/third_party/jpeg-xl/lib/jxl/opsin_params.h b/third_party/jpeg-xl/lib/jxl/opsin_params.h --- a/third_party/jpeg-xl/lib/jxl/opsin_params.h +++ b/third_party/jpeg-xl/lib/jxl/opsin_params.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_OPSIN_PARAMS_H_ #define LIB_JXL_OPSIN_PARAMS_H_ // Constants that define the XYB color space. diff --git a/third_party/jpeg-xl/lib/jxl/opsin_params.cc b/third_party/jpeg-xl/lib/jxl/opsin_params.cc --- a/third_party/jpeg-xl/lib/jxl/opsin_params.cc +++ b/third_party/jpeg-xl/lib/jxl/opsin_params.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/opsin_params.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/optimize.h b/third_party/jpeg-xl/lib/jxl/optimize.h --- a/third_party/jpeg-xl/lib/jxl/optimize.h +++ b/third_party/jpeg-xl/lib/jxl/optimize.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // Utility functions for optimizing multi-dimensional nonlinear functions. #ifndef LIB_JXL_OPTIMIZE_H_ #define LIB_JXL_OPTIMIZE_H_ diff --git a/third_party/jpeg-xl/lib/jxl/optimize.cc b/third_party/jpeg-xl/lib/jxl/optimize.cc --- a/third_party/jpeg-xl/lib/jxl/optimize.cc +++ b/third_party/jpeg-xl/lib/jxl/optimize.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/optimize.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/optimize_test.cc b/third_party/jpeg-xl/lib/jxl/optimize_test.cc --- a/third_party/jpeg-xl/lib/jxl/optimize_test.cc +++ b/third_party/jpeg-xl/lib/jxl/optimize_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/optimize.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/padded_bytes_test.cc b/third_party/jpeg-xl/lib/jxl/padded_bytes_test.cc --- a/third_party/jpeg-xl/lib/jxl/padded_bytes_test.cc +++ b/third_party/jpeg-xl/lib/jxl/padded_bytes_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/base/padded_bytes.h" #include // iota #include diff --git a/third_party/jpeg-xl/lib/jxl/passes_state.h b/third_party/jpeg-xl/lib/jxl/passes_state.h --- a/third_party/jpeg-xl/lib/jxl/passes_state.h +++ b/third_party/jpeg-xl/lib/jxl/passes_state.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_PASSES_STATE_H_ #define LIB_JXL_PASSES_STATE_H_ #include "lib/jxl/ac_context.h" @@ -88,11 +79,11 @@ // the CodecInOut, or can point to an existing ImageBundle. // TODO(veluca): pointing to ImageBundles in CodecInOut is not possible for // now, as they are stored in a vector and thus may be moved. Fix this. ImageBundle* JXL_RESTRICT frame = &storage; // ImageBundle doesn't yet have a simple way to state it is in XYB. - bool ib_is_in_xyb = true; + bool ib_is_in_xyb = false; } reference_frames[4] = {}; // Number of pre-clustered set of histograms (with the same ctx map), per // pass. Encoded as num_histograms_ - 1. size_t num_histograms = 0; diff --git a/third_party/jpeg-xl/lib/jxl/passes_state.cc b/third_party/jpeg-xl/lib/jxl/passes_state.cc --- a/third_party/jpeg-xl/lib/jxl/passes_state.cc +++ b/third_party/jpeg-xl/lib/jxl/passes_state.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/passes_state.h" #include "lib/jxl/chroma_from_luma.h" #include "lib/jxl/coeff_order.h" diff --git a/third_party/jpeg-xl/lib/jxl/passes_test.cc b/third_party/jpeg-xl/lib/jxl/passes_test.cc --- a/third_party/jpeg-xl/lib/jxl/passes_test.cc +++ b/third_party/jpeg-xl/lib/jxl/passes_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include #include #include diff --git a/third_party/jpeg-xl/lib/jxl/patch_dictionary_internal.h b/third_party/jpeg-xl/lib/jxl/patch_dictionary_internal.h --- a/third_party/jpeg-xl/lib/jxl/patch_dictionary_internal.h +++ b/third_party/jpeg-xl/lib/jxl/patch_dictionary_internal.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_PATCH_DICTIONARY_INTERNAL_H_ #define LIB_JXL_PATCH_DICTIONARY_INTERNAL_H_ #include "lib/jxl/dec_patch_dictionary.h" diff --git a/third_party/jpeg-xl/lib/jxl/patch_dictionary_test.cc b/third_party/jpeg-xl/lib/jxl/patch_dictionary_test.cc --- a/third_party/jpeg-xl/lib/jxl/patch_dictionary_test.cc +++ b/third_party/jpeg-xl/lib/jxl/patch_dictionary_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "gtest/gtest.h" #include "lib/extras/codec.h" #include "lib/jxl/dec_params.h" #include "lib/jxl/enc_butteraugli_comparator.h" diff --git a/third_party/jpeg-xl/lib/jxl/preview_test.cc b/third_party/jpeg-xl/lib/jxl/preview_test.cc --- a/third_party/jpeg-xl/lib/jxl/preview_test.cc +++ b/third_party/jpeg-xl/lib/jxl/preview_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include #include diff --git a/third_party/jpeg-xl/lib/jxl/progressive_split.h b/third_party/jpeg-xl/lib/jxl/progressive_split.h --- a/third_party/jpeg-xl/lib/jxl/progressive_split.h +++ b/third_party/jpeg-xl/lib/jxl/progressive_split.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_PROGRESSIVE_SPLIT_H_ #define LIB_JXL_PROGRESSIVE_SPLIT_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/progressive_split.cc b/third_party/jpeg-xl/lib/jxl/progressive_split.cc --- a/third_party/jpeg-xl/lib/jxl/progressive_split.cc +++ b/third_party/jpeg-xl/lib/jxl/progressive_split.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/progressive_split.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/quant_weights.h b/third_party/jpeg-xl/lib/jxl/quant_weights.h --- a/third_party/jpeg-xl/lib/jxl/quant_weights.h +++ b/third_party/jpeg-xl/lib/jxl/quant_weights.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_QUANT_WEIGHTS_H_ #define LIB_JXL_QUANT_WEIGHTS_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/quant_weights.cc b/third_party/jpeg-xl/lib/jxl/quant_weights.cc --- a/third_party/jpeg-xl/lib/jxl/quant_weights.cc +++ b/third_party/jpeg-xl/lib/jxl/quant_weights.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/quant_weights.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/quant_weights_test.cc b/third_party/jpeg-xl/lib/jxl/quant_weights_test.cc --- a/third_party/jpeg-xl/lib/jxl/quant_weights_test.cc +++ b/third_party/jpeg-xl/lib/jxl/quant_weights_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/quant_weights.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/quantizer-inl.h b/third_party/jpeg-xl/lib/jxl/quantizer-inl.h --- a/third_party/jpeg-xl/lib/jxl/quantizer-inl.h +++ b/third_party/jpeg-xl/lib/jxl/quantizer-inl.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #if defined(LIB_JXL_QUANTIZER_INL_H_) == defined(HWY_TARGET_TOGGLE) #ifdef LIB_JXL_QUANTIZER_INL_H_ #undef LIB_JXL_QUANTIZER_INL_H_ #else diff --git a/third_party/jpeg-xl/lib/jxl/quantizer.h b/third_party/jpeg-xl/lib/jxl/quantizer.h --- a/third_party/jpeg-xl/lib/jxl/quantizer.h +++ b/third_party/jpeg-xl/lib/jxl/quantizer.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_QUANTIZER_H_ #define LIB_JXL_QUANTIZER_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/quantizer.cc b/third_party/jpeg-xl/lib/jxl/quantizer.cc --- a/third_party/jpeg-xl/lib/jxl/quantizer.cc +++ b/third_party/jpeg-xl/lib/jxl/quantizer.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/quantizer.h" #include #include diff --git a/third_party/jpeg-xl/lib/jxl/quantizer_test.cc b/third_party/jpeg-xl/lib/jxl/quantizer_test.cc --- a/third_party/jpeg-xl/lib/jxl/quantizer_test.cc +++ b/third_party/jpeg-xl/lib/jxl/quantizer_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/quantizer.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/rational_polynomial-inl.h b/third_party/jpeg-xl/lib/jxl/rational_polynomial-inl.h --- a/third_party/jpeg-xl/lib/jxl/rational_polynomial-inl.h +++ b/third_party/jpeg-xl/lib/jxl/rational_polynomial-inl.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // Fast SIMD evaluation of rational polynomials for approximating functions. #if defined(LIB_JXL_RATIONAL_POLYNOMIAL_INL_H_) == defined(HWY_TARGET_TOGGLE) #ifdef LIB_JXL_RATIONAL_POLYNOMIAL_INL_H_ diff --git a/third_party/jpeg-xl/lib/jxl/rational_polynomial_test.cc b/third_party/jpeg-xl/lib/jxl/rational_polynomial_test.cc --- a/third_party/jpeg-xl/lib/jxl/rational_polynomial_test.cc +++ b/third_party/jpeg-xl/lib/jxl/rational_polynomial_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include #include #include diff --git a/third_party/jpeg-xl/lib/jxl/robust_statistics_test.cc b/third_party/jpeg-xl/lib/jxl/robust_statistics_test.cc --- a/third_party/jpeg-xl/lib/jxl/robust_statistics_test.cc +++ b/third_party/jpeg-xl/lib/jxl/robust_statistics_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/base/robust_statistics.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/roundtrip_test.cc b/third_party/jpeg-xl/lib/jxl/roundtrip_test.cc --- a/third_party/jpeg-xl/lib/jxl/roundtrip_test.cc +++ b/third_party/jpeg-xl/lib/jxl/roundtrip_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "gtest/gtest.h" #include "jxl/decode.h" #include "jxl/decode_cxx.h" #include "jxl/encode.h" diff --git a/third_party/jpeg-xl/lib/jxl/speed_tier_test.cc b/third_party/jpeg-xl/lib/jxl/speed_tier_test.cc --- a/third_party/jpeg-xl/lib/jxl/speed_tier_test.cc +++ b/third_party/jpeg-xl/lib/jxl/speed_tier_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include #include "gtest/gtest.h" #include "lib/extras/codec.h" diff --git a/third_party/jpeg-xl/lib/jxl/splines.h b/third_party/jpeg-xl/lib/jxl/splines.h --- a/third_party/jpeg-xl/lib/jxl/splines.h +++ b/third_party/jpeg-xl/lib/jxl/splines.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_SPLINES_H_ #define LIB_JXL_SPLINES_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/splines.cc b/third_party/jpeg-xl/lib/jxl/splines.cc --- a/third_party/jpeg-xl/lib/jxl/splines.cc +++ b/third_party/jpeg-xl/lib/jxl/splines.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/splines.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/splines_gbench.cc b/third_party/jpeg-xl/lib/jxl/splines_gbench.cc --- a/third_party/jpeg-xl/lib/jxl/splines_gbench.cc +++ b/third_party/jpeg-xl/lib/jxl/splines_gbench.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "benchmark/benchmark.h" #include "lib/jxl/splines.h" namespace jxl { diff --git a/third_party/jpeg-xl/lib/jxl/splines_test.cc b/third_party/jpeg-xl/lib/jxl/splines_test.cc --- a/third_party/jpeg-xl/lib/jxl/splines_test.cc +++ b/third_party/jpeg-xl/lib/jxl/splines_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/splines.h" #include "gmock/gmock.h" #include "gtest/gtest.h" diff --git a/third_party/jpeg-xl/lib/jxl/test_utils.h b/third_party/jpeg-xl/lib/jxl/test_utils.h --- a/third_party/jpeg-xl/lib/jxl/test_utils.h +++ b/third_party/jpeg-xl/lib/jxl/test_utils.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_TEST_UTILS_H_ #define LIB_JXL_TEST_UTILS_H_ // Macros and functions useful for tests. diff --git a/third_party/jpeg-xl/lib/jxl/testdata.h b/third_party/jpeg-xl/lib/jxl/testdata.h --- a/third_party/jpeg-xl/lib/jxl/testdata.h +++ b/third_party/jpeg-xl/lib/jxl/testdata.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_TESTDATA_H_ #define LIB_JXL_TESTDATA_H_ #ifdef __EMSCRIPTEN__ diff --git a/third_party/jpeg-xl/lib/jxl/tf_gbench.cc b/third_party/jpeg-xl/lib/jxl/tf_gbench.cc --- a/third_party/jpeg-xl/lib/jxl/tf_gbench.cc +++ b/third_party/jpeg-xl/lib/jxl/tf_gbench.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "benchmark/benchmark.h" #include "lib/jxl/image_ops.h" #undef HWY_TARGET_INCLUDE diff --git a/third_party/jpeg-xl/lib/jxl/toc.h b/third_party/jpeg-xl/lib/jxl/toc.h --- a/third_party/jpeg-xl/lib/jxl/toc.h +++ b/third_party/jpeg-xl/lib/jxl/toc.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_JXL_TOC_H_ #define LIB_JXL_TOC_H_ #include diff --git a/third_party/jpeg-xl/lib/jxl/toc.cc b/third_party/jpeg-xl/lib/jxl/toc.cc --- a/third_party/jpeg-xl/lib/jxl/toc.cc +++ b/third_party/jpeg-xl/lib/jxl/toc.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/toc.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/toc_test.cc b/third_party/jpeg-xl/lib/jxl/toc_test.cc --- a/third_party/jpeg-xl/lib/jxl/toc_test.cc +++ b/third_party/jpeg-xl/lib/jxl/toc_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/toc.h" #include diff --git a/third_party/jpeg-xl/lib/jxl/transfer_functions-inl.h b/third_party/jpeg-xl/lib/jxl/transfer_functions-inl.h --- a/third_party/jpeg-xl/lib/jxl/transfer_functions-inl.h +++ b/third_party/jpeg-xl/lib/jxl/transfer_functions-inl.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // Transfer functions for color encodings. #if defined(LIB_JXL_TRANSFER_FUNCTIONS_INL_H_) == defined(HWY_TARGET_TOGGLE) #ifdef LIB_JXL_TRANSFER_FUNCTIONS_INL_H_ diff --git a/third_party/jpeg-xl/lib/jxl/transpose-inl.h b/third_party/jpeg-xl/lib/jxl/transpose-inl.h --- a/third_party/jpeg-xl/lib/jxl/transpose-inl.h +++ b/third_party/jpeg-xl/lib/jxl/transpose-inl.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // Block transpose for DCT/IDCT #if defined(LIB_JXL_TRANSPOSE_INL_H_) == defined(HWY_TARGET_TOGGLE) #ifdef LIB_JXL_TRANSPOSE_INL_H_ diff --git a/third_party/jpeg-xl/lib/jxl/xorshift128plus-inl.h b/third_party/jpeg-xl/lib/jxl/xorshift128plus-inl.h --- a/third_party/jpeg-xl/lib/jxl/xorshift128plus-inl.h +++ b/third_party/jpeg-xl/lib/jxl/xorshift128plus-inl.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // Fast but weak random generator. #if defined(LIB_JXL_XORSHIFT128PLUS_INL_H_) == defined(HWY_TARGET_TOGGLE) #ifdef LIB_JXL_XORSHIFT128PLUS_INL_H_ diff --git a/third_party/jpeg-xl/lib/jxl/xorshift128plus_test.cc b/third_party/jpeg-xl/lib/jxl/xorshift128plus_test.cc --- a/third_party/jpeg-xl/lib/jxl/xorshift128plus_test.cc +++ b/third_party/jpeg-xl/lib/jxl/xorshift128plus_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include #include #include diff --git a/third_party/jpeg-xl/lib/jxl_benchmark.cmake b/third_party/jpeg-xl/lib/jxl_benchmark.cmake --- a/third_party/jpeg-xl/lib/jxl_benchmark.cmake +++ b/third_party/jpeg-xl/lib/jxl_benchmark.cmake @@ -1,18 +1,9 @@ -# Copyright (c) the JPEG XL Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Copyright (c) the JPEG XL Project Authors. All rights reserved. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. # All files ending in "_gbench.cc" are considered Google benchmark files and # should be listed here. set(JPEGXL_INTERNAL_SOURCES_GBENCH extras/tone_mapping_gbench.cc diff --git a/third_party/jpeg-xl/lib/jxl_extras.cmake b/third_party/jpeg-xl/lib/jxl_extras.cmake --- a/third_party/jpeg-xl/lib/jxl_extras.cmake +++ b/third_party/jpeg-xl/lib/jxl_extras.cmake @@ -1,18 +1,9 @@ -# Copyright (c) the JPEG XL Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Copyright (c) the JPEG XL Project Authors. All rights reserved. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. set(JPEGXL_EXTRAS_SOURCES extras/codec.cc extras/codec.h # codec_jpg is included always for loading of lossless reconstruction but diff --git a/third_party/jpeg-xl/lib/jxl_profiler.cmake b/third_party/jpeg-xl/lib/jxl_profiler.cmake --- a/third_party/jpeg-xl/lib/jxl_profiler.cmake +++ b/third_party/jpeg-xl/lib/jxl_profiler.cmake @@ -1,18 +1,9 @@ -# Copyright (c) the JPEG XL Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Copyright (c) the JPEG XL Project Authors. All rights reserved. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. set(JPEGXL_PROFILER_SOURCES profiler/profiler.cc profiler/profiler.h profiler/tsc_timer.h diff --git a/third_party/jpeg-xl/lib/jxl_tests.cmake b/third_party/jpeg-xl/lib/jxl_tests.cmake --- a/third_party/jpeg-xl/lib/jxl_tests.cmake +++ b/third_party/jpeg-xl/lib/jxl_tests.cmake @@ -1,18 +1,9 @@ -# Copyright (c) the JPEG XL Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Copyright (c) the JPEG XL Project Authors. All rights reserved. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. set(TEST_FILES extras/codec_test.cc jxl/ac_strategy_test.cc jxl/adaptive_reconstruction_test.cc diff --git a/third_party/jpeg-xl/lib/jxl_threads.cmake b/third_party/jpeg-xl/lib/jxl_threads.cmake --- a/third_party/jpeg-xl/lib/jxl_threads.cmake +++ b/third_party/jpeg-xl/lib/jxl_threads.cmake @@ -1,18 +1,9 @@ -# Copyright (c) the JPEG XL Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Copyright (c) the JPEG XL Project Authors. All rights reserved. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. find_package(Threads REQUIRED) set(JPEGXL_THREADS_SOURCES threads/thread_parallel_runner.cc diff --git a/third_party/jpeg-xl/lib/lib.gni b/third_party/jpeg-xl/lib/lib.gni --- a/third_party/jpeg-xl/lib/lib.gni +++ b/third_party/jpeg-xl/lib/lib.gni @@ -1,18 +1,9 @@ -# Copyright (c) the JPEG XL Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Copyright (c) the JPEG XL Project Authors. All rights reserved. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. # Source files definitions for GN-based build systems. # Library version macros libjxl_version_defines = [ diff --git a/third_party/jpeg-xl/lib/profiler/profiler.h b/third_party/jpeg-xl/lib/profiler/profiler.h --- a/third_party/jpeg-xl/lib/profiler/profiler.h +++ b/third_party/jpeg-xl/lib/profiler/profiler.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_PROFILER_PROFILER_H_ #define LIB_PROFILER_PROFILER_H_ // High precision, low overhead time measurements. Returns exact call counts and diff --git a/third_party/jpeg-xl/lib/profiler/profiler.cc b/third_party/jpeg-xl/lib/profiler/profiler.cc --- a/third_party/jpeg-xl/lib/profiler/profiler.cc +++ b/third_party/jpeg-xl/lib/profiler/profiler.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/jxl/base/profiler.h" #if PROFILER_ENABLED diff --git a/third_party/jpeg-xl/lib/profiler/tsc_timer.h b/third_party/jpeg-xl/lib/profiler/tsc_timer.h --- a/third_party/jpeg-xl/lib/profiler/tsc_timer.h +++ b/third_party/jpeg-xl/lib/profiler/tsc_timer.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef LIB_PROFILER_TSC_TIMER_H_ #define LIB_PROFILER_TSC_TIMER_H_ // High-resolution (~10 ns) timestamps, using fences to prevent reordering and diff --git a/third_party/jpeg-xl/lib/threads/thread_parallel_runner.cc b/third_party/jpeg-xl/lib/threads/thread_parallel_runner.cc --- a/third_party/jpeg-xl/lib/threads/thread_parallel_runner.cc +++ b/third_party/jpeg-xl/lib/threads/thread_parallel_runner.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "jxl/thread_parallel_runner.h" #include diff --git a/third_party/jpeg-xl/lib/threads/thread_parallel_runner_internal.h b/third_party/jpeg-xl/lib/threads/thread_parallel_runner_internal.h --- a/third_party/jpeg-xl/lib/threads/thread_parallel_runner_internal.h +++ b/third_party/jpeg-xl/lib/threads/thread_parallel_runner_internal.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. // // C++ implementation using std::thread of a ::JxlParallelRunner. // The main class in this module, ThreadParallelRunner, implements a static diff --git a/third_party/jpeg-xl/lib/threads/thread_parallel_runner_internal.cc b/third_party/jpeg-xl/lib/threads/thread_parallel_runner_internal.cc --- a/third_party/jpeg-xl/lib/threads/thread_parallel_runner_internal.cc +++ b/third_party/jpeg-xl/lib/threads/thread_parallel_runner_internal.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "lib/threads/thread_parallel_runner_internal.h" #include diff --git a/third_party/jpeg-xl/lib/threads/thread_parallel_runner_test.cc b/third_party/jpeg-xl/lib/threads/thread_parallel_runner_test.cc --- a/third_party/jpeg-xl/lib/threads/thread_parallel_runner_test.cc +++ b/third_party/jpeg-xl/lib/threads/thread_parallel_runner_test.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "gtest/gtest.h" #include "lib/jxl/base/data_parallel.h" #include "lib/jxl/base/thread_pool_internal.h" diff --git a/third_party/jpeg-xl/plugins/CMakeLists.txt b/third_party/jpeg-xl/plugins/CMakeLists.txt --- a/third_party/jpeg-xl/plugins/CMakeLists.txt +++ b/third_party/jpeg-xl/plugins/CMakeLists.txt @@ -1,18 +1,9 @@ -# Copyright (c) the JPEG XL Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Copyright (c) the JPEG XL Project Authors. All rights reserved. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. if(NOT WIN32) add_subdirectory(gdk-pixbuf) endif() diff --git a/third_party/jpeg-xl/plugins/gdk-pixbuf/CMakeLists.txt b/third_party/jpeg-xl/plugins/gdk-pixbuf/CMakeLists.txt --- a/third_party/jpeg-xl/plugins/gdk-pixbuf/CMakeLists.txt +++ b/third_party/jpeg-xl/plugins/gdk-pixbuf/CMakeLists.txt @@ -1,18 +1,9 @@ -# Copyright (c) the JPEG XL Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Copyright (c) the JPEG XL Project Authors. All rights reserved. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. find_package(PkgConfig) pkg_check_modules(Gdk-Pixbuf IMPORTED_TARGET gdk-pixbuf-2.0>=2.38) if (NOT Gdk-Pixbuf_FOUND) diff --git a/third_party/jpeg-xl/plugins/gdk-pixbuf/pixbufloader-jxl.c b/third_party/jpeg-xl/plugins/gdk-pixbuf/pixbufloader-jxl.c --- a/third_party/jpeg-xl/plugins/gdk-pixbuf/pixbufloader-jxl.c +++ b/third_party/jpeg-xl/plugins/gdk-pixbuf/pixbufloader-jxl.c @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #define GDK_PIXBUF_ENABLE_BACKEND #include #undef GDK_PIXBUF_ENABLE_BACKEND diff --git a/third_party/jpeg-xl/plugins/gimp/CMakeLists.txt b/third_party/jpeg-xl/plugins/gimp/CMakeLists.txt --- a/third_party/jpeg-xl/plugins/gimp/CMakeLists.txt +++ b/third_party/jpeg-xl/plugins/gimp/CMakeLists.txt @@ -1,18 +1,9 @@ -# Copyright (c) the JPEG XL Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Copyright (c) the JPEG XL Project Authors. All rights reserved. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. find_package(PkgConfig) pkg_check_modules(Gimp IMPORTED_TARGET gimp-2.0>=2.10 gimpui-2.0>=2.10) if (NOT Gimp_FOUND) diff --git a/third_party/jpeg-xl/plugins/gimp/common.h b/third_party/jpeg-xl/plugins/gimp/common.h --- a/third_party/jpeg-xl/plugins/gimp/common.h +++ b/third_party/jpeg-xl/plugins/gimp/common.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef PLUGINS_GIMP_COMMON_H_ #define PLUGINS_GIMP_COMMON_H_ #include diff --git a/third_party/jpeg-xl/plugins/gimp/file-jxl-load.h b/third_party/jpeg-xl/plugins/gimp/file-jxl-load.h --- a/third_party/jpeg-xl/plugins/gimp/file-jxl-load.h +++ b/third_party/jpeg-xl/plugins/gimp/file-jxl-load.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef PLUGINS_GIMP_FILE_JXL_LOAD_H_ #define PLUGINS_GIMP_FILE_JXL_LOAD_H_ #include diff --git a/third_party/jpeg-xl/plugins/gimp/file-jxl-load.cc b/third_party/jpeg-xl/plugins/gimp/file-jxl-load.cc --- a/third_party/jpeg-xl/plugins/gimp/file-jxl-load.cc +++ b/third_party/jpeg-xl/plugins/gimp/file-jxl-load.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "plugins/gimp/file-jxl-load.h" // Defined by both FUIF and glib. #undef MAX diff --git a/third_party/jpeg-xl/plugins/gimp/file-jxl-save.h b/third_party/jpeg-xl/plugins/gimp/file-jxl-save.h --- a/third_party/jpeg-xl/plugins/gimp/file-jxl-save.h +++ b/third_party/jpeg-xl/plugins/gimp/file-jxl-save.h @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #ifndef PLUGINS_GIMP_FILE_JXL_SAVE_H_ #define PLUGINS_GIMP_FILE_JXL_SAVE_H_ #include diff --git a/third_party/jpeg-xl/plugins/gimp/file-jxl-save.cc b/third_party/jpeg-xl/plugins/gimp/file-jxl-save.cc --- a/third_party/jpeg-xl/plugins/gimp/file-jxl-save.cc +++ b/third_party/jpeg-xl/plugins/gimp/file-jxl-save.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include "plugins/gimp/file-jxl-save.h" // Defined by both FUIF and glib. #undef MAX diff --git a/third_party/jpeg-xl/plugins/gimp/file-jxl.cc b/third_party/jpeg-xl/plugins/gimp/file-jxl.cc --- a/third_party/jpeg-xl/plugins/gimp/file-jxl.cc +++ b/third_party/jpeg-xl/plugins/gimp/file-jxl.cc @@ -1,18 +1,9 @@ -// Copyright (c) the JPEG XL Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Copyright (c) the JPEG XL Project Authors. All rights reserved. // -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. #include #include #include #include diff --git a/third_party/jpeg-xl/plugins/mime/CMakeLists.txt b/third_party/jpeg-xl/plugins/mime/CMakeLists.txt --- a/third_party/jpeg-xl/plugins/mime/CMakeLists.txt +++ b/third_party/jpeg-xl/plugins/mime/CMakeLists.txt @@ -1,15 +1,6 @@ -# Copyright (c) the JPEG XL Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Copyright (c) the JPEG XL Project Authors. All rights reserved. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. install(FILES image-jxl.xml DESTINATION share/mime/packages/)